method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fd693847-bc60-4600-90be-8f847fffe168
9
final void method3049(ByteBuffer class348_sub49, int i, int i_23_) { do { try { int i_24_ = i; while_201_: do { do { if (i_24_ != 0) { if (i_24_ != 1) { if ((i_24_ ^ 0xffffffff) == -3) break; break while_201_; } } else { anInt9344 = class348_sub49.getS...
65dae5eb-8f00-4b22-a382-5f3372ec2a2c
3
public void itemStateChanged(ItemEvent evt){//***Event if(evt.getStateChange() == ItemEvent.SELECTED) { if (evt.getSource() == cBox_Price) { que.setUserChoice(Q4_PriceDistance.PRICE); }else if (evt.getSource() == cBox_Distance) { que.setUserChoice(Q4_PriceDistance.D...
15bc11eb-0018-4e9f-8253-27b687c44ca1
0
public Grammar getUnitProductionlessGrammar(Grammar grammar, VariableDependencyGraph graph) { Grammar uplgrammar = new ContextFreeGrammar(); addAllNonUnitProductionsToGrammar(grammar, uplgrammar); addAllNewProductionsToGrammar(grammar, uplgrammar, graph); return uplgrammar; }
334d33d9-8c6a-4fce-881b-9bfb4d8be4a2
7
private void AceptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AceptActionPerformed // TODO add your handling code here: int x1 = 0; String str = null; List<Pojo.Producto> p = new Conectar().ConexionProd(); String id; for(Pojo.Producto prod : p){ ...
50d10c24-2862-4707-9980-61b4deda7f86
4
public boolean isCellEditable(int row, int col) { //Note that the data/cell address is constant, //no matter where the cell appears onscreen. if (col == 0 || col == 1 || col == 2 || col == 3) return true; return false; }
5b92cb49-9e7e-4543-82df-429b009f74e1
3
public void valueOf(final Type type) { if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) { return; } if (type == Type.VOID_TYPE) { push((String) null); } else { Type boxed = getBoxedType(type); invokeStatic(boxed, new Method("valueOf", boxed, new Type[] { type })); } }
4a956505-c9ac-4146-95d6-05e8c504b9cb
3
private boolean placeUnitNearCityAt(Position p, Unit u){ Position[] positions = makePlacementArrayWithCenter(p); for (Position place : positions){ if ( !isImpassable(place) && !isOccupied(place) ){ unitMap.put(place, u); notifyWorldChangeAt(place); ...
4bd0fc80-cfeb-4300-9031-237b769de6f5
8
private void mouseWheelMovedImpl ( float amount ) { if ( !enabled ) return; if ( interActiveElements == null ) return; updateListenerList(); for ( AbstractActiveElement interActiveElement : interActiveElementsList ) { if ( !interActiveElement.isActive() ) continue; interActiveElement.mouseScrolled( ...
2c3eee56-3e33-43a0-862d-15147d11c278
0
public String toString() { return " InfiniteRecursion address: " + this + "\n"; }
a453425e-da7b-4dde-a399-e79d2b4bf07b
0
@BeforeClass public static void setUpClass() { }
6b015f80-c687-45b8-8d81-a0ff8d431266
5
private int skipWhiteSpace() { char c; for (; currentPos < maxPos; currentPos++) if (((c = string.charAt(currentPos)) != ' ') && (c != '\t') && (c != '\r') && (c != '\n')) return currentPos; return Token.EOF; }
a513173e-ee0a-43d3-b93f-fee901982040
7
protected boolean canMend(MOB mob, Environmental E, boolean quiet) { if(E==null) return false; if(!(E instanceof Item)) { if(!quiet) commonTell(mob,L("You can't mend @x1.",E.name())); return false; } final Item IE=(Item)E; if(!IE.subjectToWearAndTear()) { if(!quiet) commonTell(mob,L("...
50a24925-3200-446e-9feb-e889f70916f5
0
@Override public Iterator getExtensions() { return extensions.keySet().iterator(); }
39c8c335-f58f-4fe8-b64f-ca69faecc378
1
@Override public void writeToSave(DataTag tag) { super.writeToSave(tag); tag.writeInt("burntime", burnTime); tag.writeInt("isLit", isLit() ? 1 : 0); }
db8793cf-858b-42dc-a6b8-5f3c0b8a0f4a
2
public void setWidth(float width) { if ((width > 0.0) && (width < 20.0)) { this.width = width; } else { width = 0; } }
18e40d82-a881-4d84-9446-046024f6fffe
5
private long removeRefLoomServer(long lIndex) { // // loop through the elements in the actual container, in order to find the one // at lIndex. Once it is found, then loop through the reference list and remove // the corresponding reference for that element. // LoomServer refActualElement = GetLoomServer(lIndex)...
abc6c108-142c-4ad3-82a5-6d424039c7e4
2
public final void setProdDesc(String prodDesc) { if(prodDesc == null || prodDesc.isEmpty()) { throw new IllegalArgumentException(); } this.prodDesc = prodDesc; }
5991fcd6-d1ec-4f20-826a-8f401419e11e
2
public JournalsGUI(JournalInputGUI journalInputGUI) { this.journalInputGUI=journalInputGUI; setBorder(new TitledBorder(new LineBorder(Color.BLACK), getBundle( "Accounting").getString("JOURNALS"))); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); combo = new JComboBox<>(); combo.addActi...
0156695f-6a7e-4919-bb9a-bd62344f51a9
2
public boolean has(String genotype) { for (String gen : genotypes) if (gen.equals(genotype)) return true; return false; }
00344e2a-cee2-4242-85db-a7d04a272ccd
8
public void run() { setFont("Courier-20"); while (true) { int selection = getSelection(); if (selection == QUIT) break; switch (selection) { case LIST_SONGS: listSongs(); break; case LIST_ALBUMS: listAlbums(); break; case ADD_SONG: addSong(); break; case ADD_ALBUM: ...
6748c360-e08c-4269-87f2-23545498bfe8
3
public void removeCard(String str) { for (DevCard dC : hand) { if (dC.getSubType() == str || dC.getType() == str) { hand.remove(dC); break; } } }
e82c969e-3acc-4d38-8f94-35a8c6789a41
4
public void lightTorch() //Create LightTorch Method { int chance; //Declare chance Variable Random rnd = new Random(); chance = rnd.nextInt(10) + 1; //Randomize chance Variable if (wet == true) { //Check if Wet Is True if (chance >= 4){ Room1.torchlit = true; System.out.printf("\n > You light ...
54c874f9-7921-4368-8f47-3df21bf234e7
8
public static void main(String[] args) { if (args == null || args.length < 1) { System.out.println("Usage:"); System.out.println(" args[0]: path of the test file."); System.exit(0); } String path_input = args[0]; FileInputStream instream_collection = null; Trie trie = new Trie(); try { // Loa...
833ffe33-f0af-4cca-a90a-d8e47d3a9c51
2
@EventHandler (priority = EventPriority.MONITOR) public void banEnforcer(PlayerJoinEvent event) { Player player = event.getPlayer(); String playerName = player.getName(); if (!bannedPlayers.containsKey(playerName)) { return; } long future = bannedPlayers.get(play...
52bcf3e8-0903-4298-86da-6938ed95345e
0
public Write(){ this.path = Params.testFolder + this.separator; this.graf = new ArrayList<Long>(); }
4ffab352-1f9a-4150-9af8-f504aa1ee6da
1
void document(File file) throws Exception { Locale locale = Locale.getDefault(); if (System.getProperty("oms3.locale.lang") != null) { locale = new Locale(System.getProperty("oms3.locale.lang")); } Documents.db5Sim(file, // output file model.getComponent().getClass(), // the model class model.getPara...
c81f9ff8-b00f-48e8-b401-8d38e959a42e
8
public T processArguments(String[] args,T instance) throws CmdLineParseException { if(instance instanceof InitFinishParserObject){ ((InitFinishParserObject)instance).init(); } // first we break up the args at switches. List<DelimitedArgs> delimited = new ArrayList<DelimitedArgs>(); List<String> current = n...
09be9d5a-98c5-45b7-89cc-fcd86995a490
3
private void init(SudokuGrid grid) { int i,j; for(i=0;i<9;i++) { for(j=0;j<9;j++) { if(grid.getGridVal(i, j) != 0) { solveGraph(i,j,grid.getGridVal(i, j)-1); solveProbability(i,j,grid.getGridVal(i, j)-1); } } } } // end of init function
e28e0ae9-632e-4997-b6b0-542447ec908f
1
public static void LoadData(String paperterm, String term ){ //HashMap of the Vocabulary Terms HashMap<Integer, String> udict = new HashMap<Integer, String>(); udict = ReadName( Folder + "term.txt" ); //Array List of all the eldges ( term id, term id, document id) HashMap<SparseMatrix, Integer> uup = new H...
c7ff59bf-6a73-408a-ae21-fcd6e4cad548
1
void setNotation(String nname, String pubid, String sysid) throws java.lang.Exception { Object notation[]; if (notationInfo.get(nname) == null) { notation = new Object[2]; notation[0] = pubid; notation[1] = sysid; notationInfo.put(nname, n...
437002df-9b95-41d8-8abc-4160952c9f4a
5
private static Serializable readfromFile() { Triangle readTriangle = null; FileInputStream fin = null; ObjectInputStream ois = null; try { fin = new FileInputStream("triangle.ser"); ois = new ObjectInputStream(fin); readTriangle = (Triangle...
be5a4e1c-f4be-4632-beff-049e51dae11c
7
private void typeColor(Byte type) { switch (type) { case 1: g2.setColor(Color.red); break; case 2: g2.setColor(Color.magenta); break; case 3: g2.setColor(Color.orange); break; case 4: g2.setColor(Color.blue); break; case 5: g2.setColor(Color.green); break; case 6: g2.setC...
4646e9e5-522e-43bb-adef-1b66da5c61bf
8
public void removeItem(Hero owner, Item item) { if (owner != null && item != null && owner.equals(item.getOwner())) { switch (item.getCategory()) { case CONSUMABLE: { // remove item from pouch owner.getPouch().remove(item); if (LOGGER.isDebugEnabled()) LOGGER.debug("Successfully removed co...
bc38d87a-e526-46f4-afa3-3109cd85c101
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
c7a9341b-6544-4337-8064-b58bfc00263f
0
public ArrayList viewBkId() { ArrayList al = new ArrayList(); al = shsmb.viewMyBooking(); return al; }
8b48df6b-e732-4be3-808d-c65cd2465012
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 fe...
e42ecd6c-d3f3-4107-803f-a97acd59fe8f
5
@Override public synchronized void update(final LineEvent event) { if(event.getType() == LineEvent.Type.STOP && !mixer.isPaused()) { Clip clip = (Clip)event.getSource(); clip.close(); try { audioInputStream.close(); } catch(IOException e) { System.out.println("Failed to close audioInputStream"...
fba9e749-36d6-40f7-a981-cfefe4694bf0
8
public static void main(String[]args){ int[] numbers = new int [5]; Scanner scanner = new Scanner(System.in); /*for (int i=0; i<5; i++) { System.out.println("Write numbers[" + i + " ] = "); numbers[i] = scanner.nextInt(); System.out.println(verifyIfNumberIsPrime(numbers[i])); ...
128f7073-00c3-4e09-b9c6-d96575c26cc9
0
public void setSeat(OperatingSeat value) { this._seat = value; }
f82046cf-08de-42a7-943e-88e83fdd0b64
5
public String getMove( String predNear ) { String move = ""; double chance = Math.random(); // if the predator is not in adjacent location if ( predNear.equals("CLEAR") ) { for( int i = 0; i < probRange.length; i++ ) { if( chance <= probRange[i] ) { move = possibleMoves[i]; break; } } ...
07c1277c-e069-4891-bcad-6b7bbf20a930
6
public void method480(int i, int j, int k, int l, int i1) { for(int j1 = 0; j1 < anInt1630; j1++) { int k1 = anIntArray1631[j1]; int i2 = anIntArray1632[j1]; int j2 = anIntArray1633[j1]; if(anIntArray1637 == null) { int i3 = anIntArray1640[j1]; Class33 class33 = super.aClass33Array1425[k1]; ...
e06a373e-9c64-4040-88cc-4e565797fd0f
1
public void visit_aswrange(final Instruction inst) { stackHeight -= 3; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
2fa2a892-3977-4c01-b0d0-4eb4135c5763
6
public static NamespaceInfo setNamespace(XMLStreamWriter writer, String prefix, String namespaceURI, String defaultPrefix) throws XMLStreamException { String p = writer.getPrefix(namespaceURI); if (p == null) { // not defined yet NamespaceContext nsc = writer.getNamespaceContext(); if (prefix == null...
728c8524-6da1-4a67-98bf-5dc4f9ed3e47
1
private void beenden() { int response = JOptionPane.showConfirmDialog(null, "M\u00F6chten Sie das Programm wirklich beenden?"); if (response == JOptionPane.YES_OPTION) { System.exit(0); } }
4e0e77c9-cb23-4ed0-9348-261e8bf4189e
6
public static String findMinRoute() { String start = "0122112211221122"; String end = "0212212112122121"; Set<String> map = new HashSet<String>(); map.add(start); Queue<String> nextPattern = new LinkedList<String>(); nextPattern.add(start); Queue<String> count= new LinkedList<String>(); count.add("")...
9a20f259-8e26-4cb2-a53c-7dffc4cf9af3
1
@Override public void mouseEntered(MouseEvent e) { if(e.getComponent().getName().equals("globeMenu")) parent.getTitlePanel().hoverGlobe(); }
fce0dbc9-5f28-41ac-a971-49aaba4fc960
6
public void close() throws IOException { if (debugLeaks) { openFiles.remove(location); if (showOpen) System.out.println(" close " + location); } if (file == null) return; // If we are writing and the buffer has been modified, flush the contents // of the buffer. flush(); ...
d57dbab9-fbdd-4e91-8a0b-c6db1f7a29ac
0
public void setBlogId(long blogId) { this.blogId = blogId; }
78115ccf-a8d2-47f3-a4f2-5e4d40ed55f3
1
public SLKeyframe addDelayIncr(float delay, Component... cmps) { float d = 0; for (Component c : cmps) delays.put(c, delays.get(c) + (d += delay)); return this; }
ca7f8a59-1540-44a7-9f11-0dad9f393c72
2
public Channel(int width, int height) { if (width <= 0 || height <= 0) { throw new IllegalArgumentException( "Images must have at least 1x1 pixel size"); } this.width = width; this.height = height; this.channel = new double[width * height]; }
df633767-5d16-40c9-b55b-7e01d3324cd2
9
private void loadData(TrainingClass trainingClass) { if (UserSession.getDebug()) { System.out.println(trainingClass.toString()); } //set date field try { date.setDate(trainingClass.getStartTime()); } catch (PropertyVetoException ex) { ...
0e32eeb2-2100-49d3-ac10-488a52e606ef
2
public void testSystemMillisSecurity() { if (OLD_JDK) { return; } try { try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); DateTimeUtils.setCurrentMillisSystem(); fail(); ...
37c6d7e5-3d36-4845-958b-bdeb739bd161
2
public void notify(Object[] objects) { Integer value = (Integer)objects[0]; if (value.equals(DISPLAY_PROJECT_VARIABLES)) { displayProjectVariables(); } else if (value.equals(DISPLAY_DESTINATION_FOLDER)) { displayDestinationFolder(); } }
0300428d-eb52-4d0a-8ccd-b62b96c48933
8
String readString (int max) { int ch, length=0; char assembly[] = new char [max]; try { ch = in.read(); while(ch==' ' || ch=='\n' || ch=='\r') { ch = in.read(); } for (int i=0; i<max; i++) { assembly[i] = (char)ch; ...
37f59754-5570-449b-a5ce-0c75c4d8e4d2
5
private int[] merge(int[] arr1, int[] arr2) { // новый массив для результата int[] array = new int[arr1.length + arr2.length]; int idx = 0; int idx1 = 0; int idx2 = 0; while (idx1 < arr1.length && idx2 < arr2.length) { // добавить в массив меньший элемент с начала int elem; cou...
0d2ad9e0-a2f7-45ba-9d0c-5e6c9a1c4f10
5
public void normalization() { //for each col in data for (int i = 0; i < datas.get(0).size(); i++) { //find max and min double max = datas.get(0).get(i); double min = max; for (int j = 0; j < datas.size(); j++) { if (datas.get(j).get(i) > m...
109b6b4e-e719-4348-9ed9-5063e6ae3797
3
@Override protected void handleMessage(String message) { String[] parsed = message.split(":"); if(message.equals(REVERSE_DIRECTION)) { this.position.x -= this.velocity.x * 0.07; this.velocity.x = -this.velocity.x; this.position.y -= DOWNWARD_MOVEMENT; } ...
fbc3eb17-dcb8-4370-8912-354017d060ae
9
*/ public Direction navigateToDestination() { if(destination==null || br.curLoc.equals(destination)) return null; Direction dir = Direction.NONE; switch(mode) { case RANDOM: dir = navigateRandomly(destination); break; ca...
167d54a4-78e6-44f7-b1bb-d1cd4fa784a6
7
public MinHeap<T> init(List<T> heap) { this.heap = heap; this.heap.add(0, null); int currentSize = heap.size() - 1; // һС for (int i = currentSize / 2; i >= 1; i--) { T y = heap.get(i);// ĸ // Ѱҷyλ int ci = i * 2;// ciĸڵyĿλ try { while (ci <= currentSize) { Class<?> c = y.getClass(); ...
55b8af07-3c5c-409d-83a3-2756f5200a40
7
private void handleEnumeratedAttribute(Instances trainInstances) throws Exception { Distribution newDistribution,secondDistribution; int numAttValues; double currIG,currGR; Instance instance; int i; numAttValues = trainInstances.attribute(m_attIndex).numValues(); newDistribution...
06d0fd7b-923b-4f3a-bd40-d67d58df1c72
1
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { subExpressions[0].dumpExpression(writer, getPriority() + 1); writer.breakOp(); writer.print(getOperatorString()); writer.print(objectType ? "null" : "0"); }
a19c2281-e7a5-45dc-a5b0-32d6576b5e28
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IdentListNode other = (IdentListNode) obj; if (idents == null) { if (othe...
79c8b0c1-5e47-4367-8b71-64f7eb973946
8
public File stemming(File[] fileList) { PorterStemmer s = new PorterStemmer(); File stemLocation = null; for (int i = 0; i < fileList.length; i++) { numOfDocs += 1; try { InputStream in = new FileInputStream(fileList[i]); stem...
f31a33f4-a88e-4bc2-a502-5b382faba4df
5
private void deleteAnstalld() { int val; if (roleStateProjektledare == 1) { val = JOptionPane.showConfirmDialog(null, "Vill du verkligen ta bort " + lblName.getText() + "?\nAlla spelprojekt som denna projektledare leder kommer behövas tilldelas nya projektledare.", "Är du säker?", JOptionPan...
e106860c-ccd6-40c3-93b4-55ebf0052c6e
2
private Instances deleteUselessAtributes(Instances instances) { if (instances.checkForStringAttributes()) instances.deleteStringAttributes(); int classPosition = instances.classIndex(); if (classPosition >= 0) instances.deleteAttributeAt(classPosition); return instances; }
8da7fcdd-0259-46ea-b7b3-8127c2f56bba
2
public static Word chooseBestScoreWord(ArrayList<Word> words, Lexicon lex, SubSeqCounter counter) { // Pick the most frequent Word bestWord = null; double bestScore = 0; for (Word word : words) { double score = lex.getScore(word, counter); if (score > bestScore) { bestWord = word; bestScore = s...
33d2b06c-ce5d-4083-8fa3-fae20e077303
1
public Calendar deserialize(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException { String s = arg0.getAsString(); try { Calendar c = ISO8601.toCalendar(s); return c; } catch (jav...
1b999dcd-c1d6-47be-b7df-eef4f96e1ab5
7
public JButton createButton(final int index, String text) { JButton b = new JButton(); b.setText(text); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { switch (index) { case 0: ...
4883ea7b-1a5b-4598-ba92-d008d796f9a5
7
private void updateTime(Task task, String start, String end) { if (!start.isEmpty() && !end.isEmpty()) { if (!Keyword.getMeaning(task.getValue(Keyword.TYPE)) .equals(Keyword.TIMED)) { task.setValue(Keyword.TYPE, String.valueOf(Keyword.TIMED)); ...
0f08112f-16a7-4f1f-9e1e-f9a9aa19c458
4
public void GetPacketActionClient(int idUser, int idRoom) { JSONObject packet = new JSONObject(); packet.put("packet", "action_client"); List<Plane> plane = roomsGame.get(sendIdRoom(idRoom)).getPlanes(); List<Bullet> bullet = roomsGame.get(sendIdRoom(idRoom)).getBullets(); ...
f051eed8-6446-4b72-bdad-bfc35f847545
5
public void keyTyped(java.awt.event.KeyEvent evt) { if (evt.getSource() == nombreproveedoresField) { RegistroProveedores.this.nombreproveedoresFieldKeyTyped(evt); } else if (evt.getSource() == telefonoproveedoresField) { RegistroProveedores.this.telefo...
4cc5c457-00fc-450f-a2ae-82412ef104a9
3
private int tryGuessNumber(int number) { if (number > currentUser.getUpperBound()) { return -1; } if (currentUser.theNumberIs(number)) { return number; } int answer = tryGuessNumber(2 * number); if (answer == -1) { answer = tryGuessN...
0727d554-c8c0-4e8e-bfaa-c6dd92411081
3
public synchronized Proceso quitarProceso() { while(disponible==false) { try { wait(); }catch(InterruptedException ex) { } } disponible=false; notify(); if(!cola.isEmp...
1a60374f-b556-48f6-89f2-9b97112d8302
6
public int percentageOfPublicAreas() { int amount = percentageOfGreenArea(); for (Cuboid c : cuboids.values()) { if (c != null) if (CuboidType.getType(c.getCuboidType()) == CuboidType.Public || CuboidType.getType(c.getCuboidType()) == CuboidType.Hospital || CuboidType.getType(c.getCuboidType()) ...
6447ce9a-a11e-4367-9083-f700f53c884d
1
private void jTextFieldCmdCliQte4FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldCmdCliQte4FocusLost mondecimal = new DecimalFormat("#######.00"); if (!(jTextFieldCmdCliQte4.getText().equals(""))) { int qte = Integer.parseInt(jTextFieldCmdCliQte4.getText().trim...
b240cca9-5f19-4eb2-b5ee-a8cc257aa636
8
public static int determinApproporiateDepth(MorrisBoard bd) { int depth = SEARCH_DEP_LIMIT_DEFAULT; int numWhite = bd.countWhite(); if (numWhite < 3) { depth = UNVALIED; } else if (numWhite == 3) { depth = 3; } else { int numEmpty = bd.countEmpty(); if ((numEmpty >= HIGH_BOTTOM) && (numEmpty...
8d9c8802-741d-4408-9479-532558ac8cf2
9
public String deleteWithCompositePrimaryKey(String tableName, List<PrimaryKeyElement> primaryKeys) { StringBuffer sql = new StringBuffer(); sql.append("delete from " + tableName + " where "); if (tabla.getSelectedRows().length == 1) { for (Iterator<PrimaryKeyElement> iterator = pr...
a6efe6d8-326f-4c82-9914-ffe7b6d4103f
8
public void go(String... args) { System.out.println("Starting Gear Scraping..."); if(args.length==0) x = new GEAR_scraper(); else{ try{ x = new GEAR_scraper(new URL(args[0]),Integer.parseInt(args[1]),Integer.parseInt(args[2]));} catch(Exception e){ System.out.println("error following url"); ret...
4eb3512a-27aa-4ef8-b019-4945425ab182
6
public final String getSummary() { final StringBuilder ret = new StringBuilder(); final List<CheatingOffenseEntry> offenseList = new ArrayList<CheatingOffenseEntry>(); synchronized (offenses) { for (final CheatingOffenseEntry entry : offenses.values()) { if (!entry.isExpired()) { offenseList.add(entry);...
24abd0a4-fb1e-4279-9a79-35d6913814f8
1
public MailboxLog() { super("MAILBOX - LOG"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(1, 1, 442, 342); textArea = new JTextAreaWithScroll(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); ...
9867bf78-0f0c-4fec-a225-8490c1c81618
7
@Test public void testNumStarters() { RosterDefinition roster = new RosterDefinition(); roster.setStarters(new FantasyPosition(Position.TE), 1); for ( Position p : Position.values() ) { int expected = Position.TE == p ? 1 : 0; Assert.assertEquals("Incorrec...
4b285aba-ce23-4b22-9c39-91856d28850e
6
private void recurse(int depth, Portal ignore) { if (depth < max_depth) { int pNum = 0; for (Portal p : portalList) { if (p == ignore) { continue; // perf } // stencil per portal buffers(true, false, fals...
fae89da9-2140-4492-9678-d63bf26188cf
0
public void setId(int id) { this.id = id; }
593309fd-c6b5-49dc-97ba-bc0b8db5a89e
1
@Override @Execute public void execute() throws ComponentException { check(); while (cond.alive) { internalExec(); } }
39ccc446-b3fa-4bc4-a7ad-6351c750fa7b
3
static double[][] multiply(double[][] A, double[][] B){ double[][] AB = new double[A.length][B[0].length]; for(int i = 0; i < A.length; i++){ for(int j = 0; j < B[i].length; j++){ for(int k = 0; k < B.length ; k++){ AB[i][j] += A[i][k]*B[k][j]; } } } return AB; }
02f8b538-3b8b-4cf5-9409-3c6a028e3eeb
4
private void performUpgradeRequest(UpgradeRequest request) { for (Unit unit : self.getUnits()) { if (unit.getType() == request.building) { // If we don't have enough resources, wait if (self.minerals() > request.upgrade.mineralPrice() && self.gas() > request.upgrade.gasPrice()) { // We have the buil...
8dbb4cc6-def8-4916-8175-6e4023691924
5
private static void merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi){ //set starting points int i=lo, j=mid+1; //copy all elmts to tmp buffer for( int k = lo; k <= hi; ++k ){ aux[k] = a[k]; } //copy the next smallest elmt to the end of sorted...
855fa3ed-b4fb-4f1c-b803-e0d4b8f56e18
0
public DenseScrabble(String f) throws IOException { super(f); count = 0; maxScore = 0; maxWord = null; maxLineCount = 0; }
beebf692-44ec-40a9-9c74-da7b05bc70a2
7
private void openROMEnclosingFolder() { try { Desktop desktop = Desktop.getDesktop(); if(_romFileName != null && _romFileName.length() > 0) { File romFile = new File(_romFileName); if(romFile != null && romFile.canRead()) { File d...
eff273ad-c68c-4ca3-8b7b-3724e939ea5f
3
@Override public int hashCode() { if (this.gender == null || this.firstName == null || this.surname == null) { return this.age; } return this.age + this.gender.hashCode() + this.firstName.hashCode() + this.surname.hashCode(); }
cec8b16d-35fd-4101-bb81-76a8f9a50a59
9
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.BLACK); for (int a = 0; a < knownCells.size(); a++) { int x = (knownCells.get(a).locX * 50) + 5; int y = (floorYdimension * 50...
4729c5a8-e5e1-4ae9-b25c-1ed49ebd43cd
1
public final void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) { AttributesImpl att = new AttributesImpl(); att.addAttribute("", "dflt", "dflt", "", getLabel(dflt)); String o = AbstractVisitor.OPCODES[Opcodes.LOOKUPSWITCH]; addStart(o, att); for (int i = 0; i < labels.len...
f79bb2b7-7fb8-4add-8daf-9eb3f10707e8
7
public void overrender(Graphics g, Camera camera) { int x0 = camera.x >> 4; int x1 = (camera.x + camera.width + 16) >> 4; int y0 = camera.y >> 4; int y1 = (camera.y + camera.height + 16) >> 4; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { if (x >= 0 && y >= 0 && x < width && y < heig...
07711012-0e49-452b-90a8-7bba2fc32908
4
public Map<Integer, Double> getCooccurenceTags(Map<Integer, Integer> tags) { Map<Integer, Double> resultTags = new LinkedHashMap<Integer, Double>(); for (Map.Entry<Integer, Integer> sourceTag : tags.entrySet()) { SparseVector vec = this.coocurenceMatrix.get(sourceTag.getKey()); for (Map.Entry<Integer, Double>...
86665284-5ba5-4198-85d5-6512afbdbda8
0
public MethodAnnotationChecker(Method method) { this.methodToCheck = method; }
5b84a1fe-7566-46b5-8b7f-1a9376418f45
1
public Shader(){ program = glCreateProgram(); uniforms = new HashMap<String, Integer>(); if (program == 0){ System.err.println("Shader creation failed, could not find valid memory location in constructor"); System.exit(1); } }
f3797fa8-d955-47a4-a938-f196b2bfd29b
5
public static double distance(double a, double b) { if (a < 0.0 || a >= 1.0) throw new IllegalArgumentException("Invalid distance: " + a); if (b < 0.0 || b >= 1.0) throw new IllegalArgumentException("Invalid distance: " + b); double d = Math.min(Math.abs(a - b), 1.0 - Math.abs(b - a)); assert d >= 0.0 && ...
dc737e2f-1b21-4e7e-b5f7-f35155fba74e
8
* @param style * @param maxdepth * @param summaryP * @param stream */ public static void explainWhynot(String label, Keyword style, int maxdepth, boolean summaryP, OutputStream stream) { if (label == null) { Native.setSpecial(Logic.$MOST_RECENT_EXPLANATION_MAPPING$, KeyValueList.newKeyValueList(...
e5216894-135e-497c-bb85-a35982df79ba
5
public static float calcCommission (float salesAmount){ double dcommission = 0; float fcommission = 0; if (salesAmount < 200) { dcommission = salesAmount * 0.03; fcommission = (float)dcommission; } else if (salesAmount >= 200 && salesAmount < 500) { dcommission = salesAmount *...
edf5b360-9b4c-4253-95b8-c5a96038a28a
8
public void browseInFileSystemToFileOrDir(File fileOrDir) throws Exception { if (null == fileOrDir) { return; } try { Process process = executeFileSystemBrowserCommand(fileOrDir); if (null != process) { boolean waitFor = process.waitFor(2, T...