method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3997ff71-f285-4d45-ab97-b5a82a512189
4
public static Path writeMatrix(double[][] matrix, Path path, HamaConfiguration conf) { SequenceFile.Writer writer = null; try { FileSystem fs = FileSystem.get(conf); writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class, VectorWritable.class); for (int i = 0; i < matrix.length; i++) { ...
5aed241f-3484-445c-94fe-3adc86d33639
5
private SQLiteDriver(Plugin p, HashMap<String, String> c) { plugin = p; this.db = c.get("database"); this.prefix = c.get("prefix"); this.user = c.get("user"); this.pass = c.get("password"); this.dbg = (c.containsKey("debug")) ? this.parseBool(c.get("debug"), false) : false; String dbPath = "jdbc:sqlit...
820ff520-7046-4954-becc-6257d0010842
3
public String delete(String id){ HttpClient httpClient = new DefaultHttpClient(); HttpDelete httpDelete = new HttpDelete(Url+"&id="+id); String backRes = "-1"; try { HttpResponse httpResponse = httpClient.execute(httpDelete); int backCode = httpResponse.getStatusL...
e81dbe0f-a01d-4ce2-9bfc-29f55d671fcb
3
private static void printGridletList(GridletList list, String name, boolean detail) { int size = list.size(); Gridlet gridlet = null; String indent = " "; System.out.println(); System.out.println("============= OUTPUT for " + name ...
6019fe1d-b803-4c8c-87d3-dd6a6b8d5d99
5
public PointGame findAStupidPlace() { PointGame pointToPlace = null; // High Priority: form a mill. for (PointGame pt : Board.validPoints) { if (!Board.isOccupied(pt) && hasMills(pt)) { pointToPlace = pt; //System.out.println(pointToPlace); return pointToPlace; } } for (PointGame pt : Board....
56e62b51-f243-48c2-b0da-bf004e256d32
8
public static Hashtable getLargestConnectedSubgraph(GraphEltSet ges) { int nodeCount = ges.nodeCount(); if(nodeCount==0) return null; Vector subgraphVector = new Vector(); for(int i=0; i<nodeCount; i++) { Node n = ges.nodeAt(i); boolean skipNode=false; ...
d6618e64-fe0b-40e6-b115-167b4892d4eb
8
public List<Entity> getEntities(int x0, int y0, int x1, int y1) { List<Entity> result = new ArrayList<Entity>(); int xt0 = (x0 >> 4) - 1; int yt0 = (y0 >> 4) - 1; int xt1 = (x1 >> 4) + 1; int yt1 = (y1 >> 4) + 1; for (int y = yt0; y <= yt1; y++) { for (int x = xt0; x <= xt1; x++) { if (x < 0 || y < 0...
af53f26b-5534-4c68-af69-d82a722a2646
2
private void mergeReports() { File firstReportDir = config.getMergeDirs().get(0); ioUtils.copyDir(firstReportDir, config.getMergeDestDir()); String[] data = new String[config.getMergeDirs().size()]; for (int i = 0; i < data.length; i++) { File dataFile = new File(config.getM...
215e4088-7e2e-494b-855d-a6f7369ebc46
7
@Override public Coordinates nextMove(GameBoard gb) { oldTime = System.currentTimeMillis() - timeoutOffset; timeoutHasOccured = false; boardSize = gb.getSize(); int alpha = LOOSE; Coordinates bestMove = null; int bestScore = 0; ArrayList<Coordinates> openCoo...
0a50dd86-041a-4662-99ec-5defe4dd45a1
2
void collisionCheck(){ inBounds(); for(collidableObject tempObj : listWrecks){ if(tempObj.isColliding(posX, posY)){ reset(); break; } } }
0918e7ea-f855-4bb4-a5f4-9b8c06bb4ee8
9
@Override public void init() { // 234 : 402 => 0.5820895522 // 402 : 234 => 1.7179487179 dayLeft = SplitFlapBuilder.create().prefWidth(146).prefHeight(250).flipTime(300).selection(SplitFlap.ALPHA).textColor(Color.WHITESMOKE).build(); dayMid = SplitFlapBuilder.create().prefWidth(14...
47b2574c-178a-49dc-9022-2a854a6cdf31
6
public ListNode removeNthFromEnd(ListNode head, int n) { if (n <= 0) { return head; } ListNode first = head; while (head != null && n > 0) { head = head.next; n--; } if (n != 0) { return first; } ListNode c...
23aa5946-79e0-43ad-aaf7-5184c48d167c
4
private void toggleAutoRestart(int level, String[] keywords) { if (isAccountTypeOf(level, ADMIN, MODERATOR)) { if (keywords.length == 2) { if (Functions.isNumeric(keywords[1])) { Server s = getServer(Integer.parseInt(keywords[1])); if (s.auto_restart) { s.auto_restart = false; sendMessage...
7dbfc306-5a10-4816-844c-8616a82ec8a1
0
public FiniteStateAutomaton() { super(); }
3bda5780-f905-4e47-88f2-3ad832743871
1
public void updateDiscDisplay(Disc disc) { tDiscName.setText(disc.getName()); switch(disc.getManufacturer()) { case INNOVA: tManufacturer.setText("Innova"); break; default: tManufacturer.setText("?"); break; ...
5f0d099a-58d2-4cc1-93ad-d89248ffb723
4
private void saveSession() { if (this.lastTime != null && this.curRawData.getTime() - this.lastTime >= 0.001) { if (this.i >= 99) { this.curSession = new SessionDao().createOrUpdateSession(this.curSession); this.slf4j.info("curSession :"); this.slf4j.info(" Session Id :" + this.curSession.getId()); ...
733c85ea-22ba-4314-b803-7c8a9ab423e3
1
private void backClicked() { WindowStack ws = WindowStack.getLastInstance(); if (ws != null) { ws.pop(); } }
efe492ed-1b64-4286-bcd0-323ce670832f
5
private void revealArea(int position) { if (isFlagged(position)) { return; } changeState(position, BoxState.SAFE); for (int i : map.getNeighbors(position)) { int v = map.getValueAt(i); boolean recursivelyReveal = v == 0 && boxStates[...
3efe7077-2bf4-4cc8-bf65-adfbf0a1e4d6
1
public void setMatrix(Matrix set, int i){ if(set.getRowDimension() == dimension){ XMatrix[i] = set.copy(); return; } else{ return; } }
148a97da-626b-4a14-a199-5b1525767f7d
7
private void addIgnore(long target) { try { if (target == 0L) return; if (ignoreCount >= 100) { pushMessage("Your ignore list is full. Max of 100 hit", 0, ""); return; } String targetName = TextClass.formatName(TextClass .longToName(target)); for (int p = 0; p < ignoreCount; p++) i...
858b504b-3b2b-4fa5-b542-b483a424ecb2
1
synchronized void shutdown() { try { mClientSocket.close(); } catch (Exception exception) { Log.error(exception); } mServer.remove(this); }
89417fa6-bafe-49b8-9f49-e8f27f42ea60
3
@Override public void run() { try { isRunning = true; while (isRunning) { Thread.sleep(5L); if (network.hasMessageToSend()) { writer.write(network.poll(EnumMessageType.SEND).toString() + "\r\n"); } } } catch (IOException | InterruptedException e) { e.printStackTrace(); } }
28c301ce-f44c-4ae8-bbc5-139bacc5576a
7
static final Class348_Sub21 method199(int i) { anInt8369++; if (Class75.aClass262_1254 == null || r.aClass312_9716 == null) return null; r.aClass312_9716.method2328(Class75.aClass262_1254, 75); Class348_Sub21 class348_sub21 = (Class348_Sub21) r.aClass312_9716.method2327((byte) -53); if (class348_sub21 ==...
c351aa97-db59-4d62-8ff9-c41237eef5d1
4
public List<Integer> findMatchingPatterns() { List<Integer> patternList = new ArrayList<Integer>(); int count = 0; while (this.text.length() > 0) { Tree.Node<String, Integer> parent = trie.getRoot(); for (int i = 0; i < text.length(); i++) { if (isPatternP...
49a4839e-e060-4f96-abbe-2207a740e587
6
public void setDrawable (Drawable drawable) { if (drawable != null) { if (this.drawable == drawable) return; if (getPrefWidth() != drawable.getMinWidth() || getPrefHeight() != drawable.getMinHeight()) invalidateHierarchy(); } else { if (getPrefWidth() != 0 || getPrefHeight() != 0) invalidateHierarchy(); ...
631d66f5-0f9c-41c5-8f22-5018bb544791
2
public static void init() { Date currentDate = new Date(); SimpleDateFormat df = new SimpleDateFormat("dd_MM_yy_hh_mm_ss"); outPutfolder = df.format(currentDate); String strBrowserType = conf.getString("BrowserType"); if(strBrowserType.equals("InternetExplorer")) { System.setProperty("webdriver.ie.dr...
6bd57f64-8258-4eb8-8602-8bb33edec5ae
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...
05304248-a008-4151-aba6-f55fa82d408c
3
@Override public List<MedicineDTO> getAllMedicines() throws SQLException { Session session = null; List<MedicineDTO> medicines = new ArrayList<MedicineDTO>(); try { session = HibernateUtil.getSessionFactory().openSession(); medicines = session.createCriteria(MedicineD...
8a059f60-a9a3-4f1b-ae16-a206ae29bd19
0
public Object getData(){ return this.data; }
ecb3801b-7765-4143-b37c-62829ec396af
6
@Override public synchronized void run() { while (!done) { try { while (!paused) { if (count > 0) { Core.cycle(1); count--; updatecount--; } else if (infloop) { Core.cycle(1); updatecount--; } else { tv.updateDisplay(); // update when we pause/stop running co...
43dd2d2c-d9b5-420a-a226-77155c526792
4
public static int smallestSuccessor( int n ) { // get p, get c0 and c1 // p is the position of the first non-trailing zero // c0 is the length of the trailing zeros // c1 is the length the 1's left to the trailing zeros //c0 int num = n; int c0 = 0; while ( isLastDigitZero( num ) ) { c0++; ...
14962a22-6bab-45c0-b06b-80ef4021cc35
9
private static boolean bestPermutation (Tour tour, int a, int b, int c, int d, int e, int f) { City A = tour.getCity(a); City B = tour.getCity(b); City C = tour.getCity(c); City D = tour.getCity(d); City E = tour.getCity(e); City F = tour.getCity(f); double[] dist = new double[8]; ...
cc2da0a2-7668-4a33-a5aa-fd59d124917d
4
public int oneSidedBinarySearch(int[] arr, int K) { int log2 = getLog(arr.length); int currentI = 0; while (log2 >= -1) { System.out.println("currentI: " + currentI); System.out.println("arr[currentI]: " + arr[currentI]); if (arr[currentI] == K) { return arr[currentI]; } else if (arr[currentI...
301b7a4f-7960-4749-a7f5-edc8ed719855
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 ...
5375bc51-b9ef-4e70-9e85-858f7a4980da
2
public void uploadFiles(final String localDirectory, final Collection<String> filenames) throws IOException { new Thread(new Runnable() { @Override public void run() { try { connect(); InputStream is; for (String...
4abc10ae-a0b5-43d1-ad44-3b5c2444e825
0
@Override public Iterator<AbstractPlay> iterator() { return plays.iterator(); }
6a585604-0d06-4678-ac96-6dba0c5247ca
3
public Id addOrComplete(Element<?> element) { for (Element actual : elements) { if (actual.isSameElementAs(element)) { actual.completeWith(element); return actual.getId(); } } // still there? one doesn't find it, so let's create it ...
4f41d3bf-3578-4d10-ab4c-b06367f54976
6
private void btnGoResaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGoResaActionPerformed if (txtDate.getText().equals("")) { JOptionPane.showMessageDialog(null, "La date est obligatoire.", "Erreur", JOptionPane.ERROR_MESSAGE); return; } String oeu...
5914529f-87e2-4450-aee8-455e01d3123a
9
void updateStorage(double time, int site) { println("st0 before= " + daStorageUsed[0]); println("st1 before= " + daStorageUsed[1]); int size = vUnreleased.size(); println("size=" + size + "; iMinClass=" + iMinClass); ReleaseStorage rs1 = null, rs2 = null; Vector<ReleaseStorage> vRemove = new Vector<Releas...
51379dae-fb21-4c02-a18e-fa7bb82d61bd
6
public void buildTipMap() { tipMap.clear(); for (AIColony aic : getAIColonies()) { for (TileImprovementPlan tip : aic.getTileImprovementPlans()) { if (!validateTileImprovementPlan(tip)) { aic.removeTileImprovementPlan(tip); continue; ...
fcc19986-c479-4457-98ef-e61fcc90d28c
8
@Override public void cover(ImageBit[][] list) { ImageBit ib = new ImageBit(); for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { ib = list[i][j]; if (ib.isCovered()) { continue; } Leg...
beff5f73-9605-468d-8213-cec1cff7afb3
6
static GregorianCalendar datum (Component parent, String datumaanduiding){ try { String[] datumSplit = datumaanduiding.split("-"); if (datumSplit.length != 3) { JOptionPane.showMessageDialog(parent, "Ongeldige datum", "", JOptionPane.ERROR_MESSAGE); ...
cb22ba3a-b4a2-4d02-b8a3-32a20faf83db
0
public int getBalance() { return this.balance; }
3884cd55-e40e-4d7b-9e03-bb2798d4b087
7
public void removeOnetimeLocals() { StructuredBlock secondBlock = subBlocks[1]; if (secondBlock instanceof SequentialBlock) secondBlock = ((SequentialBlock) secondBlock).subBlocks[0]; if (subBlocks[0] instanceof InstructionBlock && secondBlock instanceof InstructionContainer) { InstructionBlock first = ...
a1cf744c-6b26-4459-904e-fa1639e49410
1
@Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return connection.isWrapperFor(iface); }
1bf40232-1915-4958-b1ee-63a04e03b3a3
8
public void doRun(int run) throws Exception { if (getRawOutput()) { if (m_ZipDest == null) { m_ZipDest = new OutputZipper(m_OutputFile); } } if (m_Instances == null) { throw new Exception("No Instances set"); } // Randomize on a copy of the original dataset Instances runInst...
ace6a289-bd16-4e2a-82d5-14f255be9a98
8
private void setupNeighbours() { int edgeCount = 0; for(int i = 0; i < this.gridCellContents.size(); i ++) { //if reached end of row start again if(edgeCount == xSize){ edgeCount = 0; } //adds below neighbour if(i+xSize < this.gridCellContents.size()) { this.gridCellContents.get(i).a...
76c5b499-003d-444c-8038-3c2a55da099c
5
public static void resetBall(boolean global) { if (!global) { Game.countdown.setVisible(true); for (int i = 3; i != 0; i--) { // Counts down from 3 Game.countdown.setText("" + i); Game.countdown.setFont(Game.countdownFont1); // Big font UPF.pause(750); Game.countdown.setFont(Game.countdown...
5abd84a1-8c71-4498-8aa3-b15f3cbb7685
6
public static void boot() { try { // 1. Step: Init the application configuration. ApplicationConfigurationManager.setup(); ApplicationConfiguration appConfig = ApplicationConfigurationManager.get(); int serverPort = Integer.parseInt(appConfig.getServerPort()); // 2. Init the server. new Mine...
7a6496f8-eae1-44cf-9445-ce30e9bf8879
0
protected String addIGameFeatures() { myIDisplay = new JTextArea(1, 5); myIDisplay.setEditable(false); return new String(DESCRIBE_I); }
0e204b47-7d3f-4baa-9656-e446546d84d5
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + port; result = prime * result + ((protocol == null) ? 0 : protocol.hashCode()); result = prime * result + ((ssid == null) ? 0 : ssid.hashCode()); result = prime * result + ((uid == null) ? 0 : uid.hashCode());...
81c1dffd-1df2-46ea-aa45-894a90349c55
9
public static void main(String[] args) { Scanner input = new Scanner(System.in); Random randomizer = new Random(); int actual = randomizer.nextInt(10) + 1; int guess = 0; boolean answer = false; int current_play = 1; int attempts = 1; int gameplays = 0; System.out.println("Welcome to the Guess A...
70e3387c-fabd-487f-93fa-0a4cbb1c9392
4
public void update() { if (fired) { v = c; u = u + d; fired = false; } else { //Simulate 1 ms frame step (can be repeated for larger frame step size) v += 0.5f*((0.04f * v + 5.0f) * v + 140.0f - u + getI()); u += 0.5f*a * (b * v - u...
38a9e8f3-f6b9-414b-8920-71b370391619
8
public boolean recurSearch(int[] A, int target, int start, int end){ if(start > end) return false; int center = (start + end)/2; if(A[center] == target) return true; if(A[center] > A[start] ){ if(A[start] <= target && target <= A[center]) return recur...
3abba285-476d-4e37-83cd-148ab64d73a0
2
@Override public void propertyChange(PropertyChangeEvent evt) { propertyName = evt.getPropertyName(); oldValue = evt.getOldValue() instanceof String ? (String) evt.getOldValue() : ""; newValue = evt.getNewValue() instanceof String ? (String) evt.getNewValue() : ""; }
d11e0d6b-f9ef-4c71-9d56-484c95c9f08a
1
public static void listEmployeesProjectsPhoneNumbers(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select e from Employee e left join fetch e.projects p left join fetch e.phoneNumbers", Employee.class); List<Employee> resultList = query.getResultList(); entit...
d6999f95-527c-41d8-8a70-e8a3203d28ea
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equal...
dd274d25-93ed-411a-a2c3-72c0c0b1df3f
9
@Override public void deposito(BigDecimal valor) { switch(status) { case Silver: saldo = saldo.add(valor); if(saldo.compareTo(new BigDecimal("200000.0")) == 0 || saldo.compareTo(new BigDecimal("200000.0")) == 1) { status = Categorias.Platinum; } else if(saldo.compareTo(new BigDecimal("50000.0")) ==...
32e8ab78-724a-404c-86ab-fce1f31e39d1
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(mob.location().getArea().properSize()<2) { mob.tell(L("This area is too small to cast this spell.")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return ...
c8d69b6d-c2dc-4934-bb4c-0109f900a4e9
4
public void update() { centerX += speedX; speedX = bg.getSpeedX()*5; getHeliBoy1().setBounds(centerX - 25, centerY - 25,50,60); getHeliBoy2().setBounds(centerX - 25, centerY - 25,50,60); if (getHeliBoy1().intersects(Robot.yellowRed) || getHeliBoy2().intersects(Robot.yellowRed)){ checkCollision(); }...
7f056b5f-ccf7-4936-aa8e-7bcb991c9709
3
@Override public boolean removeAll(Collection<?> arg0) { boolean result = list.removeAll(arg0); if (result) try { save(); } catch (IOException ex) { System.err.println("Autosave failed - " + ex.getMessage()); ex.printStackTrace(...
07919dd5-f50b-416b-87b0-91bc950c5269
8
private static void callOrderBook(){ try { Vector<Vector<Double>> array = OrderBookAPI.HttpGetOrderBook(); int n = array.get(0).size(); DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries data = new XYSeries("Bids", true, false); for(int i=0; i<n; i++){ ...
6fae4879-0490-43c8-ab44-f98470d6eca7
2
public boolean GiveMoney(String player, int money) { if (VaultEnabled) { EconomyResponse resp = econ.depositPlayer(player, money); if (resp.type == ResponseType.SUCCESS) { Log(player + " has been given $" + resp.amount + " (new balance $" + resp.balance + ")"); return true; } else { Warn("Vault p...
3b282908-d762-46c9-830f-2c1703c60eec
6
public static HashMap<String, Integer> rareWordMarker(String countFile, String dataFile) throws IOException { HashMap<String, Integer> wordToCount = new HashMap<String, Integer>(); FileReader in = new FileReader(countFile); BufferedReader br = new BufferedReader(in); StringTokenizer stk; String input; ...
f78f373a-4f08-4659-9557-db0164272872
4
public synchronized void release(Object user, MemoryManageable mm) { if (user == null || mm == null) return; //System.out.println("+-+ MM.release() user: " + user + ", mm: " + mm); HashSet inUse = locked.get(user); if (inUse != null) { boolean removed = inUse.remove(mm); ...
36a62ef1-088c-4494-a597-3cea60302752
9
@Override public void handlePinEvent(PinEvent event) { // only process listeners and triggers if the received interrupt event // matches the pin number being tracked my this class instance if (this.pin.getPin().equals(event.getPin())) { if (event.getEventType() == PinEventType.D...
aea0e3e5-ef65-471f-9ab1-8a6dcfb91904
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Policestation)) { return false; } Policestation other = (Policestation) object; if ((this.policeStationID == nu...
1b458cfd-9def-4527-909d-327a936b6a7e
9
public String toString(){ String str ="distSegment: "+distSegments.size()+"\n"; str+="Active State ("+pActiveState+", "+tActiveState+")\n"; str+="Predictive State ("+pPredictiveState+", "+tPredictiveState+")\n"; str+="Learn State ("+pLearnState+", "+tLearnState+")\n"; if(this.distSegments.size()>0){ int...
f522d6b3-68c0-403a-9bcd-937c16aa7ae8
6
private boolean wincheck3() { for (int column = 0; column < (gv.getColSize()-THREE); column++) { for (int row = 0; row < (gv.getRowSize()-THREE); row++) { if (cells[row][column].getValue() != 0 && cells[row][column].getValue() == cells[row + 1][column + 1] ...
36bd8c59-453e-4831-a341-b93a25c1396e
7
public Component getComponents() { if(!sort) { setPositions(); return Header; } else if(HashTable == null) { return null; } boolean HeaderSet = false; for(int i = 0; i < 28; i++) { if(HashTable...
b56bfc61-7179-4a0d-ad0f-a6d09466ad27
7
private static void quicksortusingmedianpivot(int l, int k) { // TODO Auto-generated method stub if(l==k){ return; } if (k>l){ int i=l+1; // startelement int j=l+1; // int temp; int arrayr[] = new int[3]; arrayr[0] = array[l]; arrayr[1] = array[k]; arrayr[2] = array[(l+k)/2]; Arrays.sort(arr...
7d2525ea-83cc-434b-9fed-33e266651b4a
3
public void test_06_fisher_vs_chi2() { int n11 = 25, n12 = 5; int n21 = 15, n22 = 15; int k = n11; int D = n11 + n12; int N = n11 + n12 + n21 + n22; int n = n11 + n21; // Chi square approximation (without Yates correction) double pChi = FisherExactTest.get().chiSquareApproximation(k, N, D, n); if (v...
00492ae6-8e39-46fc-8705-31c648ae1e2e
4
public Component draw() throws ParseException { final JFrame item = new JFrame(); item.setAlwaysOnTop(true); item.setSize(new Dimension(300, 250)); item.setResizable(false); item.setTitle("Order conformation"); JPanel popUp = new JPanel(); popUp.setLayout(new GridBagLayout()); popUp.setBorder(BorderFact...
e13aa0bd-78ad-44ed-acb6-069868e5d6d6
1
public double getSuojakilvenHalkaisija(){ if (suojakilpi){ return getMahdSuojakilvenHalkaisija(); } else { return vartalo.getHalkaisija(); } }
708b7bc4-8c86-4930-a818-24d77e90a88c
3
@Override protected void paintComponent(Graphics g) { // use all pictures from the array g.drawImage(backgroundImages[currentBackground % backgroundImages.length], 0, 0, null); g.setColor(Color.GREEN); g.drawString(String.format("Score: %d\t Level: %d \tLives: %d", score, level, he...
69c89a83-0d00-4a95-8b25-9c3a8450344b
5
public BigDecimal kurtosis_as_BigDecimal() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } BigDecimal kurtosis = BigDecimal.ZERO; switch (type) { case 1: case 12: BigDecimal[] bd = thi...
c3711228-c525-4248-8338-5c983745c480
2
public void performInterferenceTestBeforeRemove() { if(!Configuration.interferenceIsAdditive) { return; } if(newAdded) { testForInterference(); newAdded = false; } }
391ad269-5d78-4146-bbc6-cd6e092e6c0c
3
public void updateNums() { for(int i = 0; i < fleet.size(); i++) { Ship ship = fleet.get(i); for(int x = ship.x; x < ship.x+ship.xSize; x++) for(int y = ship.y; y < ship.y+ship.ySize; y++) sea[x][y] = SHIP; } }
0c684b63-c0b3-40ba-9096-c9eaea632d92
6
public void adjustChildren() { //Will crash if it exceeds around 2k objects for some reason and doesn't have size limit if(noChildren() && props.size() + rects.size() > size && container.getWidth() > 80) { propChildren = new PropQuad[4]; addChildren(0); } else if(!noChildren() && props.size() + rects.size()...
1ea2a4e4-760b-4153-b9c2-407f65edcffa
2
private static boolean isNameUnique(String name, ArrayList list) { for (int i = 0, limit = list.size(); i < limit; i++) { if (name.equals(list.get(i).toString())) { return false; } } return true; }
97ee8b88-324e-49c2-98d8-e695b301ef80
5
private Node addToTree(Node root, int v) { if (root == null) { return new Node(v); } Node curr = root; Node prev = null; int left = -1; while (curr != null) { if (curr.v < v) { prev = curr; curr = curr.right; left = 0; } else if (curr.v == v) { return root; } else { prev = cu...
7c95ade7-d19e-40aa-b3d4-4ae7c8c702ef
3
public static void saveGif(BufferedImage[] images, String fname) { new File("output images/").mkdir(); try { new File("output images").mkdir(); ImageOutputStream output = new FileImageOutputStream(new File("output images/" + fname)); GifSequenceWriter writer = new Gif...
d5f4eff6-9b9f-4b02-9025-86a7c0d9bbf6
8
private String funcionarioCargo() { String cargo = null; int opcao = 0; boolean confirma = false; boolean valido = false; String resposta; in = new Scanner(System.in); while (!confirma) { // enquanto o usua...
eb02b875-15ec-451f-9a46-16603911c134
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...
d7a0e282-a07c-4cd8-9f1a-0f11d190049d
0
public Ex1() { System.out.println("Inside Mustang()"); name = "Ford"; year = "1976"; color= "Black"; }
7c74be18-f7b2-4260-a640-d1a3656a0649
8
public void update() { String latestTweet = getLatestTweetFrom(twitterQuery); if (latestTweet == null) { return; } clearBoard(); String [] lines = splitToLines(latestTweet, CHARACTERS_IN_LINE - colorCodes.length()); int noOfLines = lines.length; if (noOfLines > 0) { int signIndex =...
08632e12-2ae8-4397-8dec-16452b93b0a8
3
public void paint(Graphics arg0) { Graphics2D g2d = (Graphics2D) arg0; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (show) { g2d.setColor(Constants.BLACK_TRANS); g2d.fill(Constants.CHATBOX_AREA); g2d.setColor(Color.PINK); g2d.setFont(Constants.PAINT_TI...
6e14123d-b32d-4654-a9fb-2a2dc026113f
8
public static void main(String[] args) { // Queue<TaskArg> taskQueue = new LinkedBlockingQueue<TaskArg>(); try { UIManager.setLookAndFeel(new NimbusLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (Throwable e) { ...
28f1cb61-a067-4f36-a9f2-c523839c17dc
0
public ZeroFilter(final ConnectionProcessor proc, final Properties config) { super(proc, config); }
71bc0bd7-65ea-4757-b8eb-48170350c877
2
public List<KeyRegistrationRecord> getPeers(String inBase64Key) { long start = System.currentTimeMillis(); List<KeyRegistrationRecord> out; int maxFriendsToReturn = 26; try { maxFriendsToReturn = Integer.parseInt(System.getProperty(EmbeddedServer.Setting.MAX_FRIENDS_RETURNED.getKey())); } catch( Except...
cbb9c810-dd80-413c-aac7-011573922c03
2
private void savePath(Vector<Integer> Row) { //Path-Objekt erstellen Path P = new Path(); //Der Weg beginnt mit der aktuellen Position P.addPoint(position); for(int z=0; z<Row.size(); z++) { //Vector I enthaelt den Weg von 0 bis z Vector<Integer> I = new Vector<Integer>(); for(int u=0; u<=z;...
13f45886-d52e-4cb4-b95e-a2c4cecbbd37
5
private boolean jj_3R_47() { if (jj_scan_token(LEFTB)) return true; if (jj_3R_9()) return true; if (jj_scan_token(COMMA)) return true; if (jj_3R_9()) return true; if (jj_scan_token(RIGHTB)) return true; return false; }
fcac7cda-0c1f-4fc0-b155-092ecb4cb534
6
private void processEncodedTable(Decoder dec) throws ASN1DecoderFail { /* Table ::= SEQUENCE { name TableName, fields SEQUENCE OF FieldName, fieldTypes SEQUENCE OF FieldType, rows SEQUENCE OF SEQUENCE OF NULLOCTETSTRING } */ dec=dec.getContent(); // Get all stuff String tableName=dec....
28e72642-8695-4984-b9d5-92c0651f06e1
9
public static final FieldObjectInstantiator getResolver(final Class<?> field_origin, final Class<?> resolver_enclosing_class, final String resolver_function) throws NoSuchMethodException { if (resolver_function == null) { return getDefaultInstantiator(field_origin); } else { for (final Method method : Reflect...
450b798e-bf12-4a7a-9dc7-eca784718caa
2
public void update() { if(XboxController.controller != null) XboxController.update(); if (gameStates[currentState] != null) gameStates[currentState].update(); }
24962675-4adf-45a2-915a-9786ca57ea30
4
public boolean isLastState(State state) { if (state == null) return false; reSortSubProcesses(); SubProcess sp = state.getSubProcess(); if (sp == null || !this.subProcesses.contains(sp)) return false; if (this.subProcesses.indexOf(sp) == this.subProcesses.size() - 1) return true; return false; }
80ff2669-0c31-4452-9386-ffe7c10c0b1c
4
private void testParseText() { String TEXT = "A beginning is the time for taking the most delicate care that the balances are \n" + "correct"; StanfordParser sp = new StanfordParser("parser"); ArrayList<ArrayList<Tuple>> parsedText = sp.parseText(TEXT); assert parsedText....
4324d9e8-352d-4bd4-b44c-906a1bac53eb
5
@Override public double getImportance(List<Example> exampleCollection) { // assume winner 1 as positive, winner 2 as negative double startEntropy = getEntropy(exampleCollection); double entropyReminder = 0; List<AttributeValue> aValueList = getAttributeValues(); List<Double> entropyList = new ArrayList<Dou...
131565f6-a4ab-4145-92e8-b4fc5c3913e6
7
@Override public void handle(SocketChannel channel, Packet packet) { if (packet instanceof GameInfoPacket) { handleGameInfo((GameInfoPacket)packet); } else if (packet instanceof PlayerJoinGamePacket) { handleJoinGame((PlayerJoinGamePacket)packet); } else if (packet instanceof SpawnPacket) { handleSpawn(...
38bf68b0-a424-49d9-918e-8f8852aca549
7
public void doRender(Graphics2D g, double interpolation, long renderCount) { // Call the superclass' doRender, including the user defined render() function super.doRender(g, interpolation, renderCount); float opacity = (float)__getOpacity(); if (opacity <= 0.001) { return; /...