method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
17f11d10-6b14-4213-a338-ccbca75815fc
1
@Test public void WhenComparingKeys_ExpectResults() { Key key1 = new PGridKey(""); Key key2 = new PGridKey(""); Assert.assertTrue(key1.compareTo(key2) == 0); key1 = new PGridKey(""); key2 = new PGridKey("00"); Assert.assertTrue(key1.compareTo(key2) == 1); ke...
c71fdbb5-66e4-4bd1-ad88-3923af2bba49
9
public String nextToken() throws JSONException { char c; char q; StringBuilder sb = new StringBuilder(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
efc91b55-bf3b-47b9-84fc-ee62bb9f9e9a
8
public static void palette_change_color_16_static(int color, int red, int green, int blue) { if (color == palette_transparent_color) { int i; palette_transparent_pen = shrinked_pens[rgbpenindex(red, green, blue)]; if (color == -1) { return; /* by default, pa...
8f538f5f-b373-4c17-9d20-355163106db1
0
public IrcCommandSender(AprilonIrc plugin, IrcClient client, IrcMessage message) { this.Plugin = plugin; this.Client = client; this.Message = message; this.User = message.getUser(); }
4b7e772d-d03e-4d78-86f7-4c627bffaad9
3
public static void removeConnectedClient(String btN) { for(int i = 0;i<=5;i++) { if(clientsTable.getModel().getValueAt(i, 0) != null) { if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN)) { //Clear Device clientsTable.getModel().setValueAt(null, i, 0); clientsTable.getM...
48c55063-2477-41f8-b6f7-504298dcda4b
0
public int getBumoncode() { return this.bumoncode; }
f0ad5e3d-f5c3-4212-a5a6-f792a52c541e
6
public void download( String source, String target ) { try { String remote = convertPath( source ); String local = convertPath( target ); if ( isDirectory( local ) && !isDirectory( remote ) ) { throw new IllegalStateException( "Can not send a directory to a file!" ); } File f = new Fil...
87438601-c2b6-4321-9b77-0034cfe11b96
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...
7c2b289e-76b0-4a60-9e1f-bb221733d8ad
7
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
1df3b665-a23a-4e6a-b673-9ae3bd9baf08
0
public void setId(Integer id) { this.id = id; }
6216c404-7826-4bba-8d29-00a6b38ab41c
8
private void getWavData() { // Get the sample from the input thread try { // Add the data from the thread pipe to the circular buffer circBuffer.addToCircBuffer(inPipeData.readInt()); // Process this data processData(); // Update the progress bar updateProgressBar(); // Check if the file ...
2942c62f-b2da-4380-9840-d01872617c5f
1
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { newPersonDialog = new javax.swing.JDialog(); newNameField = new javax.swing.JTextField(); newAddressField = new javax.swing.JTextField...
6dda1608-a855-473c-8f5b-59feeeacece0
7
protected Target nextMoveTarget(Target dummy, Actor actor) { float offs[] = null ; switch (drill) { case (DRILL_MELEE ) : offs = MELEE_OFFS ; break ; case (DRILL_RANGED ) : offs = RANGED_OFFS ; break ; case (DRILL_ENDURANCE) : offs = ENDURE_OFFS ; break ; case (DRILL_AID ) : offs ...
8f7a9ddb-cb7b-40d3-ad22-8c60e39d014b
2
private int partition(int[] array, int p, int r) { int i = p; int key = array[p]; for (int j = p + 1; j < r + 1; j++) { if (array[j] < key) { i++; swap(array, i, j); } } swap(array, p, i); return i; }
9b1559f3-f555-4413-9f97-faea8ba677a9
3
public void Render(GameContainer gc, Graphics g) { g.setColor(INVENTORY_BACKGROUND_COLOR); g.fillRect(600, 100, 180, 400); g.setLineWidth(5f); g.setColor(INVENTORY_OUTLINE_COLOR); g.drawRect(600, 100, 180, 400); g.resetLineWidth(); Vector2 currentlyDrawing = new Vector2(603, 112); Inventory inv = player...
020d632e-acf4-4801-a795-3d2b4ed00559
9
public static void wordFrequencyCount(String s) { int count = StringDemo.wordCount(s); String ar[] = new String[count]; int ocr = 0; for (int i = 0; i < count; i++) { if (i == (count - 1)) { ar[i] = s.substring(0); } else { ar[i] = s.substring(0, s.indexOf(' ')); s = s.substring(s.indexOf(' ')...
ba1ad7a0-1b87-4992-9b16-44542673b405
5
*/ protected Rectangle repaintSelectionInternal() { Rectangle area = new Rectangle(); Insets insets = getInsets(); Rectangle bounds = new Rectangle(insets.left, insets.top, getWidth() - (insets.left + insets.right), getHeight() - (insets.top + insets.bottom)); int last = getLastRowToDisplay(); List<Column> c...
c467f3eb-d544-46fb-8881-975e97ecf135
2
@Override public boolean activate() { if(Tabs.getCurrent() != Tabs.INVENTORY && hasSpinTicket()) { return false; } return hasSpinTicket(); }
846a2c3f-164f-49c6-b8ba-13728bc52099
3
public List<Double> multiply(Business bus, double[] maxPerFeature){ double scoregiven = 0; List<Double> sample = new ArrayList<Double>(); for(Review r:reviews){ if(r.b_id.equals(bus.id)){ scoregiven = r.stars; break; } } for(int i=0; i<features.size();i++){ sampl...
08500631-14ae-4a7a-9031-702796f8229b
3
public int loadALData() { AL10.alGenBuffers(buffer); if(AL10.alGetError() != AL10.AL_NO_ERROR) { return AL10.AL_FALSE; } /* WaveData waveFile = WaveData.create("testi.wav"); AL10.alBufferData(buffer.get(0), waveFile.format, waveFile.data, waveFile.samplerate);...
e97feaa0-df02-4bf3-b551-d14e0c870ffe
8
@Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ try{ OAuth2Message requestMessage = OAuth2Servlet.getMessage(request, null); OAuth2Client client = SampleOAuth2Provider.get...
56a12149-fe3f-48a0-a47b-67f68922868d
7
public void setSelected(boolean isSelected) { if(this.isSelected && isSelected ) { if ( isXSelected) { isXSelected = false; isYSelected = true; } else if (isYSelected) { isYSelected = false; isXSelected = false; } } else if (!this.isSelected && isSelected) { this.isSelected = true;...
d4c0339f-9d63-413a-9d4d-1e7d765beabe
0
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed //set a Princess Peach Theme! world.setThemes("Peach"); this.repaint(); }//GEN-LAST:event_jMenuItem7ActionPerformed
a7446937-8b65-438f-b6e5-2c485040976e
4
public STTPoint getNextPoint() { long timeSinceLastPull = System.currentTimeMillis() - this.lastDataPullTime.getTime(); if (timeSinceLastPull > this.pointPollingTimeMS) { ArrayList<STTPoint> newData = this.wrapperReference.getWrappedData(); this.mostRecentPoints = newData; this.lastDataPullTime = new Ti...
0c10b3ad-b46a-4824-a5bd-a54ca8d91488
9
public int getBlockTextureFromSideAndMetadata(int par1, int par2) { int var3 = par2 & 7; return var3 == 0 ? (par1 <= 1 ? 6 : 5) : (var3 == 1 ? (par1 == 0 ? 208 : (par1 == 1 ? 176 : 192)) : (var3 == 2 ? 4 : (var3 == 3 ? 16 : (var3 == 4 ? Block.brick.blockIndexInTexture : (var3 == 5 ? Block.stoneBrick...
aee26fe7-434d-4f64-9742-780a38a07bc8
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
febe30ec-bd4b-414c-87ba-0af895361517
5
public int minDistance(String word1, String word2) { int m = word1.length(); int n = word2.length(); int array[][]= new int[n+1][m+1]; //init for(int i =0 ; i < n+1;i++) array[i][0] = i; for(int i = 0 ; i < m +1; i++) array[0][i] = i; for(...
e7af966c-a1e7-4992-a713-c33c4302bb89
2
public Upgrade getUpgradeByName(String name){ for(Upgrade u : allUpgrades){ if(u.getName() == name){ return u; } } return null; }
46442914-54cd-45df-81e6-b700686125a7
2
public PollItem getItem (int index) { if (index < 0 || index >= this.next) return null; return this.items[index]; }
2ae2b70c-b46a-448b-8920-08cc18f61271
0
@Override public boolean supportsAttributes() {return true;}
520dd361-5602-45a1-bac8-11d02a2995d5
7
public static void setMarketComparisonStatistics(StatInfo setTo, int iD, float emin, float emax) { ArrayList<Float> over = new ArrayList<Float>(); ArrayList<Float> under = new ArrayList<Float>(); for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) { // change in market forward 1wk if (!Dat...
28e5700e-239b-4196-b714-07bd44eceef9
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Location other = (Location) obj; if (!Objects.equals(this.name, other.name)) { return false; ...
567712dc-4b66-41b2-86ff-bd65cd10ad8e
5
public void run() { Plugin larvikGaming = Bukkit.getServer().getPluginManager().getPlugin("LarvikGaming"); int delay = larvikGaming.getConfig().getInt("RefreshGroupInMin", 10) * 60000; long runTime = 0; if (delay < 1) { return; } try { Thread.sleep(100); } catch (InterruptedExceptio...
f26aec51-eeec-4230-ba40-fa98146ef0fa
3
@Override public boolean verifier() throws Exception { super.verifier(); if(!expression.verifier()) GestionnaireSemantique.getInstance().add(new SemantiqueException("La declaration de la variable "+((Identificateur) expression).getNom()+" a la ligne "+/*line+*/" est manquante")); ...
af81dfd0-d9d1-47ce-97cd-629e5811358a
1
@Override protected ModelAndView onSubmit(Object command, BindException errors) throws Exception { ModelAndView modelAndView = null; NewUserForm newUserForm = (NewUserForm)command; if (usersManager.existingUserName(newUserForm.getUserName())){ modelAndView = new ModelAndView(getFormView(), "startUserSession",...
dcf030de-0a6d-46ef-9f6f-48485fc3c024
3
void close() { try { Thread.sleep(100000); } catch (InterruptedException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } try { mySocket.close(); } catch (IOException e1) { // TODO Auto-generated catch bl...
548f1699-5b03-48b2-89d7-9d05eac7dd06
0
@Override public String toString() { return "\nUser [id=" + getId() + ", " + firstName + " " + lastName + ", email: " + email + ", " + role + "]"; }
e2dd3b81-1588-4c3c-b590-16f248195904
4
private File ensureFolder( final File folder ) { if( folder.exists() ) { if( !folder.isDirectory() ) { throw new IllegalArgumentException( "Given path " + folder.getAbsolutePath() + " is not a directory." ); } if( !folder.canWrite() ) { throw new IllegalArgumentException( "Can't write into directory ...
232fa443-67b1-4e45-aaa2-014e97c40e05
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 2) { final String remoteVersion = title.split(delimiter)[1].split(" ")[...
2c46e1fc-73dc-4e8e-a70f-2ffd060a43c2
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.print("try"); writer.openBrace(); writer.tab(); subBlocks[0].dumpSource(writer); writer.untab(); for (int i = 1; i < subBlocks.length; i++) subBlocks[i].dumpSource(writer); writer.closeBrace(); }
911a82a9-50a4-431c-98b6-5e6d0380c75c
9
protected StringBuilder appendIntValue(StringBuilder sb) { if ("0".equals(number)) { return sb.append(style.getNumbersText()[0]); } int length = number.length(); // 计算cell的个数 int size = length >> 2; if (length % 4 != 0) { size++; } // 循环截取4位数字字符串组装成cell,放入List中 List<Cell> cells = new ArrayList<C...
3248efb6-71ec-4525-92f7-b303e6d0621c
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Spot spot = (Spot) o; if (col != spot.col) return false; if (row != spot.row) return false; return true; }
be59456b-d394-4d75-8dc8-c37bd2e26aed
8
protected void getEvidenceDetail(String title) { if (title != null) { for (int i = 0; i < evidenceResultList.size(); i++) { if (evidenceResultList.get(i).getTitle().equals(title)) { if (!(evidenceResultList.get(i).getDescription() == null || evidenceResultList.get(i).getDescription().equals("null"...
81f9f1c1-e44e-4c7b-8140-ccafd466bcaf
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...
7900426c-dfc0-4e1d-a073-8457f53e7473
5
public void MI(HashMap<String, _stat> featureStat, int[] classMemberNo){ m_selectedFeatures.clear(); double[] PrCi = new double[classMemberNo.length]; double[] ItCi = new double[classMemberNo.length]; double N = Utils.sumOfArray(classMemberNo); double Iavg = 0; for (int i = 0; i < classMemberNo.length; i++...
b6649ef5-ccf2-4eb6-b189-34b79f0d8092
3
public int compute() { subSequence[0] = seq[0]; len = 1; for (int i = 1; i < seq.length; i++) { if (seq[i] > subSequence[len-1]) { subSequence[len++] = seq[i]; } else if (seq[i] < subSequence[0]) { subSequence[0] = seq[i]; }...
2964490e-332d-4ea0-9c98-b6089d873ce3
7
private void handleLoginLogoutButtonPressed(ActionEvent e) { if (loginLogoutButton.getText().equals("Log In")) { String serverName = serverBox.getValue(); String version = versionBox.getValue(); String userName = userField.getText(); if (userName == null || userName.length() == 0) { return; } ...
24c2f84e-0430-4122-b485-ba19ca91f40a
9
private void readAndDecompress() throws IOException { // Read the length of the compressed block int ch1 = in.read(); int ch2 = in.read(); int ch3 = in.read(); int ch4 = in.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); inLength = (...
70373764-6873-4974-8565-acaf15abd176
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
f566de80-6ab1-4cce-8e8b-071548630b6d
7
@Override public Line localOptimize() { for (int i = 0; i < conditions.size();) { conditions.set(i, conditions.get(i).localOptimize()); if (conditions.get(i) instanceof ExpressionLiteral) { Value conditionValue = ((ExpressionLiteral) conditions.get(i)).getValue(); if (conditionValue instanceof Bo...
b82f86a4-bfdc-4636-93e6-3bae4af470eb
9
public synchronized static Integer getValue(Object layout, String key, int type) { Integer ret = null; boolean cont = true; for (int i = LAYOUTS.size() - 1; i >= 0; i--) { Object l = LAYOUTS.get(i).get(); if (ret == null && l == layout) { int[] rect = VALUES_TEMP.get(i).get(key); if (cont && rect ...
a6114e04-3e2f-4f03-ab54-c634cc8e6971
3
@Override public Move makeAMove() { // Send make a move request over network then wait this.send("YOUR-TURN"); String result; try { result = this.inStream.readLine(); if (result == null) { return null; } String[] cmdToke...
0ee7a940-f35f-4f07-939b-8433a7a22027
4
public void runGroup(GroupSettings settings, boolean printResult, boolean printEmpty) { if(settings.warnOnly()) return; EntityConcentrationMap map = new EntityConcentrationMap(settings, this); for(World world : Bukkit.getWorlds()) { if(allowWorldGlobal(world) && settings.allowWorld(world)) map....
0cf15200-1448-43c3-b47f-67998aa2d0b6
0
public void setActivity(String activity) { this.activity = activity; }
7343812a-3896-470a-a4d1-1291724615b1
1
public static String encodeURIComponent(String s) { String result = null; try { result = URLEncoder.encode(s, "UTF-8") .replaceAll("\\+", "%20") .replaceAll("\\%21", "!") .replaceAll("\\%27", "'") .r...
b5708745-e895-4f50-a866-c9602840ba9a
2
public final synchronized BigDecimal readBigDecimal(){ this.inputType = true; String word=""; BigDecimal big = null; if(!this.testFullLineT) this.enterLine(); word = nextWord(); if(!eof)big = new BigDecimal(word.trim()); ...
fbe7d3c3-d983-4915-a632-d72a7c8c368e
1
public SignatureVisitor visitExceptionType() { if (exceptions == null) { exceptions = new StringBuffer(); } else { exceptions.append(", "); } // startType(); return new TraceSignatureVisitor(exceptions); }
c0136239-9baf-4a2f-91ec-e40ea1351462
5
public static String Base64EncodedStringFromString(String string) { byte[] data = string.getBytes(); int length = data.length; byte[] input = data; byte[] output = new byte[((length + 2) / 3) * 4]; for (int i = 0; i < length; i += 3) { int value = 0; for...
aa91f38b-2e30-4a15-b536-a478af5592ab
0
private void printSimpleString(Graphics2D g2d, String s, int width, int XPos, int YPos){ int stringLen = (int) g2d.getFontMetrics().getStringBounds(s, g2d).getWidth(); int start = width/2 - stringLen/2; g2d.drawString(s, start + XPos, YPos); }
006ab8b4-dfe6-47e5-af48-630238135276
0
public int GetTimeDeliverd() { return timeDelivered; }
63d804a9-bd68-46a7-9682-d3b613fce680
2
public static boolean isPlate(int itemID) { for (int i=0; i<platebody.length; i++) if (platebody[i] == itemID) return true; return false; }
91831b10-ffb3-4d7e-9b39-b6cb19dc109f
1
public void print() { System.out.println("#nodes:" + this.nodes.size() + " #edges:"+ this.edges.size()); for (Edge oneEdge : this.edges.values()) { oneEdge.print(); System.out.println(""); } }
7e9cb821-c954-4e1f-97ea-7af8e8476a31
5
public static String encodeParameters(PostParameter[] httpParams) { if (null == httpParams) { return ""; } StringBuffer buf = new StringBuffer(); for (int j = 0; j < httpParams.length; j++) { if (httpParams[j].isFile()) { throw new IllegalArgumentE...
25f41f76-4701-4c0a-a325-0f07e5273f73
3
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] d = f.get2DData(px, pz, sx, sz); int s = sx * sz; for (int i = 0; i < s; i++) { double n = d[i]; if (n < min) n = min; if (n > max) ...
41eca377-54da-424a-bb35-43118a13a996
8
public static final int getMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean usingSpec, double specMultiplier) { if (!ranging) { int strengthLvl = player.getSkills().getLevel(Skills.STRENGTH); double xpStyle = CombatDefinitions .getXpStyle(weaponId, attackStyle); double...
f8133f6e-ec7f-442f-9a63-bd71f894cd90
2
NewsSearchResponse(JSONObject jsonObject) { super(jsonObject); if (this.Count > 0) { JSONArray results = (JSONArray) jsonObject.get("results"); @SuppressWarnings("unchecked") Iterator<JSONObject> iterator = results.iterator(); while (iterator.hasNext()) { Results.add(new NewsResult(iterator.next()))...
207c9b00-77a2-4b6a-96da-b8d9e526178c
2
public static int getMF(String name) { String s = (String) getCache(60 * 60 * 24 * 365).get("namelist"); if (s == null) { WakeBackends wb = new WakeBackends(); wb.memSet(); s = (String) WikiUtil.getCache(60 * 60 * 24 * 365).get("namelist"); } Pattern p_name = Pattern.compile("^.*?" + name.split("[ __]"...
ad68dada-9ed6-4c20-8d47-86fc3590f836
3
@Override public void setAccounts(Accounts accounts) { this.accounts = accounts; boolean active = accounts != null; if (accountTypes != null) { for (AccountType type : accountTypes.getBusinessObjects()) { JCheckBox checkBox = boxes.get(type); check...
46581c6c-231e-4cf8-9380-a403297b4b45
7
private void writeDescriptor() { OutputStream resourceOut = null; XMLStreamWriter xml = null; String resourceName = PERSISTENCE_FILE; try { final FileObject resource = filer.createResource( StandardLocation.CLASS_OUTPUT, "", PERSISTENCE_FILE); resourceName = resource.getName(); resourceOut = re...
54876864-f200-4bf3-843f-e52998dfd86b
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficien...
b67c0748-2f5c-45da-ad38-2bc5da9055ad
4
@Override public boolean execute(CommandSender sender, String[] args) { if(sender instanceof ConsoleCommandSender == false) { return true; } if(args.length != 3) { // Ignore, its the console anyway //sender.sendMessage(RED+"Incorrect sy...
10bcddf6-0052-4759-82ad-053f2fdda3f3
1
private void popTurtleStack() { try { Turtle lt = (Turtle) turtleStack.pop(); lt.updateBounds(currentTurtle); currentTurtle = lt; g.setColor(currentTurtle.getColor()); g.setStroke(currentTurtle.getStroke()); } catch (EmptyStackException e) { // We just ignore it. } }
15ca956a-265d-40f1-8b21-db6a1ed769f2
2
void t2dGenes(VcfEntry ve) { if ((ve.getId() == null) || ve.getId().isEmpty()) ve.addInfo(T2D_GENES); }
1cb5194c-a1a9-4b41-875c-52ad0517ed6a
7
public List<File> buildFont( String internalName, FileGarbage garbage ) throws IOException { File tempDir = File.createTempFile( "fonts", ".tmp" ); tempDir.delete(); tempDir.mkdirs(); garbage.addFile( tempDir, true ); File binDir = new File( "bin" ); File binFile = ...
9de5762e-d4e5-4efd-92dc-d720a31182d5
7
public static boolean checkMathAssign(Type p1, Type p2) { if (p1 == null || p2 == null) { return false; } return p1 == Type.Fixed && p2 == Type.Integer || p1 == Type.Fixed && p2 == Type.Fixed || p1 == Type.Integer && p2 == Type.Integer; }
168c1a96-ae11-47a6-bf8f-a890c45452fa
0
public static HTTPResponse notFound() { return new HTTPResponse(404, "<h1>Not Found</h1>The requested URL was not found."); }
49f875af-1976-4e80-8815-bb6743db990a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Edge)) return false; Edge other = (Edge) obj; if (u == null) { if (other.u != null) return false; } else if (!u.equals(other.u)) return false; i...
8ebc2fe6-1416-4977-a8b7-c2558fcf7485
4
/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) /* */ { /* 14 */ if (((sender instanceof Player)) && ((sender.hasPermission("ghost.noclip:")) || (sender.getName().equalsIgnoreCase("gateklaas")))) /* */ { /* 16 */ PlayerListener.toggleGhostMode((P...
0335681b-c702-4852-9209-8b07950a5e6c
4
public void magnify(){ if(magnifyingLevel == 0.25){ setMagnifyingLevel(0.5); }else if(magnifyingLevel == 0.5){ setMagnifyingLevel(1); }else if(magnifyingLevel == 1){ setMagnifyingLevel(1.5); }else if(magnifyingLevel == 1.5){ setMagnifyingLevel(2.5); } }
99a9fd65-c2cb-46d0-8689-f4dd33b9a0a4
0
public Integer getContestId() { return this.contestId; }
20a0a87f-c756-4119-b84c-c825f1a79542
6
private String getTagAsString(XMLTag tag) { String tagStr = ""; if (tag instanceof PITag) { PITag instruction = (PITag) tag; if (instruction.getName().equals("easyxml")) { tagStr += parseEasyXML(instruction.getValue()); } } else { ...
e16cf349-65e3-455f-9333-08c3681dd11b
3
public void fall() { if(this.getWorld() != null) { while(canFall() && this.getWorld().liesWithinBoundaries(this)) { this.setPosition(new Position(this.getPosition().getX(), this.getPosition().getY() - this.getRadius()*0.1)); // fall with a little bit } } }
ef41bc05-11dd-4e9c-97d8-b8a5b7337da8
4
private void editQuantity(Product product) { String msg; if (product instanceof WeighableProduct) { msg = "Enter how many grams of " + product.getProductName() + " you want to remove"; } else { msg = "Enter how many " + product.getProductName() + "s you want to remove"; } String answer; boo...
20c76529-d460-426d-9fc7-8876017bd372
1
final public Iterator<PropertyTree> getChildren() { if(children==null) return null; return children.iterator(); }
404804de-67b0-4d60-914a-c8d6025c83ad
7
@Override public float getWidth(char code, String name) { // we don't have first and last chars, so therefore no width array if (getFirstChar() == -1 || getLastChar() == -1) { String key = chr2name[code & 0xff]; // use a name if one is provided if (name != null) ...
827459d6-65fd-4548-bde0-07598171b941
1
public void test_printParseShortNameWithLookup() { Map<String, DateTimeZone> lookup = new LinkedHashMap<String, DateTimeZone>(); lookup.put("GMT", LONDON); lookup.put("BST", LONDON); DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder() .appendPattern("yyyy-MM-dd HH:m...
87920b3c-40c1-4872-8591-7984c361c814
7
protected boolean isCallableMethod(Method m, Class<?> runClass) { if (!runClass.equals(m.getDeclaringClass())) return false; if (!Modifier.isPublic(m.getModifiers())) return false; if (m.getParameterTypes().length != 0) return false; if (Modifier.isNative(m.getModifiers())) return false; if (Modif...
a0590418-b232-41a2-a8b5-78c2706e1477
3
public int Winner() { Set<Integer> remainingPlayers = new TreeSet<Integer>(); for (Planet p : planets) { remainingPlayers.add(p.Owner()); } switch (remainingPlayers.size()) { case 0: return 0; case 1: return ((Integer) remainingPlayers.toArray()[0]).intValue(); default: return -1; } }
9c04ab5b-3341-435b-ac63-f23b2c2ff865
0
public String displayInfo() { super.displayInfo(); //The getFood method is an example of encapsulation return "Bears oh My!Bears are "+look+" fury and\neat a lot. Bears live in the "+location+" and\neats "+getFood(); }
6b9f7e27-054b-471d-b82e-f439ec764108
3
public User getUserByFacebookID(EntityManager em, long facebookID) { User returnUser = null; try { TypedQuery<User> query = em.createQuery( "from User u where u.facebookID = ?", User.class); query.setParameter(1, facebookID); List<User> result = query.getResultList(); if (result.isEmpty()) { r...
d798354b-c08b-47fd-90a0-4b065ebb0350
1
public Texture(String fileName) { this.m_fileName = fileName; TextureResource oldResource = s_loadedTextures.get(fileName); if(oldResource != null) { m_resource = oldResource; m_resource.AddReference(); } else { m_resource = LoadTexture(fileName); s_loadedTextures.put(fileName, m_resource); ...
0ad819e5-a755-49fd-b847-f729f57b5dbf
7
public static void main(String[] args) { Item ourCounter = new Item("Team Counter", 150); try { Vector<Thing> things = new Vector<Thing>(); for (int i = 1; i < 5; i++) { Thing t = new Thing(); t.setCode(String.valueOf(i)); t.setDescription("Description of " + i); t.setValue(new BigDeci...
5c4e5864-a891-43c5-994e-857dc0e23a83
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { this.stack[this.top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { ...
e80d9903-9721-45a6-ac0b-86648b7817bd
9
public String getDataVisita(String abrev) { String aux=""; String SQL1 = "SELECT * FROM tuta_visitestutors WHERE abrev='"+abrev+"'"; try { Statement st = client.getMysql().createStatement(); ResultSet rs1 = client.getMysql().getResultSet(SQL1); w...
a161390d-6a07-4911-914b-1f3ad2094fc2
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
b25b90aa-2235-42d6-8840-28566cd0807b
8
public void putAll( Map<? extends Character, ? extends Float> map ) { Iterator<? extends Entry<? extends Character,? extends Float>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Character,? extends Float> e = it.next(); this.p...
512b0466-2099-4c36-a7b4-967d49385865
4
@Override public int hashCode() { int result = item != null ? item.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); result = 31 * result + (item3 != null ? item3.hashCode() : 0); result = 31 * result + (item4 != null ? item4.hashCode() : 0); retu...
778cab5a-02d4-472d-b7b5-2a211b4355a6
2
public PersonListItem(Person person) { this.person = person; givenName = person.getGivenName(); int bYear = person.getBirthYear(); int dYear = person.getDeathYear(); asString = givenName + " (" + ((bYear == 0) ? "?" : ""+bYear) + " - " + ((dYear == 0) ? "?" : ""+dYear) + ")"; }
57447a7a-fca3-490f-8a7e-3410a6e28788
6
public DemoLayout(int num) { num = num < 1 ? 1 : num; setTitle("DemoLayout application"); setSize(640, 480); setLocation(100, 50); setDefaultCloseOperation(DISPOSE_ON_CLOSE); cp = getContentPane(); CardLayout cpl = new CardLayout(); cpl.setHgap(10); ...
1aab8b2f-94a7-45b1-a2d6-438eaed59783
5
@EventHandler (priority = EventPriority.NORMAL) public void getInBed(final PlayerBedEnterEvent evt) { // super accurate nanotime ?! Long time = System.nanoTime(); String name = evt.getPlayer().getName(); if (Bukkit.getServer().getOnlinePlayers().length < 2) return; if (slept.containsKey(name)) { //check...