method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
519262e8-d2a0-4c96-8867-4eaaddbe2a05
8
public void Fill(int x, int y, int fillColor, int colorClicked) { // create queue of points that will store all the points to be filled Queue<Point> queue = new LinkedList<Point>(); // start the fill at the clicked point queue.add(new Point(x, y)); while (!queue.isEmpty()) { Point p = queue.remove(); /...
a8d7ba29-29c9-4100-95f5-ea854e4ed11e
4
private TreeNode successor(TreeNode predecessorNode) { TreeNode successorNode = null; if (predecessorNode.left != null) { successorNode = predecessorNode.left; while (successorNode.right != null) { successorNode = successorNode.right; } } else { successorNode = predecessorNode.parent; while (s...
b39105fc-9e96-4cd2-92bb-a58fd5196c2b
5
public String getDirectory() { if (!enabled) { return ""; } Object selection = directoryCombo.getSelectedItem(); if (selection != null) { String strSelection = selection.toString(); int itemCount = directoryCombo.getItemCount(); boolean con...
0eb0c43c-27bf-4828-be7b-e2926e010b1a
9
private void parseNextElement() { // loop while there are headers left to parse while (this.headerIt.hasNext() || this.cursor != null) { if (this.cursor == null || this.cursor.atEnd()) { // get next header value bufferHeaderValue(); } /...
c8adead9-2c0d-4053-b067-f06805a48011
8
EFieldOption(final AtomisticView view) { super(JOptionPane.getFrameForComponent(view), "Electric Field Options", true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); String s = MDView.getInternationalText("ElectricFieldOptions"); if (s != null) setTitle(s); this.view = view; JPanel p = new JPanel(); p....
0991274d-79b7-40b5-9651-d90ac0acc2ad
1
public static void main(String args[]) { org.omg.CORBA.Object objRef; try{ // create and initialize the ORB ORB orb = ORB.init(args, null); // get reference to rootpoa & activate the POAManager POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().act...
4351d1f8-c16d-4c2d-a5e0-c4fd19fa2bb2
2
private void sequentiallyUpdate(Region[][] array, int hij, int loj, int hii, int loi) { for (int i = loi; i < hii; i++) { for (int j = loj; j < hij; j++) { array[i][j].calculateTemp(); } } }
fa56c445-5b5d-4dae-ac9f-23afe883a136
6
private static int[] getWaterFilled(int[] a) { int[] diff = new int[a.length]; int L = 0; int R = a.length - 1; int maxL = a[0]; int maxLIdx = 0; int maxR = a[a.length - 1]; int maxRIdx = a.length -1; while (L < R) { if (a[L] < a[L + 1]) ...
68da1599-ce3b-4fe8-b458-8c08180f2a90
9
private void produceTemperature() { Perlin noise = new Perlin(); try { noise.setOctaveCount(octaves); } catch (Exception e) {e.printStackTrace();} noise.setFrequency(frequency); noise.setSeed(seed); if (details) System.out.println("Noise produced."); int dimx = MyzoGEN.DIMENSION_X * chunksX; int dim...
1867ca6e-32b8-41b8-afd2-43ffc5b298a1
2
private void printArray(Card[][] cards){ //debug method for(int j = 0; j < A1Constants.NUMBER_OF_COLS; j++){ System.out.println(cards[0][j] + " "); } System.out.println(""); for(int j = 0; j < A1Constants.NUMBER_OF_COLS; j++){ System.out.println(cards[1][j] + " "); } }
f1ad37f0-f040-4e33-82e7-653f8b9ede80
7
public void doFrameInGame() { checkCollision(PLAYER_ID, ENEMY_ID); checkCollision(ENEMY_ID, PLAYER_ID); //setViewOffset(0, (int) p.y+64-viewWidth()/2, true); setViewOffset(0, (int) p.y, true); for(int i = 0; i < this.waves.size(); i++){ waves.get(i).update(); } for(int i = 0; i < this.waves.si...
26d1dc5d-f8ac-4f1f-a6e6-f14bb86a650f
1
public ChatGui() throws UnknownHostException { initComponents(); echoClient.registerEchoListener(this); InetAddress address = InetAddress.getLocalHost(); String hostIP = address.getHostAddress(); try { echoClient.connect(hostIP, 9090); } catch (...
510b1cd6-3c16-4b0c-8d9d-655f17d5ebdb
1
public void saveDiscs() throws IOException { File file = new File("bags/" + username + "/bag.txt"); FileWriter fw = new FileWriter(file.getAbsolutePath()); for (Disc disc: discs.getDiscs()){ fw.write(disc.getName() + "\n"); } }
cd0adb75-a893-4a51-bb47-a545e4d7f286
7
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
76da5d27-bd80-4f3a-b334-1210318c197d
3
private void printMove(String name, Vector<Card> move) { System.out.print(name + ": "); if (move.size() == 0) { System.out.print("Takes"); } else { for (int i = 0; i < move.size(); i++) { if (move.get(i) == null) { System.out.print("--...
b715106d-9218-4d75-abac-3c9a96b4705b
5
public compState getBiggerVersion(Version otherVersion){ int smallestlayers = min(intList.size(), otherVersion.getSize()); for(int i = 0; i < smallestlayers; i++){ if(intList.get(i) < otherVersion.getIntAt(i)){ // this list is the smaller one return compState.OTHER; } else if (intList.get(i) > othe...
c83b3186-9225-471e-bf83-ac3080fb8b69
8
public static void main(String[] args) { // TODO code application logic here //Lab 1 System.out.println("Lab1"); Map<String,JetFighter> jets = new HashMap<String,JetFighter>(); JetFighter j1=new JetFighter("Ruthless"); JetFighter j2=new JetFighter("Blood...
9d9cdc8d-e8a2-4763-a963-addcce659b82
5
public void update() { Player p = controler.getActivePlayer(); int card; for (int i = 0 ; i < 4 ; i++) { card = p.getCard(i); switch (i) { case 0: nChevalier.setText(Integer.toString(card)); carteChevalier.setEnabled(card > 0); break; case 1: nMonopole.setText(Integer.toStrin...
33e2a6bb-321e-4caf-8983-3d914ae5b996
2
public int getInt(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number)object).intValue() : Integer.parseInt((String)object); } catch (Exception e) { throw new JSONException("JS...
e867c304-8923-4aa9-b428-392604ca9bbd
4
private int jjMoveStringLiteralDfa19_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 18); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 18); } switch(curChar) { case 56: return jjMoveStringLiter...
112e514a-909d-44d6-90f1-a7b1384dfe57
6
public void setImgPath_SliderBar(Path img, Imagetype type) { switch (type) { case DEFAULT: this.imgSlider_Def = handleImage(img, UIResNumbers.SLIDER_BAR_DEF.getNum()); if (this.imgSlider_Def == null) { this.imgSlider_Def = UIDefaultImagePaths.SLIDE...
703c9969-ff26-4ba2-bfe5-58e1ad11ce3a
3
public int countOverlap(GeneSet gs) { GeneSet gsSmall = this, gsLarge = gs; if (size() > gs.size()) { gsSmall = gs; gsLarge = this; } // Iterate on smaller gene set. Count overlap int count = 0; for (String gene : gsSmall) if (gsLarge.hasGene(gene)) count++; return count; }
1314402d-ed77-40b2-9dad-aae01b485e03
1
private void spawnBoss() { int r = Application.get().getRNG().nextInt(4) + 1; GameSector sector = Application.get().getLogic().getGame().getSector((long)r); if(sector.free()) { bossID = sector.spawnBoss(manager.getNextBoss()); spawned = true; } }
18f04167-8ed4-4b42-b6eb-68037fd9bb81
1
public void visit_ifnonnull(final Instruction inst) { if (longBranch) { final Label tmp = method.newLabel(); addOpcode(Opcode.opc_ifnull); addBranch(tmp); addOpcode(Opcode.opc_goto_w); addLongBranch((Label) inst.operand()); addLabel(tmp); } else { addOpcode(Opcode.opc_ifnonnull); addBranch((...
72d2e999-eb33-4a67-878d-224f0b3a0349
8
public String getValue(String varName) throws VariableException { String result = null; if (gate == null) throw new VariableException("cannot get var's value since no gate is currently loaded", varName); if (varName.equals(VAR_TIME)) result = String.valueOf(time) + (clo...
633ce647-d17d-4870-89b6-585d47290947
7
private void extractField(String[] array, int line) { try { Integer obj = null; // get the job number int id = 0; if (JOB_NUM == IRRELEVANT) { id = gridletID_; } else { obj = new Inte...
2524ef46-b563-4a88-a775-8d81b13ba098
8
public void setDimensions(int dimensionCount, int dimensionNumBytes) { if (dimensionCount < 0) { throw new IllegalArgumentException("dimensionCount must be >= 0; got " + dimensionCount); } if (dimensionCount > PointValues.MAX_DIMENSIONS) { throw new IllegalArgumentException("dimensionCount must ...
a0dcc8fb-6369-4ca3-a55d-1312feb33494
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { ...
3a05a434-43a9-46f1-82c7-47eee9d6d6c5
2
public WindowCampaign(int variant) { super(); //setStyleSheet(core.Const.menuStyle); setMinimumSize(1000, 700); setMaximumSize(1000, 700); back.setGeometry(width()-200, height()-50*1-32, 150, 40); start.setGeometry(width()-200, height()-50*2-32, 150, 40); background.setParent(this); logo...
06515667-366f-4299-8ed8-93830041171b
4
private void btn_generate_tokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_generate_tokenActionPerformed // TODO add your handling code here: String cadToken = this.val_token.getText(); if (cadToken.length() > 0) { while (modelTable.getRowCount() > 0) { ...
cc52af89-4fdc-4e86-bd9f-0e6da6e2d7d7
5
public void visitPhiStmt(final PhiStmt stmt) { // a := Phi(b, c) // [b] <= [a] // [c] <= [a] final List back = new ArrayList(stmt.operands().size()); Iterator e = stmt.operands().iterator(); while (e.hasNext()) { final Expr expr = (Expr) e.next(); if ((expr instanceof VarExpr) && (expr.def() == nu...
c4b2c174-287f-4a31-8a01-4ed6655f7899
7
/* */ public Grenade(float x, float y, int targetX, int targetY, int damage) /* */ { /* 16 */ this.x = x; /* 17 */ this.y = y; /* 18 */ this.targetX = targetX; /* 19 */ this.targetY = targetY; /* 20 */ this.damage = damage; /* 21 */ this.timer = 0; /* 22 */ this.duration = 2000; /*...
6aadd95e-56b7-4386-a5ed-33c669ec7990
5
public MsgPanel() { setLayout(null); cardP.setBounds(151, 1, 548, 423); cardP.setLayout(cardL); functionPanel.setBounds(0, 1, 150, 423); functionPanel.setBackground(Color.getHSBColor(0, 0, (float) 0.68)); FlowLayout fl = (FlowLayout) functionPanel.getLayout(); fl.setVgap(0); switchPane[0] = new MsgInPa...
dfac6d29-41e9-44c1-8443-7010315322c2
5
public boolean nextMove(int row, int col) { LinkedList<Coords> choices = new LinkedList<Coords>(); //Returns true for a valid and successful move boolean result = false; int r = game.getBoard().board_row; int c = game.getBoard().board_col; for(int i = 0 ; i < r; i++) { ...
f4ed8330-352d-4e1a-817c-d144c28be0c8
0
@Override public String toString() { return libelle; }
4e3cdef8-1b11-4760-b637-3c9d62f43db5
0
public void invoke(){ super.InheritorClass1(); }
e37315f5-67c6-42e6-8215-b94f3e3a54ee
9
private void collectiveInstinctiveMovement() { double[] m = new double[dimensions]; double totalFitness = 0; // calculating m, the weighted average of individual movements for (int i = 0; i < school.size(); i++) { Fish _fish = school.get(i); for (int j = 0; j < dimensions; j++) { m[j] += _fish...
dd9a7bb7-1c5f-4223-a566-4691517d510d
1
public static void print(ListNode head){ while(head != null){ System.out.print( " " + head.val); head = head.next; } }
9e5a8667-6abd-486c-b7c7-71be9e75e40d
8
public int oldCompareTo(Person that) { if(this.age > that.age || (this.age == that.age && this.isTall && !that.isTall)) { return 1; } else if( this.age < that.age || (this.age == that.age && !this.isTall && that.isTall)) { return -1; } return 0; }
17ae8829-70ed-4362-b857-5d29f67ced9e
9
private boolean connectToImplant(boolean connectingToImplant, boolean connectingToController, boolean connectingToRelay, boolean connectToCortana) { try { String IP = this.jtfIP_Address_To_Implant.getText(); if ((IP == null) || (IP.trim().equals(""))) { Drivers.jop_Error("Invalid IP...
b58d653e-e7b2-4299-9518-dee8ed9c2139
4
@Override public void update(Observable arg0, Object arg1) { GameStatus status = (GameStatus)arg1; if(status == GameStatus.SHOTMISSED){ remove(arrowButtonPanel); remove(moveButtonPanel); } else if(status == GameStatus.SHOTHIT){ remove(arrowButtonPanel); remove(moveButtonPanel); } else if(status...
ea6382aa-abe4-4cff-846d-d1049869179c
0
@Override public Position getStart() { return start; }
7cf4b4d0-90a8-410e-b127-d84ff35dff80
9
public RectangleManager(List<Rectangle> recs) { rectangles = new LinkedList<Rectangle>(); rectangles.addAll(recs); xEndPoints = new LinkedList<Endpoint>(); yEndPoints = new LinkedList<Endpoint>(); for (int i = 0; i < 2*rectangles.size(); i++) { xEndPoints.add(null); yEndPoints.add(null); ...
84da4c2f-14d4-4555-94e5-de159d0b5c01
5
public synchronized List<StockBook> getBooksByISBN(Set<Integer> isbnSet) throws BookStoreException { if (isbnSet == null) { throw new BookStoreException(BookStoreConstants.NULL_INPUT); } for (Integer ISBN : isbnSet) { if (BookStoreUtility.isInvalidISBN(ISBN)) throw new BookStoreException(BookStoreCon...
962fb3b2-e458-48f1-90ea-a8f416b5c8c6
1
public void testWithFieldAdded_DurationFieldType_int_2() { LocalTime test = new LocalTime(10, 20, 30, 40); try { test.withFieldAdded(null, 0); fail(); } catch (IllegalArgumentException ex) {} }
08d0f682-2dc8-44ff-a509-1923bbbd9eb8
1
public void push(final Value value) throws IndexOutOfBoundsException { if (top + locals >= values.length) { throw new IndexOutOfBoundsException( "Insufficient maximum stack size."); } values[top++ + locals] = value; }
1648512a-6954-4953-b380-620afdeac328
4
@Test public void invokeCommandTest() { try { Client clientInvoked = new Client("localhost", 4444); clientInvoked.getClientGUI().setupCanvas(); lineSegmentObject.invokeCommand(clientInvoked.getCanvas()); Client clientDrawn = new Client("localhost", 4444); ...
d709d1d8-91a7-413c-bb03-f0c0034181c9
7
public Level() { Bitmap bmp = Art.load("/levels/level.png"); int w = bmp.w + 8; int h = bmp.h + 8; this.w = w; this.h = h; xs = w; ys = h; blockmap = new Blockmap(w * 16, h*16, 32); tiles = new int[xs*ys]; for (int y = 0; y < ys; y++) { for (int x = 0; x < xs; x++) { int xx = x...
6703068e-9956-4171-877b-247d3890574c
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...
f087e8d0-894e-46c2-b2c9-2fb0e4a58714
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...
cf6c029d-54d7-4252-b9f1-d9d55da03476
5
public void checkGameOver() { // if((isTwoPlayers && !placingShips) && game.gameFinished()) if(!placingShips && game.gameFinished()) { System.out.println("Game over"); gameOver = true; game.makeRightWin(game.isMyWin()); // if(!debugMode) // { render(); String winner = "left side wins...
409260d6-3ddb-4cd0-8810-76b3ffa2c7de
1
private void setGrid(Grid grid) { if (grid == null) throw new IllegalArgumentException("Grid can't be null!"); this.grid = grid; }
0e70f2a6-a8cd-46d7-92ab-ffab45c1f8f8
3
public String toString() { StringBuilder res = new StringBuilder(); for(int i=0; i<10 && i < data.length; i++){ res.append(StringFormat.format(data[i])).append(" "); } if (data.length > 10) { res.append("..."); } return res.toString(); }
c1dbe698-eecd-4abe-a31b-213836a6afbb
8
static public Object maybeResolveIn(Namespace n, Symbol sym) throws Exception{ //note - ns-qualified vars must already exist if(sym.ns != null) { Namespace ns = namespaceFor(n, sym); if(ns == null) return null; Var v = ns.findInternedVar(Symbol.intern(sym.name)); if(v == null) return null; return v;...
00bf1e52-8046-4d39-b2aa-eab2f25a6c3d
1
public void visit_dcmpg(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
77e3854d-5445-4827-b883-8b34facda7d9
3
public String Fonetizar(String pTexto) { pTexto = pTexto.trim(); String[] dados; StringBuilder retorno = new StringBuilder(); DoubleMetaPhone dmp = new DoubleMetaPhone(); CleasingTratamentoTexto cs = new CleasingTratamentoTexto(); pTexto = cs.tirarEspacoDuplo(pTexto);...
ce6757c5-3192-48f6-94cc-3a4cdb31a81b
4
@Override public void actionPerformed(GuiButton button) { if(button.id == 0) holder.closeWindow(this); else if(button.id == 1 && holder instanceof GuiEditor) { GuiEditor editor = (GuiEditor)holder; Map newMap = new Map(); newMap.loadR2DFile(ResourceLoader.getCollection(textField.text)); if(ed...
702c37a9-7a10-4da3-b2aa-0e16797beac7
6
private void shutdownCommand(String args[]){ if(args.length >= 2){ String reason = ""; if(args[1].startsWith("\"") && args[args.length-1].endsWith("\"")){ for(int i=1;i<args.length;i++){ if(!reason.isEmpty()) reason += " "; reason += args[i]; } reason=reason.substring(1, reason.lengt...
66b2d3a5-10f3-47f1-9d95-78b89e3df3fa
2
public Discrete getDiscretePoissonOneToN(int N, double lambda) { N = N + 2; distribution = new double[N]; sum = 0.0; for(int i = 1; i < N-1; i ++){ distribution[i] = poisson(lambda, i); sum += distribution[i]; } for(int i = 1; i < N-1; i ++) distribution[i] = distribution[i]/sum; return new...
440e3ffd-d3be-4c6a-9b9b-5cf67439eeab
0
public Map<String, String> getSomeMap() { return someMap; }
2a8ae71d-4b96-40c4-ad25-3bfdc5e63125
8
protected File getFile(String fileName) { mBaseDir = "./"; File theFile = new File(fileName); if (theFile.exists()) return theFile; mBaseDir = HumboldtJS.baseDir; theFile = new File(HumboldtJS.baseDir + fileName); if (theFile.exists()) return theFile; for (int i = 0; i < HumboldtJS.includePaths.size(...
b8c62116-718c-4197-adfd-127e4725c8dd
4
private boolean _jspx_meth_c_otherwise_0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_choose_0, PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:otherwise org.apache.taglibs.standard.tag.common.cor...
aa8dad11-c3dc-4395-a277-52da585ac1be
5
private static long readInteger(long min, long max) { // read long integer, limited to specified range long x=0; while (true) { String s = readIntegerString(); if (s == null){ errorMessage("Integer value not found in input.", "Integer in the range " + min + "...
742576fb-c2a5-43b7-986b-4464b2406249
4
public void merge(int[] a, int[] b, int lastA, int lastB) { int iA = lastA - 1; int iB = lastB - 1; int iM = lastA + lastB - 1; while (iA >= 0 && iB >= 0) { if (a[iA] > b[iB]) { a[iM] = a[iA]; iA--; } else { a[iM] = b[iB]; iB--; } iM--; } // need to move arrayB, no need for a...
406acd13-7329-4e35-bd04-a285920fd200
4
static private boolean jj_3R_22() { if (jj_scan_token(NEW)) return true; if (jj_scan_token(44)) return true; if (jj_scan_token(LPAREN)) return true; if (jj_scan_token(RPAREN)) return true; return false; }
83d2a54d-d0d2-44c3-9f65-a01942c0511e
2
public Token getNextToken(){ // Clear Flags from previous call currentState = 0; nextState = 0; tokenFoundFlag = false; whiteSpaceFlag = false; exitSMFlag = false; tempString = ""; while(!tokenFoundFlag){ exitSMFlag = false; if(!ptrAheadOneFlag){ nextChar = readChar(); } else...
431dddaf-1142-404c-8649-5d938321932a
5
@Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; HexLocation other = (HexLocation)obj; if(x != other.x) return false; if(y != other.y) return false; return true; }
445b5c44-dac6-4e19-af48-e575d70bc913
1
public int codeLength() { if (code != null) { return (code.codeLength()); } else { return (0); } }
6b3d2cab-630b-40bb-b576-e444b1bf8778
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Tick other = (Tick) obj; if (demoname == null) { if (other.demoname != null) return false; } else if (!demo...
828e9eb2-c48d-4975-b708-85be24ab47d3
9
public String convertII(String s, int nRows) { // Start typing your Java solution below // DO NOT write main() function if(s == null) return null; if(nRows == 1) return s; StringBuilder sb = new StringBuilder(); // minSize should not be zero int minSize = (nRows -...
35400a99-766b-4cf6-b4e9-794a893f31c5
3
public byte[] toByteArray() throws PacketEncodingException { ByteBuffer buffer = ByteBuffer.allocate(HEADER_SIZE + (message == null ? 0 : message.length())); buffer.putInt(protocolId); buffer.put(Packet.encodeConnectionId(connectionId)); buffer.putShort(Packet.encodeSequenceNumber(sequenceNumber)); buffer.put...
84827746-e3d0-4efb-bf4d-8baa38128023
2
private void initializeElements() { int number = ElementType.values().length * 10 + (GameModel.getUnit() * 10); for(ElementType type:ElementType.values()) { for(int i = 0; i < number; i++) { addElement(new Element(type, getRandomLocationOnGrid(GameModel.GROUND_LEVEL + 25))); } number -= 10; } ...
a527d406-2034-4d7a-b86d-eb9d41918464
6
public StdImage getColumnDragImage(Column column) { StdImage offscreen = null; synchronized (getTreeLock()) { Graphics2D gc = null; try { Rectangle bounds = new Rectangle(0, 0, column.getWidth() + (mDrawColumnDividers ? 2 : 0), getVisibleRect().height + (mHeaderPanel != null ? mHeaderPanel.getHeight() + 1...
0cc9ce47-9c3e-499a-be41-26e324293fe0
6
public void close() { if(resultSet != null){ try { resultSet.close(); } catch (SQLException e) { System.out.println("Warning: Couldn't close results."); } } if(statement != null){ try { statement.close(); } catch (SQLException e) { System.out.println("Warning: Couldn't close the...
9736b0ea-0a5b-4746-9a9d-518e225e0708
9
public Object getValueAt(int rowIndex, int columnIndex) { assert((columnIndex >= 0) && (columnIndex <= 2)); Iterator i = scoreSet.iterator(); int j = 0; while(i.hasNext()) { if(j == rowIndex) { Object...
0eb772f3-8cec-41b2-8a6d-bdebf7b4118c
7
private void connect14(int atom1, int atom2, int atom3, int atom4){ if (atom1 > atom4){ int temp = atom4; atom4 = atom1; atom1 = temp; temp = atom3; atom3 = atom2; atom2 = temp; } // check for duplicate entries for(int i=0; i<numberOf14Connections; i++){ int ix4 = i * 4; if (connected14[...
0402debc-8e35-4bc3-b397-ddc7909211f1
7
public void actionPerformed(ActionEvent evt) { // resets the output ButtonFrame.getOutputLog().setText(""); ButtonFrame.getOutputLog().setText(""); if (ButtonFrame.getPeriodBox().getSelectedItem().equals("Choose Period") && ButtonFrame.getAreaBox().getSelectedItem().equals("Choose Area")) { ButtonFrame.get...
50f5065a-7c92-406f-bb78-0a07d8463429
0
public void setIdent(String ident){ this.Ident = ident; }
c0156ca1-e3b6-4d83-ac0f-c77dbd2b3094
9
private DefaultListModel makeListModel(List<? extends SystemObject> list) { DefaultListModel dlm = new DefaultListModel(); String filter = _filterTextField.getText(); Pattern pattern = null; long id = 0; if(!filter.isEmpty()) { try { // if(filter.startsWith("/") && filter.endsWith("/")){ // pattern ...
2753dc2a-c9a6-4ab9-ad36-81e78c4809c3
8
@Override public String getQueryString() { if (m_fields == null || m_table == null || m_placeholders == null) throw new IllegalStateException("Table name or fields missing"); if (m_where == null && m_all == false) throw new IllegalStateException("Must call all() to update all records"); StringBuilder ...
0c709429-1e3c-4ba9-9201-535828482c83
6
public String toCommaSeparatedString() { StringBuffer sb = new StringBuffer(VERSION); sb.append(','); for (int i=0; i<NUM_TOKEN_TYPES; i++) { sb.append(i).append(','); Style ss = styles[i]; if (ss==null) { // Only true for i==0 (NULL token) sb.append("-,-,f,-,,,"); continue; } Color c ...
26fc3a56-46e9-4d34-ab7b-971fd59a4a3e
4
public Car out(Ticket ticket) { if(!parkIsNull() && this.park.contain(ticket)) { return this.park.out(ticket); } for(ParkBoy boy : this.parkBoyList) { if(boy.contain(ticket)) { return boy.out(ticket); } } throw new ParkException("没有你要取的车。"); }
f057bbcd-1f3a-4f41-ba04-f0a7abfddd4a
4
private int jjMoveStringLiteralDfa17_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 16); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 16); } switch(curChar) { case 49: return jjMoveStringLiter...
1e563074-ed04-414a-9f3d-9196dcc78d9f
3
@Override public boolean accept(File dir, String name) { if (mFileNameMatchers.isEmpty()) { return true; } for (String one : mFileNameMatchers) { if (name.matches(one)) { return true; } } return false; }
5090447d-5480-4580-8e71-fd04a353689e
3
private static int removeFromArray(int count, AreaObject[] array, AreaObject obj) { for (int i = 0; i < count; i++) { if (array[i] == obj) { if (i != --count) { array[i] = array[count]; } array[count] = null; break; } } return count; }
16a12bc2-725b-4871-a6d5-45fef95edcc2
8
public static String[] splitbyLetter2(CharSequence text){ list.clear(); int pos = 0; int len = text.length(); boolean first=true; for (int i = 0; i < len; i++) { char c = text.charAt(i); if(c > 58){ //ASCII no number and no whitespace if(fi...
f7f37acb-757f-493b-8bd8-074ed1866105
2
private boolean jj_3R_79() { if (jj_scan_token(CLASS)) return true; Token xsp; xsp = jj_scanpos; if (jj_3_14()) jj_scanpos = xsp; return false; }
da1b1145-89e0-4064-884b-e512257ce9f8
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
c9ca9c09-5201-441f-b83b-9f1b584f2f40
4
public void moveLeft(Area currentWorld){ for(int count = stats.speed; count > 0; count--){ if(currentWorld.locWalkable(x - size - 1, y) && currentWorld.locWalkable(x - size - 1, y + size) && currentWorld.locWalkable(x - size - 1, y - size)){ x--; } } }
914c5fd1-7ecf-4b1c-9f94-e41745dd8a0e
8
@Override public void transform(double[] src, double[] dst) { // TODO Auto-generated method stub for (int i = 0; i < 3; i++) temp2[i] = src[i]; temp2[3] = 1; for (int i = 0; i < 3; i++) { dst[i] = 0; for (int j = 0; j < 4; j++) { dst[i] += matrix[i][j] * temp2[j]; } } for (int i = ...
6f3cb322-3e3d-4e10-bf0b-2d2d93de8c41
8
private void drawCollider(Graphics g, Enemy[][] enemys, Player player) { g.setColor(Color.GREEN); //Players collider g.drawRect((int)player.getCollider().getX(), (int)player.getCollider().getY(), (int)player.getCollider().getWidth(), (int)player.getCollider().getHeight()); //Enemys collider...
3a4cfb0c-b84d-4595-adfe-5410e8cd2a32
7
public PreparedStatement prepare(String query, Object... params) { if (isOpen()) { try { PreparedStatement statement = this.connection.prepareStatement(query); int count = 1; if (params != null) { for (Object value : params) { ...
c53117aa-9150-4875-b6a6-ef9e16499604
8
public static void handle(Connection connection) throws IOException { if (connection instanceof StreamConnectionNotifier){ BlucatState.serverConnection = connection; do{ BlucatState.connection = ((StreamConnectionNotifier)connection).acceptAndOpen(); BlucatConnection.handle(BlucatState.conn...
45e26b93-c83e-482f-a285-161d446e6780
6
private void parseXMLFile() throws DataInitialisationException{ try{ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(getClass().getResourceAsStream(XMLFileName)); doc.getDocumentElement().norm...
55bdbe7a-f22f-4d87-95ec-b86377f79497
8
@Override public ArrayList<position> getAttacks() { // TODO Auto-generated method stub ArrayList<position> possibleAttacks=new ArrayList<position>(); PieceInterface[][] board=game.getBoard(); position move; //If the pawn ever reaches the end of the board, it should promote. Therefore incrementing or decrem...
a747ec1a-4e02-40a5-9b7e-479637739661
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...
57e3bb64-b07a-4c4e-a878-33cc1f0cfb84
8
public static int countNeighbours(boolean [][] world, int col, int row){ int total = 0; total = getCell(world, col-1, row-1) ? total + 1 : total; total = getCell(world, col , row-1) ? total + 1 : total; total = getCell(world, col+1, row-1) ? total + 1 : total; total = getCell(world, col-1, row ) ? total + 1...
22e502eb-cf3f-4f70-b18e-42d6a27ffd9e
1
public void toggleAI(){ if (this.onkoAI){ this.onkoAI = false; } else { this.onkoAI = true; } }
37f57adc-3dc8-4dea-aab9-eb663a11414b
8
private void downloadAndInstallResource(URL var1, String var2, long var3, int var5) { try { int var6 = var2.indexOf("/"); String var7 = var2.substring(0, var6); if(!var7.equals("sound") && !var7.equals("newsound")) { if(var5 != 1) { return; } ...
d8d9cd2e-2a9a-40d6-b3d1-bd10dac26115
7
@Override public void addKPIs(String inst_id, double maxPower, double avgPower, double energy, double cost, double co2) { boolean first = false; String tableName; String tick_tableName; String id; if(inst_id.equalsIgnoreCase(AGGR)) { id = AGGR; tableName = COL_AGGRKPIS; tick_tableName = COL_AG...