method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d06fd09b-ae51-48fb-a781-2c77d6f16c31
2
public static Projectile getProjectile(ProjectileType type, int x, int y, double dir) { switch(type) { case BOMB: return new Bomb(x, y, dir); default: /** Falls thru **/ case BULLET: return new Bullet(x, ...
5effa4e1-f253-4027-bf75-7ea9850123f7
4
private void createCommands() { commandMap = new HashMap<>(); commandMap.put("StartGame", new Command() { @Override public void executeCommand() { optionDialog.reset(); runApplication(); } }); commandMap.put("PlayAgain"...
2d0d7ab2-340c-4cad-bbfc-07269501a7eb
2
public void setPWResetFont(String font) { if ((font == null) || font.equals("")) { this.pwResetFont = UIFontInits.PWRESET.getFont(); } else { this.pwResetFont = font; } somethingChanged(); }
3d08c7b4-b5a0-4fd6-aad4-48b519e7b848
2
public static int[] setToArray(final Set<Integer> set) { final int length = set.size(); final Iterator<Integer> it = set.iterator(); final int[] temp = new int[length]; int index = 0; while(it != null && it.hasNext()) { temp[index] = it.next(); index++; } return temp; }
29462dd6-354f-4180-acc5-7a60495b5773
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 { ...
3c6693d5-7220-4448-a428-5ce26fd48ba0
7
protected static void parseBridges(SiteConfig site_config, Node root) throws Exception { NodeList children=root.getChildNodes(); if(children == null || children.getLength() == 0) return; for(int i=0; i < children.getLength(); i++) { Node node=children.item(i); ...
5de5f123-2458-467a-b372-f2cd3c29f54b
1
private Card[] getCardsArray() { Card[] cards = new Card[VALUES.length]; for (int i=0; i < cards.length; i++) { cards[i] = new Card(VALUES[i], SUITS[i]); cards[i].setCardArea(X_VALUES[i], Y_VALUES[i], cardWidth, cardHeight); cards[i].setIsFaceUp(IS_FACE_UP[i]...
d83b7680-864b-4e06-8276-e63530c3e846
1
private void createDaoExceptions() { sb = new StringBuilder(); String filePath = "src/main/java/" + packageToPath() + "/util/DaoException.java"; File file = new File( filePath ); if ( !file.exists() ) { sb.append( "package " + table.getPackage() + ".util;\n" + "\n" ...
4925083d-25e8-49fb-b6d9-bc8dfe180584
4
public FunkyJar(final File file, boolean compress, final String version, final String author) throws IOException { super(new FileOutputStream(file)); this.compress = compress; if (compress) { this.setMethod(ZipOutputStream.DEFLATED); } else { this.setMethod(ZipOutputStream.STORED); } final Manif...
40e87826-ab2b-4178-ad47-397a0a1c8db0
8
@SuppressWarnings("deprecation") @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { //HyperPVP.checkWorlds(event.getPlayer()); try { if (!HyperPVP.getStorage().entryExists("SELECT * FROM users WHERE username = '" + event.getPlayer().getName() + "'")) { Bukkit.broadcastMessage(ChatColor.AQU...
19b0dea2-d432-4531-8042-50cba3db0e40
4
void setVolumePercent(float percent){ if (percent < 0.0 || percent > 1.0) throw new IllegalArgumentException(percent+" is not a valid percent-value"); if (volume_control == null){ System.err.println("Volume-Control for sounds is not supported"); return; } ...
a9f95059-f33c-4b73-b7de-3dd264f89f78
1
public Object pop() throws Exception { if (size == 0) throw new Exception(); return elements[--size]; //memory leak. /** * fix: * Object result = elements[--size]; * elements[size] = null; * return result; */ }
0ff7afb3-2047-4f72-a318-c18524f11386
6
public static String escape(String string) { char c; String s = string.trim(); int length = s.length(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c ...
49510fd2-272f-4ed8-be41-1d12e342d988
8
private String accessString() { String s = ""; if ((accessFlags & 0x0001) > 0) s += "public "; if ((accessFlags & 0x0002) > 0) s += "private "; if ((accessFlags & 0x0004) > 0) s += "protected "; if ((accessFlags & 0x0008) > 0) s += "static "; if ((accessFlags & 0x0010) > 0) s += "fin...
9e2e0e40-7d26-422e-9685-f70b04cbaf24
0
public int getExpectedStringLength() { return expectedStringLength; }
b6fa6e88-97c9-4d4a-b109-fbd4f50324b5
6
public void loukkaaVastustajaa(Rotu loukattavaRotu, Hahmo loukkaavaHahmo, Hahmo loukattavaHahmo) { if (loukattavaRotu.getRodunNimi() == loukattavaHahmo.getHahmonRodunNimi()) { if (noppa.heitaNoppaa(4)) { System.out.println(loukattavaHahmo.getHahmonNimi() + " hyökkää raivoissaan, m...
dff8d596-1e68-4c20-b015-b5eedfab94c0
2
private CrewRecord readCrewRecord(InputStream in) throws IOException { int score = readInt(in); String name = readString(in); String race = readString(in); int unknownFlag = readInt(in); // Unknown always 1 or 0. Died? if( unknownFlag != 1 && unknownFlag != 0 ) throw new RuntimeException(); return ...
a90525e5-73c6-40fc-9566-95b3a237f94f
9
public boolean isMatch(String s, String p) { boolean[] F = new boolean[p.length() + 1]; F[0] = true; for (int j = 1; j <= p.length(); j++) { F[j] = F[j - 1] && p.charAt(j - 1) == '*'; } boolean last = false; for (int i = 1; i <= s.length(); i++) { boolean[] tmp = new boolean[p.length() + 1]; for (i...
063aad2e-f42f-45b2-80c7-e33e637b910b
5
public static int paintSyntaxLine(Segment line, Token tokens, SyntaxStyle[] styles, TabExpander expander, Graphics gfx, int x, int y) { Font defaultFont = gfx.getFont(); Color defaultColor = gfx.getColor(); int offset = 0; for(;;) { byte id = tokens.id; if(id == Token.END) break; int lengt...
d812dc15-fa33-455a-88f9-72cb5172dc07
1
@Override public void mouseDragged( MouseEvent e ) { for( MouseMotionListener listener : listeners( MouseMotionListener.class )){ listener.mouseDragged( e ); } }
a3dda5b8-ea42-4729-9ae4-b82b00f56d71
2
public int haeTilaustenLukumaara() throws DAOPoikkeus { Connection yhteys = avaaYhteys(); int lukumaara = 0; String sql = "SELECT COUNT(tilausID) AS lkm FROM Tilaus"; try { Statement lause = yhteys.createStatement(); ResultSet tulokset = lause.executeQuery(sql); while(tulokset.next()) { ...
41a1cc47-c2fa-4a2f-987e-5862fed795f5
3
public static String ParseMessage(Player p, String s) { PermissionManager manager = null; String messageFormat = "<%prefix%player%suffix> %message"; if(Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")) manager = PermissionsEx.getPermissionManager(); if(Bukkit.ge...
255a4d83-2742-4cfa-b2a8-6958de832911
6
@Override public boolean takeDamage(int amount, Living from) { if (from != null && !from.living()) { return false; } boolean b = super.takeDamage(amount, from); if (from != null) { if (amount > 0) { addStatus("The", from.name(), dhit[new Random...
c24a2418-1d15-45fe-a4ac-aef54924953e
1
@Override public double earnings() { if (hours < 40) { return hours * wage; } else { return 40 * wage + (hours - 40) * wage * 1.5; } }
6b42aadd-1e3e-4f67-819e-4fa8550b0834
5
@Override public void run() { while (true) { synchronized (timers) { for (Timer timer : timers) { if ((timer.isWorking()) && (timer.update())) { timer.stop(); } } } try { ...
f01cd67f-e3e1-42ae-a72d-94e2200824c8
2
public boolean hasWon() { for (List<Card> pile : topRow) { if (pile.size() != 13) { return false; } } return true; }
45d17559-f899-4fa9-b9a0-62b0564c5a52
3
private AndroidDevice findDevice(String serialNumber) { AndroidDevice device = null; Iterator<AndroidDevice> androidDevicesIterator = ServerConnectionManager .getInstance().getDevices().iterator(); while ((device == null) && androidDevicesIterator.hasNext()) { AndroidDevice next = androidDevicesIterator.ne...
216e7386-c789-4e55-8252-74676ad06e41
9
protected boolean isDiggableRoom(final Room R) { if(R==null) return false; if(((R.domainType()&Room.INDOORS)>0) &&(R.domainType()!=Room.DOMAIN_INDOORS_CAVE) &&((R.getAtmosphere()&RawMaterial.MATERIAL_ROCK)==0)) return false; if((R.domainType()==Room.DOMAIN_OUTDOORS_CITY) ||(R.domainType()==Room.DO...
7512a8c1-a75d-4002-9fd1-dbe3347b3a05
7
public static void handleExamine(final Player player, InputStream stream) { if (!player.hasStarted() || !player.clientHasLoadedMapRegion() || player.isDead()) return; @SuppressWarnings("unused") boolean junk = stream.readUnsignedByte128() == 1; int x = stream.readUnsignedShort128(); final int id = stre...
2dec79af-30ce-49bb-aad4-751dca45c596
8
public void update(Map userCredentials) throws AuthenticationException { if (passwordFile == null) { throw new AuthenticationException("update()", new IllegalStateException()); } try { String userName = (String) userCredentials.get(Registry.SASL_USERNAME); String password = ...
ec4d34a3-6d59-4145-bf0f-db2bc9112159
7
private int quicksortStep(int lo, int hi) { int pivot = a[lo]; // Get the pivot value. // The numbers hi and lo mark the endpoints of a range // of numbers that have not yet been tested. Decrease hi // and increase lo until they become equal, moving numbers // bigger than pivot so that they lie above hi and m...
fbe6ce9b-bd9b-4b15-bb77-9203774f5592
7
public final boolean equals(Object par1Obj) { if (!(par1Obj instanceof LongHashMapEntry)) { return false; } LongHashMapEntry longhashmapentry = (LongHashMapEntry)par1Obj; Long long1 = Long.valueOf(getKey()); Long long2 = Long.valueOf(longhashmapentry.getK...
e949d581-17ca-4dea-bff6-4d10e86a3840
3
public void mouseWheelMoved(MouseWheelEvent e) { float factor = 1; if (e.getWheelRotation() > 0) { factor = 1 / 1.15f; } if (e.getWheelRotation() < 0) { factor = 1.15f; } Point2D.Float pf = coordToDocument(new Point2D.Float(mouseX, mouseY)); if (artwork.isPointWithin(pf.x, pf.y)) { zoomOnPoint(g...
21b909d1-bc74-4d22-b247-640296528a93
1
private void printRoute(){ for(int i = 0;i<route.length;i++){ System.out.print(route[i]+" "); } }
3e4cb621-b586-4b69-81c0-8dc419e379da
1
private Document getDocument() { try { DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); f.setValidating(false); DocumentBuilder builder = f.newDocumentBuilder(); return builder.parse(new File(fileName)); } catch (Exception exception) { ...
03430329-fdcd-498d-8a7e-9e0711ee1c6b
0
public static List<Praticien> selectAll(EntityManager em) throws PersistenceException { List<Praticien> lesPraticiens = null; Query query= em.createQuery("select pra from Praticien pra"); lesPraticiens = query.getResultList(); return lesPraticiens; }
7beaf74a-aa26-4b37-b1fa-62416248059e
1
public void addVerticalRoad(VehicleAcceptor l, int i, int j, boolean southToNorth) { double x = skipInit + skipRoad + j*skipRoadCar; double y = skipInit + i*skipRoadCar; Translator t = southToNorth ? new TranslatorSN(x, y, MP.baseRoadLength, VP.elementWidth, VP.scaleFactor) :...
78d0f921-bc7c-4230-abd1-f3d118477d05
0
protected void onServerResponse(int code, String response) {}
4d162f4e-3531-46d1-bd96-49f41f323063
1
@Test public void derivative_test() { try{ double a=5.0; GaussCFunction gc= new GaussCFunction(a); double result= gc.derivative(a); double exp =-8.91284935643E-26; Assert.assertEquals(exp,result,0.00000001); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented...
0fce83e4-0479-4ea4-a05d-94092f02a4ca
9
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
2b827cf9-3603-4ea2-83f3-391e37f64318
5
@Override public void actionPerformed(ActionEvent e) { if (BmTestManager.getInstance().getTestInfo().getId().isEmpty()) { JMeterUtils.reportErrorToUser("JMX can not be downloaded: test id is empty", "Empty test id"); return; } GuiPackage guiPackage = GuiPackage.getIns...
0d1443c2-07b9-4efe-b66f-687580a1460c
2
public ListNode insertionSortList(ListNode head) { if ( head == null ) { return null; } else if ( head.next == null ) { return head; } else { return insertHelper(head); } }
950615bb-c35c-40f0-99bc-c3b9ec56eb30
6
public static SvgImageGroup parseGroup(String graphicsXML) { int start, end; String gContent, token, transform; StringTokenizer st; SvgImageGroup group; group = new SvgImageGroup(); if (graphicsXML.startsWith("<g") && graphicsXML.e...
a1ade7c8-bec4-4fb7-8f35-76b6b7ecd59e
4
static Regle generateRandomRule() { Direction direction = Direction.values()[generateur.nextInt(4)]; StringBuffer obs = new StringBuffer(); for (int i = 0; i < 8; i++) { double rand = Generateur.getInstance().nextDouble()%1; if (rand > 0.20) // 80% joker obs.append('?'); // ContenuCase.ANY els...
28846bdf-26a2-484c-9e3c-b712877edb66
3
@Override public boolean inputEvent(final NiftyInputEvent inputEvent) { if (inputEvent == NiftyInputEvent.NextInputElement) { focusHandler.getNext(element).setFocus(); return true; } else if (inputEvent == NiftyInputEvent.PrevInputElement) { focusHandler.getPrev(element).setFocus(); re...
bb938015-52b5-40d4-84f7-69b3249a5ae5
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...
a1c1968f-e44b-45a4-9446-0bc8c84b8aa3
7
public void sortBy(String key) { switch (key) { case "Name" : sortByName(); fireContentsChanged(this, 0, images.size()-1); break; case "Number" : sortByNumber(); fireContentsChanged(this, 0, images.size()-1); break; case "Color" : sortByColor(); fireContentsChanged(this, 0, images.size()-1); break; ...
f23ccb59-5e24-42ab-a566-da5f283f106e
1
public Drop generateDrop() { Drop drop = null; int randomNumber = Rand.getRange(1, 10000); if (randomNumber <= (percentageChance * 100f)) { drop = new Drop(itemName, Rand.getRange(minQty, maxQty)); } return drop; }
5c92161b-0b3d-47db-bb0c-9fe99de54387
0
public IdDto() throws UnknownHostException{ this.id = InetAddress.getLocalHost().getHostName() + ":" + System.getProperty("user.name"); }
62b8e919-651a-4b5a-b401-3cc3fa2af3d7
9
public void actionPerformed(ActionEvent e) { if (e.getSource() == update) { Graph g = graphPanel.getGraph(); g.plotSettings.setMinX(Double.parseDouble(minX.getText())); g.plotSettings.setMaxX(Double.parseDouble(maxX.getText())); g.plotSettings.setMinY(Double.pars...
991ecf47-9644-4ace-87dd-29b6e9cadbd6
2
public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException { super.update(gc, game, delta); player.update(gc, game, delta); map.update(gc, game, delta); if(gc.getInput().isKeyPressed(Input.KEY_D)) { if(((Game) game).isDebug()) ((Game) game).setDeb...
bba667a8-35c9-4442-bf93-b802925db07c
5
private void notifyPlayerOfTransactions(String playerName) { // get the player Player player = Bukkit.getPlayer(playerName); // Check to see if there a merchant file for the player System.out.println("You are: " + playerName + " Merchants: " + swDataClass.getMerchants().keySet().toString()); if (swDataClass.g...
fb39bffe-8362-4d95-afc1-755f232c2f2b
4
public void unbind() { if(shaderProgram != 0 && isBound) { ARBShaderObjects.glUseProgramObjectARB(0); isBound = false; } else if(shaderProgram != 0 && !isBound) { System.err.print("RoyalFlush: Shader.unbind - Shader program " + shaderProgram + " is NOT bound.\n"); } else { System.err.print("RoyalF...
4fde1ca3-3449-46db-8e36-8b045b24a9bf
6
@Override public void read(Object destination, int type, Stream s) { int count = s.getUByte(); StringBuilder output = new StringBuilder(); for (int attr = 0; attr < count; ++attr) { boolean flag = s.getUByte() == 1; int index = s.getUInt24(); Object gotten = flag ? s.getString() : s.getInt(); if (Deb...
7b24f8cd-2082-4c67-8bc5-c37c7fe290b1
6
public static int translate(String name){ switch(name){ case "STR": return 0; case "DEX": return 1; case "CON": return 2; case "INT": return 3; case "WIS": return 4; ...
3f0cc9ea-faac-4e38-a9d3-dba49da01533
4
public static String writeList(final Iterable<? extends Object> iterable) { StringBuilder sb = new StringBuilder(); sb.append(BConst.LIST_START); if (iterable != null) { Iterator<? extends Object> iterator = iterable.iterator(); while (iterator.hasNext()) { ...
7e0fcca1-cc4a-4e72-8687-ab13ef4f10e7
2
public void execute() { CarWashState s = ((CarWashState) state); double timeBefore = s.getLatestUpdateTime(); int slowWashes = s.getAvailableSlowWashes(); int fastWashes = s.getAvailableFastWashes(); //There might be cars in line, update the queue time. s.setQueueTime(s.getQueueTime() + (priority - ti...
d1225df6-a788-4e38-ae96-83ab67127709
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
c502553c-7aff-4329-a483-ca88dcc7aef2
0
@Override public String toString() { String a = String.format("%+f", this.a); String b = String.format("%+f", this.b); return "[(x" + a + ")^2" + "(y" + b + ")^2=" + r * r + "]"; }
6ce1fd63-bfce-4520-8e70-2fee21005948
8
@Override public void actionPerformed(ActionEvent e) { // FIXME - assume, for the mean time, that all action events are going to be JButtons. JButton buttonEvent = (JButton) e.getSource(); // Check which action event was triggered.` if (buttonEvent == powerDemandButton) { String value = demandChange.g...
c583f52c-6296-4197-978f-3dba5c5e252a
4
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getChromosomeName()); sb.append("\t"); sb.append(start); sb.append("-"); sb.append(end); sb.append(" "); sb.append(type); sb.append(((id != null) && (id.length() > 0) ? " '" + id + "'" : "")); if (hasAnnotations...
cff965bf-22db-42dd-a773-3e867fa59f6d
8
private void parseCommand(String command, String action) { // System.out.println("command:" + command + ", action:" + action); if (command.equals("addplayer")) { addPlayer(action); } else if (command.equals("removeplayer")) { removePlayer(action); } else if (command.equals("editplayer")) { editPlayer(a...
b52d5c91-354c-483d-bd10-0e3ad74b1afb
2
public static List<MyFile> getFolderContent(File file) { List<MyFile> filesList = new ArrayList<>(); try (DirectoryStream<Path> listPathFiles = Files.newDirectoryStream(Paths.get(StringUtils.trimToEmpty(file.getPath())))) { for (Path currentPath : listPathFiles) { FileTime lastModifiedDate = Fi...
c928fe09-b117-4dab-a32d-378eb8c934d9
1
public static void pauseGame() { if (game != null) { game.pause(); } }
59b8b007-cd82-4f1e-a2fc-86da04f2ebfb
0
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("SolidObject"); sb.append("{destroyed=").append(destroyed); sb.append(", floorDistance=").append(floorDistance); sb.append('}'); return sb.toString(); }
fd42feaf-7f1a-4c77-888b-610365d1c0e1
8
void readData() { List<Short> files = passwdManager.getFileList(); InputStream in = null; Short fid = BasicService.EF_COM; files.remove(fid); try { fid = BasicService.EF_DG1; if (files.contains(fid)) { in = passwdManager.getInputStream(fid); dg1file = new DG_1_FILE(in); BasicInfo bi = dg1fil...
c7a29b08-96ff-4be2-8dcc-af03bafe7310
0
public boolean isDestroyed() { return destroyed; }
9061e643-d00a-4d7e-89cc-ab1cc09d6b2f
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if(target==null) return false; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell...
1d86e7f0-f768-4e29-8e25-b0ba15ca4d66
9
public boolean inArc(int x, int y) { Point test = new Point(x, y); for (int i = 0; i < getNumPoints() - 1; i++) { Point start = getPoint(i); Point end = getPoint(i + 1); if (inRect(start, end, test)) { if ((i == 0) && (getNumPoints() > 2)) { selectedPoint = end; } else if ((i + 1 == get...
cab4291d-4019-4af9-8dfe-491da60de998
2
public void superFire(){ Direction[] dirs = dirs = Direction.values(); for(int i = 0 ; i < dirs.length; i++){ if(dirs[i] != Direction.STOP) fire(dirs[i]); } }
af7c969d-f739-47db-a677-1fb435ff3356
9
public static void openURL(String url) { try { //attempt to use Desktop library from JDK 1.6+ Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod( "browse", new Class[] { java.net.URI.class } ) .invoke( d.getDeclaredMethod("getDesktop").invoke(null), new Object[] { java.net.URI.c...
d4050c29-4af2-4973-98f4-aa8ac01448f3
9
@SuppressWarnings("unused") private Control closeToEdge(){ double[] pose = this.plane.getPosition(); double x = pose[0]; double y = pose[1]; double theta = pose[2]; double desiredTheta = 0; //overwritten? boolean closeToEdge = false; if (x< 10){ if (y < 10){ desiredTheta = Math.PI/4; } else...
dcc92262-67fb-4aa0-8e26-e2a23452ea5f
7
public Pacer(TileMap tm, int startingAction, String s, double walkLength){ super(tm); this.tm = tm; this.walkLength = walkLength; moveSpeed = .1; maxSpeed = .6; fallSpeed = 0; maxFallSpeed = 0; width = 30; height = 34; cwidth = 30; cheight = 34; health = maxHealth = 1; damage = 1; i...
8ee7700f-2729-45e1-90ed-99e5c3b9fbcd
0
public static boolean isApplicable(Object object) { return true; }
a113a1c9-811e-4d20-bd2f-1e3cf7bf5941
4
public boolean isGround() { switch (this) { case FLOOR: return true; case DOOROPEN: return true; case STAIRSUP: return true; case STAIRSDOWN: return true; default: return false; } }
d57a21a7-f16e-4831-9b47-df2e4ae15e79
6
public TreeNode<Integer> findFirstCommonAncestor(TreeNode<Integer> root, TreeNode<Integer> n1, TreeNode<Integer> n2) { if (root == null || n1 == null || n2 == null) return null; boolean n1InLeft = canReach(root.left, n1); boolean n2InLeft = canReach(root.left, n2); boolean leftCover = n1InLeft && n2InLeft...
42129446-9199-4ccd-8a4a-f70c48ebd233
6
static final boolean method2503(int i, int i_21_, int i_22_, byte[] is, int i_23_, int i_24_, int i_25_) { anInt6408++; int i_26_ = i_23_ % i_22_; int i_27_; if (i_26_ != 0) i_27_ = i_22_ - i_26_; else i_27_ = 0; int i_28_ = -((-1 + (i_22_ + i_25_)) / i_22_); if (i_24_ != -16259) method250...
bb4843ae-1c48-4906-8a3c-3247eb279d03
5
public CheckResultMessage check31(int day) { int r1 = get(39, 5); int c1 = get(40, 5); int r2 = get(43, 5); int c2 = get(44, 5); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r2 +...
4401c234-121c-42ea-95c0-c325e5a0ba83
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((crc32 == null) ? 0 : crc32.hashCode()); result = prime * result + (int) (fileSize ^ (fileSize >>> 32)); result = prime * result + ((imageAttributes == null) ? 0 : imageAttributes.hashCode()); return resu...
0b5892c6-a2b0-421f-a434-fcb98aba2e7b
7
private Node getNextNode() { Node[] possibleNode = getPossibleNode(); Node bestNode = new Node(9999, 9999); for (int i = 0; i < possibleNode.length; i++) { if (possibleNode[i].getStatus() == 5) { if(bestNode.getStatus()==0){ bestNode = possibleNode[i]; } else if (distance(bestNode, current) > ...
51995e8b-4365-49c1-aff0-7e7a17df79f9
1
protected final void addEnd(final String name) { try { h.endElement("", name, name); } catch (SAXException ex) { throw new RuntimeException(ex.toString()); } }
40c7c8d6-b8d0-4410-8832-0f373dcdebf8
2
public boolean hasNonNullProperty() { for(int x = 0;x<values.size();x++) { if(values.get(x)!=null) { return true; } } return false; }
62f5db3b-3f1d-4470-b80b-310888a3e106
1
public void testConstructor_RP_RP8() throws Throwable { Partial dt1 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.hourOfDay(), 12); Partial dt2 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.hourOfDay(), 14); try { new Period...
e083553c-e8a4-4ae0-8447-cf21a1939040
9
@Override public void cancelProductSubstractionFromStock(Order order, Product product) { ProductRawMaterialProportional cancellationPRMP = null; for (ProductRawMaterialProportional prmp : product.getProductRawMaterialProportional()) { boolean found = false; for (StockQuantity sq : stock.get(prmp.getRawMat...
bd46d009-15b4-48ca-b642-1aa2d8e8a28f
1
public void test_DateTime_setHourBack_NewYork_Spring() { DateTime dt = new DateTime(2007, 3, 11, 8, 0, 0, 0, ZONE_NEW_YORK); assertEquals("2007-03-11T08:00:00.000-04:00", dt.toString()); try { dt.hourOfDay().setCopy(2); fail(); } catch (IllegalFieldValueE...
47227135-6aeb-4a72-af0f-b277ca8b8de4
1
public JGCButton(String text){ super(text); if(allObjects == null){ allObjects = new ArrayList<>(); } allObjects.add(this); }
0b4e9683-b222-4b6a-8097-43966eb199cd
1
public static void info(String string){ if(developerMode){ System.out.println("INFO: " + getClassName() + ":" + getMethodName() + "():" + getLineNumber() + ": " + string); } else { System.out.println("INFO: " + string); } }
a6dfe87c-d624-4278-9bb9-3293696023d9
7
public Object readConst(final int item, final char[] buf) { int index = items[item]; switch (b[index - 1]) { case ClassWriter.INT: return new Integer(readInt(index)); case ClassWriter.FLOAT: return new Float(Float.intBitsToFloat(readInt(index))); case Clas...
830eaa4a-4281-41ea-94cd-abb0bf946b72
7
public void handleEndTag(Tag t, int pos) { int ptr; TreeNode[] branches; int length = stack.size(); for(ptr = length - 1; ptr >= 0 && ! ((String)((TreeNode)(stack.elementAt(ptr))).data).equals(t.toString()); ptr--) { // do nothing } // end of f...
e714710c-b818-4f47-bf8d-d2b590933a72
5
@SuppressWarnings("unchecked") @Override protected boolean canRun(ClassNode node) { int ownType = 0, longType = 0; ListIterator<FieldNode> fnIt = node.fields.listIterator(); while (fnIt.hasNext()) { FieldNode fn = fnIt.next(); if ((fn.access & Opcodes.ACC_STATIC) == 0) { if (fn.desc.equals(String.form...
f94a5654-9570-45c1-bfc0-3892f2705837
0
public void setSize(int size) { this.size = size; }
2fbee8a4-291d-4f90-befb-b264d075b25c
6
public static boolean transTree(TreeNode parent,TreeNode children){ if(parent == null && children == null){ return true; } else if(parent == null){ return false; } else if(children == null){ return false; } else{ if(parent.data == children.data){ return isChildrenTree(parent,children); ...
508570a7-8f21-4e1f-a6f2-63c47b476867
3
public boolean isEqual(CPColor color) { return rgb == color.rgb && hue == color.hue && saturation == color.saturation && value == color.value; }
14d1ccde-19b2-4199-97e7-968b848f2a25
1
@Override public Position<T> parent(Position<T> p) throws BoundaryViolationException, InvalidPositionException { BTPosition<T> rp = checkPosition(p); // node get its parent Position<T> parentP = rp.getParent(); if (parentP == null) throw new BoundaryViolationException("No parent"); return parentP; }
e42fc7a2-adee-41f6-93f9-640517248b38
4
static double GetMaxFrontEndCompletionTime() { double ret = systemClock.getCurrent(); if (sessionList.size() > 0) { for (int i = 0; i < sessionList.size(); i++) { if (sessionList.get(i).getFrontEndCompletionTime() != Double.MAX_VALUE) { if (sessionList.get(i).getFrontEndCompletionTime() >= ret) { ...
d6eb5585-b4cd-4260-983e-9db9df97f7a2
8
public boolean moveLeft() { // Block invalid moves if (!canMoveLeft) return false; boolean result = false; for (int i = 0; i < dim; i++) { for (int j = 1; j < dim; j++) { // We can skip the left most column // Skip empty tiles if (isTileEmpty(i, j)) continue; // Stepping ...
55a7edd6-eb00-4378-a010-fcad96bf01de
8
@Override public List<Gruppi> getGruppiByServizi(Servizi servizi) { List<Gruppi> result = new ArrayList(); ResultSet rs = null; ResultSet rs1 = null; try { gIdGruppi_Servizi.setInt(1, servizi.getKey()); rs = gIdGruppi_Servizi.executeQuery(); wh...
d5ca1fa8-22cc-456e-9dba-55e95658e801
5
public final CecilParser.value_return value() throws RecognitionException { CecilParser.value_return retval = new CecilParser.value_return(); retval.start = input.LT(1); try { // C:\\Users\\Shreeprabha\\Documents\\GitHub\\CecilRPi\\src\\org\\raspberrypi\\cecil\\model\\grammar\\Cecil.g:232:3: ( ( DIGIT )+ ) ...
71dd99ab-7c50-44b5-980d-6aadba7f32f3
5
@Override public boolean execute(CommandSender sender, String[] args) { if(!(sender instanceof Player)) { return true; } String username = sender.getName(); String name = args[0]; Group group = groupManager.getGroupByName(name); if(group == null) { sender.sendMessage("Group doesn't exist"); ...
90aa84ca-6dc6-4ea8-a0d6-a6fa991efa7d
1
private void toLower(String array[]){ for (int i = 0, n = array.length; i < n; i++){ array[i] = array[i].toLowerCase(); } }