method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a9f39980-69cf-4a28-aee4-96bcce2fa410
5
public void eventDispatched(AWTEvent event) { if (MouseEvent.MOUSE_CLICKED == event.getID() && event.getSource() != button) { Set<Component> components = getAllComponents(datePanel); boolean clickInPopup = false; for (Component component : components) { ...
5adb0d4f-3e74-40b5-a63e-2c923b81d7f8
9
private Color getColor(SquareType square) { if (square == null) { return Color.WHITE; } else { switch (square) { //I, L , J, T, O, S, Z, EMPTY, OUTSIDE; case I: return Color.BLUE; case L: retu...
4884c44f-5637-40ed-b4ad-24c7373ad600
4
public void buildcountytable(List<Tuple> tups, StateProfile result) { Iterator<Tuple> tupiter = tups.iterator(); while (tupiter.hasNext()) { Tuple t = tupiter.next(); outputService.getCountyProfile(result.getStateInfo().getID(), t.getId(), new AsyncCallback<CountyProfile>() { public void onFailure(Thro...
e4c08969-dbc9-43ea-b065-33008d33efd8
2
public static void drawHerbsMinimap(GOut g, Coord tc, Coord hsz) { if(UI.instance.minimap == null) return; synchronized (UI.instance.minimap.hherbs) { for (Pair<Coord, String> arg : UI.instance.minimap.hherbs) { Coord ptc = arg.fst.div(tileSize).add(tc.inv()) .add(hsz.div(2)); g.chcolor(Color...
f5cb831b-f710-42ec-b8f3-42fb03f00cb1
1
@Override public void paintComponent(Graphics g) { super.paintComponent(g); try { g.drawImage(object.getSprite(), 5, 5, null); } catch(NullPointerException e) {} }
3ea9523e-4f84-4afe-be21-61026182a985
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...
b4b148d7-b322-45eb-8203-0c6be210e285
9
public Map<UserType, Set<Session>> getMySessions(String email) { Map<UserType, Set<Session>> mySessions = new HashMap<UserType, Set<Session>>(); Set<Session> adminSessions = new HashSet<Session>(); Set<Session> facilitatorSessions = new HashSet<Session>(); Set<Session> attendeeSessions = new HashSet<Session>();...
7f86568e-2a4e-4209-ac75-e4b38d080b57
3
public static int Dcalculation(Planet pA, Planet pB) { // Tested // The next values are only relatives value to the global values of grothrates and number of ships int hisLoss = 0; int myLoss = 0; int hisGrowth = 0; int myGrowth = 0; if (Helper.WillCapture(pA,pB)){ /* if A capture B */ myLoss = ...
65c66896-2139-465b-8eb5-c09845dde5a4
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String nextPage = request.getPathInfo(); if (nextPage != null) { if (nextPage.substring(1).contentEquals("connexion")) { connexion(request); } else if (nextPage.substring(1).contentEqu...
51572f2f-c100-4392-8a8a-395b4de23d90
8
public Object nextValue() throws JSONException { char c = nextClean(); String s; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
ac0aa430-2b0c-435b-b46a-e717cfedb202
7
public static boolean isSpecial(Pokemon.Type t) { switch(t) { case FIRE: case WATER: case ELECTRIC: case GRASS: case ICE: case PSYCHIC: case DRAGON: return true; default: return false; } }
8960e2dc-a430-43a7-8fc3-440997190e82
8
@Override public Object put(CycSymbol parameterName, Object value) { // @Hack if the value is :UNKNOWN the parameter will not be set and it is assumed that // Cyc uses its own default for that particular parameter if (value instanceof CycSymbol && ((CycSymbol) value).toString().equals(":UNKNOWN")) { ...
48e3df57-b0fc-493f-8287-6cfabde44971
9
public void startAnimation(Graphics2D g){ if(timerRepeats>100 && timerRepeats<102){g.setColor(Color.blue);g.fill(screen);loadImage(g,"CyrusAntiVirus.png");} if(timerRepeats>200 && timerRepeats<203){ g.setColor(Color.blue);g.fill(screen);loadImage(g,"CyrusAntiVirus.png");} if(timerRepeats>300 && timerRepeats<304){...
35778112-c67b-4aaa-a302-ff45570f7b11
9
public Instances getDataSet() throws IOException { Instances result; double[] sparse; double[] data; int i; if (m_sourceReader == null) throw new IOException("No source has been specified"); if (getRetrieval() == INCREMENTAL) throw new IOException("Cannot mix getting Instance...
c4dbac16-2cfa-4408-85ba-7f87b080a412
4
private static Method findSetScriptContextMethod(Class<?> clazz) { try { Method setCtxMethod = clazz.getMethod("setScriptContext", new Class[] { ScriptContext.class }); int modifiers = setCtxMethod.getModifiers(); if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)) { return ...
5bcf73ea-edf2-4cc1-b913-023f351e5fae
4
public boolean containsPoint(Point p) { if (p.x > getLeftEdge()) { if (p.x < getRightEdge()) { if (p.y > getTopEdge()) { if (p.y < getBottomEdge()) { return true; } } } } retur...
4029bf45-190b-4d67-83dd-ccca32908916
0
void addAwaitingResume(DccFileTransfer transfer) { synchronized (_awaitingResume) { _awaitingResume.addElement(transfer); } }
1e8c7824-2517-4ff5-b9d6-2b2d313454fc
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Customer other = (Customer) obj; if (!Objects.equals(this.id, other.id)) { return false; ...
96051581-c5e6-454f-a00e-1a7ff6056b8b
4
public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) {// parcour par colonne case 0 : return listClient.get(rowIndex).getId(); case 1://colonne type_vetement return listClient.get(rowIndex).getNom(); cas...
4f656381-b33c-4aae-b3e1-6a3dc9c58f9c
4
@Override public void addBoats(ArrayList<Boat> boatList) throws SQLIntegrityConstraintViolationException, SQLException { theConnection.open(); Connection conn = theConnection.getConn(); try { int[] boatID = new int[boatList.size()]; conn.setAutoCommit(false); ...
81f35f66-2d16-4506-a911-080ddb11b420
2
public int getIntInput(String promptMessage, String invalidInputMessage){ int userInput = 0; boolean inputInvalid = true; while (inputInvalid) { System.out.print(promptMessage); String response = Main.Scan.next(); Pattern digitPattern = Pattern.compile("([0-9]+)"); Matcher digitMatches = digitPattern....
d1ef3f47-c20f-47b0-ac2d-0cc41a1609f2
9
public static void readStatement(String lexeme, SymbolTable currTable) throws IOException{ int[] offset = currTable.getOffsetByLexeme(lexeme); String type = currTable.getTypeByLexeme(lexeme); boolean byRef = false; if(offset != null) { //by copy for (Symbol s: currTable.symbols) { if(s.iden.equals(lex...
d735204a-3fe7-41a4-b0db-cde2b48f337a
4
public static void main(String[] args) throws Exception{ WebDriver driver = new FirefoxDriver(); driver.get("http://www.fifa.com/worldcup/matches/index.html"); // matches PrintWriter writer = new PrintWriter("/u/jeremiah/MatchStats.txt"); // gotta get a list of the countries, but like with...
b3731e51-e076-4154-a996-38395606b60c
9
public static Texture getDude(boolean flip, Gun gun){ if(!flip){ if(gun == Gun.PISTOL){ return fpistol; }else if(gun == Gun.SMG){ return fsmg; }else if(gun == Gun.GRENADE){ return fgre; }else if(gun == Gun.NONE){ return fdude; } }else{ if(gun == Gun.PISTOL){ return pistol; }...
45fa610b-bb45-4ac4-9c8a-b1008454bff2
0
private void printTime(double time) { System.out.println("Average time taken: " + time + " ms"); }
3bce19f7-e6a9-4e8f-bc00-46ebeb76ee81
3
protected int getKnownAttributeCount() { int count = 0; if (constant != null) count++; if (syntheticFlag) count++; if (deprecatedFlag) count++; return count; }
d0f8fe2a-2e07-4f0a-b48d-4728014e7159
0
private void setLinearity(int linearity) { myLinearity = linearity; }
462ddcdc-a29d-480f-9e18-c785a7a15346
1
private int getCharScore(char c) { try { return charScore[c - 97]; } catch (IndexOutOfBoundsException e) { return 0; } }
b653c318-c512-41be-95cd-7c4bed0f9335
5
private void attackPlaceLeft(int position, char[] boardElements, int dimension) { if (isPossibleToPlaceLeft(position, dimension)) { if (isPossibleToPlaceOnNextLine(boardElements, position + dimension) && isBoardElementEmpty(boardElements[positionLeftBelow(position, dimension)])) ...
1e139b91-7cf2-4887-a7e4-424eaee6bf46
8
private TerminologyManager() { try { // user configuration File userFile = new File(TERMINOLOGIES_FILE); if (!userFile.exists()) { File dir = new File(System.getProperty("user.home") + System.getProperty("file.separator") + "odml"); if (!dir.exi...
59f96406-063f-4748-9f84-25ec2f21b83b
1
public int addToQueue(String channel, String message, int source) { if (source == 0) { acebotCore.printChannel(addHash(channel), "[" + BotCore.sdf.format(new Date()) + "] ", graphics.acebotsthree.TIMECOLOR); acebotCore.printlnChannel(addHash(channel), message, new Color(230, ...
c617a20a-c924-4b87-b9ab-1f7450c8d5bb
4
public void isBlackJack() throws PlayerEndOfGameException{ if (player.isBlackJack() && !dealer.isBlackJack()){ player.playerBlackJack(); throw new PlayerEndOfGameException("/photos/blackJack.gif"); } if (player.isBlackJack() && dealer.isBlackJack()) throw new PlayerEndOfGameException("/photos...
0c8b3eb0-2d89-40e2-a3b4-86ab91f4dfff
1
private void loadLeaderboard(int currentPlayersPosition, int quantity) { // TODO Auto-generated method stub lobby.setStatus("Loading Leaderboards"); this.currentLeaderPosition = quantity; String result = sendMessageToServer(GameSocketServer.GET_TOP_PLAYERS, ",startAt=" + currentPlayersPosition + ",quantity=...
702825c4-b1b3-4631-b55d-4b60ddabef56
8
public ArrayList<Shape> getRunwayLightings(Runway runway, AffineTransform at, Graphics2D g){ double runwayLength = runway.getLength(); double runwayWidth = runway.getWidth(); double runwayX = runway.getX(); double runwayY = runway.getY(); double runwayCenterX = runway.getCenterX(); double runwayCenterY = r...
65f020e7-8438-4154-9143-fc1300469db1
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Student student = (Student) o; if (!number.equals(student.number)) return false; return true; }
ee4ceb7c-77bd-4509-be32-c11e09dca1ac
6
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); Debug.print("Action performed on: " + o); if(o == okButton) { Debug.print("Checking Yeast..."); // create a new Yeast object Yeast i = new Yeast(); i.setName(txtName.getText()); i.setCost(txtCost.getText()); i.setDe...
175253fd-0673-4caf-b21c-c8670f4e3ad7
0
public MultipleOutputSimulateAction(Automaton automaton, Environment environment) { super(automaton, environment); putValue(NAME, "Multiple Run (Transducer)"); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, MAIN_MENU_MASK)); }
66b0033f-efac-460e-8599-acb610e190e1
7
public static void initScript(NativeFunction funObj, Scriptable thisObj, Context cx, Scriptable scope, boolean evalScript) { if (cx.topCallScope == null) throw new IllegalStateException(); int varCount = funObj.getParam...
e1fa4154-d2cf-4a78-969d-9afcdda12d93
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S...
ed964ebb-3fa8-4d62-9130-3596e6e4b859
1
public static String extractDate(String fullTitle) { if (!fullTitle.contains("_URL_")) return "incompatible text"; String dateTitle = fullTitle.replaceAll(".html", "").split("_URL_")[1]; return dateTitle; }
0cec4897-ac37-4ab4-9884-484f2f2243e7
6
private void doEquip(ItemStack item) { ItemMeta meta = item.getItemMeta(); if (meta == null) return; if (!meta.hasLore()) return; for (String lore : meta.getLore()) { String name = ENameParser.parseName(lore); int level = ENameParser.parseLevel(lore); ...
cfa8fe08-3703-4d47-b1bf-883cb9350940
6
public int findShortestDistance(String[] words, String a, String b) { Map<String, Integer> parityValueMap = new HashMap<String, Integer>(); parityValueMap.put(a, 0); parityValueMap.put(b, 1); Map<String, Integer> posMap = new HashMap<String, Integer>(); posMap.put(a, 0); ...
9061e8a5-4475-48e3-9026-a25d02950bce
6
public static <E> E[] map(E[] a, Function<E> func){ assert a != null; assert func != null; assert a.length > 0; E[] b = (E[]) Array.newInstance(a[0].getClass(), a.length); assert b != null; assert b.length != 0; assert b.length == a.length; for(int n = 0; n < b.length; n++){ assert 0 <= n &&...
3f4a6400-8638-4d63-92cd-486a54992ee8
5
public final void method44(int i, AbstractToolkit var_ha) { anInt10008++; Object object = null; r var_r; if (aR10036 != null || !aBoolean10003) { var_r = aR10036; aR10036 = null; } else { Class2 class2 = method2417(0, var_ha, 262144, true); var_r = class2 != null ? ((Class2) class2).aR118 : nul...
4c57033f-a082-4efa-8c89-795d35cb31f8
8
public boolean isScramble(String s1, String s2) { if (s1.length() != s2.length()) return false; if (!hasSameChars(s1, s2)) return false; if (s1.equals(s2)) return true; for (int mid1 = 1; mid1 < s1.length(); mid1++) { int mid2 = s1.length() - mid1; String sub11 = s1.substring(0, mid1); String ...
f17d523d-05fb-4344-842a-aeaf24a0d5df
3
public boolean equals(Object obj) { try { if (!obj.getClass().equals(baseVideoClass.class)) { throw new Exception(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return (obj != null) && ((baseVideoClass) obj).getType().equals(this.type); }
ae52cba3-334c-4890-821f-763d8da18df5
5
public void moveDown() { if(!win && !m.getMap(p.getTileX(), p.getTileY() + 1).matches(pattern) && p.getTileY() != Maze.gridSize-1) { if(yOffset < Maze.gridSize - 20 && p.getTileY() == yOffset + 10) { Board.yOffset++; p.move(0, 1); } else { p.move(0, 1); } } }
c0c39526-852f-4663-82f9-dd9ee01f3d0b
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...
7db2499b-e7ed-4876-beb1-b501e6489d85
2
@Override public ByteBuf serialize(O_02_MultipleAddressCallInput ucpOperation) { ByteBuf bb = Unpooled.buffer(); Serialization.serializeString(bb, ucpOperation.getNpl()); Serialization.serializeString(bb, ucpOperation.getRads()); Serialization.serializeString(bb, ucpOperation.getOadc()); Serialization.ser...
44b8e442-d796-4d7b-b511-87cfb9f0cbd9
5
public void attach(String word) { if (word.length() > 1) { if (this.isRoot()) { Character key = Character.valueOf(word.charAt(0)); MTrieNode node = (MTrieNode) this.children.get(key); if (node != null) { node.attach(word); } else { this.children.pu...
a5a2c035-6857-445a-84e9-2a2144fe56f1
1
static public void remove(String name) { if (states.containsKey(name)) { states.remove(name); } }
9a7cbafa-df2e-442a-950d-2746ebc709d6
7
@Override public void accept(Metadata metadata, InputStream content) throws IOException { // handling of service type messages if (metadata.getType() == Metadata.Type.SERVICE) { List<MessageReceiver> receivers = new ArrayList<>(); synchronized (consumers) { Ma...
4e618dd3-9f3d-4929-8254-c4b8219bf5e3
2
public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException { if(!isGameOver) { if(!isPause) { } else { } } else { } }
33d0a0a0-07fd-40ba-ad84-eaa168cc400d
1
public void mousePressed(MouseEvent event) { State state = getDrawer().stateAtPoint(event.getPoint()); if (state == null) return; controller.expandState(state); }
deb06e4f-ca65-4ed7-9568-1757a364f62d
3
public PDFObject getDictRef(String key) throws IOException { if (type == INDIRECT) { return dereference().getDictRef(key); } else if (type == DICTIONARY || type == STREAM) { key = key.intern(); HashMap h = (HashMap) value; PDFObject obj = (PDFObject) h.get...
c3b65cbd-99fc-4cc0-ae3e-25d9ee776e01
4
private boolean validPlacement(int x, int y, Entity entity){ int width = entity.getWidthInTiles(); int height = entity.getHeightInTiles(); boolean validPlacement = true; for(int i = 0; i < height; i++){ for(int c = 0; c < width; c++){ if(gameMap[c+x][y-i] != null && gameMap[c+x][y-i] != entity){ ...
1cba4b39-1f19-4470-8fba-221da3b86fec
5
private static int sortUtil(int[] array, int low, int high) { int key = array[low]; while(low < high) { while(high > low && array[high] >= key) { high--; } array[low] = array[high]; while(low < high && array[low] <= key) { low++; } array[high] = array[low]; ...
64d6194a-2f8d-4dec-93a7-157599d3814f
9
public void quickSort(int[] a, int begin, int end) { int left = begin; int right = end; int temp = a[left]; while (left < right) { while (left < right && a[right] >= temp) right--; if (left < right) a[left] = a[right]; while (left < right && a[left] < temp) left++; if (left < right) ...
16da45f6-c9bc-45d9-b16e-2d49d96033b4
7
@Override public String execute() throws Exception { PingjiaoService service = new PingjiaoService(); Map<String, Object> application = ActionContext.getContext() .getApplication(); getSearchList(service, application); // 设置表格第一行第一列的文本 firstTitle = ""; if (course == null && professionalName == null ...
5289080d-52ab-4dc9-9a53-4dbbae560a98
4
private void modifyExtensionAnnotatedRefset(RefexChronicleBI<?> memberChron) throws ContradictionException, InvalidCAB, IOException { RefexVersionBI<?> mem = memberChron.getVersion(vc); RefexCAB bp = mem.makeBlueprint(vc, IdDirective.PRESERVE, RefexDirective.INCLUDE); if (bp.getMemberUUID() == null) { bp.setM...
38e979ba-98fc-4843-ab0d-3a36fcda6b97
4
@Override public void run() { try { packet = receivePacket(); stdOut.writeln(TAG + " received packet is: " + packet); } catch (Exception e) { stdOut.printError(e.getMessage()); cancelOnReceiveError(); return; } if (initiat...
bd673af1-9d99-4c5f-b3d3-58dd18365db2
1
@SuppressWarnings("unused") private int getLayerFromIndex(final int index) { int layer = 0; while (index > Math.pow(2, layer) - 1) { layer++; } return layer; }
227f4272-e12f-4cb2-bdc9-5cc72de0ed71
3
public ArrayList<ExternalUser> getAllExternalUsersFromDatabase(){ ArrayList<ExternalUser> externalUsers = new ArrayList<>(); ArrayList<HashMap<String, String>> externalUsers_raw = mySQLQuery.getAllRows("ExternalUser"); for(HashMap<String, String> externalUser_raw : externalUsers_raw){ ...
4a948d38-7516-4ead-90f6-95ebd85f368a
5
public static Product buscarCod(String cod) throws IOException{ try { ObjectInputStream dataIn=new ObjectInputStream(Files.newInputStream(path)); while(true ){ Product product=(Product) dataIn.readObject(); if(product.getCod().equalsIgnoreCase(cod)){ System.out.println("Este c...
6262fe04-1deb-4a58-b748-f3c9976c1b91
1
public SimpleStochasticLotSizingSolution(double totalSetupCosts, double totalInventoryCosts, String amountVariableName, double[] amountVariableValues, boolean[] setupPattern) { //Check inputs if (amountVariableValues.length != setupPattern.length) throw new IllegalArgumentException("Planning horizons did not ...
089924fd-676d-4142-bf05-cefbf2d51735
3
public String cutToSize(String o, int limit) { if(o.length() > limit) { o = o.substring(0, limit); } else if (o.length() < limit) { while (o.length() < limit) { o += " "; } } return o; }
69875ece-e174-44ff-bac3-cfeadca93303
3
@Override public int willingnessToMoveHere(Hero hero, Player player, float distance, int day) { float moveRatio = hero.getMovePoints()/distance; float result = 0; Cost need = player.getBalancedBudget(); if (type == ResourceType.GOLD) { result = 1.2f*(moveRatio + Math.min(3, need.gold/amount)); } els...
00ca909e-f4c6-48a1-81a0-ae115512c0d2
2
private void drawAxis(int[] bits){ int pw = getPanelWidth(); int ph = getPanelHeight(); int xNull = getXnull(); int yNull = getYnull(); for (int i = 0; i < ph; i++){ bits[i*pw + xNull] = GUIStandarts.axisColor; } for (int i = 0; i < pw; i++){ ...
77a322d0-8a7f-4dc6-8de0-65110adfa831
6
public void magicComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("", "You can see what each of the spells", 6949, 0); menuLine("", "does by selecting the spellbook icon on", 0, 1); menuLine("", "your side interface. Move the mouse", 0, 2); menuLine("", "over the icon of the spell you wan...
66f9fac6-6971-443d-9d26-65e8704bbf32
8
public String getFranchiseAirportName(int ID) throws UnauthorizedUserException, BadConnectionException, DoubleEntryException { /* Variable Section Start */ /* Database and Query Preperation */ PreparedStatement statment = null; ResultSet results = null; ...
86c6ed3f-c62a-41a1-adba-da7d3d54de5f
9
public boolean Open(String path) { try { FileInputStream open_file = new FileInputStream(path); byte fileheader[] = new byte[14]; byte infoheader[] = new byte[40]; open_file.read(fileheader); open_file.read(infoheader); if (file...
a28fc242-f38b-4e0d-82a9-9029b4baae59
4
public static void rectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys = scal...
7f6a635d-45fe-4d88-8877-37d7d0f0d76b
6
protected static void rechercheTrajetsParticipant(Membre m){ ArrayList<Trajet> resConducteur = dbT.getTrajetByConducteur(m); ArrayList<Trajet> resPassager = dbT.getTrajetsWithPassager(m); System.out.println(); if(resConducteur.size()==0 && resPassager.size()==0){ System.out.println("Vous ne participez enc...
1918da27-2398-4408-a465-6fff13ca7997
0
public final String getEmpty() { return toSubstitute; }
181cb59a-19ee-45a1-b02d-040581524b41
3
public void setVisible(boolean visible) { if(frame == null) { frame = new JFrame("About YAMG"); mainPanel = new JPanel(new GridLayout(18, 2)); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); addRow("Game Version", Configurables.GAME_VERSION); addRow("Lead Programmer", "Daniel Glus")...
7ca2a61f-74d0-407d-acda-bc947778ec55
1
private Ball getBall() { if (networkGameType == NetworkGameType.MASTER) return new Ball(100, 40, (int)(BALL_SCALE * width), (int)(BALL_SCALE * width)); else return new Ball(width - 110, 40, (int)(BALL_SCALE * width), (int)(BALL_SCALE * width)); }
d4df75a0-e12b-42ff-9c2b-6821c56fa464
4
private void addDependent(JSRTargetInfo result) { if (dependent == null || dependent == result) dependent = result; else if (dependent instanceof JSRTargetInfo) { Set newDeps = new HashSet(); newDeps.add(dependent); newDeps.add(result); } else if (dependent instanceof Collection) { ((Collec...
9cae64d2-6bf0-4efc-9012-b786d5dadc6a
6
@Override public boolean shouldReact(Message message) { String messageText = message.text.trim(); if (messageText.startsWith("movie") || messageText.startsWith("movies") || messageText.startsWith("vycsfdkuj") || messageText.startsWith("vyfilmuj")) { ...
5d108237-2f1d-4d91-9089-53225b7121bf
8
public static int[] mergeSort(int[] array) { if (array.length==1) return array; int mid = (array.length) / 2; int[] low = new int[mid]; int[] high = new int[array.length-mid]; for (int i=0;i<array.length;i++) { if (i<mid) { low[i]=array[i]; } else { high[i-mid]=array[i]; ...
43411adb-b5c6-4c18-a9f5-fa482b15865d
2
public void process(String tweet) throws IOException { JSONParser jsonParser = new JSONParser(); String tweetText = null; String tweetTimestamp = null; String tweetId = null; String tweetUserId = null; String tweetInReplyToStatusId = null; try { JS...
e715ddac-feac-4160-b6ae-68f0577f3ff8
3
public static void loadFile() { Scanner in = null; try{ in = new Scanner(new FileReader(fileName)); } catch(Exception e){System.out.println("File Doesn't Exist");} for(int i=0; i<151; i++) seen[i] = in.nextBoolean(); for(int i=0; i<151; i++) caught[i] = in.nextBoolean(); totalSeen = Integer.p...
3690ef51-c903-40f8-b24c-8b43f3879622
5
public void update() { for(int y = 0; y < ySize; y++) { for(int x = 0; x < ySize; x++) { Site site = (Site)scape.grid[x][y]; JLabel label = labels[x][y]; Color background = new Color(255, 250, 205); label.setBackground(background); Agent a = site.getAgent(); if(a != ...
ac012de0-faaa-4834-a824-45b394084501
3
public int getPositionInRefereeClassArray(String name) { int positionInList = 0; for (int i = 0; i < elementsInArray; i++) if (refereeClassArray[i] != null && refereeClassArray[i].getRefereeName().equals(name)) positionInList = i; return positionInList; }
3e455fa4-68b2-43c1-aece-a335bf2f7d03
6
private void compute() { if (computed) { return; } float sum = 0; int n = 0; while (true) { float val; try { val = floatVal(n); } catch (ArrayIndexOutOfBoundsException e) { break; } sum += val; minVal = Float.isNaN(minVal) ? val : Math.min(mi...
848cb6fc-1574-4182-bde2-dafdc8a5ba03
3
public boolean isClause(ArrayList<String> potentialClause, ArrayList<String> charIdentifier) { for (int i = 0; i < this.subjectsOf(potentialClause, charIdentifier).size(); i++) { if ((this.subjectsOf(potentialClause, charIdentifier).get(i).isEmpty()) || (this.actionsOf(potentialC...
7d92541f-ebca-4dea-9d26-1b218965855c
5
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!plugin.hasPerm(sender, "heal", false)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } if (args.length == 0) { if (plugin.isPlayer(sender)) {...
974d4c42-cf97-43d6-a5f6-77b3b4108a05
8
private void calcCuboidsMinMax() { if (!(frameRenderer instanceof ExtendedFrameRenderer)) return; Cuboids c = ((ExtendedFrameRenderer) frameRenderer).cuboids; if (c.isEmpty()) return; Point3f min = c.getMin(); Point3f max = c.getMax(); if (min.x < minBoundBox.x) minBoundBox.x = min.x; if (min.y <...
403265d0-92e3-4d8d-8157-94f529e84267
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SalesDetail other = (SalesDetail) obj; if (idOrder == null) { if (other.idOrder != null) return false; } else if (!idOrder.equals(other....
7751b197-f8ef-4723-bfd9-6e90fdbe3e42
5
public String getTwoPair() { String stt = "0"; //same implementation idea as in isOnePair method. //this time, when a pair is found, a second pair must be found too. if (cards[0].getRank() == cards[1].getRank()) { if (cards[2].getRank() == cards[3].getRank()) { ...
32027888-b38d-42ee-b6d5-e0fb849bf6f0
6
public void loadAllFFmpegArguments(List<FFmpegArguments> list) { if (connection == null || list == null) return; list.clear(); Statement stat = null; try { stat = connection.createStatement(); ResultSet rs = stat.executeQuery( "SELECT Name, Arguments, FileExtension FROM " + FFmpegArgu...
436552d3-d307-44d2-8f93-330e35262924
7
public static <E> void reversedBFSWithLine(KAryTreeNode<E> root) { if(root == null) { return; } ArrayList<Integer> lineNodeCount = new ArrayList<Integer>(); Queue<KAryTreeNode<E>> queue = new LinkedList<KAryTreeNode<E>>(); Stack<KAryTreeNode<E>> stack = new Stack<KAryTreeNode<E>>(); queue.add(root); l...
9168ae1a-38c0-431d-8c98-09dfc2bbbea1
6
private void jButtonEliminarBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarBuscarActionPerformed if (banco.longitud() == 0) { mostrarOption("Error: No hay clientes registrados en el banco.\n Ingrese las cuentas antes de hacer esta operacion.", JOptionPane.ERR...
4ec8ac7a-12e3-49bb-8fc6-b13b8478b000
7
public boolean inAreaCapturable(Player p) { int x = p.getLocation().getBlockX(); int z = p.getLocation().getBlockZ(); int y = p.getLocation().getBlockY(); //inner 1/2 int capRadius = AreaRadius / 2; if(capRadius*2 <= 50) capRadius = 25; String worldname = p.getWorld().getName(); b...
92819053-93e6-49a4-9b5f-d940c3e58d66
1
@Override protected void onConnect() { if(addons.isEmpty()) registerAddons(); }
7f32c5a4-7187-4f7a-b52c-ac2849d44954
0
@Override public void windowActivated(WindowEvent arg0) { }
2bc27283-9c2d-47d7-b37e-647927f0cb20
2
public int[][] getActualState() { int[][] gridState = new int[sudokuSize][sudokuSize]; for (int i = 0; i < sudokuSize; i++) { for (int j = 0; j < sudokuSize; j++) { gridState[i][j] = cells[i][j].valueState; } } return gridState; }
32e0764f-2d10-4219-b62e-35a33c733946
5
public static void backup(){ String fileDate = ""; String fileExt = ".bin"; //get parameters from GUI getParametersFromGUI(); //check if the path ends with "/" or "\" - if not, display a Popup if (!(filepath.endsWith("/") || filepath.endsWith("\\"))) OptionPanes.notifyFilepath...
6cdd5739-591f-428a-844a-197b0f36ce0a
4
public String createCalendar(String username, String calendar, boolean isPublic) { try { crs = qb.selectFrom("calendars").where("calendar", "=", calendar).executeQuery(); if(!crs.next()) { if(isPublic) { String[] keys = {"calendar", "createdBy"}; String[] values = {calendar, username}; q...
d009c49d-c994-4fd6-9460-103f2dc4d30c
5
@Override public void visitEnd() { boolean hasDummy = dummyArgument != 0; String callerMethodDescriptor = hasDummy ? methodDescriptor.replace("I)", ")") : methodDescriptor; Type[] argumentTypes = Type.getArgumentTypes(methodDescriptor); MethodVisitor methodVisitor = cv.visitMethod(Opcodes.ACC_PUBLIC, callerMeth...
431b5ea9-5fb3-48a2-8a13-52727ae0c979
9
private void process() { Scanner in = new Scanner(System.in); int hotkeys = in.nextInt(); HashMap<String,ArrayList<String>> operationsPerKey = new HashMap<String,ArrayList<String>>(); ArrayList<String> possible = new ArrayList<String>(); in.nextLine(); for (int i = 0; i < hotkeys; i++) { String keyLine ...