method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9fb0166e-52b9-4016-8597-1a80381c45ad
2
List<Compound> list() { if (p == null) { p = new ArrayList<Compound>(); for (T el : list) { p.add(create(el)); } } return p; }
715880d1-0e86-4183-8284-ee0c29c77f00
4
public String diff_prettyHtml(LinkedList<Diff> diffs) { StringBuilder html = new StringBuilder(); for (Diff aDiff : diffs) { String text = aDiff.text.replace("&", "&amp;").replace("<", "&lt;") .replace(">", "&gt;").replace("\n", "&para;<br>"); switch (aDiff.operation) { case INSERT: ...
8cd034e9-fabf-4857-a12e-a82b65283181
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 Tache)) { return false; } Tache other = (Tache) object; if ((this.num == null && other.num != null) || (this.nu...
246b0477-274d-43bb-928f-de8b37695a25
6
public boolean httpPostWithFile(String url, String queryString, List<QParameter> files, QAsyncHandler callback, Object cookie) { if (url == null || url.equals("")) { return false; } url += '?' + queryString; PostMethod httpPost = new PostMethod(url); List<QParameter> listParams = QHttpUtil.getQueryParam...
476307af-56d4-4243-9e79-454f960047fc
5
@Override public Polynomial<Double, Double, Double> setCoefficient(final int degree, final Double value) { if (degree < 0) throw new IllegalArgumentException("The specified degree must be " + "non-negative."); if (this.getDegree() < degree) thr...
aa7d8fbe-4867-4b07-acdd-76b205c9b161
4
private static void sortStudents(ArrayList<Student> studentArray2) { //Student top = studentArray2.get(0); int j, first; for(int i=studentArray2.size() - 1; i > 0; i--) { first = 0; for(j = 1; j <= i; j++) { if((studentArray2.get(j).getLength()) < (studentArray2.get(fir...
7257fee1-573b-4260-b8f9-b6cc99a3a454
4
public void treeNodesInserted(TreeModelEvent e) { TreePath path = e.getTreePath(); Object root = tree.getModel().getRoot(); TreePath pathToRoot = new TreePath(root); if (path != null && path.getParentPath() != null && path.getParentPath().getLastPathCo...
7d416e1f-15b8-4e6f-b574-4194756ae05b
5
private String sendDataOut(String key, String data) throws TimeoutException { ClientInfo ci = new ClientInfo(); ci.setClientKey(key); PooledBlockingClient pbc = null; try { pbc = blockingClientPool.getBlockingClient(ci); if (pbc == null) { throw new TimeoutException("sdo: we do not have any client[p...
5d8b0302-3a17-4d84-a552-29111658b8ac
2
private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; }
ea111a4f-4b8f-406a-bb56-6a7b6e1e9c47
2
static void rotate(int[][] matrix) { int n = matrix.length; int tmp; for (int offset = 0; offset < n/2; offset++) { for (int i = offset; i<offset+n-2*offset-1; i++) { tmp = matrix[offset][i]; matrix[offset][i] = matrix[n-1-i][offset]; m...
a2bfbddd-3b97-4aaa-9381-3bcaf6e0e51e
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 Dokument)) { return false; } Dokument other = (Dokument) object; if ((this.dokumentid == null && other.dokument...
4e8f472f-04d9-451a-b5ff-ccb87ea2eef9
7
@Override public int compareTo(Version o) { if (o == null) { throw new NullPointerException(); } if (super.compareTo(o) != 0) { return super.compareTo(o); } if (!(o instanceof BigVersion)) { // ...
4fd67ce3-f84c-4258-9a21-10f1ff3282e7
1
public void suspend() throws InterruptedException { suspending = true; while(suspending) { Thread.sleep(10); } }
31bde575-312f-4a6c-bf40-71b817922304
4
public void alterar(Paciente pacienteAnt) throws Exception { if(pacienteAnt.getNome().isEmpty()){ throw new Exception("Nome esta invalido !!"); }else{ this.verificaNome(pacienteAnt.getNome()); } if(pacienteAnt.getCpf().equals(" . . - ")){ throw ...
4cc1dd06-b377-4524-9c61-9f9d78a2d53a
1
private static void showAllRoles() throws Exception { RoleDAO dao = new RoleDAO(); ArrayList users = (ArrayList) dao.findAll(); Role o; System.out.println("Listing roles..."); for (int i = 0; i < users.size(); i++) { o = (Role) users.get(i); ...
2749f6a1-d5c3-4c8f-acbb-9025806f29b9
5
public static byte linear2alaw(short pcm_val) /* 2's complement (16-bit range) */ { byte mask; byte seg=8; byte aval; if (pcm_val >= 0) { mask = (byte) 0xD5; /* sign (7th) bit = 1 */ } else { mask = 0x55; /* sign bit = 0 */ pcm_val = (short) (-pcm_val - 8); } ...
0db393bc-ba54-4c4c-a515-d875965b29e2
2
public boolean isKeysOpen() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (hud.getName().equals("ScreenKeys")) { return hud.getShouldRender(); } } return false; }
145c13cd-68a1-4c28-9d25-b2c77848743b
8
void handleLeaderDisconnection() { String [] disMessagePieces= backupAccumulatorString.split(DELIM, 3); //wait until new backupString is updated since it might take time while (disMessagePieces.length < 2) disMessagePieces= backupAccumulatorString.split(DELIM, 3); currentLeaderInfo = disMessagePi...
cf5fe1c8-1b39-4bc4-8727-1f7bab8af35e
3
@Test public void testCreateQueueSender() { QueueSender pub; try { pub = BrokerFactoryImpl.createSender("TestQueue"); assertNotNull("TopicPublisher is null", pub); } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokerError e) { fail("Unexpected exception while creating publisher")...
a98ec8cc-0abf-4aae-a8b7-d1656debf50d
4
@Override public String getColumnName(int c) { String result; switch (c) { case 0: result = "Name"; break; case 1: result = "Registration date"; break; case 2: result = "Last log-in da...
6bc78784-cd16-4d3c-b0e0-44fc1f2255a8
7
@Override public void onUpdate(World apples) { if (!apples.inBounds(X, Y)) { alive = false; //apples.explode(X, Y, 32, 8, 16); } if (!apples.isSolid(X, Y-10)) { Y-=10; } for (int i = 1; i < 10; i++) { if (!apples.is...
36196de9-a259-4498-9d9d-e30659b433c9
3
private int finishReservations() { int resFinished = 0; Iterator<ServerReservation> iterRes = reservTable.values().iterator(); while(iterRes.hasNext()) { ServerReservation sRes = iterRes.next(); if(sRes.getActualFinishTime() <= GridSim.clock()) { sRes.setStatus(ReservationStatus....
ca5f422f-ece0-40ec-89a9-db765f57d819
9
private void parseLine(ContainerSqlFragment container, Line line) { String trimmed = line.lineTrimmed(); if (trimmed.length() == 0) { return; } if (trimmed.contains("@INCLUDE")) { parseIncludeTag(container, line); } else if (trimmed.contains("@LIKE")) { parseOperatorTag(con...
09b8535b-340f-49f3-adae-c3e607e93352
7
@Test public void testGetPositions() { RosterDefinition roster = new RosterDefinition(); Set<FantasyPosition> fantasyPositions = roster.getFantasyPositions(); Assert.assertNotNull("Failed to retrieve fantasy position set", fantasyPositions); Assert.as...
00590ef4-1eff-4b1e-8f4f-3c62498f4708
5
public void savePattern(Pattern pattern, String fn) { try { fn = "recordings/" + fn; FileWriter fw = new FileWriter(new File(fn)); System.out.println("Saving pattern"); fw.write(pattern.rightHanded + "\n"); //for each frame in the pattern for (int i=0; i<pattern.length; i++) { if (i > 20) ...
de96d175-bbd9-4ca7-a02c-9993ee53374e
5
public double score(StringWrapper s,StringWrapper t) { BagOfTokens sBag = asBagOfTokens(s); BagOfTokens tBag = asBagOfTokens(t); double lambda = 0.5; int iterations = 0; while (true) { double newLamba = 0.0; // E step: compute prob each token is draw from T for (Iterator i = sBag.tokenIterator(); i...
68d59202-1e01-483c-925d-5c19f00f145a
9
public PlayerClass(String configPath) { effects = new ArrayList<PotionEffect>(); items = new ArrayList<ItemStack>(); armor = new ArrayList<ItemStack>(); if (config.contains(configPath + ".Items")) { List<Integer> itemIds = config.getIntegerList(configPath + ".Items"); for (int id : itemIds) items.add(new ...
d37f93d9-0061-4687-98e1-e97599f69744
1
private void setStackNumElem(StackNum stackNum, Object...obj){ for(Object o : obj){ stackNum.add(o); } }
e1c9275f-748b-4022-9eec-5b551f4664ae
2
public <C extends StatefulContext> void callOnStateLeaved(StateEnum state, C context) throws Exception { Handler h = handlers.get(new HandlerType(EventType.STATE_LEAVE, null, state)); if (h != null) { ContextHandler<C> contextHandler = (ContextHandler<C>) h; contextHandler.call(c...
2556a6fc-1b01-42fc-ae97-eee0d1b13745
9
protected synchronized final void addTComponent(TComponent component) { if (component != null && !getTComponents().contains(component)) { /* * Only initiates the TComponent if it has not been * initiated already and this class has had it's own * parent set. */ if (com...
eae9e359-c7fb-4acd-be8b-9cb7ff485239
4
public void stats() { // Sort by start markers.sort(false, false); Marker prev = null; for( Marker m : markers ) { lengthStats.sample(m.size()); // Distance to previous interval if( (prev != null) // && (m.getChromosome().getId().equals(prev.getChromosome().getId())) // Same chromosome? ) { ...
1dcc1332-b14b-4c59-9c8b-6e7c54e11d78
1
public static void closeSession() throws HibernateException { if (session != null) session.close(); session = null; }
1abd233b-ec01-46b5-b8de-d02a98747c17
5
public String deleteSpaces(String ligne){ int i; StringBuilder sb = new StringBuilder(); for(i=0;i<ligne.length();i++){ if(ligne.charAt(i) == ' '){ if(i!=0) sb.append(ligne.charAt(i)); while(i+1<ligne.length() && ligne.charAt(i+1) == ' ') i++; } else sb.append(ligne.charAt(i))...
5711b3e2-bb8f-446c-9c8a-f8c7f0762ab4
2
public void open() { Display display = Display.getDefault(); createContents(); shlPscDatabase.open(); shlPscDatabase.layout(); while (!shlPscDatabase.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
f6aca38d-a401-4321-81ba-ba909d9a8653
0
public CastlingMove(Player player, Board board, Piece piece, Field from, Field to) { super(player, board, piece, from, to); }
2fdecbf5-e65e-4fd3-afa7-c8c6c136e787
3
private boolean validPosition(int[][] temp,int x, int y) { return !(x < 0 || y < 0 || x >= temp.length || y >= temp[0].length); }
72ba5541-f81f-4522-84f2-9d11282db241
2
private void addMethod(Method method) { Deploy deploy = (Deploy) method.getAnnotation(Deploy.class); if (deploy != null) { for (String path : deploy.value()) { addMethodPath(path, method); } } }
5c4299b0-85e7-4f77-9e9f-5aebda4052fc
6
public List<RanglistenEintrag> getTeamRangliste() { List<Team> alleTeams = eloPersistence.createQuery("select distinct t from Team t join fetch t.punktzahlHistorie", Team.class) .getResultList(); Collections.sort(alleTeams, new Comparator<Team>() { public int compare(Team o1, Team o2) { return (o1.getPun...
a471dd47-a8e4-49f5-a763-105cc89d5261
2
public GenericNode getOther(GenericNode node) { if(node1 == node) return node2; if(node2 == node) return node1; return null; }
d17cbde2-16a6-44a8-b1c3-bf80abac2ce0
6
static final void method2060(byte i, boolean bool) { if (i > -4) method2059(-6); anInt3484++; Class5_Sub3.anInt8374++; BufferedPacket class348_sub47 = Class286_Sub3.createBufferedPacket(Class348_Sub34.aClass351_6970, Class348_Sub23_Sub2.outgoingGameIsaac); Class348_Sub42_Sub14.queuePacket(37, ...
f94bae19-1832-4e33-beaf-0149318077d5
3
public void vitesseMoins(int $param_int_1) throws java.rmi.RemoteException { try { ref.invoke(this, $method_vitesseMoins_0, new java.lang.Object[] {new java.lang.Integer($param_int_1)}, 4692753105378022573L); } catch (java.lang.RuntimeException e) { throw e; } catch (java.rmi.RemoteException e) { ...
1c673475-d918-4df6-9ca9-1c0547855328
9
private void read(FileInput fin){ this.nAnalyteConcns = fin.numberOfLines()-1; this.titleZero = fin.readLine(); this.nResponses = this.nAnalyteConcns; this.analyteConcns = new double[this.nAnalyteConcns]; this.responses = new double[this.nAnalyteConcns]; this.weights = ne...
441b69f0-e6d5-4097-a5fa-731e28d25676
9
public static void addPerson(Role subRole) { if (subRole instanceof CwagonerHostRole) { host = (CwagonerHostRole)subRole; host.setNumTables(numTables); for (CwagonerWaiter iWaiter : Waiters) { host.addWaiter(iWaiter); } } else if (subRole instanceof CwagonerCashierRole) { ...
3fe73598-08ff-437f-be0d-5b5478ed4fa9
8
@Override public boolean equals(Object anObject) { if (this == anObject) return true; if (anObject == null || getClass() != anObject.getClass()) return false; Element element = (Element) anObject; if (emptyElementTag != element.emptyElementTag) return false; if (!attributeN...
5089b27a-feba-428c-b7c6-b1e7a8cca18d
9
public String parseCommand(String inputCommand) { if(inputCommand.equals("")) { return "No command entered!"; } ArrayList<String> commands = new ArrayList<String>(); for(String command : inputCommand.split(" ")) { commands.add(command); } if...
3ca3262b-b56b-4bfd-bcf3-1b6ce00dc99d
8
@Override public boolean tick(Tickable ticking, int tickID) { if((affected!=null)&&(affected instanceof Room)) { final Room R=(Room)affected; DeadBody B=null; for(int i=0;i<R.numItems();i++) { final Item I=R.getItem(i); if((I instanceof DeadBody) &&(I.container()==null) &&(!((DeadBody)...
9a1e7d15-126b-4ebe-9139-dd99fe80968a
7
@Override public void performClassification( HashMap<Integer, RawImageInstance> rawInstances, HashMap<Integer, Instances> entireData, Instances trainData, HashMap<Integer, Instances> testData) throws Exception { System.err.println("Evalutating accuracy..."); int numClassifiers = classifiers.length; // ...
1b043462-74cf-4f75-aaa8-8fdc9d038b84
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PackageMetaResource other = (PackageMetaResource) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other...
cb1ae12e-18d4-438d-815f-dba427602bd3
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pos other = (Pos) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }
88937513-1b23-4f71-aa2b-c3572b571d7d
6
public static SampleSet generateData( final int samples, final float rel, final Random rnd ) { // final SampleSet result = new SampleSet(); // int size1 = (int)(samples * rel); int size2 = samples - size1; // int size = size1 + size2; while...
a9600e56-0f2e-47fc-a3f3-9822c81c59be
9
private boolean r_mark_suffix_with_optional_s_consonant() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 143 // or, line 145 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 144 // (, line 144 // test, line 144 v_2 = limit - cursor; // lit...
48f5593d-3ed9-40fe-b2fe-fcac0a39fd63
2
private byte[] makeHeader(int number) { byte[] header = new byte[HEADER_SIZE]; if(number >= (1 << (8* HEADER_SIZE))) { throw new InputMismatchException("The round number " + number + " exceeds the bound of " + (1 << (8*HEADER_SIZE))); } int i = 0; do { header[i] = (byte) (number % 256); number >>= 8;...
307ec392-ee28-4933-8e07-4ba0479bb3e1
4
@Override public List<ConcertInfo> getConcertsForArtist(String artist) throws LastFmConnectionException { if(artist==null) throw new IllegalArgumentException("artist"); SimpleDateFormat simpleDate = new SimpleDateFormat("EEE, dd MMM YYYY", Locale.US); DocumentBuilderFactory domFactory = DocumentBuilderFactory.ne...
c36c86e7-dee0-423f-9342-2a00a09a2413
4
@Test public void TestAll() throws IOException, SyntaxFormatException { for (File file : new File("src/test/resources/testprogs/").listFiles()) { if (file.isFile()) { if (file.getPath().indexOf(StatementTest.simpleFuncTest4) >= 0) { continue; } if (!file.getPath().endsWith(".txt")) { continu...
36430ec8-ed5d-4a1a-9f9f-b2097f9ae8a4
2
protected void addBlockToArea(final Block block, final Player player, final PlanArea area, final Material type, final short durability) { if (area.isCommitted()) { // If committed area, means that we're changing the structure underlying the plan, so // replace the original. area.addOriginalBlock(bl...
b5583425-715e-4e51-a792-13d7eae4b0f8
3
@Override public boolean isMine(String command) { Iterable<String> ans = Splitter.on(' ').omitEmptyStrings().split(command); arguments.clear(); CollectionUtils.addAll(arguments, ans.iterator()); if (arguments.get(0).equals(commandName)) { if (argumentNumber != 0 && argume...
8af652fb-b628-452b-8949-59de438a37dc
7
public static void figureOutConnect(PrintStream w, Object... comps) { // add all the components via Proxy. List<ComponentAccess> l = new ArrayList<ComponentAccess>(); for (Object c : comps) { l.add(new ComponentAccess(c)); } // find all out slots for (Compone...
1c6e91e5-33a5-49eb-ae88-d7c57fb0e3f9
7
private void resetPosition(Tile current, int row, int col) { if (current == null) return; int x = getTileX(col); int y = getTileY(row); int distX = current.getX() - x; int distY = current.getY() - y; if (Math.abs(distX) < Tile.SLIDE_SPEED) { current.setX(current.getX() - distX); } if (Math.abs(dis...
c024d732-7f1f-4287-a54a-d8f1dea77704
2
public MenuBar() { // FILE JMenu menuFile = new JMenu("File"); this.add(menuFile); JMenuItem itemOpenSource = new JMenuItem("Open source file"); itemOpenSource.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {...
c2bf0647-167c-4f9f-bcc0-e8fb5d90192a
3
public int get_bits(int number_of_bits) { int returnvalue = 0; int sum = bitindex + number_of_bits; // E.B // There is a problem here, wordpointer could be -1 ?! if (wordpointer < 0) wordpointer = 0; // E.B : End. if (sum <= 32) { // all bits contained in *wordpointer returnvalue...
5f2dcb7a-5d34-4c88-89c0-4a401ca692bc
4
Module getSubModule(String name) { if (StringUtils.isEmpty(name) || !hasSubModules()) { return null; } for (Module module : this.subModules) { if (name.equals(module.name)) { return module; } } return null; }
05bfb7b7-6b31-491d-a643-77d172bc0db2
1
public void setBtn_Std_Fontstyle(Fontstyle fontstyle) { if (fontstyle == null) { this.buttonStdFontStyle = UIFontInits.STDBUTTON.getStyle(); } else { this.buttonStdFontStyle = fontstyle; } somethingChanged(); }
e4279067-9622-44e1-b978-8a32eb1a643a
8
public void update() { if (fireRate > 0) fireRate--; int xa = 0, ya = 0; if (anim < 7500) anim++; else anim = 0; if (input.up) ya--; if (input.down) ya++; if (input.left) xa--; if (input.right) xa++; if (xa != 0 || ya != 0) { move(xa, ya); moving = true; } else { moving = false; } cl...
52e80727-0ef7-43d0-b33d-71ad64a9b986
8
public static DCLayer createLayer(ConstantProvider cp, int sector, int superlayer, int layer) { if(!(0<=sector || sector<6)) { System.err.println("Error: sector should be 0...5"); return null; } if(!(0<=superlayer || superlayer<6)) { System.err.println("Error:...
0c035843-1e8f-4209-b629-52dbc9484c1f
6
public static String checkKeys(final String keyName, final String[] keyNames) { String result = null; if (keyNames != null && keyNames.length > 0 && keyName != null) { for (int i = 0; i < keyNames.length; i++) { if (keyName == keyNames[i]) { result = keyNames[i]; break; } } if (result =...
fd8cf8f3-31cc-46e3-8f3c-75e9c1b50ada
4
private void setPreferredClasses() { if (!_classLocked) { _classBox.removeActionListener(_classListener); _classBox.removeAllItems(); Vector<BaseClass> preferred = _character.getRankedClasses(16); Vector<BaseClass> average = _character.getRankedClasses(15); ...
c7918b6f-cf2e-483a-b35e-8e59d3d55165
1
public OptionsMenu() { try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } frame.setResizable(false); frame.setTitle("OptionsMenu"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(width, 380); frame.setLocat...
7a77b61c-cb59-49f1-bcba-e66cbfede755
2
public void OpenFile(int primary) throws FileNotFoundException{ JFileChooser fileChooser = new JFileChooser("C:\\Users\\Aishwarya\\Documents\\NetBeansProjects\\NewVideoPlayer"); int status = fileChooser.showOpenDialog(this); if(status == 0) { try { R...
aa047485-8a2a-4e42-ab11-589e39ad873c
5
public void populate(){ tiles = new Tile[Map.CHUNK_SIZE][Map.CHUNK_SIZE]; SimplexNoise noise = new SimplexNoise(7, 0.1); double xStart = chunkXPos * Map.CHUNK_SIZE; double yStart = chunkYPos * Map.CHUNK_SIZE; double xEnd = xStart + Map.CHUNK_SIZE; double yEnd = yStart + Map.CHUNK_SIZE; int xRe...
c5c95c8c-4398-467f-907e-51cabf9a49c4
6
private void addPlayerBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPlayerBtnActionPerformed String playerName = playerNameText.getText(); playerNameText.setText(""); try { DBController.addPlayer(playerName); } catch (ClassNotFoundException ex) { ...
ac11e3cc-3a34-42e4-96fd-c7fe7064f87e
0
@Override public boolean supportsEditability() {return false;}
ef0eae74-8a68-496a-9ac4-0e6aab2c0ffa
1
public boolean Apagar(Telefone obj){ try{ PreparedStatement comando = banco .getConexao().prepareStatement("UPDATE telefones SET ativo = 0 WHERE id = ?"); comando.setInt(1, obj.getId()); comando.executeUpdate(); comando.getConnection().commit()...
aa90ecd2-a288-4cce-81ed-b520dd563302
6
public void hurt(Entity var1, int var2) { if(!this.level.creativeMode) { if(this.health > 0) { this.ai.hurt(var1, var2); if((float)this.invulnerableTime > (float)this.invulnerableDuration / 2.0F) { if(this.lastHealth - var2 >= this.health) { return; } this.health = this.lastHealth - v...
9147b79a-1e5e-4f96-83c5-e963eb21c93d
3
@Override public void processKeyEvent(Component c, KeyEvent e) { try { if (c instanceof OutlinerCellRendererImpl) { OutlinerCellRendererImpl renderer = (OutlinerCellRendererImpl) c; JoeTree tree = renderer.node.getTree(); if (renderer.node != tree.getEditingNode()) { tree.getDocument().panel.layo...
48d9bb72-d567-4469-9994-dc599101486a
2
@Override public String toString() { if (meetings.size() == 0) { return "{}"; } StringBuilder sb = new StringBuilder(); sb.append(meetings.size()); sb.append("\\{"); for (Integer key : meetings.keySet()) { sb.append(key); sb.append(...
096c0308-3be0-4e16-8f24-e3cdefc3f0af
8
public void add(byte[] packedValue, int docID) throws IOException { if (packedValue.length != packedBytesLength) { throw new IllegalArgumentException("packedValue should be length=" + packedBytesLength + " (got: " + packedValue.length + ")"); } if (pointCount >= maxPointsSortInHeap) { if (offli...
89bbc3e1-8bec-429c-893e-f4c3c7ce235c
9
protected void optimize2() throws Exception { //% main routine for modification 2 procedure main int nNumChanged = 0; boolean bExamineAll = true; // while (numChanged > 0 || examineAll) // numChanged = 0; while (nNumChanged > 0 || bExamineAll) { nNumChanged = 0; // if (examin...
0da0f36c-c2d2-454b-8966-3d9335766e0d
4
public static Fst<Pair<Character, Character>> fromString(CharSequence string) { Fst<Pair<Character, Character>> bla = new Fst<>(); if (string.length() == 0) { bla.addState(StateFlag.ACCEPT, StateFlag.INITIAL); return bla; } State previous = null; for (int i = 0; i < string.length(); i++) { State s...
7696ddcc-7818-478a-9dca-1fcce01ad3db
0
public int getStudentId() { return studentId; }
ef9ff144-b96c-47dc-b6a8-71f33b1082e6
7
private boolean ValidPetNameChars(String inputStr,int HardCodedLen) { for(int i=0;i<HardCodedLen;i++) { if(i==0) { if(inputStr.charAt(0) == ' ') { return false; } } if((inputStr.charAt...
4548e1f6-476b-4707-95fe-a4ea8116fa3e
9
public static void parse(String filename, int n) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); String line = null; // drop the header line line = br.readLine(); int abs_min = Integer.MAX_VALUE, abs_max = Integer.MIN_VALUE, tmp0, tmp1; double...
ad1e529d-54be-4f0e-9495-57cfac1eae29
7
@Override public Polynomial gcd(Polynomial polynomial1, Polynomial polynomial2) { if (!isZero(polynomial1) && isZero(polynomial2)) { return polynomial1; } if (isZero(polynomial1) && !isZero(polynomial2)) { return polynomial2; } if (isZero(polynomial1)...
21894da4-c68e-4dcc-b1e8-ff2f9f677379
9
public static String decode(String text) { if (text == null) return null; StringBuilder buf = new StringBuilder(text.length()); final int limit = text.length(); for (int i = 0; i < limit; i++) { char ch = text.charAt(i); // Handle unescaped characters...
32fd4ba5-00b7-41ff-bb82-068bb64bdb80
6
@Override public void run() { String data = this.plugin.getFileMan().read(this.plugin.chatFile()); JSONArray jArray; try { jArray = (JSONArray) new JSONParser().parse(data); for(int i=0;i<jArray.size();i++){ JSONObject json = (JSONObject) jArray.get(i); String time = (String) json.get("time"); ...
87d343a7-492b-448b-859b-c0eac49ff3ce
8
private static void generateParameterReifierCode(String[] paramTypes, boolean isStatic, final CodeVisitor cv) { cv.visitIntInsn(SIPUSH, paramTypes.length); cv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); int localVarIndex = isStatic ? 0 : 1; for (int i = 0; i < paramTypes.length; ++i) { String param = param...
5dda23af-d1c5-438e-9525-4adc6523f1b4
3
private static Token matchOperator(String word, int line, int position){ // Try building a symbol for (Operator testOp: Operator.values()) { String testOpStr = testOp.getValue(); int testOpLen = testOpStr.length(); if (testOpLen <= word.length()){ String testWord = word.substring(0, testOpLen); if ...
1be0c707-5f5b-40bf-8567-f54f54e18803
2
public void testWeekdayNames() { DateTimeFormatter printer = DateTimeFormat.forPattern("EEEE"); for (int i=0; i<ZONES.length; i++) { MutableDateTime mdt = new MutableDateTime(2004, 1, 1, 1, 20, 30, 40, ZONES[i]); for (int day=1; day<=366; day++) { mdt.setDayOfYear...
a84bfaea-14fb-4ea0-affb-2eb8a6827242
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((hausnummer == null) ? 0 : hausnummer.hashCode()); result = prime * result + ((land == null) ? 0 : land.hashCode()); result = prime * result + ((ort == null) ? 0 : ort.hashCode()); ...
b6bca02b-cbce-49c5-ad75-8715c5386269
7
private void drawHeliostats(Graphics2D g) { List<Heliostat> heliostats = model.getHeliostats(); if (heliostats.isEmpty()) return; Stroke oldStroke = g.getStroke(); Color oldColor = g.getColor(); Symbol.HeliostatIcon heliostatIcon = new Symbol.HeliostatIcon(Color.GRAY, Color.BLACK, false); synchronized (h...
f7c70eae-f4f3-4eb5-9577-cd4047abdf75
5
@SuppressWarnings("unchecked") public T removeEnd() { ListNode<T> before = null; ListNode<T> after = front; T tempData; if (isEmpty()) return null; tempData = tail.getData(); if (size() == 2){ front.setNext(null); ...
43115be5-a4f5-4cbf-a6a4-ca5189746186
4
private String cardName(int number) { String name = ""; name += cardRank(number); name += " of "; switch(number / 13) { case(0): name += "Clubs"; break; case(1): name += "Diamonds"; break; case(2): name += "Hearts"; break; case(3): name += "Spades"; break; } return name; }
df911b98-5382-44bd-a1e2-af6d37589fdf
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just created a thunder storm!"); return random.nextInt((int) agility) * 2; } return 0; }
12a4a648-e48e-4af6-9955-1445d4c1acae
5
private static void DownloadNewLauncher( ) { try { //progressCurr.setValue(0); String strPath = Utils.getWorkingDirectory() + File.separator+GlobalVar.LauncherFileName; File AppPath = new File(URLDecoder.decode(LauncherUpdater.class.getProtectionDomain().getCodeS...
e7dae66b-3ba4-4112-a505-7b866bb1f3c7
6
public boolean onStack(final LocalExpr expr) { if (expr.isDef()) { return false; } final UseInformation UI = (UseInformation) useInfoMap.get(expr); if (UI == null) { if (StackOptimizer.DEBUG) { System.err .println("Error in StackOptimizer.onStack: parameter not found in useInfoMap"); } ...
14cd4024-7a36-40e6-aa30-e678b5eedeb6
8
@Override public void write(ICTMC ctcm, String pathname) throws Exception { BufferedWriter outputStrm = new BufferedWriter(new FileWriter(pathname)); Matrix tmpM; List<Matrix> tmpTra; int i = -1; int max = -1; int j = -1; int maxT = -1; try { if(ctcm.isIrreducible()) { tmpM = ctcm.getStaziona...
e152ecf8-08f7-4e14-80b6-7cb68d6f796e
5
public char[][] transpose_square(int[] key,char[][] square, boolean col_flag) { int row=square.length; int col=square[0].length; char[][] result=new char[row][col]; if(!col_flag) { for(int i=0;i<key.length;i++) { for(int j=0;j<row;j++) { result[j][i]=square[j][key[i]-1...
ef06505d-51d5-46de-a60d-c0f29dabd3d0
7
public void tick() { if (queueTiles.size() == 0) { if (owner.cities.size() == 0) { //settle(); return; } Tile t = settleLocation(); //System.out.println(t.owner); waddleToExact(t.row,t.col); } else { while (action > 0) { if (queueTiles.size() == 0) { Tile t = settle...
81a3f788-33b5-4a64-9cde-d8e6a49c55c1
4
public void defineObjects(){ CharacterManager.character = CharacterManager.defineChar(); PlatformManager.defineFloors(level); LivingEntityManager.defineEnemies(level); EntityManager.initialize(); EntityManager.setupEntities(); // define star locations for (int i = 0; i < CharacterManager.starNumber; i++)...
6d827db5-7cfd-4971-9526-770802ec9e07
4
private String getPlayer() { Player[] bufferPlayer = manager.getAllPlayer(); String s = ""; int counter = 0; if(bufferPlayer[bufferPlayer.length -1] != null&&bufferPlayer[bufferPlayer.length -1].name.contentEquals("Bot")){ counter = 1; } ...
985f9ba8-6880-42c3-9e19-b8d72053bcb0
3
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isJsonType(mediaType) && filteringEnabled(type, genericType, annotations, mediaType) && getJsonProvider().isWriteable(type, genericType, annotations, mediaType); }