method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
837b3a45-3c0c-4cd9-a39a-681bcc053c7b
1
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_Q...
0a57c5d2-3b83-4f6c-93d2-432c00b6c397
9
public Vector<BigComplex> roots(int digits) { RatPoly mon = monic() ; Random rand = new Random() ; MathContext mc = new MathContext(digits+3, RoundingMode.DOWN) ; Vector<BigComplex> res =new Vector<BigComplex>() ; final int d = m...
67898c69-3999-478f-8831-d650e0e20936
6
@Override public SetOfSentences doProcess(SetOfSentences sos) { ArrayList<Eojeol[]> eojeolSetArray = sos.getEojeolSetArray(); LinkedList<Eojeol> eojeolArray = new LinkedList<Eojeol>(); for (int i = 0; i < eojeolSetArray.size(); i++) { Eojeol[] eojeolSet = eojeolSetArray.get(i); eojeolArray.clear(...
9cd29ad1-d57a-406f-ab7f-f478793c914a
0
public String getAge() { return age; }
83510dfe-fa87-407c-b1e2-4829b9b7eed3
4
private void drawMoleculesInPlay() { drawMoleculesFromList(inPlayOne); drawMoleculesFromList(inPlayTwo); drawMoleculesFromList(inPlayThree); drawMoleculesFromList(inPlayFour); if (startingArrowStrand[0] != null) startingArrowStrand[0].paintArrow((Graphics2D) bufferGraphics, this); if (startingArrowStrand[...
33271024-e981-4bf9-9ac0-ebec7cd8f82a
1
public void testDividedBy_int() { Seconds test = Seconds.seconds(12); assertEquals(6, test.dividedBy(2).getSeconds()); assertEquals(12, test.getSeconds()); assertEquals(4, test.dividedBy(3).getSeconds()); assertEquals(3, test.dividedBy(4).getSeconds()); assertEquals(2, te...
e92b7a56-06e3-4261-a67f-9c122c0ca1b6
1
public static void remember(ScannedRobotEvent event) { if (!log.containsKey(event.getName())){ log.put(event.getName(), new ArrayList<RobotIntel>()); //add new robot to map } log.get(event.getName()).add(new RobotIntel(event)); }
4980c897-affe-4eb4-99d2-65a24a94de1b
4
@Override public TVenta mostrarVenta(int ID) throws Exception { Statement query = null; Connection connection = null; TVenta ret = new TVenta(); String contenido_query = "SELECT * FROM Ventas WHERE id_ventas=" + ID + ";"; try {...
eb9575b1-9e19-4b3c-a2f2-2e43c327766f
6
public boolean removeFirst(T data) { if (head == null) { return false; } if (head.getData().equals(data)) { if (head == tail) { head = null; tail = null; } else { head = head.getNext(); head.setPr...
5b8ab559-2ad4-40d7-98f1-fd4c8ade42d3
5
public static boolean processMegaphone(final MapleClient c, final String msg) { String message = msg.toLowerCase(); if (msg.length() > 100) { c.showMessage("[Anbu] toobad so sad. not over 100 characters. :P"); c.getSession().write(MaplePacketCreator.enableActions()); ...
07203cf3-ee42-417e-bf08-66bf81242f05
8
public void unitize() { assert (vertices != null); float maxx, minx, maxy, miny, maxz, minz; float cx, cy, cz, w, h, d; float scale; /* * get the max/mins */ maxx = minx = vertices.get(1).x; maxy = miny = vertices.get(1).y; maxz = minz ...
b9fb07d9-ae7b-44bb-ab6b-b195351a9d55
7
public static void runTests() { String filename = "./data/"; for(int targetLength = 10; targetLength <= 50; targetLength += 10) { //make the target string String target = ""; for(int i = 0; i < targetLength; i++) { target += "1"; } for(int numGen = 20; numGen <= 1000; numGen += 20) { for(in...
a44194dd-2c86-4e8b-86ae-a6798049d023
6
@Override public void onUpdate(World apples) { if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y)) { alive = false; //apples.explode(X, Y, 32, 8, 16); } for (Player p:apples.playerList) { if (maker!=p.ID&&p.checkCollision((int)X, (...
0fc5211a-7144-4a17-b893-f3903b8fe0e5
3
public LinkedHashMap<Integer, Compra> cargarCompraDOM(String rutaFichero) { rutaFichero = rutaFichero + ".xml"; LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>(); try { File xmlFile = new File(rutaFichero); DocumentBuilderFactory documentFactory = DocumentBu...
f5eed2d7-3b89-4aa3-ae1d-08692349efcc
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Edge other = (Edge) obj; if (p1 == null) { if (other.p1 != null) return false; } else if (!p1.equals(other.p1)) return false; if (p...
98ed2d0d-d480-40c2-baaf-6206d6532393
9
protected PointInSetQuery(String field, int numDims, int bytesPerDim, Stream packedPoints) { this.field = field; if (bytesPerDim < 1 || bytesPerDim > PointValues.MAX_NUM_BYTES) { throw new IllegalArgumentException("bytesPerDim must be > 0 and <= " + PointValues.MAX_NUM_BYTES + "; got " + bytesPerDim); ...
7f027efb-b337-402c-88df-0a66f820752d
4
public static ArrayList<Integer> getVersionParts( String version ) { ArrayList<Integer> parts = new ArrayList<Integer>(); if( version == null ) return( parts ); for( int i = 0; i < versionPatterns.length; i++ ) { Matcher m = versionPatterns[ i ].matcher( version ); ...
c38c73e8-385d-4c47-b78f-aadf55a6bd7a
2
@Override public Double validate(String fieldName, String value) throws ValidationException { if (value == null) { return null; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ValidationException(fieldName, value, "not a valid double", e); ...
7fc90571-28e4-4e14-a81a-5deb217d16f8
8
public int getBoardCommentaryCount(int idx) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs =null; int result = 0; String sql = ""; try{ conn = getConnection(); sql = "select count(*) from boardcommentary where idx=?"; pstmt = conn.prepareStatement(sql); ps...
605c495a-c16d-4ba1-88f4-6f9f393b27f4
7
public static void others(String[] args) { Scanner in = new Scanner(System.in); int cnt = 0; while (true) { cnt++; a = in.nextInt(); b = in.nextInt(); if (a == 0 && b == 0) break; System.out.println("Jury #" + cnt); p = new short[a + 1]; d = new short[a + 1]; for (int i = 1; i <= a; i+...
48402d13-7e95-4ed2-b064-3a8ea4e89ff6
8
public void putAll( Map<? extends Byte, ? extends Long> map ) { Iterator<? extends Entry<? extends Byte,? extends Long>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Byte,? extends Long> e = it.next(); this.put( e.getKey(), e....
7d69ba0e-640f-4d19-bd71-745a2f9e6784
2
public static int Cardinality(Object obj, Collection<Auction> coll){ for(Object o : coll){ if(o.equals(obj)){ total++; } } return total; }
bea81ed1-dfa1-4363-9361-0436bb6ef226
1
@Override public void mouseMoved( MouseEvent e ) { for( MouseMotionListener listener : listeners( MouseMotionListener.class )){ listener.mouseMoved( e ); } }
1bb5f0fb-baae-4ac1-b148-a3cdf6dcffd5
7
private void incrementServerCount() { BufferedReader br = null; int count = -1; try { String sCurrentLine; br = new BufferedReader(new FileReader("backup_files/serverCount")); while ((sCurrentLine = br.readLine()) != null) { count = Integer.parseInt(sCurrentLine); } } catch (IOExc...
aa7aeef0-3ffa-44b9-9826-e910d47fe73d
8
private static StatoDelGioco creaStatoDelGiocoEliminazioneGiocatore() { StatoDelGioco statoDelGioco = creaStatoDelGiocoDistribuzioneCarte(); List<Giocatore>giocatoriDaEliminare=new ArrayList<Giocatore>(); for(int i=0;i<statoDelGioco.getGiocatori().size();i++){ if(statoDelGioco.getGiocatori().get(i).getDanari()...
a33bb1f4-11f1-45dc-af8d-5ae8d126fa2d
0
public int hashCode() { return getClass().hashCode() ^ start.hashCode(); }
2a0e6448-a62b-4af0-9757-a3ea33357ac7
2
private void readFromFile() { try { knowledgeBuilder.add(ResourceFactory.newReaderResource(new FileReader(new File(System.getProperty("user.dir") + "/res/rules", "lighterRules.drl"))), ResourceType.DRL); } catch (FileNotFoundException e){e.printStackTrace();} if (knowled...
8a2944bd-f85f-4c02-8744-39c129a199d5
3
int select_roulette(double probs[], double sum) { double acum = 0; int res = 0; double tope = rnd.nextDouble()*sum; while(res<probs.length && acum < tope) { acum += probs[res++]; } if(res==probs.length) res--; return res; }
6f9e8e73-214c-441b-994d-ab36e2ec6f91
3
private static String smallPattern(HackResult hackResult) { int sumResoCount = 0; int sumXmpCount = 0; for(HackItem hackItem : hackResult.hack.items) { switch ( hackItem.object ) { case RESO: sumResoCount += hackItem.quantity; break; case XMP: sumXmpCount += hackI...
d45dc07f-f732-435d-91da-80c6980a8acb
4
@Test public void testGetinfo() { expected_str1="2009-05-20 14:54:55 1069"; expected_str2="2008-06-21 15:04:16 1000"; expected_str3="Rank 1358"; expected_str4="2816 1 1"; info.init("lantian66"); info.getinfo(); try{ file=new File("E:\\doc\\lantian66_profile.txt"); br=new BufferedReader(new FileRea...
4874dc61-023e-4af6-a5dc-2dac9a2bc887
1
public static ctrlDisco getInstance() { if (INSTANCE == null) { creaInstancia(); } return INSTANCE; }
4f32494b-843c-45d5-a22b-e82cc42a3f8f
9
@Override public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } ITestId...
a063e135-76ce-428c-b403-ae9c25789ece
2
@Override public Label predict(Instance instance) { // TODO Auto-generated method stub int feaIndex =0; int result = 0; double minDistance = Double.MAX_VALUE; for (FeatureVector cluster : clusters) { if (MathUtilities.SquaredL2Distance(cluster, instance) < minDistance) { minDistance = MathUtilities.Sq...
ee321e08-cd54-401e-bc2e-1e205ec26a1c
2
public void setValue(String button, String stringValue) { float value = Float.parseFloat(stringValue); System.out.println("float value" + value); int milis = (int) (value * 1000); if(button == "start time"){ loop.setBeginTime(milis); }else if(button == "end time"){ loop.setEndTime(milis); } }
7726d0d8-7db3-42ba-badd-1e433ddf0036
9
private static String _post(nitro_service service, String request, String objtype) throws Exception { HttpURLConnection httpURLConnection; StringBuilder responseStr = new StringBuilder(); try { String urlstr; String ipaddress = service.get_ipaddress(); String sessionid = service.get_sessionid(); S...
81197485-dfbb-47f4-83e2-eb0b47238a47
1
public void testEmptyRowCheck() { DataSet ds; final String cols = "column1,column2,column3\r\n,,"; // check to see if the flag empty rows works Parser p = DefaultParserFactory.getInstance().newDelimitedParser(new StringReader(cols), ',', FPConstants.NO_QUALIFIER); p.setFlagEmpty...
08d1ae4a-ad8d-4e37-9b27-22a94652425d
4
public TorrentHandler(TorrentInfo torrentInfo, String outputFile){ this.torrentInfo = torrentInfo; this.file = outputFile; this.pieces = new HashMap<Integer, Piece>(); this.recieved = new boolean[this.torrentInfo.piece_hashes.length]; for(int i = 0; i < this.torrentInfo.piece_hashes.length; i++){ int...
392b0246-c8d2-4e35-8773-4812c470d370
8
public void physics(){ if(target.inGame() && target != null && ammoType.equals("Missile")){ rotate(); } x += Math.cos(rotation) * speed; y += Math.sin(rotation) * speed; checkHit(); ammoTimeOut ++; if(ammoTimeOut > 1000){ tower.removeFiredAmmo(this); } ...
96c208bc-df84-47d3-9cb4-1cfe23a43117
2
public void setCheckType(String checkType) { this.checkType = checkType; try { if (checkType.equals(XMLChecker.VALID)) { reader.setFeature("http://xml.org/sax/features/validation", true); } else { reader.setFeature("http://xml.org/sax/features/validation", false); } } catch (Exception e) { ...
d5c79da2-9738-40b4-9ddf-7d535019af9e
1
public void parse() throws BadBytecode { int n = numOfEntries; int pos = 2; for (int i = 0; i < n; i++) pos = stackMapFrames(pos, i); }
03a02e41-e2f8-4fe5-8b6e-cc1bf6c97d00
0
public int getSourceEnd() { return _sourceEnd; }
a091b189-6454-40a6-9404-0e6fb9ee492c
4
private static boolean isValidContentType(URLConnection connection) { String type = connection.getContentType(); boolean isValid = true; if (type != null && type.length() >= 5) { String category = type.substring(0, 5); isValid = !category.equals("image") && !category.equa...
4a50ce1b-b2df-4be3-b56c-953d8974a359
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent(); if (node.getUserObject() instanceof Asset) { //save asset on to new element ...
3c3ae5fe-4f9b-40f7-9587-a518f01b0e23
2
@Override protected void reactPressed(MouseEvent event) { ProgramState curr = StateMachine.getState(); if (curr == ProgramState.EDITING) newSong(); else if (curr == ProgramState.ARR_EDITING) newArrangement(); }
8adb2905-cbff-4fb6-8e32-0af7f2fcb37f
1
public static BlazemeterApi getInstance() { if (instance == null) instance = new BlazemeterApi(); return instance; }
699d625b-66a5-411d-b795-24e4bffd3e13
4
public boolean startup2() throws IOException { String userId = node.getUserId(); RPCMessageFactory messageFactory = node.getMessageFactory(); NodeSecurityAgent securityAgent = node.getSecurityAgent(); StringBuilder buffer = new StringBuilder(); buffer.append("\nStarting init...
29abd3dd-fdd0-4dbb-a926-afc09002bb9f
0
@Test public void removingLastVertex() { l.addVertex(v); l.removeVertex(0); assertNull(l.getNeighbours(0)); }
1ef72a80-405e-463a-8a36-2df87c418ebd
4
@Override public void setToNative(long i, Object value) { if (value == null) { objectLengths.setShort(i, (short) -1); } else { byte[] ba = toByteArray(value); if (ba.length > maxObjectLength) { throw new IllegalArgumentException("Object " + va...
ee1bfebb-4075-44cc-ace0-98f9cfe9e0c7
7
public static void abort() throws IOException { CoordinatorGUI.textArea.append("One or more nodes did not respond or said it wasn't ready..." + "\n" + "\n"); if (abortCounter >= maxAborts) { CoordinatorGUI.textArea.append("Reached maximum number of timeouts and rejections by nodes..." + "\...
8fe18222-f6d7-4ba9-8e50-0e4e84cb92e9
5
private int getKPower(int priority) { int k = 0; if (priority <= POWERS_OF_TWO[0]) k = 0; else if (priority > POWERS_OF_TWO[POWERS_OF_TWO.length - 1]) { k = POWERS_OF_TWO.length + 1; } else { for (int i = 1; i < POWERS_OF_TWO.length - 1; i++) { if (priority > POWERS_OF_TWO[i - 1] && priority...
a8f8379d-840d-4888-a0bc-1ee99f4364d6
8
public String register(User userEntity){ Boolean check = true; //check all the userEntity fields if(userEntity.getAddress().equals("")||userEntity.getCreditcard().equals("")||userEntity.getEmail().equals("")||userEntity.getFirstname().equals("")||userEntity.getLastname().equals("")||userEntity.getPassword()....
7dd2baf6-7fd6-48a8-95b6-ca49afba941a
1
public static String formater(String source){ String destination = source.substring(0, 2) ; for(int i = 1 ; i < 5 ; i++){ destination = destination + " " + source.substring(2 * i, 2 * ( i + 1)) ; } return destination ; }
eae6bd70-40e2-40f3-835a-d733c7a124de
3
public void render(Screen screen) { if (window == 1) screen.setOffset(6 * 8, 0); //Font.renderFrame(screen, title, 1, 1, 12, 11); renderItemList(screen, 1, 1, 12, 11, container.items, window == 0 ? selected : -oSelected - 1); //Font.renderFrame(screen, "inventory", 13, 1, 13 + 11, 11); renderItemList(screen,...
43f3e67c-b5ce-49e2-ab24-f32632450a6e
5
public void selectionEquipement() { int indexArme = listeArme.getSelectedIndex(); int indexEquipement[] = listeEquipements.getSelectedIndices(); int indexEquipementMagique[] = listeEquipementMagique.getSelectedIndices(); if(indexArme >= 0 && indexEquipement[0] >= 0 && indexEquipeme...
1aa52048-ce62-4892-b985-6cc819487644
3
private void downloadFile() { FTPClient client = new FTPClient(); FileOutputStream fos = null; try { client.connect("ftp.site.com"); client.login("username", "password"); // Create an OutputStream for the file String filename = "test.txt"; fos = ne...
c58971a5-9d3e-405d-a442-17de6ff2e2e6
8
public void run(){ try{ socket.setSoTimeout(5000); username = in.readLine(); if(server.clients.hasUser(username)){ out.println("Chat has already user with name " + username); System.out.println("Socket closed: " + socket); server.addMsgToMsgsQueue("Socket closed: " + socket); socket.close(); ...
29db15e8-bdb7-4c17-bcfc-6a5f84164c26
2
public void saveToFile() { boolean writeSuccess; String fileName = selectFile(MODE_SAVE); if(fileName !=null) { writeSuccess = write_serialize(fileName); if (writeSuccess) { String message = "Game state successfully saved."; JOptionPane.showMessageDialog(null, message, "Game State", JOptionPane....
c360751d-9e4e-4361-b756-797fcd917122
5
public static void setMasterOutputVolume(float value) { if (value < 0 || value > 1) throw new IllegalArgumentException( "Volume can only be set to a value from 0 to 1. Given value is illegal: " + value); Line line = getMasterOutputLine(); if (line == null) throw new RuntimeException("Master output port no...
10ce0f94-e426-4aea-b2cd-44c43b31796d
3
private void AImovements() { int i = rand.nextInt(10); cwidth += 30; if (this.intersects(getWorld().getPlayer())) { follows = false; if (i < ((getWorld().getDiff() * 2) + 5)) { cwidth = 30; attack(); } if (i == 9) { backOff(this); backOff(this); } } else { follows = true; } ...
9c25bca2-03df-4ca4-9129-94bd32307a60
1
public Double get_coeffs_expertizes(int idP) { Double res = 0.0; //получить список дел,список статей, добавить коэфф for(int T:t_людиID_to_t_делаIDs(idP)) { res+=0.3; } //for() return res; }
524abed9-1fd0-4081-93da-6ae16e221ead
6
public static boolean nullLiteralWrapperP(Stella_Object self) { if (self == null) { return (true); } { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfIntegerP(testValue000)) { { IntegerWrapper self000 = ((IntegerWrapper)(self)); return (s...
6fe3f30b-b081-4004-9b86-0c019464c308
7
int[] getRowGaps(ContainerWrapper parent, BoundSize defGap, int refSize, boolean before) { BoundSize gap = before ? gapBefore : gapAfter; if (gap == null || gap.isUnset()) gap = defGap; if (gap == null || gap.isUnset()) return null; int[] ret = new int[3]; for (int i = LayoutUtil.MIN; i <= LayoutUtil...
dddd0261-3c83-4f9d-8f48-2053dae3e7e7
3
public void run() { while (true) { while (!_textureRequests.isEmpty()) { String name = _textureRequests.poll(); _loadedTextures.put(name, ResourceLoader .loadTextureDataFromFile(baseDir + name)); } try { Thread.sleep(100000); } catch (InterruptedException e) { } } }
ba715a78-292c-4014-9125-72a2d00593e4
9
public void updateUserProblem(Submission submission) { long userId = submission.getUserId(); long problemId = submission.getProblemId(); if (userId == 0 || problemId==0){ throw new IllegalArgumentException("user_id=["+userId+"], problem_id=["+problemId+"]. They cannot be 0."); } int us...
2fee2621-7f0f-4115-aa07-69b4d03d78f7
1
public JSONObject optJSONObject(int index) { Object o = this.opt(index); return o instanceof JSONObject ? (JSONObject) o : null; }
159c6ddc-996c-4433-a042-ac19fcd74729
6
public Move chooseMove(State s) { TreeNode.maxDepth = maxdepth; TreeNode rootNode = new TreeNode(); rootNode.setState(s); TreeNode.nowScore = (s.whoseTurn()=="red")?s.getnRed()-s.getnBlue():s.getnBlue()-s.getnRed(); if(rootNode.expand()==false){ return null; } rootNode.setPlayer...
b18329dd-c968-4e0d-9ff4-e78a44f4433f
2
private void affPtsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_affPtsActionPerformed if(points == false){ points = true; } else if (points == true){ points = false; } }//GEN-LAST:event_affPtsActionPerformed
c054e777-954f-43b1-996e-5f3aad95fff7
0
private void onOK() { NamesManager.getInstance().setNames(this.leftNameField.getText(), this.rightNameField.getText()); RoundManager.getInstance().setMaxRound(Integer.parseInt(roundsCountField.getText())); selectDataSource(); savePreferences(); dispose(); }
09a4ea85-6b99-4a60-8b94-f857db6ae119
1
public int climbStairs(int n) { int[] array = new int[n+1]; array[0] = 1; array[1] = 1; for(int i = 2; i <= n; i++){ array[i] = array[i-1] + array[i-2]; } return array[n]; }
a2c38bed-fe25-4ff0-b1ad-bc4ff723bab2
4
@RequestMapping(method = RequestMethod.POST) public ModelAndView postInputForm(WebRequest request) { ModelAndView mav = new ModelAndView(); mav.setViewName("inputform"); String firstName = StringValidator.cleanString(request.getParameter("firstName")); String lastName = StringValidator.cleanString(request.getP...
e98a0b8f-8e02-42a3-b3b8-25e932a1cf9a
7
public void paint(Graphics g) { //super.paint(g); if(bBuffer==null) { bBuffer=createImage(screenWidth,screenHeight); bBg=bBuffer.getGraphics(); } bBg.setColor(Color.WHITE); bBg.fillRect(0,0,screenWidth,screenHeight); switch(_state) { case state_Menu: case state_inGame: if(moveR...
e7f8f42e-f4e0-41c3-9331-b313de3ff6f5
9
public boolean sample() { if(rejectNonExact && curDist != targetDist) // reject sample if distance does not match exactly return false; String key = curAli.toString(); Integer cnt = sampleMap.get(key); if(cnt == null) { cnt = 1; // if(sampleMap.size()%100==99) // System.out.println("found: "+(sample...
57e3a581-d7a3-4e11-9b38-b738d6435569
4
private void init() throws Exception { // If this resource doesn't have any PEs then no useful at all if (resource_.getNumPE() == 0) { throw new Exception(super.get_name() + " : Error - this entity " + "has no PEs. Therefore, can't process any Gridlets."); ...
e0c332a7-46d6-46fa-b3df-aba940a718c1
8
public int score(Player p) { int rScore = 0; int bScore = 0; for (int row = 0; row < 5; row++) { for (int col = 0; col < 5; col++) { switch (status[row][col]) { case RED: case RED_DEFENDED: rScore += 1; break; case BLUE: case BLUE_DEFENDED: bScore += 1; default: bre...
20d39d62-f5a4-4b64-a9d2-afde19329822
3
private Object handleAnci(Object tos, String ref) { if (tos instanceof Person && ((Person)tos).getAncestorInterestSubmitterRef() == null && ref != null) { ((Person)tos).setAncestorInterestSubmitterRef(ref); return new FieldRef(tos, "AncestorInterestSubmitterRef"); } return null; }
4b1a5bdc-7566-4f1f-bb52-1e83f49087cf
3
private void gridCoefficients(){ double[] xt = new double[4]; this.coeff = new double[this.nPoints][4]; double d1 = 0.0; for(int i=0; i<this.nPoints-1; i++){ d1 = this.x[i+1] - this.x[i]; xt[0] = this.y[i]; xt[1] = this.y[i+1]; xt[...
d109e9ed-21d0-451c-934f-d0e949a8aef9
3
private PlayerFlag getPlayerFlagOfPlayer(Player p) { for (Element e : grid.getElementsOnGrid()) if (e instanceof PlayerFlag) { PlayerFlag pf = (PlayerFlag) e; if (pf.getPlayerInfo().equals((PlayerInfo) p)) return pf; } return null; }
1c814edc-d959-4e5c-80a7-70366ad94dc7
2
public boolean contains(String code) { for (int i = 0; i < rows.size(); i++) if (code.equals((String) (rows.get(i)[1]))) return true; return false; }
bc62f3cd-4681-4f0d-a4e2-cf43c33e3e2c
4
static void SkipLexicalActions(Token matchedToken) { switch(jjmatchedKind) { case 53 : image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); comments++; break; case 54 : image.append(input_stream.GetSuffix(jjimageLen + (lengthO...
95693aac-711f-40de-b9b6-4f344ac1a5f9
7
protected void doHurt(int damage, int attackDir) { if (hurtTime > 0) return; if (level.player != null) { int xd = level.player.x - x; int yd = level.player.y - y; if (xd * xd + yd * yd < 80 * 80) { Sound.monsterHurt.play(); } } //level.add(new TextParticle("" + damage, x, y, Color.get(-1, 500, ...
61c040c0-23a1-4ae8-a9f7-d3a5c561c8f5
5
public static void testClassifier(String apiKey) throws NetworkException, AnalysisException { ClassifierManager manager = new ClassifierManager(apiKey); String testClassifierId = "java_test_classifier"; try { for (Category cat : manager.allCategories(testClassifierId).getCategories()) { System.out.pr...
46000fb7-b9c1-4bb8-ac08-87e3c3ad52f8
4
public File extractTheme(File zip) throws Exception { final int BUFFER = 2048; int count; String tmpFilePath = System.getProperty("java.io.tmpdir"); File outDir = new File(tmpFilePath, getFilename(zip) + System.currentTimeMillis()); byte data[] = new byte[BUFFER]; outDir....
f43a95ce-ed7f-4e27-bacc-d84720dcb9b1
4
private int[] stackDecode(DecodeHelper helper){ // init sentences SortedSet<StackSentence> list = new ConcurrentSkipListSet<>(); StackSentence hypo = new StackSentence(null, LanguageModel.SENTENCE_BEGIN_WORD, helper.sourceSentence, helper.dictionary, helper.targetLanguageModel, helper.lengthModel); // ...
6898c73f-da5d-4880-8bc9-0a51bd9c6399
3
private static void finish(Thread commandManagerThread, Thread messageReceiverThread) { try { log.info("commandManagerThread.join"); commandManagerThread.join(); log.info("commandManagerThread finish"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); l...
93c46061-0517-44d5-979d-1c359df6175f
5
private static void populateSMBL(SysBioMarkLang smbl, SpeciePool species, Program program) { smbl.setModel(new Model()); smbl.getModel().setId("GPGeneratedModel"); Species[] listOfSpecies = new Species[species.getSpecies().size()]; smbl.getModel().setListOfSpecies(listOfSpecies); for(Specie s: species.get...
69c9f688-e2f1-43b1-9425-db7497bde747
3
void addFeature(String typeStr, StringBuilder values, int lineNum) { Feature.Type type = Feature.Type.parse(typeStr); if (type == null) { if (debug) Gpr.debug("WARNING: Unknown feature '" + typeStr + "', not added."); return; } try { Feature newFeature = featureFactory(type, values.toString(), lineNum...
e6161149-ba44-437f-839c-02475ecf6170
5
public boolean addMember(String regionName, String member, World world) { ProtectedRegion target = _plugin.WORLDGUARD.getGlobalRegionManager().get(world).getRegion(regionName); String currentOwner = getOwnerName(regionName, world); boolean ret; if(!_plugin.getDBConnector().isForRent(regionName)) { _plugin.ge...
62c72aa1-272f-4b53-bb54-02dcd12a7a4a
8
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null) { return; } RoomItem Item = Room.GetItem(Main.DecodeInt()); if (Item == null) { ...
9d0a6012-655c-4336-9f62-047fba75c163
4
public void run() { deal(); for (int i = currentPlayer = 0; i < players.length; i++, nextPlayer()) currentPlayerChooseFaceUp(); startGame(); for (nextPlayer(); remainingPlayers.size() > 1; nextPlayer()) if (remainingPlayers.contains(Integer.valueOf(currentPlayer))) currentPlayerPlayTurn(); for (...
49440004-f215-4073-86c6-1c3bd8c7ec29
3
void makeLive(final Type type) { if (this.liveClasses.contains(type)) { return; } // Make type live and unblock all methods blocked on it CallGraph.db(" Making " + type + " live"); liveClasses.add(type); final Set blockedMethods = (Set) blocked.remove(type); if (blockedMethods != null) { final I...
81e9202a-2af5-47ae-b420-8b72c08a1f74
2
public void asetaEnsimmainen(Laskutoimitus ensimmainen) throws IllegalArgumentException, IllegalStateException { if (ensimmainen == null) { throw new IllegalArgumentException(); } if (seuraavaArvollinen == null) { throw new IllegalStateException(); } ...
2b531a45-d2d9-4149-b6ad-378f93982280
2
public String getLocationByPID(Statement statement,String PID)//根据PID获取停车场位置信息 { String result = null; sql = "select location from Park where PID = '" + PID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("location"); } } catch (SQLException ...
c77cd4bb-2efe-4129-a014-5d89f1e467d8
7
private double getSameWordValue(double SAME_WORD, String text) { // Replaces punctuation and more than one blank space with one blank space text = text.replaceAll("[ \\p{Punct}]", " "); text = text.replaceAll(" {2,}", " "); // Obtains words from the text String[] words = text.split(" "); // For each wo...
a89984d1-fc59-48e3-8492-34d11a53af03
1
public SignatureVisitor visitReturnType() { endFormals(); if (seenParameter) { seenParameter = false; } else { declaration.append('('); } declaration.append(')'); returnType = new StringBuffer(); return new TraceSignatureVisitor(returnType)...
f0552afa-1d99-41d2-8fce-1f094715b86d
5
private void manageMessage(int senderID, NetworkMessage nm) throws NetworkMessageException { switch (nm.messageType()) { case NetworkMessage.STRING_MESSAGE: manageStringMessage(senderID, (StringMessage) nm); break; case NetworkMessage.IDENTIFICATION_MESSAGE: manageIdentificationMessage(senderID, (Id...
9247ce71-3014-4194-98ac-698dddda6658
4
private void process_buffer() { for (int i = 0; i < this.interfaces; i++) { RouterBuffer buf = this.buffers.get(i); while (!buf.is_empty()) { try { //tempo de latência do roteador para processar pacote sleep((long) this.performance);//this.performance); } catch (InterruptedException e)...
23c44ccb-602d-4ae2-a8d8-e596ba931beb
9
@Override public Tuple exec(Tuple aInput) throws IOException { if (aInput == null) return null; TupleFactory tTupleFactory = TupleFactory.getInstance(); BagFactory tBagFactory = DefaultBagFactory.getInstance(); // processing target | 処理対象 DataBag tTarget = DataType.toBag(aInput.get(0)); DataBag tGroup...
7d112122-b6fd-4a40-8eeb-3ecbe4768d65
8
public static String findname(String line, String s){ int index = line.toUpperCase().indexOf(s); int index2, i, j, k; String ret = ""; if (index > -1){ index=Math.max(line.indexOf("=", index),line.indexOf("[", index)); if (index > -1){ i=line.indexOf(">", index); if(i==-1) i=line.lengt...
ceff16f7-3871-4faf-89d0-25e2ba5f350e
5
public TexturePackFilterDialog(final TexturepackPane instance) { super(LaunchFrame.getInstance(), true); this.instance = instance; setupGui(); getRootPane().setDefaultButton(apply); int textures = TexturePack.getTexturePackArray().size(); ArrayList<String> res = new Ar...
8bbe59a7-a940-4e27-9aae-9c06300f6fb6
5
@Override public Sijainti sijainti() { if(suhteellinenSijainti() == null) return tetrimino.sijainti(); switch(tetrimino.asento()) { case 0: return new Sijainti( (int)Math.round(tetrimino.sijainti().x() + suhteellinenSijainti().x()), (int)Math.round(tetrimino...