method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a77ee7ff-2767-4352-b61d-b3ffe377a0c3
4
public static Object[] getSourceVertices(mxAnalysisGraph aGraph) throws StructuralException { if (!mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED)) { throw new StructuralException("The graph is undirected, so it can't have source vertices."); } ArrayList<Object> sou...
145d27be-7d3d-4773-9db3-bf00fa03b07f
7
public String getHindustaniNoteForWesternNote(String w){//B3 int octave = getOctaveOfWesterNote(w); String wNote = getNoteOfWesternNoteWithoutOctave(w); //Determine Hindustani Note int wNoteIdx = getNoteIndex(wNote, wNotes); int hNo...
6346cb48-bdc4-4f0c-aea8-45d462581fa1
4
@DELETE() @Path("release/{playerId}") @Produces("application/json") @SportService(ServiceType.MLB) public Player releasePlayer(@PathParam("playerId") int iPlayerId) { Player p = new Player(); UserTransaction utx = null; try { ...
c8632be2-c46d-436b-bb19-777457507673
5
public void updateState() { updatePause(); if (!isPaused) { if (level.isFinished()) { if (level.isVictorious()) { if (!lg.hasMoreLevels()) { SwingUtilities.invokeLater(new Runnable() { public void run() { controller.setVictoryScreen(); } }); } else { Sw...
97145103-19b3-4891-8f0e-29f97ffc14cf
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
8e1b2813-6ad6-4051-a816-2e21f4f70205
6
public static void main(String[] args) { Poker[] pokers = new Poker[52]; BufferedReader br; for (int i = 0; i < 4; i++){ for (int j = 0; j < 13; j++){ pokers[i*13+j] = new Poker(nums[j], colors[i]); } } int n = 2; do{ ...
1cac0944-ef5f-45df-87ec-d1768f5a3f6a
8
public String[] loadArchiveFromBlob(byte[] blob, boolean isSecondary) throws IOException { if (isSecondary && mFileManifest == null) { throw new IOException("Can't load secondary archive because no primary archive is loaded yet!"); } ByteArrayIO io = new ByteArrayIO(); io.se...
8f5d4133-66fd-4ab2-b945-7036befa01b6
1
public void testWithFieldAdded_DurationFieldType_int_3() { LocalDateTime test = new LocalDateTime(2004, 6, 9, 10, 20, 30, 40); try { test.withFieldAdded(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
2c7c602c-5350-41f2-a151-9a715fd58e09
4
private void checkForUpdates() { if (!getConfig().getBoolean("global-settings.check-for-updates")) { getLogger().log(Level.WARNING, "Why you no like being informed about updates??"); return; } if (getConfig().getBoolean("global-settings.auto-update")) { Updater updater = new Updater(this, 65327, this....
cf61f9e6-f110-4ec0-869b-2bcceff6339d
3
public boolean isValid() { Set<Box> boxes = getBoxes(); Set<Integer> seen = new HashSet<>(); boolean isValid = true; for(Box box : boxes) { if(box.getValue() == -1) { isValid = false; } else if(seen.contains(box.getValue())) { isValid = false; } else { seen.add(box.getValue()); } } ...
98779e02-8fa9-48af-b775-b73c0461e0f0
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...
4d32a613-2624-4b8e-9af5-6c868a9f9f78
0
public String getAccessToken() { return accessToken; }
012e71ad-55bc-4a0d-94ee-706694c3c763
0
@Override public void setLoggerConfig(ILoggerConfig loggerConfig) { this.loggerConfig = loggerConfig; }
193a9705-1516-4a24-b1e7-cd46bcdffbde
5
@Override public void drawTool(Graphics g, int mouseX, int mouseY) { ((Graphics2D) g).setStroke(new BasicStroke(2)); Canvas c = MainWindow.MAIN_WINDOW.getCanvas(); super.drawTool(g, mouseX, mouseY); if (rect != null){ g.setColor(Color.CYAN); switch (state){ case FIRST: g.drawRect(c.getScaledCoord...
3146a82f-8c22-468b-a803-d2016bff8d9e
4
public EsteenTyyppi kuuluukoPiste(Piste piste) { if (piste.getX() >= vasenYlakulma.getX() && piste.getX() <= oikeaAlakulma.getX() && piste.getY() >= vasenYlakulma.getY() && piste.getY() <= oikeaAlakulma.getY()) { return tyyppi; } return null; }
6e942195-423f-4793-bae7-2dd69a1a24ec
2
private static int entrance(List<Point> points){ int size=points.size(),result=0; for(int i=0;i<size-1;++i){ for(int j=i+1;j<size;++j){ Point middle=middle(points.get(i),points.get(j)); result=Math.max(result,inCircleCnt(middle,points)); } ...
2ba8bf1f-c8ad-48d3-9506-e76b5795c8c8
4
private Animation GetWalkAnimation(dir d){ Animation fm = null; switch(d){ case down: fm = WalkDown; break; case left: fm=WalkLeft; break; case right: fm=WalkRight; break; case up: fm=WalkUp; break; } return fm; }
98d6814b-db2b-418e-aaf1-225ba1261aa9
3
public void pollInput() { while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { toggle(Keyboard.getEventKey(), true); if (Console.isActive()) { pollTyping(Keyboard.getEventKey()); } } else { toggle(Keyboard.getEventKey(), false); } } }
057740d8-7b32-4fec-bf37-7f68384ee97e
4
private static Shape getRandomShape(){ Shape randomShape = null; switch (getRandomNumber(1, 4)){ case 1: randomShape = new Square(getRandomColor(), getRandomNumber(1, 100)); break; case 2: randomShape = new Triangle(getRandomColor(...
ebac20df-f65f-4b64-a3ee-f33ef48b8c50
5
public void run() { final String[] azotArgs = new String[1]; azotArgs[0] = workflowFile; final Properties customProperties = new Properties(); customProperties.setProperty("azot-verbose", String.valueOf(verbose)); customProperties.setProperty("azot-debug", String.valueOf(debug)); customProperti...
94815642-25c5-4c62-a70f-3ab499a28b0e
5
public String[] checkLogin(String us,String pass){ /* * elegxei an einai swsta ta stoixia tou login kai epistrefei to epipedo tou user px(ipalilos) */ String[] priv= new String[2]; priv[0]="0"; try { pS = conn.prepareStatement("SELECT * FROM users WHERE username=? AND password=?"); pS.setString(1, u...
eabe2340-572c-4cbf-8693-d27490fb426c
2
public String getEventName() { return ( name == null || name.equals("")) ? getClass().getSimpleName() : name; }
a1a48f6a-cfc9-4167-8f79-3ba536d5adf0
8
public void VM(Villain v){ //try { // while (!win) { int ranNum = (int)(Math.random() *4) +1; System.out.println(ranNum); if(ranNum == 1){ if(!m.getMap(v.getVillainX(), v.getVillainY() - 1).equals("w") ) v.villainMove(0, -1); } if(ranNum == 2){ if(!m.getMap(v.getVillainX(), ...
b8546d69-1fe7-4ed4-b7e6-3def82946a0f
2
public static void count(String s) { int UniqueWords = 0; boolean[] b = new boolean[256]; for(int i=0;i<s.length();i++) { if(!b[s.charAt(i)]) { UniqueWords += 1; b[s.charAt(i)] = true; } } System.out.println("Unique words in the String is : " + UniqueWords); }
743d530f-8a7e-4075-9273-63af4e344991
4
public void close(){ try{ if(in!=null)in.close(); if(out!=null)out.close(); if(socket!=null)socket.close(); } catch(Exception e){ } in=null; out=null; socket=null; }
34b419a5-a775-4292-a224-fa16e3a3fca3
5
@Override public void actionPerformed(ActionEvent arg0) { String command = arg0.getActionCommand(); String JSONtext = ""; switch (command) { case "startButton": if(startable){ try { JSONtext = enc.encode(new StartedMessage()); sendMessage(JSONtext); } catch (JSONException e1) { e1.pri...
23d4ebb5-40c4-49c5-8782-0963599cb435
6
public static boolean isCachedObject(int objectX, int objectY, int objectHeight, int objectId) { for (StateObject so : stateChanges) { if(so == null) continue; if(so.getHeight() != objectHeight) continue; if(so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY) retu...
7194fbb1-54b4-4dca-a177-23b4483cead9
3
public Item zoekItems(int teZoekenNummer) { Item item = null; try (Connection conn = DriverManager.getConnection(JDBC_URL)) { PreparedStatement queryZoekItem = conn.prepareStatement("SELECT FROM ITEM WHERE ITEMID = ?"); queryZoekItem.setInt(1, teZoekenNummer); tr...
6138546a-cf47-442e-b118-78bc617c46b0
5
public int write(byte[] abData, int nOffset, int nLength) { LOG.log(Level.FINE, ">TCircularBuffer.write(): called; nLength: {0}", nLength); dumpInternalState(); synchronized (this) { LOG.log(Level.FINE, "entered synchronized block."); if (!m_bBlockingWrite) { ...
923f38c6-c018-4247-8b43-f82c44ec1788
5
public static int[] lis(int[] array) { int[] A = new int[array.length + 1]; int[] lis = new int[array.length]; Arrays.fill(A, Integer.MAX_VALUE); int longest = 0; for (int i = 0; i < array.length; i++) { int low = 0; int high = array.length - 1; while (low < high) { int mid = low + (high - low + ...
4636fe1b-056b-4e8f-92d8-0e9fba7b3ff8
3
public Label firstBlock() { final Iterator iter = code.iterator(); while (iter.hasNext()) { final Object obj = iter.next(); if (obj instanceof Label) { final Label l = (Label) obj; if (l.startsBlock()) { return l; } } } return null; }
91f7ed59-4d4f-46b0-a6f0-f846f9c32183
4
public void act() { setImage(flashScreen); if (style) { if (transparency > 10) { getImage().setTransparency(transparency-=10); } else { getWorld().removeObject(this); } } ...
993e2757-8eea-40a6-b85b-19ed547923a9
9
static void kungfum_draw_background(osd_bitmap bitmap) { int offs,i; /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (offs = videoram_size[0]/2 - 1;offs >= 0;offs--) { if (dirtybuffer[offs]!=0 || dirtybuffer[offs+0x800]!=0)...
db5a754b-964a-47d5-8cf9-a8a1b63febfe
9
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed path = formatDest(jTextField3.getText().trim()); if(path.length()>1 && item1!=null && item2!=null) { patch = loadFileChooser(new PatchChooseFilter(), true); try { ...
c0e6083a-e973-4b83-aa1c-ac44c8a4f1fd
8
Widget computeTabGroup() { ToolItem[] items = _getItems(); if (tabItemList == null) { int i = 0; while (i < items.length && items[i].control == null) i++; if (i == items.length) return super.computeTabGroup(); } int index = 0; while (index < items.length) { if (items[index].hasFocus()) ...
f8aaa95f-0fbd-4870-bcab-be85041d586d
4
public int searchAndReplace( String searchfor, String replacewith ) { CellHandle[] cx = getCells(); int foundcount = 0; for( CellHandle aCx : cx ) { if( !(aCx.getCell() instanceof Formula) ) { // find the string if( !aCx.isNumber() ) { String v = aCx.getStringVal(); if( v.indexOf( s...
e9d7e36d-c027-4d11-8f2a-5ba32e9cf345
9
private Expression renameJikesSuper(Expression expr, MethodAnalyzer methodAna, int firstOuterSlot, int firstParamSlot) { if (expr instanceof LocalLoadOperator) { LocalLoadOperator llop = (LocalLoadOperator) expr; int slot = llop.getLocalInfo().getSlot(); if (slot >= firstOuterSlot && slot < firstParamSlot...
ae8fee7d-e5fd-4214-8805-a2b93f1b3e32
6
public static Attunement get2(String key, World world){ //return players.get(key); if (players.containsKey(key)){ for (int i=0;i<players.get(key).size();i++){ if ((players.get(key).get(i).loc.getWorld() != null && players.get(key).get(i).loc.getWorld().equals(world)) || (Config.fallbackToOtherWorldLifestone ...
af6ced76-dd8f-4422-9541-55537497a80f
2
public static boolean isTypeVoid(Class<?> type) { return (type != null && void.class.equals(type)); }
cd9a7ad6-7d58-4be9-997e-dae9d0e40a1b
5
public synchronized void close() { if (m_Dead) { return; } else { try { // connection dead m_Dead = true; // close i/o m_TerminalIO.close(); } catch (Exception ex) { log.error("close()", e...
b9dc0766-fc32-4f94-8d6d-46c5bc05287f
3
public boolean inBound(int x, int y) { return (x >= position.getX() && x <= position.getX() + width || y >= position.getY() && y <= position.getY() + height); }
6ea751d5-dffb-4190-b56e-8cebe75a87e2
1
public HashMap listToMap(MapFilter mf) { HashMap newmap = new HashMap(); Iterator it = iterator(); while(it.hasNext()) { Object o = it.next(); newmap.put(o, mf.map(o)); } return newmap; }
e4ca712f-fa0d-4601-948d-bb3f75f16b6f
6
public boolean contains (Point2D point) { double x = point.getX(); double y = point.getY(); if (x >= start.getX() && x <= end.getX() && y >= start.getY() && y <= end.getY()) { if (isX) return true; else { // y = ax + b double _y = a * x + b; if (_y == y) return true; } } re...
1880b5aa-4b42-4426-973b-383d91a1fede
5
@Override public OccurrenceAllocation select(SolverState schedule, Occurrence forOccurrence) { // Allocations aligned to elementary intervals start and ends AlignedOccurrenceAllocationsIterator allocations = new AlignedOccurrenceAllocationsIterator(forOccurrence, schedule.allocation...
7c63dbed-dba9-4174-a73c-727f82acb4b0
7
private String getStatusMessage(final int status) { switch (status) { case 0x00: return "OK"; case 0x01: return "invalid/unsupported command"; case 0x02: return "no memory on target"; case 0x03: return "malformed data in request"; case 0x64: return "invalid session ID"; ...
603eee85-a57b-4c60-90b9-181f9256c1a7
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Acao other = (Acao) obj; if (nomefull == nu...
c97bc4aa-d65e-42c0-8f6a-e0720ed762fe
5
final private void init(){ Utils.setDialogIcon( this ); setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE ); Container cont = getContentPane(); cont.setLayout(new GridBagLayout()); Insets insetL = new Insets(8,8,0,8); Insets insetR = new Insets(8,0,0,8); ...
81b69ef5-0891-4651-b323-27978e51439f
1
private static Node[] splitInHalf(Node h){ Node[] ret = new Node[2]; int l = findLength(h); int cnt = 0; Node ori = h; while(cnt<l/2-1){ cnt++; h=h.next; } ret[1]=h.next; h.next = null; ret[0]=ori; return ret; }
06b03dfb-0769-4382-a9dd-be95056a7adf
4
private void addBuddyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBuddyButtonActionPerformed int response = server.addBuddy(server.getCurrentUser(), enterBuddyNameField.getText()); if(response == 106){ server.buddies.add(enterBuddyNameField.getText()); ...
4399c401-21de-400f-b96d-9b46bc98c73e
3
public boolean setsockopt(int option_, Object optval_) { if (ctx_terminated) { ZError.errno(ZError.ETERM); return false; } // First, check whether specific socket type overloads the option. boolean rc = xsetsockopt (option_, optval_); if (rc || ...
7b30abb2-44f0-43e8-a9ae-f53d872a3b9c
7
private void findApplicableMethods() { Class<?> resourceClass = resource.getClass(); for(Method m: resourceClass.getMethods()) { for(Class<?> clazz: methods) { @SuppressWarnings("unchecked") Class<? extends Annotation> httpMethodClass = (Class<? extends Annotation>) clazz; if(isApplicableMethod(m, ht...
fdfe1e5b-30f7-4fab-94d1-367d5fda82ca
2
public Ship getShip(int x, int y) { for(int i = 0; i < fleet.size(); i++) { Ship ship = fleet.get(i); if(ship.contains(x, y)) return ship; } return new Ship(); }
ce5e56d1-afe5-4ce8-8c16-3fdf7711c721
2
private CanvasMouse(Component component) { // Need the component object to convert screen coordinates this.component = component; // Calculate the component center int w = component.getBounds().width; int h = component.getBounds().height; center = new Point(w / 2, h / 2); try { robot = new Robot(); }...
701dcc6c-62d9-43f0-8ac1-2352c359a8b7
7
protected PlayerTurn nextPlayer() { boolean test= false; if (test || m_test) { System.out.println("Othello :: isWinner() BEGIN"); } if(getPlayerTurn() == Game.PlayerTurn.PLAYER1) { if (test || m_test) { System.out.println("Othello :: isWinner() END"); } return Game...
f029bfa4-9823-487d-8980-1dfbe999de48
8
public static boolean run_tick() { Sim_entity ent; int num_started; boolean queue_empty; num_started = 0; int entities_size = entities.size(); for (int i=0; i < entities_size; i++) { ent = (Sim_entity)entities.get(i); if (ent.get_state() == Sim_entity.RUNNABLE) { ent.restart(); nu...
42e4a118-003a-4264-999a-0b7015d92056
6
private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; ...
a30669b6-6aa0-4a45-a277-78b5c379a717
1
@Override public Long process(int value) { Long freq = frequencies.get(value); if (freq == null) { freq = 0L; } freq++; frequencies.put(value,freq); return freq; }
4dc81da8-fddb-4c15-8d02-6d4142cd1551
7
@SuppressWarnings("unchecked") public static ArrayList<Move> findBlackKingMoves(Chessboard board, BlackFinderStrategy strategy) throws ChessboardException { ArrayList<Move> moves = board.getAllLegalBlackKingMoves(); if (moves.size() == 0) { return null; } switch (strategy) { ca...
2ec9eee7-f449-4576-b6a7-5f560fd378ee
6
@Override public void addParametersCost(NodeArgument[] params, double cost) { this.costTable.put(NodeArgumentArray.getNodeArgumentArray(params), cost); // set the min and the max if ((cost!= Double.NEGATIVE_INFINITY) && (cost!= Double.POSITIVE_INFINITY) ){ if (this.minCo...
c1dbb21b-e7b7-4f9e-871b-bd53465887d7
9
private static int treatCommand(String s,long idClient, Aquarium a, boolean server){ String contenu [] = s.split("!"); String commande = contenu[0]; switch (commande){ case "DECONNECT": //message : CMD a.disconnectClient(idClient); break; case "ADDFISH": if(server){ //message : CMD!idClien...
39cc8924-9201-456e-ad7b-c3c5597caf11
8
public void calculatePointLoss(int group, int index) { switch(group) { case Model.DVRC_ENUM: if(index == dvrcMostPreferred) { points -= ptsDed; sound = false; } else { sound = true...
902768f0-35ca-4855-b7a6-1a6ccf343c79
4
public void run() { InputStream instr = tc.getInputStream(); try { byte[] buff = new byte[1024]; int ret_read = 0; do { ret_read = instr.read(buff); if(ret_read > 0) { System...
88593f77-0882-422c-ad2d-bf8d79b35dad
3
private Object getObject(EntityUniqueIdentifier belongsTo) { //System.out.println("BelongsTo: " + belongsTo); if (this.maintypes.containsKey(belongsTo)) { return this.maintypes.get(belongsTo); } else { for (Relation key : this.referenceTypes.keySet()) { /...
713c6d94-e810-459f-83a6-ad5817ba285c
5
@Override public int numberOfLivingNeighbors(int x, int y) { int numberOfLivingNeighbors = 0; int xPositive = ensurePositiveCoordinate(x, getBoardWidth()); int yPositive = ensurePositiveCoordinate(y, getBoardHeight()); for (int i = -1; i < 2; i++) { for (int j = -1; j < ...
393d0f11-6396-49a7-9c3a-ed548c4d4e66
7
@Override public int compare(AbstractCarriage ac1, AbstractCarriage ac2) { if (ac1 instanceof AbstractPassengerCarriage) { if (ac2 instanceof AbstractPassengerCarriage) { return compareType( ((AbstractPassengerCarriage) ac1).getComfortType().getId(), ((AbstractPassengerCarriage) ac2).getComf...
abcdad5f-5cdb-43ba-a7f8-ff6d5c4ef17f
9
private boolean findAndRemove(Object e) { if (e != null) { for (Node pred = null, p = head; p != null; ) { Object item = p.item; if (p.isData) { if (item != null && item != p && e.equals(item) && p.tryMatchData()) { ...
5160577b-06fe-4b37-b856-b53f5dd06acf
4
private ArrayList createPegList() { ArrayList pegs = new ArrayList(); for (int i = 0; i < N_ACROSS; i++) { pegs.add(new GPoint(i * PEG_SEP, 0)); } for (int i = 0; i < N_DOWN; i++) { pegs.add(new GPoint(N_ACROSS * PEG_SEP, i * PEG_SEP)); } for (int ...
bbca3f27-eebc-4016-95d4-beaebe5548cd
4
public void paintComponent(Graphics g) { int foodCount = 0; for(int x = 0; x < rows; x++) { for(int y = 0; y < cols; y++) { Tile t = map[x][y]; if(t.getType() == Tile.TileType.TILE_WATER) { g.setColor(new Color(25, 25, 185)); } else if (t.getType() == Tile.TileType.TILE_GROUND) { b...
2e5242c2-aa82-46c2-9b16-5f385fb021e8
3
@Override public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand().toLowerCase(); if (cmd != null) { if (cmd.equals("save")) { save(); frame.dispose(); } if (cmd.equals("cancel")) { frame.dispose(); } } }
3a2ef66f-7d5f-41a0-8123-87866ac94ab5
1
@OnOpen public void onOpen(Session userSession) throws IOException { chatroomUsers.add(userSession); Iterator<Session> iterator = chatroomUsers.iterator(); while (iterator.hasNext()) { (iterator.next()).getBasicRemote().sendText(buildJsonUsername()); } }
1f72ebe4-c08a-4153-90d0-08b93953feb0
3
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { System.out.println("Look and feel was not found."); } //Schedule a job for the event dispatch thread: ...
1ec2e96f-17cb-40a5-973c-ce4a9d99db4d
6
void read() { char ch = '0'; while(ch != '}'){ try{ ch = (char)System.in.read(); } catch(IOException e){ System.out.println("\nIO Exception!!!\n"); } if(((ch <= '0') || (ch >= '9')) && (ch != '}') && (ch != 10)){ result.append(ch); } } }
35cea218-9681-48d0-8f60-c13f58f9b249
4
public Text evaluate(final org.apache.hadoop.io.Text... args) { if (args.length < 1) { return new Text(NOT_ENOUGH_ARGS_ERROR); } Text md5; try { MessageDigest messageDigest = MessageDigest.getInstance(HASH_ALGORITHM); messageDigest.reset(); ...
5272eb78-f000-41c0-a39d-443fab916908
3
@Override public void updateUser(User user) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(user); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ if(ses...
41ca8e96-d54a-4085-95be-9a69a7d2d637
2
public void visitArrayRefExpr(final ArrayRefExpr expr) { if (previous == expr.array()) { // the array reference is like the previous = expr; // left child expr.parent().visit(this); } else if (previous == expr.index()) { check(expr.array()); // right child } }
d2455b3d-349b-48cd-abae-b004c993df4b
5
public static void DFS(int index, int step, char end, String path) { if (step < minL) { if(m[index]==end){ //Llegó al final minL = step+1; minPath = path+m[index]; } for (int i = 0; i < ma[index].size(); i++){ //Marcar camino usado e ir a la siguiente ciudad if(!used[index][ma[index].get(i)...
1a3d484d-eb35-4f9d-a5f6-cc1a682a04d4
3
public void shiftMode() { finalEdit = true; LRParseTable table = getParseTable(); // Determine which rows and columns have ambiguity. cellEditors = new TableCellEditor[table.getRowCount()][table .getColumnCount()]; for (int r = 0; r < table.getRowCount(); r++) for (int c = 1; c < table.getColumnCount()...
689450eb-2632-445e-9faa-6eabd1c8d971
1
private Component getResizableToolbarPanel() { JPanel panel; Box boxButtons = Box.createHorizontalBox(); Box boxButtons2 = Box.createHorizontalBox(); if (frame.getWidth() >= WINDOW_SINGLE_BUTTONS_PANEL_MAX_WIDTH) { boxButtons.setBorder(BorderFactory.createEmptyBorder(1, 8, 1...
8dc4a302-9b99-489c-8325-ce73785c664e
5
static final void method268(int i, int i_36_, int i_37_, int i_38_, int i_39_, int i_40_, int i_41_, int i_42_) { anInt259++; int i_43_ = -334 + i_39_; if (i_43_ < 0) i_43_ = 0; else if ((i_43_ ^ 0xffffffff) < -101) i_43_ = 100; int i_44_ = (i_43_ * (-Class348_Sub23_Sub3.aShort9044 + Class320.zoo...
717841a1-c938-4252-802e-3c82956cfe81
5
final DirTree walkTo(final Path path) { if (path == null) { return null; } DirTree t = this; if (path == this.base) { return t; } final String[] walkingPath = path.relativize(this.base).split("/"); int layer = 0; while (layer < walkingPath.length) { final String base_ = walkingPath[layer++]; ...
22ebc239-66b0-414a-851c-c6d76d4eeb8d
8
void makeBMEAveragesTable( double[][] D, double[][] A ) { edge e, f, exclude; node u,v; // first, let's deal with the averages involving the root of T e = root.leftEdge; f = depthFirstTraverse( null ); while ( null != f ) { if ( f.head.leaf() ) A[e.head.index][f.head.index] = A[f.head.index][e....
2454f224-2548-4f03-94d5-9e90371b462a
8
private void resolvesEntityAdditionsAndRemovals(GameContext g) { for (Mob m : g.removals) { if (m instanceof Dot) dots.remove(m); else if (m instanceof Explosion) explosions.remove(m); // else if (m instanceof Line) // lines.remove(m); else if (m instanceof DynamicPolygon) polygons.remove(m)...
84bd2b81-0428-4026-a91f-a6d4584b7094
8
public Color getSquareColor(SquareColor sColor) { if (sColor == null) { return new Color(20, 20, 20); } switch (sColor) { case CYAN: return new Color(76, 111, 124); case RED: return new Color(124, 82, 83); case BLUE:...
7cf33870-9071-4d65-81ee-0a35e9295652
3
@Override boolean transcriptChange() { //this should simply be a negative number representing the distance to the coding start if (utr5prime.intersects(seqChange)) { //distance to cds start //cdsStart>cdsEnd, so cdsStart is really cds start //this is the opposite...
f6c10974-2b56-4931-9444-4cc9557775cf
5
private static void insertNewItem(Statement stmt) { System.out.println("Are you sure? y/n"); String input = scan.nextLine(); if (input.equalsIgnoreCase("y")) { String[] newItemValues = new String[7]; int[] statsModified = new int[7];//Fix all of this later ...
08bb5c9d-6354-41d3-bca3-1fbbbfa115c6
4
public ArrayList<Task> getPlausableDependantTasks(Task task) { ArrayList<Task> tasksToReturn = new ArrayList<Task>(); ArrayList<Task> dependantNodes = task.getDependentNodes(); for (Task currentTask : tasks) { if (task.isSibling(currentTask)) { // task is subling ...
d9eef603-a5d8-4caa-95ae-660709d653e9
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof OFPortStatus)) { return false; } OFPortStatus other = (OFPortStatus) obj; ...
d009b138-4640-4dda-ac96-c219e3b13f97
5
private String infos(Signature signature) { double meanX = 0; double meanY = 0; double minX = Double.MAX_VALUE; double maxX = Double.MIN_VALUE; double minY = Double.MAX_VALUE; double maxY = Double.MIN_VALUE; for (Point point : signature.getPoints()) { meanX += point.getX(); meanY += point.getY(); ...
a89c5217-09a7-45a7-bd0f-6f17515a1790
6
private String getFile(String link) { String download = null; try { // Open a connection to the page URL url = new URL(link); URLConnection urlConn = url.openConnection(); InputStreamReader inStream = new InputStreamReader( urlConn.getInputStream()); BufferedReader buff = new BufferedReader(inSt...
9d64186e-2c0c-4cdc-8ce7-07c512227656
3
@Override public void mouseDragged(MouseEvent e) { idleTime = 0; mouseX = e.getX(); mouseY = e.getY(); if (e.isControlDown() && !isRightButton(e)) { setType(ClickType.CTRL_DRAG); } else { setType(isRightButton(e) ? ClickType.RIGHT_DRAG : ClickType.LEFT_DRAG); } updateMouse(); }
2c2af110-454c-465f-a960-c209561c5569
8
public static void main(String[] args) { final int port = 8003; //create the storage files if they do not exist File userstocks = new File("userstocks.txt"); if(!userstocks.exists()) { try { userstocks.createNewFile(); } catch (IOException e) { System.out.println("Could not create userstoc...
33bef294-1869-43d5-a243-12965eb1704e
0
@Override public void componentShown(ComponentEvent arg0) { // TODO Auto-generated method stub }
4346ff15-8ed4-4b2d-95e0-5fe171dd13b4
1
public String searchByPhone(final String phone) throws IOException { if (searchingFile(phone,"phone") == null) { return null; } return searchingFile(phone,"phone").name; }
eb69e535-ddbf-4d23-a0d6-b5e59c7db202
1
public static List<String> readSequence(String option, BufferedReader reader) throws IOException { List<String> list = new ArrayList<String>(); System.out.println(option); String line = reader.readLine(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.h...
f67dda7d-e8c3-45fc-9644-36dad372b8bf
9
public boolean eventGeneratable(String eventName) { if (m_listenee == null) { return false; } if (m_listenee instanceof EventConstraints) { if (eventName.equals("instance")) { if (!((EventConstraints)m_listenee). eventGeneratable("incrementalClassifier")) { return false; } } ...
8b99987e-2723-4a20-91ab-065632fd9366
1
public void endTagEOL(String name, boolean indent) { outdent(); if (indent) { writeIndentation(); } print("</"); //$NON-NLS-1$ print(name); finishTagEOL(); }
727d8cd0-113c-49bd-9aa0-262812a54c0c
2
private BSTNode<T> removeNode(BSTNode<T> tree) { if (tree.getLeft() == null) return tree.getRight(); if (tree.getRight() == null) return tree.getLeft(); T data; data = getPredecessor(tree.getLeft()); tree.setInfo(data); tree.setLeft(recRemove(data, tree.getLeft())); return tree; }
220f898e-04b2-4fba-a9ae-bd9406e5be84
9
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 fe...
cc9e0e4c-44b0-434f-a5a4-02f837b3c444
7
public int findPeakElement(int[] num) { if (num.length == 1) { return 0; } if (num.length == 2) { return num[0] < num[1] ? 1 : 0; } for (int i = 1; i < num.length - 1; i++) { if (num[i] > num[i-1] && num[i] > num[i+1]) { return ...
2493c4fc-251b-4e18-a861-b17100ca0fd2
3
public DHCPOption applyOption(DHCPPacket request) { if (request == null) { throw new NullPointerException("request is null"); } if (this.mirror) { DHCPOption res = request.getOption(this.getCode()); return (res != null ? res : this); // return res or this } else { return this; } }