method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e5f5a960-df4f-4ba1-8c63-457215899596
1
public void addPiece(Piece piece) { if (this.placedPiece == null) { this.add(piece); this.placedPiece = piece; this.validate(); this.repaint(); } else { throw new FieldAlreadyOccupiedException(this); } }
59ad55a6-8cc6-4ecd-be42-e1280d51627f
6
public static AdjListNode[] genRandomUndirectedWeightedGraph(int vertexCount) { if(vertexCount <= 0) { return null; } AdjListNode[] graphList = new AdjListNode[vertexCount]; Random random = new Random(); for(int i=0;i<vertexCount;i++) { if(graphList[i] == null) { graphList[i] = new AdjListNode(St...
9262215b-0378-44da-9f02-14615f1202bc
4
public void book_update() throws Exception{ int field = 0, updatecomplete =1; Book findbook = bookcollect.book_search_lib(); // Ȥ ISBN ˻ å findbook̶ Bookü Ϲ޴´. if (findbook == null){ librarian_menu(); //˻ å̾ٸ 缭Ǹ޴εư. }else{ //Ʈϰ Ʈ ׸ Է¹޴´. do{ System.out.println("Ʈ ׸ ȣ ּ.\n1. \n2. \n3. ǻ \n4. IS...
9198bfb2-ae62-4cb6-a5f4-249bb8c0b099
2
private synchronized void countParameters(Users users, int numberOfUsers) { Plan plan = users.getPlan(); int thrPerEngine = plan.getThreadsPerEngine(); this.servers = count_servers(this.numberOfUsers, thrPerEngine); this.engineSize.setLength(0); this.engineSize.append(Constants...
561fd7de-714b-4bc0-9858-4b10b9e3c1b2
4
public String getCourseID() { String class_abbrv = ""; String class_num = ""; String class_ID = ""; String tempStr = ""; tempStr = getSectionID(); int firstSub = 0; int secondSub = 0; i...
4f6d5e3b-60a9-452a-959c-fee8ddc3ee8b
8
@Override public void run() { while (true) { try { byte code = fluxEntree.readByte(); if (code == NOUVELLE_CONNEXION) { nouveauConnecte(); } else if (code == DESACTIVE_BOUTON_PARAMETRE) { ModelePanneauListeJoueurs.getInstance().setConfigurationSetted(true); ModelePanne...
f1c4431a-b9eb-4840-95c6-6831efd73281
6
private int trMedian5 (final int ISA, final int ISAd, final int ISAn, int v1, int v2, int v3, int v4, int v5) { final int[] SA = this.SA; int SA_v1 = trGetC (ISA, ISAd, ISAn, SA[v1]); int SA_v2 = trGetC (ISA, ISAd, ISAn, SA[v2]); int SA_v3 = trGetC (ISA, ISAd, ISAn, SA[v3]); int SA_v4 = trGetC (ISA, ISAd, I...
3c143a6f-cdde-454b-b348-59b0953c1403
0
public Manager(String n, double s, int year, int month, int day) { super(n, s, year, month, day); bonus = 0; }
6c8a0c86-453d-4fa6-b940-c0e1e0ba3a06
8
private Celda buscarCelda(Integer aBuscar){ //Se obtiene el balde y se busca si el elemento se encuentra dentro de él. int baldeABuscar = tecnica.h(aBuscar); int posicionABuscar = posicionElementoEnBalde(baldeABuscar,aBuscar); //Referencia al elemento que se va a devolver. Celda celdaSalida = null; if ...
43993b57-7697-420d-bd69-778334fe0ccb
9
private void generateAssymetricKeyPair(APDU apdu) { byte[] buffer = apdu.getBuffer(); short lc = (short)(buffer[ISO7816.OFFSET_LC] & 0x00FF); byte p1 = buffer[ISO7816.OFFSET_P1]; short len; short crt; if (buffer[ISO7816.OFFSET_P2] != (byte)0) { ISOException.t...
8f59281d-9e78-4f14-95ae-b15d2261383b
8
public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashMap<Integer, Balance> balanceMap = new HashMap<Integer, Balance>(); // map to cache balance int numBalance = Integer.parseInt(br.readLi...
e968dc34-b5a0-452f-a161-2997a427651f
9
public LinkedList getCentersFromPublicAdvisories() throws MalformedURLException, IOException, ParseException { if(log.isDebugEnabled()) log.debug("Get list of forecast advisories from " + stormFileName); String advisoryArchiveContent = null; advisoryArchiveContent = new WebPage(urlPrefix + stormFileName).ge...
519cc283-8403-442e-961a-e550784d1831
0
public void setName(String name) { this.name = name; }
08eb646c-09ad-437e-b601-22142ac1a8de
3
public void testRipping() { try { Collection<Record> recs = RecordUtils.getRecordToRip(Integer.MAX_VALUE); for (Record rec : recs) assert (rec.getOwner() == 1 || rec.getFormat().getName().contains("x")); } catch (SQLException e) { e.printStackTrace...
fda5ffb4-b518-4730-85f6-14c48e989bdb
1
public void remover(Local local) throws Exception { String sql = "DELETE FROM local WHERE id = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, local.getId()); stmt.executeUpdate(); } catch (SQLException e) { throw e; } }
1cdbe343-db00-4146-b43c-84724c6b94ff
9
public int MaxArea(String[] board){ int n = board.length; int m = board[0].length(); int[][] longest = new int[n][m]; for(int j=0; j<m; j++){ for(int i=n-1; i>=0; i--){ if(i<n-1 && board[i].charAt(j)!=board[i+1].charAt(j)) longest[i][j]=longest[i+1][j]+1; else...
d0fa47d0-1551-4709-b9da-663104facb86
3
private void processCommand(String command) { if (listener!=null) { command = command.trim(); if (command.length()>0) history.add(command); if (history.size()>MAX_HISTORY) history.remove(0); historyIndex = history.size(); listener.commandReceived(command); lastCommandOffset = ...
049ad612-108a-4ce8-8fd8-dd6416b70da8
3
public static boolean isStoppedResult(Option[] options){ for(int i=0,count=options.length ; i<count ; ++i){ if((options[i].getName().equals(ActionResult.RESULT)) && options[i].getValue().equals(ActionResult.STOPPED)) return true; } return false; }
42d1491c-cd7d-4fef-84b8-f1ba38d7f17e
6
private void optimizeFLangOrNatSc(boolean natSc){ // ForeignLanguages: 4 hjs mandatory // NaturalSciences: 4 hjs mandatory // Process is identical Subject[] subjectArray; if(natSc){subjectArray = natScSubjects; } else{subjectArray = fLangSubjects;} int hjsToAdd ...
5215ec49-ca2a-4b0e-b6a2-5903bc62de19
0
public void addInstance(Instance instance) { this.instances.add(instance); }
a72a4d37-8026-4fb7-9691-a91119a05206
4
private String secondsToString(int time) { int min = time / 60; int sec = time % 60; if(min<10) { if(sec<10) return "0"+min+":0"+sec; return "0"+min+":"+sec; } if(sec==0) return ""+min+":00"; if(sec<10) return ""+min+":0"+sec; return ""+min+":"+sec; }
62128203-4254-4cd4-903e-b864eec50c3e
7
private static <T> boolean checkIntersection(RuleConstraint<T> ruleA, RuleConstraint<T> ruleB) { if (ruleA == ruleB) { return false; } List<FieldGroup<T>> fieldsA = ruleA.fieldGroups(); List<FieldGroup<T>> fieldsB = ruleB.fieldGroups(); List<FieldGroup<T>> fieldsCopy = new ArrayList<FieldGroup<T>>(ruleA...
8fd3a094-8fdc-4ad7-a9bd-79c8c7609480
8
public static <C> Map<String, Object> pojoToDocument(Object o, Class<C> clazz) { Map<String, Object> map = new HashMap<String, Object>(); Class<? extends Object> rtCls = o.getClass(); Field[] fields = rtCls.getDeclaredFields(); try { for (int i = 0; i < fields.length; i++) { Field f = fields[i]; St...
3099bafd-34a3-4da6-8121-a1a1591e1e8c
2
public static boolean WalkToAndClick(String action, final int... id) { SceneObject o = SceneEntities.getNearest(portals); if(o == null) return false; if(o.isOnScreen()) { return o.interact(action); } else Walking.walk(o); return false; }
25200c7b-6b3e-43cf-bf30-e9e367dcc2f5
4
private void appendData(String type) { switch(type) { case "województwo": provinces.add(currentRow); break; case "powiat": case "miasto na prawach powiatu": case "miasto stołeczne, na prawach powiatu": d...
ed365acb-9e45-48f5-b3d1-fe76eea63168
8
public void reduce(IntWritable key, Iterable<EntityData> values, Context context) throws IOException, InterruptedException { IntWritable outputKey = new IntWritable(); EntityPairData outputValue = new EntityPairData(); // FloatWritable outputValue = new FloatWritable(); Map<Integer, String> m = new HashMap<...
95aa381d-746b-4804-986e-bd28eabbe3bf
6
@SuppressWarnings("deprecation") @EventHandler public void handleItemPurchase(InventoryClickEvent event) { if (event.getClick() == ClickType.LEFT) { Player player = (Player) event.getWhoClicked(); Inventory inventory = event.getInventory(); Cuboid cuboid = Cuboid.getCuboid(player.getLocation()); ...
d2aeceec-1ed1-4bee-a0b7-d88f7e452fd1
6
private void printQuadranten(int eersteQuadrant, int derdeQuadrant) { //Print regel 1 for (int quadrantNummer = eersteQuadrant; quadrantNummer <= derdeQuadrant; quadrantNummer++) { quadranten[quadrantNummer].printVakken(0, 2); if ((quadrantNummer + 1) % 3 != 0) System.out.print("...
35f64b3f-f4c1-4f3c-9631-4c8a53b014b6
5
@Override public void caseAFormalrest(AFormalrest node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(FormalRest"); inAFormalrest(node); if(node.getComma() != null) { node.getComma().apply(this); } if(no...
ea5902a1-bb4e-4bff-bf19-427c583343b3
9
public LinkedList<Token> analyse(String whole) { /* Each key in both the operand and operator hashmaps will be used as a delimiter to split the remaining strings in the LinkedList. Then the delimeter itself is inserted as a Token between each pair of strings, preserving the original order. */ LinkedL...
930b7f0b-62f1-4750-81f4-a41f5ca98a24
7
@Override public double timeToReach(Node startNode, Node endNode, Message msg) { double dist = startNode.getPosition().distanceTo(endNode.getPosition()); /* Link rate | time arrive mSec | dist * ---------------------------------------------------- * 11 | 2542 | 399 * 5.5 | 3673 | 531 * 2 |...
90c539bf-aa6d-4667-927a-a9390fc8a1f2
4
public void createBrowseTree() { try { String[][] genres = new Shoutcast2().getGenres(); //add an option to search for free values in Shoutcast root.add(new DefaultMutableTreeNode(trans.getObject("GetGenres.search")) ); //create for every node with their leaves for(int i=0; i < genre...
c4ab406b-fa86-4d99-92eb-bee9a0dd3c3b
9
public void check(MOB mob, Armor A) { if(!layered){ checked=true; disabled=false;} if(A.amWearingAt(Wearable.IN_INVENTORY)) { checked=false; return; } if(checked) return; Item I=null; disabled=false; for(int i=0;i<mob.numItems();i++) { I=mob.getItem(i); if((I instanceof Armor) &&(!I...
c5a54b15-f150-466f-b555-54b4955a6f26
7
private String useImageVariables(String s) { int n = view.getNumberOfInstances(ImageComponent.class); if (n <= 0) return s; int lb = s.indexOf("%image["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; ImageComponent ic; while (lb != -1 && rb != -1) { v = s.substring(lb + 7, rb); ...
b7b30d89-478d-4e85-b23b-7b1e7c95ca8d
1
private static String trim(String s) { return s == null ? null : s.trim(); }
1c638526-5d41-4a7c-9bd1-1aabf7ffd460
8
public Direction opposite() { switch(this) { case NORTH: return SOUTH; case NORTHWEST: return SOUTHEAST; case WEST: return EAST; case SOUTHWEST: return NORTHEAST; case SOUTH: return NORTH; case SOUTHEAST: return NORTHWEST; case EAST: return WEST; case NORTHEAST: return SOUTHWES...
d494511c-b33b-4dc2-bc11-c70847c06638
2
public boolean verifyAccount(String userName, String password) { try { Connection conn = openConnection(); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from " + DB_ACCOUNT_TABLE + " where username = \"" + userName + "\" and password = \"" + password + "\";"); ...
1df12bc2-35a0-4338-88c5-a1c29bb1ea70
5
public static int wordCount(String s) { s = StringDemo.allTrim(s); if (s.length() == 0) { return 0; } int count = 0; for (int i = 0; i < s.length(); i++) { if (i == (s.length() - 1)) { count++; } else if (s.charAt(i) == ' ') { if (s.charAt(i + 1) == ' ') { continue; } count++...
528b7aa0-13b8-45fb-950d-238f186e1670
0
public void collideHorizontal() { setVelocityX(0); }
115ca169-8741-43ae-9939-f2c6d6f612ff
4
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int iInputNum=0; int iMapFlag=0; String sInputStr; String sOutputStr=""; while((iInputNum=sc.nextInt())!=0){ TreeMap<String,Integer> map=new TreeMap<String,Integer>(); int iMax=1; for...
03cffeb5-c3d1-440a-b9d7-cbcb4b01d0d5
2
public void setListener(PackageListener listener) { this.listener = listener; // This does not work well: the two separate // lists do not preserve the order in which // messages arrive. while(!statusBuffer.isEmpty()) { listener.addInput(statusBuffer.pop()); } while(!messageBuffer.isEmpty()) { list...
e151f7d1-8548-47c3-8ef9-692063e6c99b
2
private double[][] getLay(double lay[][], int numberLay) { for (int i = 0; i < HEIGHT; i++) { for (int j = 0; j < HEIGHT; j++) { lay[i][j] = yCbCr[i][j][numberLay]; } } return lay; }
1f5dd6bb-7db6-4066-8fbc-87e1db238758
4
private Halfedge getHash(int b) { Halfedge halfEdge; if (b < 0 || b >= _hashsize) { return null; } halfEdge = _hash.get(b); if (halfEdge != null && halfEdge.edge == Edge.DELETED) { /* Hash table points to deleted halfedge. Patch as necessary. */ ...
7efb4d35-c8e0-459c-b306-bef44b0cbeb1
3
private EditorMap erstelleEditorMap(Raum[][] raumArray) { EditorMap result = new EditorMap(raumArray.length, raumArray[0].length); GridButton[][] buttons = result.getButtonArray(); for(int y = 0; y < raumArray[0].length; ++y) { for(int x = 0; x < raumArray.length; ++x) { Raum raum = raumArray[x][y];...
95612f79-df27-416f-b74a-f50af31e4b1d
1
public void interactWithCastle() { Hero hero = getActivePlayer().getActiveHero(); System.out.println("interact with castle "+hero+", "+hero.isInCastle()); if (hero.isInCastle()) { WorldMapObject castle = wmap.getObjectAt(hero.getX(), hero.getY()); castle.stand(hero, getActivePlayer()); } }
5e35a523-2435-4c69-adfb-4323cc8898d1
0
public CipherDataType createCipherDataType() { return new CipherDataType(); }
d6a7678d-e7ed-42d4-91b4-75b1f61a9e07
4
private void analyze(Component root){ SingleTreeModel treeModel = new SingleTreeModel(root); treeModels.add(treeModel); if (treeModels.size() == 1){ oldComboBox.setSelectedIndex(0); }else if (treeModels.size() == 2){ oldComboBox.setSelectedIndex(-1); o...
cbd7da61-ed74-4a7f-84d4-29e9f2baeae6
2
public static List<ActionCom> selectActionCom() throws SQLException { String query = null; List<ActionCom> Action = new ArrayList<ActionCom>(); ResultSet resultat; try { query = "SELECT * from ACTION_COM "; PreparedStatement pStatement = (PreparedStatement) Conn...
ed8b3365-dc3c-482e-8d6a-1751e3e911f3
3
private void activity_submit_buttonActionPerformed( java.awt.event.ActionEvent evt) {// GEN-FIRST:event_activity_submit_buttonActionPerformed // public Activity(String n, String sol, String lang, boolean p, boolean g) boolean prog; boolean group; if(activity_type_combo.getSelectedItem().toString().equalsIgnore...
64cb7c5a-1ed1-4630-bb85-88a03c1081c8
5
private boolean isWin(){ for (int i = 0; i < model.getField().size; i++) { if(isColWin(i)) return true; if(isLineWin(i)) return true; } if(isCrossWin()) return true; if(turn < MAX_TURNS) return false; else return true; }
4c7acaff-e695-4353-be5f-c7d38a29494c
8
private void zoomAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomAllButtonActionPerformed int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; int maxX = 0; int maxY = 0; Element minEX = null; Element minEY = null; Element ma...
0002b7c6-d8e0-43f6-b776-91b84b52523b
9
public static String limitToTen(String pastPrices) { // TODO Auto-generated method stub if (pastPrices.contains("Split")) System.out.println("**S-->" + pastPrices); if (pastPrices.equals("HISTORIC")) return "#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_#_#_#_#@#_#_#_#_#_...
8c1afbac-e027-4ca5-b321-d6cfbb5965c3
2
@Override public void dispose() { if (!mIsClosed) { try { saveBounds(); super.dispose(); } catch (Exception ex) { // Necessary, since the AWT appears to sometimes spuriously try // to call Container.removeNotify() more than once on itself. } mIsClosed = true; } }
0af1e889-f340-4e4f-b853-d1db68589b01
3
public Vector<Identifier> getMultiKey(Identifier identifier) { Vector<Identifier> hash = new Vector<Identifier>(); Vector<Identifier> one = new Vector<Identifier>(); one.add(identifier); for (Entry<Identifier, HashSet<Vector<Identifier> > > ii : rules.entrySet() ){ ...
5e07a8db-bba9-464f-b123-5560f6c54afe
7
@Override public Command planNextMove(Info info) { //List<InfoDetail> seznamGranatu = info.getGrenades(); //udaje meho tanku int tanX = info.getX(); int tanY = info.getY(); int tanDir = info.getDirection(); //projizdim seznam granatu ...
abdd3040-2916-4ff0-bdc9-16728ba1ecd7
8
static private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { cas...
253a6253-86c6-4ce1-94aa-51533f55a0e5
6
private double arbitrary (double n) { if ( n <= 10 && n < d) { return 0; } else if ( n <= 10 ) { return 1; } double result; int first = getFirstDigit (n); // We don't want the actual log, we want the log of the highest power of 10 lower // than this number; casting to an int drops the decimal part which a...
b2cbba10-21ae-48fe-b689-bdacda0ce694
4
public void handleKeyRelease(int value) { switch (value) { case MinuetoKeyboard.KEY_UP: this.keyUp = false; break; case MinuetoKeyboard.KEY_LEFT: this.keyLeft = false; break; case MinuetoKeyboard.KEY_RIGHT: this.keyRight = false; break; case MinuetoKeyboard.KEY_DOWN: this.ke...
a85f9930-8ac3-42f0-ba32-7b3411869607
6
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof LabeledInstance)) return false; final LabeledInstance labeledInstance = (LabeledInstance) o; if (instance != null ? !instance.equals(labeledInstance.instance) : labeledInstance.instance != null) return false; if (labe...
7ae3370e-5f4a-4500-91ba-eb20d0d6473b
1
public final EsperParser.if__return if_() throws RecognitionException { EsperParser.if__return retval = new EsperParser.if__return(); retval.start = input.LT(1); Object root_0 = null; Token IF31=null; EsperParser.condition_return condition32 =null; EsperParser.stateme...
7e51f6e3-abc0-4489-82c0-634be114de36
4
private static void defineSeleccion(String seleccion) { if (seleccion.equals(opcionesMenu[0])){ Path path = Paths.get(textfile); writeDataInFile(path, 0); showMenu(); }else if (seleccion.equals(opcionesMenu[1])){ Path path = Paths.get(bytefile); ...
fd1cfb77-2c1f-4bb8-8fde-b1f706bd3d4d
0
public String getDepotlegal() { return depotlegal; }
6b28bbb2-f764-476e-b440-ccfc8ea660e3
8
public boolean equals(Object other) { if (other instanceof Pair) { Pair otherPair = (Pair) other; return (( this.first == otherPair.first || ( this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && ( this.second == otherPair.second || ...
74c97c16-015d-40a1-8a10-0d864b0cda14
8
protected static void check_unused() { terminal term; non_terminal nt; /* check for unused terminals */ for (Enumeration t = terminal.all(); t.hasMoreElements(); ) { term = (terminal)t.nextElement(); /* don't issue a message for EOF */ if (term == terminal.EOF) continue; /* o...
278807c9-5b84-45b0-a9c8-6381fe14d412
2
public ArrayList<Card> getCreatures() { ArrayList<Card> creatures = new ArrayList<Card>(); for (Card c : this.permanents) { if (c.getTypes().contains("Creature")) { creatures.add(c); } } return creatures; }
cae76191-0edb-4f0a-9d12-3eb2387eafcb
3
private void deselectToolbarButton(JToggleButton sauf){ for(Component comp: toolbar.getComponents()){ if(comp instanceof JToggleButton && comp!=sauf){ ((JToggleButton) comp).setSelected(false); } } sauf.setSelected(true); }
790a431f-ebf5-4476-b2d5-e080d6188e6e
9
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (ch != null) { String s = new String(ch, start, length).trim(); if (product == null || s.length() < 1) { return; } else { if (qName.equalsIgnoreCase(ProductsConstants.PROVIDER.getContent())) ...
e4c4506d-3287-4601-a71a-d6b358446e66
5
public static boolean addComboData(String aCombo) { File f = new File(FILE_NAME); if (!f.exists()) { try { if (!f.createNewFile()) { return false; } } catch (IOException ex) { Logger.getLogger(ComboElemPersistenc...
d98403ef-36f1-4f3b-b296-1b61482ce66f
1
@Override public void logicUpdate(GameTime gameTime) { for (Entity entity : entityList) { processEntity(entity, gameTime.getElapsedTimeMilli()); } }
013b9472-5487-452f-a659-4a441865a6d2
9
@Override public void mouseClicked(MouseEvent arg0) { // int x = arg0.getX()/currentMap.getWidth(); // int y = arg0.getY()/currentMap.getHeight(); int x = arg0.getX() / TILE_DIMENSION; int y = arg0.getY() / TILE_DIMENSION; if (theGame.canPlaceTower(x, y) && theGame.getIsPlacingTower()) { theGame.c...
1a40c764-efbc-4d20-985f-1c84142ee993
1
@Override protected void createForm() { RadarGraphPrimitive prim; prim = new RadarGraphPrimitive(x-widthDest, y, 8, 8, 0, 0, "Select"); primitives.put(prim.getName(), prim); for (MassAttractObject3D obj : world.getSystem()) { prim = new RadarGraphPrimitive(x-widthDest, y,...
5fa86b2e-ca8e-4eea-aceb-61e4754b871d
1
public void attachClean(Record instance) { log.debug("attaching clean Record instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.lock(instance, LockMode.NONE); tr.commit(); session.flush(); session.close(); log.debug("attach successful"); }...
e8af00a0-12a0-4812-b877-d85ffad702c0
1
public Boolean isEmpty() { return (head == null) ? true : false; }
cf700025-3c08-4969-8c0e-14b4cf3a051b
4
private void fixGenome() { boolean[] digitMap = new boolean[DIGIT_COUNT]; for (int i = 0; i < DIGIT_COUNT; ++i) { digitMap[numbers[i]] = true; } int unusedDigit = 9; boolean[] collisionMap = new boolean[DIGIT_COUNT]; for (int i = 0; i < DIGIT_COUNT; +...
568870b3-1802-489c-8953-c21ee80e2bf0
5
public void controllerButtonPressed(int controller, int button) { if (button == Controls.GAMEPAD_START) { for (Player p : players) { if (!p.getControls().isUseGamepad()) { for (Player pr : players) if (pr.getControls().getGamepadNumber() == controller) return; ...
ada51101-2f95-46df-aefc-26bc18f2ffa2
4
@Override public boolean isNotArcherFortify(){ if(type.equals(GameConstants.ARCHER) && this.getDefensiveStrength() == defenseStrength) { setIsNotFortify(true); return isFortify; } else if (type.equals(GameConstants.ARCHER) && this.getDefensiveStrength() != defenseStrength) { return isFortify; } else...
bf6ec509-df27-4af9-865b-72ba60b4054b
0
Incrementable getCallbackReference() { return new Closure(); }
98babf13-53ad-488c-b0b3-c2142e3851ee
9
private void findCutOff(double[] pos, double[] neg){ int[] pOrder = Utils.sort(pos), nOrder = Utils.sort(neg); /* System.err.println("\n\n???Positive: "); for(int t=0; t<pOrder.length; t++) System.err.print(t+":"+Utils.doubleToString(pos[pOrder[t]],0,2)+" "); System.err.println...
dbd5e490-3074-4e96-83ab-7de9d1a29ba1
7
public Object createProxy(Class<?> type) { Object proxy = null; try { final javassist.util.proxy.ProxyFactory pf = new javassist.util.proxy.ProxyFactory(); pf.setSuperclass(type); final MethodHandler methodHandler = createMethodHandler(); proxy = pf.create(new Class<?>[0]...
0485ce87-6575-4f10-a354-26b07099dc25
3
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { int numeroDelUsuario = Integer.valueOf(campoNumero.getText()); if (numAleatorio < numeroDelUsuario) { campoPista.setText("El número es menor que " + nume...
c2855c7f-ba90-4af0-8c40-7e2b201b40ec
9
protected void setAll(PreparedStatement pstmt, int i, Field field) throws SQLException { double d; try { switch (field.getTypeFormat()) { case STRING: pstmt.setString(i, field.getBuffer()); break; case INTEGER: d = Double.parseDouble(field.getBuffer()) * field.getCoeff...
bb227b99-6255-4e1e-88a1-ef9616c3d77c
1
public static void remove(SnmpAgent snmpAgent) throws IOException, InterruptedException { snmpAgents.remove(snmpAgent).getIP(); activeAgents--; if (activeAgents == 0) { snmp.close(); t.join(); } }
95ef07b5-c849-4bfe-b8a3-349defcca9eb
9
public void setZeroes(int[][] matrix) { HashSet<Integer> col = new HashSet<Integer>(); HashSet<Integer> row = new HashSet<Integer>(); if (matrix.length == 0) return; if (matrix[0].length == 0) return; for (int i = 0; i < matrix.length; i++) { for (in...
b4a21dd6-b5c9-4fd8-8a9e-21e647d90bff
1
public static String returnAsyncAPICallResult(int id, boolean remove) { if(remove) return asyncResults.remove(id); return asyncResults.get(id); }
3429cf6c-cc0d-4756-b43f-cd7700ee4d8f
6
public Shader(String vertPath, String fragPath) { int vertShader = 0; int fragShader = 0; canShade = false; try { vertShader = createShader(vertPath, ARBVertexShader.GL_VERTEX_SHADER_ARB); fragShader = createShader(fragPath, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB); } catch (Exception e) { ...
ada0d286-0ae6-4978-8d36-bffef5fffe2f
4
public int loggingCheck(String nr_lekarza, String password) { String hashpass = null; String pass2 = encode.encode(password); int status; try { String pyt = "SELECT * from lekarze where nr_lekarza=?"; PreparedStatement check = getConn().prepareStatement(pyt); ...
c8b415c2-10d6-48f9-ba2f-88dbf6ca9480
8
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String funcion = request.getParameter("funcion"); ...
2f1feeba-40f6-4c85-89c5-2f98cd7c8d99
0
public final Color getPolygonColor() { return polygonColor; }
e5042a9e-bca7-4480-bc73-3e6d0b99c83a
3
public boolean isValidMaterial(Material m) { if (!m.isBlock()) return false; Iterator<Material> i = DisallowedTypes.iterator(); while (i.hasNext()) { if (i.next().equals(m)) return false; } return true; }
888f1a6c-a9cb-421d-a09e-ffea7cb8a7e4
0
@Override public void addAppender(LoggerAppender appender) throws Exception { doAddAppender(appender); }
4076bcec-fecc-449b-b488-278ce3a83b1b
6
protected int handleInput(Automaton automaton, AutomatonSimulator simulator, Configuration[] configs, Object initialInput, List associatedConfigurations) { JFrame frame = Universe.frameForEnvironment(getEnvironment()); // How many configurations have we had? int numberGenerated = 0; // When should the nex...
48f8a704-c21d-48fe-a1c1-05f93e092dcd
2
public static void insertStation(Station station) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("insert into station (serialNumber, etat, latitude, longitude) values (?,?,?,?)"); stat.setString(1, station.getSerialNumber()); stat...
8f9ab7d6-89dd-442d-b4ad-c5902cecf833
9
@Override public void writePortable(PortableWriter writer) throws IOException { if(dateProperty != null) { writer.writeLong("dateProperty", dateProperty.getTime()); } if(intProperty != null) { writer.writeInt("intProperty", intProperty); } if(longPrope...
0b6fbf69-a1cc-4a4c-9946-aef1b7857e03
1
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); JSONTokener x = new JSONTokener(string); while (x.more()) { String name = Cookie.unescape(x.nextTo('=')); x.next('='); jo.put(name, Cookie.unescape(x....
ce7dfac9-f52c-4e10-a2b1-d5843aa0e504
7
@Override public final void setGameBoard() { gameBoard.setLayout(new GridLayout(PlayerInterface.LETTERS.length, PlayerInterface.NUMBERS.length)); grid = new JButton[PlayerInterface.LETTERS.length][PlayerInterface.NUMBERS.length]; for (int j = 0; j < PlayerInterface.LETTERS.length; j++) { for (int i = 0; ...
d480ced0-ba4c-488d-8361-3a79ed5c7675
9
public static String dateFormatFix(String str) { if (str.indexOf("M") != -1 && str.indexOf("MM") == -1 && str.indexOf("MMM") == -1) { str = str.replaceAll("M", "MM"); } if (str.indexOf("d") != -1 && str.indexOf("dd") == -1 && str.indexOf("ddd") == -1) { str = str.replaceAll("d", "dd"); } if (str.indexOf...
b44fd5a0-c4ee-496f-93f8-d4371f6b1134
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
6a428038-fde0-45ae-af67-413296060de8
2
public String getNameByUID(Statement statement,String UID)//根据用户名获取邮箱 { String result = null; sql = "select name from Users where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("name"); } } catch (SQLException e) { Syste...
b70b9741-3e6d-44a6-8d84-4bd527723b25
8
@Override public void receive(Message m){ // Get the process ID from the message int processID = m.getSource(); long time = System.currentTimeMillis(); String[] messageParts = m.getPayload().split(" "); // Get payload information for heartbeat ID and when heartbeat was sent int heartbeatID = Integer...
0e8f4555-a52e-4a73-ba13-6c017cd37fee
3
private boolean jj_3R_29() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(29)) { jj_scanpos = xsp; if (jj_scan_token(30)) { jj_scanpos = xsp; if (jj_scan_token(31)) return true; } } return false; }