method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4e650d41-dcf8-433f-8308-866f83278339 | 2 | protected JPanel initDecompPanel()
{
JPanel n = new JPanel(new BorderLayout());
JPanel o = new JPanel();
o.setLayout(new BoxLayout(o, BoxLayout.X_AXIS));
sliderPanel = new JPanel();
sliderPanel.setLayout(new BoxLayout(sliderPanel, BoxLayout.Y_AXIS));
... |
03d5a6d8-a25a-4c6e-a4c5-1a4f5448278c | 8 | final public void tableColumnType() throws ParseException {
/*@bgen(jjtree) tableColumnType */
SimpleNode jjtn000 = new SimpleNode(JJTTABLECOLUMNTYPE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
switch ((jj_ntk==-1)?jj_... |
f486e758-a899-42c9-a5b6-fe4266c57853 | 2 | public void addFirst(Item item) {
if (item == null)
throw new NullPointerException();
if (isEmpty()) {
first = new Node<Item>();
last = new Node<Item>();
first.item = item;
last = first;
} else {
Node<Item> node = new Node<I... |
ebc2e68f-5489-4147-b8a5-bd412b81b218 | 2 | private void creaGrigliaMangiate(){ // riempie la griglia di pedine graficamente vuote.
for (int i=0; i<4; i++)
for (int j=0; j<3; j++){
PedinePC[i][j]=new JLabel();
PedinePC[i][j].setIcon(new ImageIcon("images/Pedine/vuota.png"));
PedineUtente[i][j]=new JLabel();
PedineUtente[i][j].setI... |
d0f58012-c3ce-4b56-8564-4ef7ca5a905e | 6 | private String getOccurences(String p, String t){
String c = new String(), returnValue = new String();
int lenP = this.tamanhoCadeiaP, lenT = this.tamanhoCadeiaT;
if(lenP>0 && lenT>0 && lenT>=lenP){
for(int i=0,j=(lenT-lenP);i<=j;i++){
c = t.substring(i,i+lenP);
if(c.equalsIgnoreCase(p)){
returnVa... |
89ece1f1-0887-48c5-bd75-fcb47c90ee84 | 8 | @Override
protected void connected(Socket socket) {
sock = socket;
try {
sock.setTcpNoDelay(true);
try {
sock.setTrafficClass(0x10);
} catch(SocketException e) {
System.out.println("Connection Error! >> " + e.getMessage());
}
... |
2951d909-6e56-4e06-9912-4e768f6c9d90 | 8 | public boolean login(String userName, String host, int port) {
freeColClient.setMapEditor(false);
freeColClient.askServer().disconnect();
try {
freeColClient.askServer().connect(FreeCol.CLIENT_THREAD + userName,
host, port, freeColClient.getPreGameInputHandler... |
be749409-23cc-45e5-aa82-4a297d201ff2 | 0 | public void initActionBox() {
actionBox = new HBox(24);
actionBox.setAlignment(Pos.CENTER);
actionBox.getStyleClass().add("popUpActionBox");
actionBox.setPadding(new Insets(5, 0, 8, 0));
Button okBtn = new Button("Submit");
okBtn.getStyleClass().add("submit-button");
okBtn.setPrefWidth(75);
okBtn.setOn... |
b1cea18a-802f-41fc-bb8a-8d63b9b95579 | 4 | String [] diamond(int limit){
int count = limit -1;
String [] process = new String[limit+(count)];
String k ="";
String c ="";
int i = 0;
for (int j = 0; j <= count ; j++) {
c+= " ";
}
for (; i < limit; i++) {
if (i==0){
... |
66d509dc-433b-4e4b-8f3f-c6e9b2bb2a22 | 4 | @Override
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
String left, right;
if (value instanceof String)
left = right = "\"";
else if (value instanceof Character)
left = right = "\'";
else if (!(value instanceof DomainEntity) && !(value instanceof Number)) {
... |
301257be-8934-451f-af51-943470842486 | 2 | public String doValidate(Object value) {
if (value == null || !value.toString().trim().equals(str)) {
return "Expected '" + str + "' but actual is '" + value + "'";
}
return null;
} |
29fc69f9-6ad2-4c58-b0e4-3076a1f19409 | 6 | public static void draw(Percolation perc, int N) {
perc.init();// this is A* init(), source and target could be passed in
// future
perc.AStar();
StdDraw.clear();
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setXscale(0, N);
StdDraw.setYscale(0, N);
StdDraw.filledSquare(N / 2.0, N / 2.0, N / 2.0);
... |
ded18104-c6b9-4da4-97f0-64fd8cfb4900 | 6 | public void draw(Graphics2D g) {
if (this.m_PointsSet.isEmpty()) return;
Graphics2D g2d = (Graphics2D) g;
int pointSize = 4;
// sets the width and height of rendering area (take in account margin)
int w = this.getInnerWidth();
int h = this.getInnerHeight();
... |
f075cf0d-85a5-4da8-a9e0-addd90de96c2 | 4 | public Background topBackground() {
if (vocation != null) return vocation ;
if (homeworld != null) return homeworld ;
if (birth != null) return birth ;
if (gender != null) return gender ;
return null ;
} |
d599a5e2-408e-47ca-bad6-96441ee6627d | 0 | public void setjTextFieldLogin(JTextField jTextFieldLogin) {
this.jTextFieldLogin = jTextFieldLogin;
} |
c78904a4-186e-4995-bca3-e53607b5600a | 5 | public int argOfInterestOfZ(MessageContent z) {
// we look for the argmin
if (debug>=3) {
String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
System.out.print... |
6fc78b77-b65e-4ee8-8a34-a7f78aa2f032 | 2 | public static PINUsageModeType fromValue(String v) {
for (PINUsageModeType c: PINUsageModeType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
fca8cc58-d822-46c2-9fa5-06eebec2de67 | 1 | protected boolean swapIfFirstIsLess(int i, int j) {
if(array[i] < array[j]) {
swap(i, j);
return true;
}
return false;
} |
d684d99d-0cc1-4c72-bebd-fb746748bc78 | 1 | public Command getCommand(String commandStr) {
return commandStr == null ? null : commands.get(commandStr.toLowerCase());
} |
f1e49faf-b0f2-4a15-a8fe-c967bf812445 | 2 | public static int generatePrime(){
int incrementCount=1;
int primeCount=0;
LinkedList list;
Integer primenumber=null;
list=new LinkedList();
while(primeCount!=10002){
if(testPrime(incrementCount)){
list.add(incrementCount);
primeCount++;
}
incrementCount++;
}
primenumber=(I... |
0b7df1e7-87a2-4fb4-b346-494a20f02921 | 7 | long parseLong(String s) throws NumberFormatException {
int radix;
int i;
if( s.startsWith("0x") || s.startsWith("0X") ) {
radix = 16;
i = 2;
} else if( s.startsWith("0") && s.length() > 1 ) {
... |
7a5854da-1610-43b5-afbd-2d734092112d | 0 | public SchlangenGlied getNextGlied() {
return nextGlied;
} |
e13ef63b-d6dd-408f-bec3-76af2a5c6a77 | 9 | protected Dir getDir(Game game, String s) throws ScriptException {
switch (s.toLowerCase()) {
case "n":
return Dir.North;
case "s":
return Dir.South;
case "e":
return Dir.East;
case "w":
return Dir.West;
case "p":
Dir p = game.getPlayer().getFacing();
switch (p) {
case East:
return ... |
bd6b62d3-b835-44e5-8155-b0736a39b2f8 | 7 | @SuppressWarnings("rawtypes")
protected void checkRequiredOptions() throws MissingOptionException {
List requiredOptions = this.getRequiredOptions();
if (!requiredOptions.isEmpty()) {
Iterator it = requiredOptions.iterator();
while (it.hasNext()) {
Object opt = it.next();
if (opt.getClass().equals(St... |
a3ab7125-bdf5-4e97-be8e-51c07311dff5 | 3 | public int compareTo( HTTPHeaderLine element ) {
int cmp = this.getKey().compareTo(element.getKey());
if( cmp != 0 )
return cmp;
// Warning: the value might be null!
if( this.getValue() == null )
return -1;
else if( element.getValue() == null )
return 1;
else
return this.getValue().compareTo... |
08c96c42-b383-4584-b952-dbac269902ab | 3 | public void run(double duration) {
double endtime = _currentTime + duration;
while ((!empty()) && (_queue.peek().waketime <= endtime)) {
if ((_currentTime - _queue.peek().waketime) > 1e-09) {
super.setChanged();
super.notifyObservers();
}
_currentTime = _queue.peek().waketime;
... |
0b6da118-7dc0-4039-bbad-ad800ee75078 | 5 | @Override
public synchronized void run() {
// For commits
jsContext = new StoppableContext();
jsContext.setGeneratingDebug(true);
jsContext.setGeneratingSource(true);
synchronized (scriptThreads) {
scriptThreads.put(scriptInfo.scrUniq, this);
}
try... |
add0f464-d2ba-4d19-b56e-bbfdc5f7cdb1 | 0 | private void initialize(){
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
new JFrame();
setSize(700,600);
setResizable(false);
setLocation(screenSize.width/2-getWidth()/2, screenSize.height/2-getHeight()/2);
this.setDefaultCloseOperation(JFrame.DISPOS... |
4ec7e724-6982-47f8-8e71-f9ca309b5bbb | 9 | @Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] params)
{
if (cmd.getLabel().equalsIgnoreCase("rewards"))
{
ArrayList<String> completitions = new ArrayList<String>();
if (params.length < 2)
{
... |
d11dcec1-dcbe-4ee5-baf2-b66c1234c20a | 5 | public static int sumMatrix(int[][] m) {
if (m.length < 1 || m[1].length < 1) {
p("Please pass a two dimensional array with a length of at least 1");
if (debugMode) p("; <= XD");
pl("");
return -1;
}
int sum = 0;
for (int i = 0; i < m.length; i++) {
for (int j = 0; j < m[i].length; j++) {
sum... |
4cda802d-9533-4079-a3c1-bb9ec70ac42b | 5 | protected void tick()
{
if(entitiesByDepth==null)
return;
for(ArrayList<Entity> entities:entitiesByDepth.values())
for(Entity entity:entities)
entity.tick();
for(Pair<Entity,Pair<Integer,Integer>> pair:addEntitiesDepthQueue)
{
entitiesByDepth.get(pair.second().first()).remove(pair.first());
... |
0091919c-17fe-4372-afea-6956a26a0a2e | 1 | public boolean isInternal(int contact) {
return contact >= icnt + ocnt && contact < icnt + ocnt + ecnt;
} |
2fedc800-5f3c-4726-b4ce-ed4dfbcd373d | 9 | public void setMode(int mode) {
if (!((mode == HUE) || (mode == SAT) || (mode == BRI) || (mode == RED) || (mode == GREEN) || (mode == BLUE))) {
throw new IllegalArgumentException("mode must be HUE, SAT, BRI, REd, GREEN, or BLUE");
}
putClientProperty(MODE_PROPERTY, new Integer(mode))... |
e4ad0ac6-cf66-47ae-a980-96025815812f | 9 | public Character nextCharacter(int playerId, Character selectedDwarf) {
if (mapping.isEmpty())
return null;
ArrayList<Character> options = new ArrayList<Character>();
for (Character character: mapping.values())
if (character.playerId() == playerId)
optio... |
991132db-3c87-436f-9060-8ac52d9f95eb | 5 | public void changeDir(boolean left) {
if (left) {
faceTo++;
backTo++;
} else {
faceTo--;
backTo--;
}
if (faceTo > 3) {
faceTo -= 4;
} else if (faceTo < 0) {
faceTo += 4;
}
if (backTo > 3) {
backTo -= 4;
} else if (backTo < 0) {
backTo += 4;
}
} |
78d9fe3f-a389-4906-96e9-0be7db92f984 | 8 | private void makeLastRow()
{
/* get the current row from the last iteration */
for(int i=0; i<current.length; i++){
current[i] = next[i];
}
for(int i=1; i<current.length-1; i+=2){
if(current[i] == SET_WALL && current[i-1] != current[i+1]){
current[i] = 0;
int old = Math.max(c... |
fb8c66da-915e-44f1-b5ad-af7a0388125f | 8 | public void paintLevel() {
if (this.ticks < 150) {
return;
}
if (this.activeLevel != null) {
if (!this.levelCreated) {
this.activeLevel.createLevel();
this.levelCreated = true;
}
if (this.ticks >= 550 && this.ticks < 660) {
this.g2d.setComposite(AlphaComposite.getInstance(AlphaComposi... |
58465fa4-c0d7-404d-b150-77e248f37687 | 8 | public char translateFrom (final Cell other) {
if (other.row - 1 == row && other.col == col) {
return 'D';
} else if (other.row + 1 == row && other.col == col) {
return 'U';
} else if (other.row == row && other.col - 1 == col) {
return 'L';
} else ... |
f56bb632-e6c6-4ad8-b64b-78764640f9de | 3 | public BigDecimal getHouseholdExpenses(Household household) {
Set<Student> mentored = household.getMentored();
BigDecimal amount = new BigDecimal(0.0);
for (Student s : mentored) {
// 1º Get activities prize
Set<Activity> activities = s.getActivities();
for (Activity a : activities) {
amount = amount... |
7b78c3af-61c5-4494-8c8a-7db1afaac7b0 | 2 | public boolean isMultiPlayerHostOpen() {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
if (hud.getName().equals("ScreenMultiPlayerHost")) {
return hud.getShouldRender();
}
}
return false;
} |
a0d73167-4399-4f75-8f1b-7679228c80c2 | 8 | public void removeBuilding(Point2D location) throws InvalidLocationException, CannotDestroyBuildingException {
if (!isInVillage(location))
throw new InvalidLocationException();
Building toDestroy = this.buildings[(int)location.getX()][(int)location.getY()];
if (!isInVillage(new Point2D.Double(location.getX()+t... |
5a5225eb-0d3d-4975-97c2-d08f1e836f00 | 2 | private void registerListeners() {
proxy.getPluginManager().registerListener(this, new PluginMessageListener(this));
proxy.registerChannel("BungeeSuite");
proxy.registerChannel("BungeeSuiteMC");
proxy.getPluginManager().registerListener(this, new ServerLoginLogout(this));
if (loginMessagesEnabled)
pr... |
26ba5c49-148c-410c-a3a7-eae381ae03eb | 3 | public int CloseTable() {
//Controllo se è stato creato l'oggetto tabella
if (this._PdfPTable != null) {
//Se non esistono Capitoli
if (this._ChapterList.isEmpty()) {
try {
//Aggiungo la tabella al documento
this._MyDocument... |
51f28109-c920-4553-a343-e31638781b00 | 4 | public void run()
{
try
{
while (true)
{
if (threadSuspended) {
synchronized (this) {
while (threadSuspended) {
//System.out.println("run(): waiting");
wait();
}
... |
f69bb360-526d-41e6-9eb4-2c1f6932f154 | 9 | protected double[] checkWeights(int length, double[] weights) {
boolean damaged = false;
// check for null
if (weights == null) {
damaged = true;
weights = new double[length];
}
// check if all elements are zeros or if there are negative, NaN or Infinite elements
else {
boolean allZero = true;
b... |
10cf2b7a-178d-4de9-a7be-ab1f8f9e2fd4 | 3 | private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
... |
920e2eba-ea90-40a0-8152-be3825978ca2 | 2 | public boolean equals(final Object value) {
if (!(value instanceof SourceValue)) {
return false;
}
SourceValue v = (SourceValue) value;
return size == v.size && insns.equals(v.insns);
} |
7100ce5e-df2c-420c-824a-4fa8a884ffcb | 1 | public static void add(int[]pi,Integer I, Matrix A){
int n = pi.length;
n--;
int mono=1;
int i=1;
for(i=1;i<=n;i++)
mono*=A.getij(i, pi[i]);
I = (int)I + mono;
} |
0b193f7f-37d2-47d9-ba15-28b8ea443ab2 | 4 | @Override
public String toString() {
switch (this) {
case SPIRE:
return "spire";
case RAMP:
return "ramp";
case INCLINE:
return "incline";
case ENTITY:
return "entity";
default:
... |
5852dc86-7584-4276-947c-3cae49f663b5 | 2 | public void close() {
if (writeToFile && printWriter != null) {
printWriter.close();
printWriter = null;
}
} |
4173a840-8650-4842-a7f9-21d5cf0874fd | 3 | static double[][] inverse(double[][] A){
double[][] B;
double detA = det(A);
if(A.length == 1){
B = new double[1][1];
B[0][0] = 1/detA;
}else{
B = new double[A.length][A.length];
B = transpose(cofactor(A));
for(int i = 0; i < B.length; i++){
for(int j = 0; j < B.length; j++){
B[i][j] = B... |
d79eac6d-3569-4c42-8912-e176a3c636df | 6 | public static int getRightImageNumber(int x, int y) {
if (x == 0 || y == 0 || x > FieldGame.size_x || y > FieldGame.size_y) {
return 1;
} else if (FieldGame.theField[x - 1][y - 1] == 0) {
return 2;
} else if (FieldGame.theField[x - 1][y - 1] == 1) {
return 3;
} else {
return 99;
}
} |
6029f0c3-c976-481a-9bb4-05cb9c9e6474 | 6 | public void changeLocation() {
switch(c.newLocation) {
case 1:
sendFrame99(2);
movePlayer(3578,9706,-1);
break;
case 2:
sendFrame99(2);
movePlayer(3568,9683,-1);
break;
case 3:
sendFrame99(2);
movePlayer(3557,9703,-1);
break;
case 4:
sendFrame99(2);
movePlayer(3556,9718,-1... |
98de9219-0f7b-4413-bc2b-99905000f115 | 8 | public int move(Team tempTeam, int currentPlayer) {
if(!board.getCellAt(ball.getLocation()).isGoal()) {
Player tempPlayer = tempTeam.getTeam().get(currentPlayer);
int playerLocation = tempPlayer.getLocation();
LinkedList<Integer> playerAdjacencies = board.getAdjacencyList(playerLocation);
ArrayList<Cel... |
e458fe8a-69da-4c97-99cd-c26a8353bacd | 1 | public static void main(String[] args) throws Exception {
for (int i = 0; i < 10; i++) {
Thread daemon = new Thread(new _5_SimpleDaemons());
daemon.setDaemon(true); // Must call before start()
daemon.start();
}
System.out.println("All daemons started");
TimeUnit.SECONDS.sleep(1);
} |
08d0afde-c4ce-4cb6-a684-e938daaa8322 | 4 | @Override
public String getToolTipText(MouseEvent e) {
int row = this.rowAtPoint(e.getPoint());
int col = this.columnAtPoint(e.getPoint());
String tiptextString = null;
if (row > -1 && col > -1) {
Object value = this.getValueAt(row, col);
if (null != value && !"".equals(value))
tiptextString = value.... |
a5348d1f-220e-4563-b511-ae0be4540a50 | 4 | public static void moviesToFile(String infilename, String outfilename) {
File file = new File(outfilename);
List<Movie> list = readData(infilename);
FileWriter fw = null;
try {
fw = new FileWriter(file);
for (Movie m : list) {
fw.append(m.toString());
}
fw.flush();
} catch (IOException e) {
... |
dc3da584-8251-464a-a9d9-295268e94f8b | 8 | public Postroll deserialize(JsonElement json, Type classOfT, JsonDeserializationContext context) throws JsonParseException {
if (!json.isJsonObject()) {
throw(new JsonParseException("Postroll value is not expected type (Object)"));
}
JsonObject jsonPostroll = json.getAsJsonObject();
JsonElement js... |
01d91b7a-6f6b-40af-ab00-fbc9967775e7 | 8 | public byte mean(String fileName) throws IOException {
initialize(fileName);
FileOutputStream fos = null;
DataOutputStream dos = null;
try{
// create file output stream
fos = new FileOutputStream("mean_bin");
// create data output stream
dos = new DataOutputStream(fos);
St... |
1dd16f87-6c63-4464-b8f1-659a1235229f | 0 | @Override
public String getBirth() {
return super.getBirth();
} |
f624c29f-653f-4a65-81b4-242f7ed13bc8 | 6 | private ArrayList<Rod> greaterRevenue(ArrayList<Rod> left, ArrayList<Rod> right) {
if(left == null) {
if(right == null) {
return null;
}
return right;
}
else if(right == null) {
return left;
}
else {
int sumLeft = 0;
int sumRight = 0;
for(Rod rod : left) {
sumLeft += rod.getPrice(... |
47d8c39f-cd0f-4d9d-9832-15ab64f4aca5 | 5 | @Override
public void run() {
try {
while (true) {
try {
processInput(in.readLine());
} catch (SocketException e2) {
try {
in.close();
} catch (IOException e1) {
ConsoleWriter.write(e1);
}
}
}
} catch (IOException e) {
if (!clientCon.close()) {
ConsoleWrite... |
89cf8626-d5f4-445d-99c3-09e8f129b66c | 4 | protected void disposeDependentItems() {
Iterable<? extends Item> items = dependentItems();
if( items != null ) {
for( Item item : items ) {
if( item != null ) {
item.dispose();
}
}
}
} |
b4a8d2fb-0054-4b50-b974-14dca9be7b4e | 8 | public void update(GameContainer container, int delta) throws SlickException{
if (container.getInput().isKeyDown(Input.KEY_LEFT) ) {
playerX-= .1 * delta;
playerPoly.setX(playerX);
if (entityCollisionWith()){
playerX++;
playerPoly.setX(playerX);
}
}
if (container.getInput().isKeyDown(Input.KE... |
7f1a2817-b572-4e71-a283-2767dcb5765c | 0 | public void setHeight(double height) {
_height = height;
} |
34d89362-8f19-4d2d-a108-328a5b2b9fe4 | 6 | private void setScoreLocationDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("fontname")) {
quizSlideDef.setScoreFont(attrs.getValue(1));
} else if (attrs.getValue(0).equals("fontsize")) {
quizSlideDef.setScoreSize(Float.valueOf(attrs.getValue(1)));
} else... |
8863cb64-f0f6-416f-97aa-9c08eb6dc521 | 9 | @Override
public void rightShoulder(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
rbFlag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetRBAssignedKeyCode());
... |
bacf964c-bbfb-44fd-b309-116dc3a88335 | 5 | public static boolean insertFlight(Flight f){
boolean result = false;
PreparedStatement pstmt;
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
String date = sdf.format(f.getDate());
pstmt = con.prepareStatement("INSERT INTO flight (flightnum... |
7f496d05-6a5d-47c4-afbf-897ecb188a1d | 7 | public Command(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "checked":
checked = Checked.parse(this, v);
break;
case "disabled":
disabled = Disabled.parse(this... |
c432b6c0-9cc7-427a-996d-6d8d6c9f71d7 | 3 | @Override
public void draw(Vector3f position) {
transform.setX(position.x);
transform.setY(position.y);
SpriteList.get(sprite).draw(transform);
if(Theater.debug) {
TextModifier modifier = TextModifier.compile(TextModValue.COLOR + "=white");
if(this.entity.hasBody() && this.entity.getBody() == Camera.g... |
4d6093b4-25aa-46f0-83cc-e05e33405309 | 4 | public Byte[] compress(HuffmanTree tree, Byte[] byteArray) {
//For each byte in the Array, shove it through the tree and get it's new encoding.
List<Byte> newByteList = new ArrayList<Byte>();
Bits bits = new Bits();
for (byte b : byteArray) {
tree.fromByte(b, bits);
}
boolean buildingBytes = true;
w... |
03ed3fed-733e-4013-97e9-20628e1489ba | 8 | public static void unequip(final MapleClient c, final short src, final short dst) {
Equip source = (Equip) c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(src);
Equip target = (Equip) c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(dst);
if (dst < 0 || source == null) {
return;
}
... |
726255c2-3b0f-4999-8997-8b6a2fc75656 | 3 | public void setMMCmode(String mode){
if(mode.equals("free"))
Composer=new FreeMMC(compName,composer);
else if(mode.equals("Atonal"))
Composer=new AtonalMMC(compName,composer);
else if(mode.equals("Algorithmic"))
Composer=new AlgorithmicMMC(compName,composer,num);
} |
b352d0a8-6b29-4af1-8236-7224c7038be4 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
c5d8bcd7-d980-49a3-9e46-68682fb814b1 | 3 | public int getOnlineTime(String playerName) {
int onlineTime = 0;
int idLogin = readLatestLoginId(playerName);
try {
ResultSet rs = _sqLite.query("SELECT (strftime('%s', datetime('now', 'localtime')) "
+ "- strftime('%s', time_login)) "
+ "AS online_time "
+ "FROM login "... |
0e672068-665b-49fd-a8f3-86a3549db262 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
f17efa77-ca36-4792-807e-56f02c5d95b2 | 8 | private void KTFKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_KTFKeyTyped
boolean OK = false;
if((evt.getKeyChar()=='-')&&(KTF.getText().equals("")))OK = true;
if((evt.getKeyChar()=='.')&&(!KTF.getText().equals("")&&!KTF.getText().equals("-")))OK = true;
if((evt.ge... |
c98d40f2-653e-4a42-aafd-abf3d13ff9ed | 7 | * responsible for reporting the error to the user through
* ValidationEventHandler.
*/
private String convert(String v) throws Exception {
if (minLength != null && v.length() < minLength) {
throw new Exception("string length violation " + this.getClass().getSimpleNa... |
797f66fe-aef6-458e-9db2-d093ca4a012a | 9 | void run(){
Scanner sc = new Scanner(System.in);
String[] s = {"a","i","u","e","o"};
String[] b = {"w","a","k","s","t","n","h","m","y","r"};
char[] r = sc.next().toCharArray();
StringBuilder res = new StringBuilder();
for(int i=0;i<r.length;i+=2){
int id = r[i]-'0';
int x = r[i+1]=='T'?0:r[i+1]=='L'?1... |
5788f490-0b2a-4231-b17c-ddbc0674bee0 | 5 | public void mouseReleased(MouseEvent e) {
if (currentElement == null) return;
if (currentElement instanceof Spring) {
MyWorldView.SPACE_INVERSE_TRANSFORM.transform(e.getPoint(),p);
// we dragged a spring, so we look for and attachable element near by
SpringAttachable element =... |
b7ba10d0-83a8-4754-884f-89c06abc4a3e | 9 | public void update() {
// Moves Character or Scrolls Background accordingly.
if (speedX < 0) {
centerX += speedX;
}
if (speedX == 0 || speedX < 0) {
bg1.setSpeedX(0);
bg2.setSpeedX(0);
}
if (centerX <= 200 && speedX > 0) {
centerX += speedX;
}
if (speedX > 0 && centerX > 200) {
bg1.setS... |
3d32bf9f-54e2-4374-9b30-f2d6163c8338 | 7 | private void jTextField3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField3FocusLost
boolean es_componente=false;
//voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos
//if (evt.getOppositeComponent()!=null){
int i=0;
... |
88f9a180-a55a-4e47-877c-3cffdf28f3a4 | 2 | private String formatTables(String content) {
String buf = "";
int idx = 0;
int aStart = 0;
int aEnd = -8;
while (content.indexOf("<table", idx) != -1) {
aStart = content.indexOf("<table", idx);
buf += content.substring(aEnd+8, aStart);
idx = content.indexOf(">", aStart)+1;
aEnd = content... |
24dc4acf-e33e-4a58-b586-de2d8d2e6145 | 3 | private void jButton_RemoveAccount3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_RemoveAccount3ActionPerformed
if (jTable_ServerList.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select Server Contract to delete", "Error", JOptionPane.ERROR_MESSAGE)... |
cebce0ed-545a-46a0-a7d2-9f8e54c812be | 2 | public void printScreen() {
System.out.println("-------------------------------------------------------------");
for (int row = 0; row < 22; ++row) {
for (int col = 0; col < 10; ++col) {
System.out.printf("%6s ",screen[row][col].isEmpty());
}
System.out.println();
}
} |
1d294707-d017-4cc1-8b6e-c49ed39fa930 | 7 | public void run() {
// get line and buffer from ThreadLocals
SourceDataLine line = (SourceDataLine)localLine.get();
byte[] buffer = (byte[])localBuffer.get();
if (line == null || buffer == null) {
// the line is unavailable
return;
... |
fe17abb6-4a33-4d93-a83c-607425f27a1d | 6 | private final void handleDecreaseIndent(Element elem, Document doc,
int tabSize)
throws BadLocationException {
int start = elem.getStartOffset();
int end = elem.getEndOffset() - 1; // Why always true??
doc.getText(start,end-start, s);
int i = s.offset;
end = i+s.count;
if (end>i) {
... |
7187db91-942f-4ecd-bd4a-4958ca8349de | 4 | private void init(int x, int y, int dir, int beepers, boolean internal) {
if (WorldBackend.getCurrent() == null) {
Display.openDefaultWorld();
}
this.x = x;
this.y = y;
if (beepers < 0 && beepers != Display.INFINITY) {
Debug.printWarning("Invalid amount of beepers: "
+ beepers +... |
58e58ae9-6094-4157-ae76-bee8b2b98233 | 0 | public static void main(String[] args) {
new Main().start();
} |
9acea33e-7540-4e07-9cc7-b76ef9e28eec | 2 | private void renderPlayer(Graphics g){
if(player.isGrounded()){
if (player.isDucked()) {
g.drawImage(Resources.duck, (int) player.getX(),
(int) player.getY(), null);
} else {
Resources.runAnim.render(g, (int)player.getX(), (int)player.getY(), player.getWidth(), player.getHeight());
}
} else {... |
588e0fd3-4f96-42c9-b9ce-439416923821 | 9 | public EditInfo getEditInfo(int n) {
if (n == 0)
return new EditInfo(waveform == WF_DC ? "Voltage" :
"Max Voltage", maxVoltage, -20, 20);
if (n == 1) {
EditInfo ei = new EditInfo("Waveform", waveform, -1, -1);
ei.choice = new Choice();
ei.choice.add("D/C");
ei.choice.add("A/C");
ei.... |
3cec6a6a-b27d-4922-b70d-a2d5be406b46 | 6 | public void actionPerformed(ActionEvent ae) {
//
// Process the action command
//
// "create report" - Create the report
// "done" - All done
//
try {
switch (ae.getActionCommand()) {
case "create report":
AccountRe... |
2a4aa4d8-4e7b-4210-85b0-ba0037f71fe6 | 5 | public void mouseClicked(int x, int y){
if(x > this.x && x < this.x + this.width && y > this.y && y < this.y + this.height){
Iterator<ActionListener> it = listeners.iterator();
while(it.hasNext()){
it.next().actionPerformed(new ActionEvent(this, ACTION_BUTTON_PRESSED, "pressed"));
}
}
} |
eb0b2abc-154d-42e3-9a91-c2e109334229 | 4 | public LuaValue get(LuaValue key) {
if (key.equals(LENGTH))
return valueOf(Array.getLength(m_instance));
if (key.isint()) {
int i = key.toint() - 1;
return i >= 0 && i < Array.getLength(m_instance) ? CoerceJavaToLua.coerce(Array.get(m_instance, key.toint() - 1)) : NIL;
}
return super.get(key);
} |
4aad2a8a-5e27-482a-9fb5-aabf2fbd7bf2 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < ... |
0dfffe45-5447-4920-8a84-56383e569436 | 8 | public void next(int width, int height) {
for (int i = 0; i < bc.length; i++) {
if (bc[i] == null) return;
if (bc[i].prevx.size() == 0) {
bc[i].prevx.addLast(new Float(bc[i].x));
bc[i].prevy.addLast(new Float(bc[i].y));
} else if (bc[i].prevx.size() == bc[i].capacity) {
bc[i].prevx.removeFirst();... |
fdd26159-7aef-4d50-8079-86f8e608a566 | 0 | public void setNamePer(String namePer) {
this.namePer = namePer;
} |
a0ed7b9f-20f2-4a7b-ad47-8530ef492e3e | 5 | public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
JCas jcas;
try {
jcas = aCAS.getJCas();
} catch (CASException e) {
throw new ResourceProcessException(e);
}
/*Code added try to iterate over annotations
*Retrieve the built index, iterate over the a... |
35c7d6e9-942c-4847-ab6d-153d5b018cc2 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
f6b3b4c1-0479-46f5-a4bd-16fa3ffae6c9 | 8 | public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Reserva other = (Reserva) obj;
if (this.libro != other.libro && (this.libro == null || !this.libro.equals(other.libro))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.