method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
16f4a177-065f-4fcf-b875-8c3edfa871f9
6
private Node[] getPossibleNode() { ArrayList<Node> possibleNodes = new ArrayList<Node>(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (i == current.getCordinates()[0] && j == current.getCordinates()[1]) { continue; } if (mapNode[i][j].getStatus() == 0 || m...
237a1507-ee42-4ed7-ac93-12e6be0e48f3
3
private String readNChars( int n ) throws IOException { if( n <= 0 ) return ""; char[] buf = new char[n]; int i = 0; for( ; this.readChar() && i < n; i++ ) { buf[i] = this.currentChar; } return new String( buf, 0, i ); }
9d010b77-8e6d-4c97-a51e-b1e7db8c50b2
3
@Override public Booking createNewChild(TreeMap<String, String> properties){ Account account = accounts.getBusinessObject(properties.get(Booking.ACCOUNT)); String debitString = properties.get(Booking.DEBIT); String creditString = properties.get(Booking.CREDIT); boolean debit= true; ...
eab1a5c3-dc89-47b5-b868-8e12ce141cef
6
public String ExecuteQuery(String QueryText) { String ExecuteQueryOutput = null; try { /* The connection specifies create=true to cause the database to be created. To remove the database, remove the directory AttackDB and its contents. The dire...
a53c1876-84a7-4af6-b87d-4bc0f07098e3
6
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); do { line = in.readLine(); if (line == null || line.length() == 0) break; int times = Integer.parseInt(lin...
b9c61aa0-d869-4917-b452-31bbb59efdcb
4
private void processCatalogueAddResult(Sim_event ev) { if (ev == null) { return; } Object[] pack = (Object[]) ev.get_data(); if (pack == null) { return; } String filename = (String) pack[0]; // replica name int msg = ((Integer) pack[1]).i...
af628708-ba9d-4c32-a87c-78419a50b1a9
3
private boolean isAllOnes() { for (int i = 0; i < this.kmap.getRow(); i++) { for (int j = 0; j < kmap.getColumn(); j++) { if (!kmap.getCellValue(i, j)) { return false; } } } return true; }
d077f859-6fa1-4024-85be-062a24f29998
6
public void recuperar() { FileInputStream fis = null; ObjectInputStream stream = null; try { File arquivo = new File("arquivo.bin"); if (arquivo.exists()) { fis = new FileInputStream(arquivo); stream = new ObjectInputStream(fis); persistencia = (Persistencia) stream.readObject(); } } catch ...
2ebd85c9-d6ca-4b77-9893-a7a96bb2b3c2
2
private void inv2ActionPerformed(java.awt.event.ActionEvent evt) { if(!game.getInBattle()) { outputText.setText(game.useItem(1) + "\n" + game.getCurrentRoom().getExitString()); if(game.itemRemoved()) inv2.setTex...
11151b75-07e8-4f19-a6d6-1c513a712880
9
public static String quoteCharacters(String s) { StringBuffer result = null; for (int i = 0, max = s.length(), delta = 0; i < max; i++) { char c = s.charAt(i); String replacement = null; if (c == '&') { replacement = "&amp;"; } else if (c ...
7bdcd6d6-e122-4ad0-b75f-1d3f477a0d3f
7
public void updateValidTiles(ArrayList<SQwirkleTile> newList, char axis) { assert (axis=='x' || axis=='y'); ArrayList<SQwirkleTile> listToUpdate = null; if (axis=='x') listToUpdate = validTilesOnXAxis; else if (axis=='y') listToUpdate = validTilesOnYAxis; for (SQwirkleTile t: listToUpdate) { if ...
13e6648b-7f28-4f21-a0e9-ec4f565aa6b3
7
public RrdGraphDef getRrdGraphDef() { // basic check if (!root.getTagName().equals("rrd_graph_def")) { throw new IllegalArgumentException("XML definition must start with <rrd_graph_def>"); } validateTagsOnlyOnce(root, new String[]{"filename", "span", "options", "datasources",...
c54f6957-6516-495b-bfe8-86d751cc08fe
6
public void stats() { int low; int i; low = erreur[1]; for(i = 0; i < 3; i++) if(erreur[i] <= low) low = erreur[i]; JOptionPane.showMessageDialog(null, "Niveau prédéfini: "+erreur[0]+" "+(erreur[0]>1?"erreurs":"erreur")+"\n"+ "Niveau personnalisé: "+erreur[1]+" "+(erreur[1]>1?"erreurs":"er...
41870408-2240-4ee9-b0a5-30772d383c02
7
@Override public boolean equals(Object other) { if (other == null) { return false; } if (other == this) { return true; } if (!(other instanceof BoardPosition)) { return false; } BoardPosition otherBoardPosition = (BoardPosition) other; if (this.xBoard == otherBoardPosition.xBoard && t...
0456ab76-80a6-4458-9373-87a4d7f35f03
7
public void acceptResult(ResultProducer rp, Object[] key, Object[] result) throws Exception { if (m_RP != rp) { throw new Error("Unrecognized ResultProducer sending results!!"); } Instance newInst = new Instance(m_AttributeTypes.length); for(int i = 0; i < m_AttributeTypes.length; i++) ...
4bb22342-c83d-427d-9daf-caa45ff89571
3
public static void addHistory(HistoryTask historyTask){ Session session = HibernateUtil.getSessionFactory().openSession(); try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(historyTask); session.getTr...
2cc0e3e8-ae28-4b96-85ca-68579be58eb1
2
@Override public String processCommand(String[] arguments) throws SystemCommandException { Election election = facade.getCurrentElection(); if (election == null) throw new SystemCommandException("No current election set."); String candidate = arguments[0]; try { facade.nominateCandidate(candidat...
dbf0560b-dfea-418b-b06f-da3f084a1ebc
4
private boolean isAtEdge(){ boolean isEdge=false; int worldX=getWorld().getWidth(); int worldY=getWorld().getHeight(); int thisX=getX(); int thisY=getY(); int thisWidth=image.getWidth()/2; int thisHeight=image.getHeight()/2; if(thisX<=0||thisY<=0||thisX+thisWidth>=worldX||thisY+thisHeight>=worldY){ ...
e26ee104-20b0-47df-adea-8c63515b8b01
1
private Point[] genSelection(Point base, Point[] rel) { Point[] selection = new Point[4]; selection[0] = base; int x = base.getX(); int y = base.getY(); for (int i = 0; i < rel.length; i++) { selection[i+1] = new Point(x+rel[i].getX(), y+rel[i].getY()); } return selection; }
f67d5551-81f4-4449-b905-3dfbb1dcd908
6
public synchronized void readBlockResponse(final int offset, final int length) { // removes old instance (all which are contained) HashSet<MessageBlockDef> rm = new HashSet<MessageBlockDef>(); for (MessageBlockDef mbds : sentBlocks) { if (mbds.offset >= offset && mbds.offset + mbds.length <= offset + length) {...
d6dc46e2-1810-4298-9338-36ca6949f6de
4
private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) { int hitCount = 0; // check if new hit list is needed if (leafHitList == null) { hitCount = getHitList(hitRegion, contained); if (hitCount == 0) return 0; // no hit data found ...
6a6e2041-e66a-4273-a47a-85d8c7c18ae1
4
static int score(int l) { if (l <= 4) return 1; else if (l <= 5) return 2; else if (l <= 6) return 3; else if (l <= 7) return 5; return 11; }
54ed9237-610c-474a-b611-7d0af0083959
0
@Autowired public void setCfService(CFService cfService) { this.cfService = cfService; }
fc7d069b-2968-4ba1-89bf-52781db7d7cc
1
public String saveString() { String toReturn = ""; for (Action a: actions) toReturn = toReturn + a.saveString(); return toReturn; }
148cd640-425c-44b7-9c67-32d304088fb7
1
public CtClass getCtClass(String classname) throws NotFoundException { if (classname.charAt(0) == '[') return Descriptor.toCtClass(classname, this); else return get(classname); }
e21274bb-8f3a-4dd6-ada9-bde161d6238c
1
public String getProperty(String key) throws PropertyNotFoundException { String value = null; if (null != properties.getProperty(key)) { value = properties.getProperty(key).trim(); } else { String errorMsg = new StringBuilder(key).append(" property not found in property file.").toString(); LOG.warn(error...
55935e95-e31d-45c6-8d7f-9243facae0ec
9
public final void funcdef() throws RecognitionException { try { // Python.g:96:9: ( ( decorators )? 'def' NAME parameters COLON suite ) // Python.g:96:11: ( decorators )? 'def' NAME parameters COLON suite { // Python.g:96:11: ( decorators )? int alt9=2; int LA9_0 = input.LA(1); if ( (LA9_0==AT) )...
f2529305-8460-4921-8ec0-4c4c20dd2d54
3
public static int getEntityId(String entityName) { if (entityName == null) { return NOT_FOUND; } try { return Sim_system.get_entity_id(entityName); } catch (Sim_exception e) { return NOT_FOUND; } catch (Exception e) { ...
5a745dd2-f93b-468b-b82e-3892a7ce06d9
0
private void setEndPoint(EndPoint endPoint) { this.endPoint = endPoint; }
4499b7a1-283b-446a-814d-b730ad1d54c0
1
public static void radSort(int intArr[], int len){ int max = getMax(intArr, len); for (int i=1; (max/i)>0; i=i*10)//Performans countSort on each column countSort(intArr, len, i); }
d3b63adb-9f87-46a2-a8c6-8c8970e611fb
8
@Override public String toString() { String dateToString = ""; String dateFromString = ""; if (mFromDateTime != null) { dateFromString = MyTasksParser.dateTimeFormats.get(0).format( mFromDateTime); } if (dateFromString.contains("00:00")) { dateFromString = MyTasksParser.dateFormats.get(0).format( ...
88cefd4b-47ed-4f88-9330-21cfa842c08f
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { VHDLProgramerUi window = new VHDLProgramerUi(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
23411fa0-0642-4c15-a263-be3ce59d8d1d
1
public void writeToFile(String textLine) { try { FileWriter fw = new FileWriter(path); BufferedWriter bw = new BufferedWriter(fw); PrintWriter pw = new PrintWriter(bw); pw.print(textLine + "\n"); pw.close(); } catch (IOException e) { ...
ad0e69b0-4f8a-4306-9d22-7b31470b8acf
4
private void generateStatistic() { for (int i = 0; i < inputLength; i++) { double min = data[0][i]; double max = 0; double avg = 0; for (int j = 0; j < trainingDataLength; j++) { if (data[j][i] < min) { min = data[j][i]; } if (data[j][i] > max) { max = data[j][i]; } avg ...
e58122b1-534e-4b6f-b8f2-1e6f8a18428e
7
@Override public double[] computeValue(char refBase, FastaWindow window, AlignmentColumn col) { char base; double count; double left, right; //Looking backward int refPos = col.getCurrentPosition(); // Fix if near left edge of contig where refPos-1 will fail if(refPos <...
c853d748-eda8-42bb-a54e-9f6ab8649ddf
0
public Image(String path){ this.path = path; load(); }
769d4a78-456f-417b-add8-79d4c96d50b5
9
public static boolean check(String line) { Stack<String> pila = new Stack<String>(); for (int j = 0; j < line.length(); j++) { if (line.charAt(j) == '(' || line.charAt(j) == '[') pila.push(line.charAt(j) + ""); else if (pila.isEmpty() || (line.charAt(j) == ')' && !pila.peek().equals("(")) || (li...
ee81c672-e1c2-42c4-9954-a33f6e4f4788
0
protected int getMaxLitterSize() { return MAX_LITTER_SIZE; }
fa7b08bf-f1de-454e-971b-337d580b7ff4
9
public boolean hasCycles() { // check for cycles boolean[] bDone = new boolean[m_nNodes]; for (int iNode = 0; iNode < m_nNodes; iNode++) { // find a node for which all parents are 'done' boolean bFound = false; for (int iNode2 = 0; !bFound && iNode2 < m_nNodes; iNode2++) { if (!bDone[iNode2]...
6c52fd37-eb47-4f33-ad71-8df1b5996004
9
private static void prepareLocalIp(final File fileIn, final File fileOut) { // insert local IP at right spots BufferedReader in = null; BufferedWriter out = null; try { final String ipSource = "<IPSource>" + InetAddress.getLocalHost().getHostAddress() + "</IPSource>"; ...
7e70a492-1045-4b5f-8026-8a78d879131e
2
public boolean openFile(String file, String fileIde) { try { //it tries using the method used to read from a jar scanner = new Scanner(TextFileToArray.class.getResourceAsStream(file)); return true; } catch (Exception e1) { //if that fails, it tries to use the try { //method to read from the IDE scann...
0057c2ce-e208-478e-8d7c-87541d80e2a1
5
private void accumulate(ArcState state, double value) throws IOException { if(Double.isNaN(value)) { state.setNanSteps(state.getNanSteps() + 1); } else { if(consolFun.get().equals("MIN")) { state.setAccumValue(Util.min(state.getAccumValue(), value)); } else if(consolFun.get().equals("MAX")) { ...
2071641e-9d2a-4931-a2fa-8a8199766aa4
7
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
59602cfd-b6dc-42da-bca3-747205620876
4
private int strToInt(String str){ int i = 0; try{ i = Integer.parseInt(str); } catch(Exception e){} if((i>=32 && i<=126) || i==1) return i; else return 0; }
e4c25cae-960f-4eef-aaad-e8c5b8796b73
4
public Cell(int i) { this.index = i; if((this.index - MAX_COL) >= 0) this.top = this.index - MAX_COL; if((this.index + MAX_COL) < (MAX_ROW*MAX_COL)) this.bottom = this.index + MAX_COL; if((this.index % MAX_COL) > 0) this.left = this.index - 1; if(((this.index + 1) % MAX_COL) > 0) this.right = this...
220a003e-fb9c-4658-90cf-1ad8b21d88ba
2
private static void makeMaps(Bzip2Block bzip2Block) { bzip2Block.nInUse = 0; for (int i = 0; i < 256; i++) { if (bzip2Block.inUse[i]) { bzip2Block.seqToUnseq[bzip2Block.nInUse] = (byte) i; bzip2Block.nInUse++; } } }
c27bda8c-5ad2-4d6a-9fdc-b188d5e400d8
1
public SignatureVisitor visitReturnType() { endFormals(); if (!hasParameters) { buf.append('('); } buf.append(')'); return this; }
7de1d29e-e189-4a8d-9602-397edbdd99ac
0
public short getId() { return id; }
45623736-863a-44ed-9e73-0195e1b13fe7
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 Room)) { return false; } Room other = (Room) object; if ((this.id == null && other.id != null) || (this.id != n...
c53cf462-49ff-41b7-b28d-a25130a4162f
0
public int GetLeftByBus() { return leftByBus; }
b9dc8b75-955b-4703-b605-8020a3add1ea
3
@Override protected Value evaluate(ExecutionContext executionContext) throws InterpretationException { Value valA = ((AbsValueNode) this.getChildAt(0)).evaluate(executionContext); Value valB = ((AbsValueNode) this.getChildAt(1)).evaluate(executionContext); if (valA.getType() == VariableTyp...
5392895c-4196-4f7c-8893-4985f9be3d6a
6
Coordinate drawOrbitalSubject(final Subject subject, final Coordinate parentPos, Coordinate relPos) { if (subject.meta.type == SubjectType.PLANET) { drawOrbit(subject, parentPos); } else if (subject == Main.SELECTED_SUBJECT) { drawOrbit(subject, parentPos); } Co...
712ce0e3-22ad-4179-8546-dc1860a7d4ef
4
@Override public void mousePressed(MouseEvent e) { if (isEnabled() && !e.isConsumed() && graphComponent.isPanningEvent(e) && !e.isPopupTrigger()) { start = e.getPoint(); } }
2448310b-c640-480a-9b41-1ac49b248092
6
public static Cons walkSlotValueSetterTree(Cons tree, Object [] MV_returnarray) { { Stella_Object objectref = null; StandardObject objecttype = null; { Object [] caller_MV_returnarray = new Object[1]; objectref = Stella_Object.walkATree(tree.rest.value, caller_MV_returnarray); objectty...
d4339e08-0596-4c7b-ba42-b9059f86f58c
9
private boolean match(Value[] matches, Value match, Value value) { if(match instanceof Symbol) { int index = args.indexOf((Symbol)match); if(index != -1) { if(matches[index] == null) { matches[index] = value; return true; } return matches[index].equals(value);...
857cb473-eb04-4109-b080-2c22d5a2719e
3
public void redraw() { // update playing area // 1) look at cards in playerHand and dealerHand and add/update labes in the "Grid" for (int i = 1; i < dealerHand.getCardCount() + 1; i++) { Card dealerCard = dealerHand.getCard(i - 1); arLblDealer[i].setIcon(new ImageIcon(Ge...
3a8fa31e-2ac0-48e5-a780-d1699b2e0d20
1
public Image loadImage (String file) // this method reads and loads the image { try { InputStream m = this.getClass().getResourceAsStream(file); return ImageIO.read (m); } catch (IOException e) { System.out.println ("Error: File " + file + " not found."); return null; ...
9d3368e7-92d6-4bd4-af99-d5ada726019a
9
protected void changeNeuronWeight(int neuronNumber, double[] vector, int iteration, int distance){ double[] weightList = networkModel.getNeuron(neuronNumber - 1).getWeight(); int weightNumber = weightList.length; double weight; if(showComments){ String vectorText="[";...
2dd57834-1812-4a66-b271-1a451736c5e8
1
public static void testFindFieldsbyCSS() throws Exception { try{ getDriver().get("http://www.google.com/webhp?complete=1&hl=en"); assertEquals("Google", getDriver().getTitle()); // Find the text input element by its name WebElement element = getDriver().findElement(By.cssSelector("inp...
ca3fa4d8-81e4-44af-bc3c-459e39031424
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...
b8a7e794-efb3-45bf-b67b-e65d6a1079db
8
final aa method425(AbstractToolkit var_ha, byte i) { anInt767++; aa var_aa = (aa) Class239_Sub24.aClass60_6096 .method583((long) ((Widget) this).anInt830, 119); if (var_aa != null) return var_aa; ImageSprite class207 = ImageSprite.getSprite(Entity.widgetSpriteIndexLoader, ((Widget) this).id, 0); if (c...
a75ac60e-38dc-4eb6-8259-c15cceef7de9
5
public void paint(Graphics g) { try { sm.getCurrentScreen().clear(); sm.getCurrentScreen().render(); }catch(NullPointerException e){if(sm.getCurrentScreen()== null)System.out.println("Screen is null!!"); else e.printStackTrace();} int[] pix = sm.getCurrentScreen().pixels; for(int y = 0; y < sm.getCurr...
e23527c2-654b-425f-b25a-428915970b88
2
public void run() { while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { return; } } }
db66410b-1a77-4c46-912c-54d41c7039bc
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class) public JAXBElement<byte[]> createPGPDataTypePGPKeyID(byte[] value) { return new JAXBElement<byte[]>(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); }
97e0a46e-15f4-4e4d-9529-f2bf642be452
7
public final void stopCutscene(Player player) { if (player.getX() != endTile.getX() || player.getY() != endTile.getY() || player.getPlane() != endTile.getPlane()) player.setNextWorldTile(endTile); if (hiddenMinimap()) player.getPackets().sendBlackOut(0); // unblack player.getPackets().sendConfig(1241, 0...
8c1fdb7e-90e6-40f2-ba41-a6bfe1e2daea
8
protected int selfTest(InstanceStream testStream) { int returnStatus = 1; Instance testInst = null; int maxInstances = this.maxInstancesOption.getValue(); long instancesProcessed = 0; //InstanceStream testStream = (InstanceStream) getPreparedClassOption(this.testStreamOption); ...
9f873ebc-2b10-40ce-ae44-412db127e60f
5
@Override public void move() { if(x + dx >= 0 && x + dx <= SpaceWarrior.WIDTH - width) x = x + dx; if(y + dy >= 0 && y + dy <= SpaceWarrior.HEIGHT - width) y = y + dy; if(explosionItr == 15) { isOnScreen = false; } }
0fe24790-23cb-47f8-9b17-160db654c716
7
public void generateAggregatedReport() { long start,end; start = System.currentTimeMillis(); File reportFile = new File(reportFileName); PrintWriter reportOut=null; boolean once= true; try { reportOut = new PrintWriter(reportFile); } catch (FileNotFoundException e) { // TODO Aut...
5d9f108f-2f69-4445-87b0-5a9f2f42604a
5
public void initialize() { // _entityIdCounter = 1L; _entityNumberCounter = 0L; // _entityId_setStatus_Table = new TLongObjectHashMap<Boolean>(); _setStatus_entityIdList_Table = new THashMap<Boolean, TLongList>(); _setStatus_entityIdList_Table.put( Boolean.TRU...
341e8768-7753-4880-9691-fb7369b27542
6
public boolean updateRoutingTable(){ //go through every node. for every node, update best distance, to every other node. //two loops. first goes through all nodes, other looks at neighbours and updates distance //get distance to neighbour, plus edge in between them //for every other node in the graph boolean u...
c27d5e00-0e34-43a3-a5f0-28c21eeb9865
1
public DefaultResponse deleteRegistrant(String asId) { if (!UtilityMethods.isValidString(asId)) { throw new IllegalArgumentException("Id parameter is null"); } return delete(REST_URL_REGISTRATION + "/" + encode(asId), DefaultResponse.class); }
6dfde43c-670e-4b2b-a0de-8f994bcb0d30
1
public int bonusGain(Territoire t) { if( t.has(EspacePleinAir.class) ) return 2; return 0; }
8606f4da-be13-4342-838b-2099cf612a64
2
public static GuiCommand getCommand(String command) { for(GuiCommand gc : GuiCommand.values()) { if(gc.name().equals(command)) return gc; } return null; }
a9462206-3e6c-4388-a48a-9414cc831401
5
public void doLog(String log) { if(appState == STARTED) { try { StyledDocument sDoc = logMessagesDisp.getStyledDocument(); if(!logBuffer.isEmpty()) { Iterator iter = logBuffer.iterator(); while(iter.hasNext()) { sDoc.insertString(sDoc.getLength(), (String)iter.next(), sDoc.getStyle(STYLE_...
ab27db68-d375-4298-8d07-2e2337a06425
8
public void continueVisit(String ... addKeys) { this.key = ""; String[] newkeys = new String[paths.length + addKeys.length]; System.arraycopy(paths, 0, newkeys, 0, paths.length); System.arraycopy(addKeys, 0, newkeys, paths.length, addKeys.length); this.paths = newkeys; ...
d7c7efb6-b213-465a-a48d-fa4814e8d0c5
1
public void addMeetings(Meeting newMeetings){ if(meetings == null){ meetings = new ArrayList<Meeting>(); } meetings.add(newMeetings); }
0e5442a1-07db-4125-b738-9ba49909b3a0
6
public static void main(String[]args){ Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int s = 0; int[] a = new int[n]; for(int i = 0 ; i < n ; i++){ int t = in.nextInt(); a[i] = t; ...
56bc5890-81c3-4821-a784-e96ef668c0ef
7
public void actionPerformed(ActionEvent e) { if (e.getSource() == fileBrowse) { // Open browse file dialog int returnVal = fileChooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { _ricFile = fileChooser.getSelec...
0f2dafb2-ccb6-4cca-b77f-9fa70fe6b26d
7
public String longestPrefixOf(String s) { if (s == null || s.length() == 0) return null; int length = 0; Node x = root; int i = 0; while (x != null && i < s.length()) { char c = s.charAt(i); if (c < x.c) x = x.left; else if (c > x.c) x = x...
0afb24ef-92fd-4955-bf02-e80b4c3c6b13
1
public final VBox createMenu() { flow.play(); final int i20 = 20; VBox menuBox = new VBox(i20); final MenuBar menuBar = new MenuBar(); final MenuItem newMenu = MenuItemBuilder.create().text("New").build(); newMenu.setOnAction(new EventHandler<ActionEvent>() { ...
1c980359-7a2a-411d-bbd0-bddfd212de15
3
public void merge(VariableSet vs) { for (int i = 0; i < count; i++) { LocalInfo li = locals[i]; int slot = li.getSlot(); for (int j = 0; j < vs.count; j++) { if (li.getSlot() == vs.locals[j].getSlot()) li.combineWith(vs.locals[j]); } } }
4d1d1adb-76e0-4fbc-86db-9a83dc002c7e
8
public static String getModifyResult(int result) { String str = null; switch (result) { case GridSimTags.AR_MODIFY_ERROR: str = "AR_MODIFY_ERROR"; break; case GridSimTags.AR_MODIFY_SUCCESS: str = "AR_MODIFY_SUCCESS"; ...
453c2ee9-0a14-41dc-bd66-04b99908c7f1
1
public void dispose() { for(Texture texture : name2texture.values()){ texture.dispose(); } MusicPlayer.getInstance().dispose(); this.spriteBatch.dispose(); }
9fe54fac-1a87-4c10-b4b1-6fb3d0f06916
8
public static double getGCContent(String s, int position, int windowSize) { int end = s.length(); end = Math.min(position+windowSize, end); double numGC =0; double numGood = 0; for( int x=position; x < end; x++) { char c = s.charAt(x); if( c == 'A' || c=='C' || c == 'G' || c=='T') numG...
95a059f7-acac-488d-bb4c-7a6749159704
4
public byte[] toByteArray() { byte[] returnValue = null; try { // if in cached mode read from the tmp file if (isCached) { if (tempFile != null) { // Create a writable file channel, can't use instance as // it will have funk...
25f76449-379e-4114-96d3-e1c23e4e17cf
1
public void replace(StructuredBlock sb) { outer = sb.outer; setFlowBlock(sb.flowBlock); if (outer != null) { outer.replaceSubBlock(sb, this); } else { flowBlock.block = this; } }
5503e8f3-de1f-4e2f-bbb8-b491ffbb638e
4
public void cdraw(GOut g) { if(folded) return; Coord avac = new Coord(32, 0); g.image(bg, avac); if(avagob != -1) { Gob gob = ui.sess.glob.oc.getgob(avagob); if(gob != null) { Avatar ava = gob.getattr(Avatar.class); if(ava != null) g.image(ava.rend, avac); } } }
0de910c5-d35a-48ba-a2d4-31cd66bff500
1
public void addCustomFields(String field, String value) { if (this.customFields == null) { this.customFields = new HashMap<String, String>(); } customFields.put(field, value); }
c9467c7c-dfab-41ff-9980-43e7ffb756fd
7
public static int partition(String s) { boolean[][] isPalindrome = new boolean[s.length()][s.length()]; int[][] cost = new int[s.length()][s.length()]; //for single letter palindromes for(int i=0; i< s.length(); i++) { isPalindrome[i][i] = true; cost[i][i] = 0; ...
345ef437-0f81-4e4c-bc8a-8fdf499f84cd
1
public void addClassPathUrl(URL url) { if (url == null) { throw new NullPointerException("url == null"); } classPathUrls.add(url); }
47c08c46-4073-4acb-8c68-a778a2f183a6
5
private void comandoLeia() { // <leia> ::= “leia” (“<argumento> <prox_argumento> “)” ”;” if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[1].equals(" (")) { if (!acabouListaTokens()) { nextToken(); this.argumento(); ...
221c9529-1823-4428-88dd-a822fa12a57e
1
private void actualizarTabla() { tableTicketModel.actualizaTabla(); table_ticket.setModel(tableTicketModel); final int row = this.table_ticket.getRowCount(); if(row > 0){ this.btnExcel.setEnabled(true); this.btnReporte.setEnabled(true); this.b...
dd03f061-8ddd-4466-921c-1709f40c55bc
9
public Endereco(String rua, int numero, String bairro, String cidade, String estado) throws Exception { if (rua == null || rua.equals("")) { throw new Exception("Nome da rua Invalido"); } if (numero < 0) { throw new Exception("Nome da Rua Invalido"); } if (bairro == null || bairro.equals("")) { ...
f8eb3113-aca4-4bd1-80c0-a0035d441bc0
9
protected synchronized void drawVehicles(Graphics g) { g.setColor(Color.black); // This chunk of code just translate and rotates the shape. for (int j = 0; j < numVehicles; j++) { if (j < my_colors.length){ g.setColor(my_colors[j]); }else{ g.setColor(my_colors[my_colors.length-1]); } int dra...
d7b71791-08b4-498d-83be-8d102a0571dd
2
public void setCast1(String[] src) { charCast1 = new Image[src.length]; for (int i = 0; i < src.length; i++) { try { charCast1[i] = new Image(src[i]); } catch (SlickException e) { System.out.println(e); } } }
b72a4c8c-20de-4f85-881f-7bf1926a8c1e
6
private static final Object[] decodeInteger(byte[] bencoded_bytes, int offset) throws BencodingException { StringBuffer int_chars = new StringBuffer(); offset++; for(; bencoded_bytes[offset] != (byte)'e' && bencoded_bytes.length > (offset); offset++) { if((bencoded_bytes[...
01b2c967-a594-4202-bbe3-8afd8e440be1
4
public void move(Point startMove, Point endMove, int canvasWidth, int canvasHeight) { if(((x + endMove.getX()-startMove.getX()) >= 0) && ((y + endMove.getY()-startMove.getY()) >= 0) && ((x + width + endMove.getX()-startMove.getX()) < canvasWidth) && ((y + height + endMove.getY()-startMove.getY()) < canvas...
8339a4f7-6987-4aad-a444-d78891c0d29e
3
public void setRight(PExp node) { if(this._right_ != null) { this._right_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
70fe7aca-868d-42ea-b6a5-05a11f1ceba7
4
public static void chooseSort(int flag,int intArray[],int sortKind) { switch(flag){ case 1: BubbleSort bubbleSort=new BubbleSort(); bubbleSort.sort(intArray, sortKind); break; case 2: SelectionSort selectionSort = new SelectionSort(); selectionSort.sort(intArray, sortKind); //selectionS...
21106b45-561c-47f7-8b81-7bf1935e1ea5
4
private static void DayTimeDisplay(){ // Must display Good/Evil/Alive/Dead probabilities. double[][] Probabilities = RunningGame.getProbabilities(); double[] LiveProbs = RunningGame.LivingProbabilities(); double DisplayProbs[][] = new double[NumPlayers][4]; for(int n = 0; n < NumPlayers; n++){ DisplayProbs[n...