method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c0dadbb7-ddd1-449f-9c54-5b6c4aaef4ba
7
public static int lowestBit(long value) { int low = 0; if (((int) value) == 0) { low += 32; value = value >> 32; } if ((value & 0xFFFF) == 0) { low += 16; value = value >> 16; } if ((value & 0xFF) == 0) { low +=...
b576b216-7a33-4972-8644-7df87aeec48b
6
public static int chooseOptionRandomlyWithWeights(boolean areValuesNormalizedToOne, double... weights) { double[] normalized; if (!areValuesNormalizedToOne) { normalized = new double[weights.length]; double total = 0; for (double value : weights) { total += value; } int counter = 0; for ...
706f0511-0885-45c1-a56c-4c0d6cda933d
7
private static boolean test4_2() throws FileNotFoundException { String input = "new\n" + "pick up key\n" + "drop key\n" + "quit\n" + "yes\n"; HashMap<Integer, String> output = new HashMap<Integer, String>(); boolean passed = true; try { in = new ByteArrayInputStream(input.getBytes()); System.setIn(...
dde182e1-6f41-48c5-84ea-d03ddf5d1f38
6
public static Set<GraphNode> Dijkstra(GraphNode origin, List<GraphNode> nodes) { Set<GraphNode> visited = new HashSet<GraphNode>(); PriorityQueue<GraphNode> frontier = new PriorityQueue<GraphNode>(10, new GraphNodeComparator()); for (int i = 1; i < nodes.size(); i++) { frontier.add(nodes.get(i)); } G...
66aaa21b-b106-4cee-b4bd-dfc814e501cd
1
private static void displayDrugs(ResultSet rs) throws SQLException{ StringBuilder bf = new StringBuilder(); while (rs.next()){ bf.append(rs.getInt("drugid")).append(": "); bf.append(rs.getString("drugname")).append(": "); bf.append(rs.getBigDecimal("price")); System.out.println(bf.toString());...
6ca13062-0cff-400f-9fb4-31b99e76b489
7
public synchronized List<Book> getEditorPicks(int numBooks) throws BookStoreException { if (numBooks < 0) { throw new BookStoreException("numBooks = " + numBooks + ", but it must be positive"); } List<BookStoreBook> listAllEditorPicks = new ArrayList<BookStoreBook>(); List<Book> listEditorPicks = ne...
794e0fa1-3736-4af3-a1e8-8b5b61504248
2
private static boolean popTwo() { if ( calcStack.getCount() < 2 ) { System.out.println("Insufficient operand count"); if ( calcStack.getCount() == 1 ) System.out.println(calcStack.getValueAtIndex(0)); return false; } else { x = calc...
afdab170-e41a-4467-a144-618258a94358
5
public int getNextCompatibleIndex(Item item, int min) { for(int i = min;i<slots.length;i++) { ItemStack s = getStackIn(i); if(s != null && s.nbr > 0 && s.item.equals(item) && s.nbr < item.getMaxInStack()) return i; } return getNextCompletlyFreeIndex(); }
ad6cacf9-b042-4e1b-9482-2dfeb0265261
3
static void checkOpcode(final int opcode, final int type) { if (opcode < 0 || opcode > 199 || TYPE[opcode] != type) { throw new IllegalArgumentException("Invalid opcode: " + opcode); } }
a2960e07-45bc-426f-9685-05139a0986ed
0
public static void registerPlugin(Plugin p) { HTTPRequestHandler.getInstance().registerPlugin(p); }
14b9a757-8e61-458e-86fb-afca775cdbad
0
protected SchlangenGlied(Rectangle masse, IntHolder unit, Color color) { super(masse, unit); this.color = color; }
5162317c-f2fe-425c-9785-557bcbfc581d
5
private void reglerAction(String s) { if(s.equals("Crypter un message")) { this.action=ACTIONS.CRYPTER; } if(s.equals("Gnrer une cl")) { this.action=ACTIONS.GENERER; } if(s.equals("Dcrypter un message")) { this.action=ACTIONS.DECRYPTER; } if(s.equals("Cryptanalyser")) { this.action=ACTIONS.CRY...
6aed91d8-48ef-4a29-b04c-03debe89e1b9
0
public TransformsType getTransforms() { return transforms; }
8ae9c0ef-6b68-47bf-b538-1a9bad5d85d5
7
static void generateNextWave() { Game.world.core.dealDamage(-5, null); monsters.clear(); wave++; /* * either parabola: 0.075 * wave*wave + 3 * or line: 2 * wave + 3 */ if (wave < 30) monsters.put(Monster.ZOMBIE, Math.round(2 * wave + 1)); else monsters.put(Monster.GOLEM, Math.round(wave - 29)...
5a1314ed-f437-4b7c-8850-7e3a96f3e777
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (boolValue ? 1231 : 1237); result = prime * result + byteValue; result = prime * result + ((dateTimeValue == null) ? 0 : dateTimeValue.hashCode()); result = prime * result + ((decimalValue == null) ? 0...
d572a488-5cf5-4a4e-b1e9-46be68b95890
7
@SuppressWarnings("deprecation") public void LoadConf(String id) { HashMap<Enchantment, Integer> effects = new HashMap<Enchantment, Integer>(); ArrayList<ItemStack> items = new ArrayList<ItemStack>(); FileConfiguration config = plugin.getConfig(); for(String item : config.getStringList("kits." +id + ".items"))...
f6cfd406-93e7-43f0-997c-911623b35ed0
4
private void extractFile() { if (contentList.isSelectionEmpty()) { JOptionPane.showMessageDialog(this, "Файл не выбран"); } else { if ((extractedFile.getDIR_Attr() & extractor.getATTR_DIRECTORY()) == extractor.getATTR_DIRECTORY()) { JOptionPan...
a03d966a-28d6-4598-a995-a2866fafeb1b
0
public void setContacter(String contacter) { this.contacter = contacter; }
7e377c35-6615-495a-995a-b6cdff75be07
9
public boolean moveToTail(Node<E> e){ mPutLock.lock(); try { mPollLock.lock(); try{ if (e == null) return false; if (e.mRemoved) return false; if (mSize.get() == 0) ...
5f178419-538b-45dd-8cd2-28eb554d3e99
3
public String toString() { ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) .append("username", this.username) .append("enabled", this.enabled) .append("accountExpired", this.accountExpired) .append("credentialsExpired", ...
5a057680-de3f-4519-8395-c89a298134ac
1
public void remover(PalavraChave palavrachave) throws Exception { String sql = "DELETE FROM palavrachave WHERE id = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, palavrachave.getId()); stmt.executeUpdate(); } catch (SQLException e) {...
127e56ac-3aa7-4c6a-800c-c80671997f38
4
boolean shootLaser(JSONObject action, GraphicsConnection graphicsConnection, int turnsLeft){ int laserLevel = 1; if(primaryWeapon.equals("laser")){ laserLevel = primaryWeaponLevel; } else if(secondaryWeapon.equals("laser")){ laserLevel = secondaryWeaponLevel; } else { return false; } try { S...
8e57e6a4-ba57-4267-8f39-9cd554cb2e80
3
@Override public void execute(IContext context) /*throws Exception*/ { String path = (String) context.getParameter("path"); File f = new File(context.getProperties().get("file.repository").toString() + "/" + path ); System.out.println(f.getPath()); if (!f.isDirectory()){ /*byte buffer[] = new byte[16384]; ...
8f7e752d-108d-4e9d-9ca3-da8608e54ea8
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
86aeb7dc-06bf-44a0-a0b9-a2a89a2e1621
2
private void jPanel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel2MouseClicked JFrame currentFrame = (JFrame) SwingUtilities.getWindowAncestor(this); try { UserClient.getOnlineUsers(new User(clientUserInMain.getText().trim())); } catch (IOException ex)...
f1c71aee-f77a-40cd-86bf-6bb581675b39
5
public static List<String> getPluginInventory() { List<String> pluginList = new ArrayList<String>(); try { File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); String parentDirName = jarLocation.getParent(); // to get the parent dir nam...
e14c5fc1-50cf-4cc3-bc57-db0581dc19bb
2
@SuppressWarnings("resource") public void login() { while (true) { System.out.print("Enter username: "); String DB_USERNAME = new Scanner(System.in).nextLine(); System.out.print("Enter password: "); String DB_PASSWORD = new Scanner(System.in).nextLine(); ds = new DataSource(DB_URL, DB_USERNAME, DB_PAS...
c6463e39-00cc-49cf-96e8-50aed7fe893c
1
@Override public void draw(Graphics2D drawScreen, int offsetX, int offsetY) { if (drawRequired) { getCurrentGraphic().draw(drawScreen, (int) (offsetX + getX()), (int) (offsetY + getY())); } }
5fc57f89-e932-43fc-84c6-edab766101ac
4
public static String getHost(String vncServerName) { int colonPos = vncServerName.lastIndexOf(':'); while (colonPos > 0 && vncServerName.charAt(colonPos - 1) == ':') colonPos--; if (colonPos == 0) return "localhost"; if (colonPos == -1) colonPos = vncServerName.length(); return vnc...
6deb26b3-1b30-4bd3-b255-ab536e0aa65a
7
public Object evalExpValue(MTuple tuple, MExp exp) throws SQLException { Object o2 = null; if(exp instanceof MConstant) { MConstant c = (MConstant)exp; switch(c.getType()) { case MConstant.COLUMNNAME: Object o1 = tuple.getAttValue(c.getValue()); if(o1 == null) ...
927520e9-ab81-4fec-95d7-bdc546f439e8
4
private void updateGroupMembers() { int selectedIndex = groupsList.getSelectedIndex(); if (selectedIndex != -1) { listModelgroupMembers.removeAllElements(); if (selectedIndex == 0){ groupMembers = null; groupMembers = Frame.getClient().getDataStorage().users().getAllUsers(); for (String i:groupMem...
60a33640-8dbe-4ccf-9675-c17fe8aac3fe
1
public static void testFunction(Function subject) { for(double i = -1; i < 1; i+=0.1) { System.out.println(subject.toString(""+i)+"="+subject.evaluate(i)); } }
8aa16077-6d8b-4c49-a7e1-740908780f67
5
public boolean DoesSatisfyConditions() { boolean doesSatisfy = true; Iterator<Condition> iter = conditions.iterator(); while (iter.hasNext()) { Condition c = iter.next(); if (! c.IsSatisfied()) { doesSatisfy = false; } } if ((type == null || type.equals("single")) && used == true) { doesSatisf...
9089d736-1325-45e0-9ca9-53e5348569f4
7
@Test public void onlyBishopOnEmptyBoard() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 2); Chessboard chessboard = Chessboard.newBuilder(figureQuantityMap) .withDimension(DIMENSION_6) ...
b999a674-5dcf-44b2-819c-24cb163ceba6
7
@Override public Component getListCellRendererComponent( final JList<? extends Symmetry<?>> list, final Symmetry<?> value, final int index, final boolean isSelected, final boolean cellHasFocus) { if (value.coxeter().length() > 0) coxeter.setText("C: " + value.coxeter()); if (value.schoenflies()....
a82efa7e-580a-4a0f-a095-95a03c966f40
0
@RequestMapping(method = RequestMethod.DELETE, value = "{id}") public void deleteTask(@PathVariable("id") Integer id) { stepsService.deleteById(id); }
98e78bde-d21c-4366-a8b1-1a08e67056d6
7
public boolean canExistingBlockSeeTheSky(int var1, int var2, int var3) { if (var1 >= -32000000 && var3 >= -32000000 && var1 < 32000000 && var3 <= 32000000) { if (var2 < 0) { return false; } else if (var2 >= 128) { return true; } else if (!this....
64881331-611f-4438-94cf-65a69039fbad
6
public AdjacencyList(String fileName, int sz)throws IOException, NumberFormatException{ n=sz; vertexCount=(n-1); adj = (List<Integer>[])new List[n]; for (int i = 1; i < n; i++) adj[i] = new ArrayList<Integer>(); readFile(fileName); for(int p=1;p<n;p++){ // System.out.println(outEdges(p)); // ...
ea7235a0-1c3c-4835-aa21-5bc5ed822082
1
@SuppressWarnings( { "unchecked", "rawtypes" } ) public List<DefaultItem<?>> getDefaultItems() { // all the Items are DefaultItems return (List) getItems(); }
89fb9fc2-c044-4061-bbda-ce4c438eb1b8
6
* @return boolean */ public static boolean logicModuleP(Module self) { { boolean testValue000 = false; if (self == Logic.$PL_KERNEL_MODULE$) { testValue000 = true; } else { { { boolean foundP000 = false; { Module m = null; Cons iter000 = s...
5a729f85-f7df-4b1a-bff3-9bb45e6f76e9
7
void zapis_Q_do_pliku(int numer_agenta) { FileOutputStream fos = null; File file = new File("Qagenta" +numer_agenta+ ".txt"); try { fos = new FileOutputStream(file); } catch (FileNotFoundException fnfe) { System.out.println("Brak pliku!"); } ...
fb8626f9-3116-4632-813b-010f6ebbc692
5
private void btnPrestarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrestarActionPerformed String text = txtBuscar.getText().toString(); ArrayList<Libros> rows = new ArrayList<>(); LibrosCRUD pdao = new LibrosCRUD(MyConnection.getConnection()); Libros lib; ...
b2f6b110-cec4-4353-817d-299f17705095
2
public double getDouble(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number)object).doubleValue() : Double.parseDouble((String)object); } catch (Exception e) { throw new JSONEx...
41b00f38-ea66-4ce2-80ed-f4ed7e2b489e
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String nom=TxtNom.getText(); Double prix=0.0; String lieu=TextLieux.getText(); if( !"".equals(TxtPrix.getText())) { prix=Double.parseDouble(TxtPrix.getText()); } String type=Combotype.getSelectedIt...
9dacd7eb-7eb8-41fc-a144-a692426d9bda
5
protected void updateAsMobile() { // // Firstly, check whether you even need to exist any more- super.updateAsMobile() ; if ( (! followed.inWorld()) || ! followed.mind.agenda().includes(tracked) ) { if (passenger != null) { ////I.say("Depositing passenger...") ; fi...
9fb52ded-323f-4ec2-8168-9874be7473b0
0
@Test public void oneOunceEqualTwoTablespoon(){ ArithmeticQuantity oz = new ArithmeticQuantity(1, Volume.OUNCE); ArithmeticQuantity tbs = new ArithmeticQuantity(2, Volume.TABLESPOON); assertEquals(oz, tbs); assertEquals(tbs, oz); }
d354b4d5-e852-4454-8ccf-3dd9f647e558
1
private String getURLContent(String url) throws IOException { StringBuilder str = new StringBuilder(); HttpURLConnection conn = (HttpURLConnection) new URL(url) .openConnection(); try (BufferedInputStream in = new BufferedInputStream( conn.getInputStream())) { int c; while ((c = in.read()) != -1) { s...
fcbe3a61-d92f-45d8-8a15-3c08069cc846
9
@Override protected int getStateFromNeighbours(int currentState, int[] neighbours) { int deadNeighbours = countState(DEAD, neighbours); int humanNeighbours = countState(HUMAN, neighbours); int zombieNeighbours = countState(ZOMBIE, neighbours); if (currentState == DEAD) { if (humanNeighbours == 3) ...
577a9855-1610-4f27-ab60-604ec5a5b3c8
2
public static String getConfigurationText(Object o) { if(o instanceof String) { return o.toString(); } if(o instanceof java.awt.Color) { Color c = (Color) o; return "r=" + c.getRed() + ",g=" + c.getGreen() + ",b=" + c.getBlue(); } return o.toString(); }
6b29e774-2a94-4e0f-bc6a-6c57e6f02d6a
1
public void setDay(int days) { DefaultComboBoxModel<Integer> model = (DefaultComboBoxModel<Integer>) day .getModel(); model.removeAllElements(); for (int i = 1; i <= days; ++i) model.addElement(i); }
ec1069cb-0e34-467f-a981-df783b06541c
2
public boolean existConnection(int id) { ListElement current = head; while (current != null) { if (current.getId() == id) { return true; } current = current.getNext(); } return false; }
506cdf72-8e14-4ce0-b3f2-0a2f85c17d01
4
public void printInfoChild(INodeMenu child){ System.out.println("Name: " + child.getText()); System.out.println("Weight: " + child.getWeight()); System.out.println("Url: " + child.getUrl()); String iconUrl = child.getIconUrl(); if(iconUrl != null){ System.out.println("Icon url: " + iconUrl); } ...
d9ac75a1-e8fb-4217-99c3-33744d3bef48
4
public void testPingPong () throws IOException { final AtomicInteger stringCount = new AtomicInteger(0); final Server server = new Server(); startEndPoint(server); server.addListener(new Listener() { public void connected (Connection connection) { connection.sendTCP("TCP from server"); connection.se...
dede4fbd-d3ef-4d9f-ac2f-60044ed6a3d0
4
public void run() { try { Output.printClockLn("Glücksrad", 1); String s = Utils.getString("guild_challenge/index"); int i = s.indexOf("var flashvars = {"); i = s.indexOf("var flashvars = {", i + 1); i = s.indexOf("var flashvars = {", i + 1); s = s.substring(s.indexOf("guild_id:", i + 1)); s = s....
235bb758-d705-4f52-b9e1-99990ca160b4
8
private void ArrInst(String name) { String size; boolean error = false; if(current.getId().equals("NEW")) { nextToken(); if(current.getId().length() > 4 && current.getId().substring(0,4).equals("TYPE")) { if(current.getId().equals(Values.getType(name))) { nextToken(); if(current.getId().eq...
2bf3df91-4ab0-4246-a245-fc13727d9723
9
private static boolean loadParameter(String line) { String[] parts; try { parts = line.split(" "); } catch (PatternSyntaxException e) { return false; } if (parts.length != 2) return false; ParameterCode code = getParameterCode(parts[0]); if (code == ParameterCode.NO_CODE) return false; tr...
ac69ab9e-0406-4d1d-92d7-2ce427a837b8
8
public static void warnAboutNonDirectSupers(Stella_Class renamed_Class) { if (renamed_Class.multipleParentsP() && Stella_Class.createNativeClassP(renamed_Class)) { { List directsupers = renamed_Class.classDirectSupers; { Surrogate renamed_Super = null; Cons iter000 = directsupers.th...
4e11d1b1-5581-496b-9717-94f36ec5d97b
5
public void decodeCharacter (StringBuffer buffer, String msg, int offset) { if (offset >= msg.length()) return; if (decoder.get(msg.charAt(offset)) instanceof Object[]) { Object[] array = (Object[]) decoder.get(msg.charAt(offset)); for (int k = 0; k < array.lengt...
5d3c47a2-297d-4293-a0cc-5d0b35137893
0
protected void onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason) {}
63ed480c-73e6-47fd-aa4f-31cfc52a2bd6
3
public boolean hasNonIndentTabsOrMultipleCarriageReturns() { int lnth=space.length(); if (lnth<2) { return false; } if (lnth<4 && !space.contains("\\t")) { return false; } return true; }
7f8b129a-b478-45d9-b515-e575f4f54c20
2
private static void connectAndAuthenticate() { try { Mongo mongo = new Mongo("localhost", 27017); DB db = mongo.getDB("paldb"); boolean auth = db.authenticate("pal", "admin123".toCharArray()); DBCollection collection = db.getCollection("users"); logger.debug("collection: " + collection); logger....
99ab67b3-f0a6-48e7-ab42-9a5ae6e821e8
7
public static String task2(String expression) { int openBrackets = 0; for(int i=0; i<expression.length(); i++) { if(expression.charAt(i) == '(') { openBrackets ++; } if(expression.charAt(i) == ')' && openBrackets>0) { openBrackets --; ...
7181d9f2-ad17-45da-a532-deafd282c829
0
@Override public boolean supportsComments() {return true;}
905a5dfe-0430-4030-8163-c893221179c9
4
public void startElement(String uri, String localName, String qName,Attributes attributes) throws SAXException { // Check an element has a value // if (attributes.getLength()>0) { // Get the elements value // String aval=attributes.getValue(0); // MMSI if (qName.equals("mmsi")) { mmsi=...
0297e041-bbdd-4df7-96cb-fe541b086b45
0
private EntityManagerFactorySingleton() { }
0804efe4-932c-4e8e-9d84-c135465bfd01
7
private void schedule_MinMin(Vector<Task> metaSet, int currentTime){ /*We do not actually delete the task from the meta-set rather mark it as removed*/ boolean[] isRemoved=new boolean[metaSet.size()]; /*Matrix to contain the completion time of each task in the meta-set on each machine.*/ ...
25b9908c-af44-4ab2-a002-1e0fcc7e274d
4
public Player getPlayer(Color c) { if (c == Color.NONE) { return ai; } for (Player player: players) { if (player != null && player.getColor() == c) { return player; } } return null; }
9c2063a3-25c0-4332-965b-e979f0e4f9fa
1
@Override public String toString() { String s = ""; if (this.props != null) { s = "Skin data:\n"; s += "[" + super.toString() + "]\n"; s += this.props.toString(); } else { s = "Uninitialized skin object."; } return s; }
1443d4ab-1d24-4972-a3ea-852b02361178
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Room other = (Room) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (n...
c4cd3119-d310-4965-9cbd-0a6e6d0aeff0
0
public void setPepIdElemento(int pepIdElemento) { this.pepIdElemento = pepIdElemento; }
08fcabf5-7208-4dcb-a156-ab3cd45e34a8
8
@Override public void keyPressed(KeyEvent e) { switch ((int) e.getKeyCode()) { case 38: // up if (curDir != Direction.moveToDown) newDir = Direction.moveToUp; break; case 40: // down if (curDir != Direction.moveToUp) newDir = Direction.moveToDown; break; case 37: // left if (curDir != Di...
6b3db649-ef30-4d42-80b9-8da535890f79
4
public Entities[][] itemEnumsInArea (Area a) { Entities[][] enumObjects = new Entities[board.length][board[0].length]; for (int x = 0; x < board.length; x++) { for (int y = 0; y < board[0].length; y++) { InanimateEntity on = board[x][y].getOn(); if (on != null && a.contains(board[x][y])) { enumObjec...
300ac7ce-91b1-42fc-8ded-214763a51f1e
7
public PNGDecoder(InputStream input) throws IOException { this.input = input; this.crc = new CRC32(); this.buffer = new byte[4096]; this.readFully(buffer, 0, SIGNATURE.length); if(!checkSignature(buffer)) { throw new IOException("Not a valid PNG file"); ...
640c9e93-a8a5-4872-b4c7-799a50b39499
0
public String getDesc() { return this.desc; }
e3e3e7f8-40a4-4e94-a442-241e725e9f9a
2
private boolean checkValidLetters(String number) { for (char c : number.toCharArray()) { float value = getValue(c); if (value < 0) { statusCode = 1; return false; } } return true; }
19b6a0ab-c13b-49a7-99f9-1f3b9f3231df
3
public void clearHedrons() { for(int i=0; i<shapes.size(); i++) { if(shapes.get(i).getPoints().size()==0 && !shapes.get(i).isSelected()) { shapes.remove(i); i--; } } }
f5b2e457-363a-40b5-a9b3-ad276f52d29a
8
public String labelDataforPredict(String predictData) throws NumberFormatException, IOException { String predict_out = predictData.substring(0, predictData.indexOf(".")) + "_labeled.txt"; File fout = new File(predict_out); if (fout.exists()) { fout.delete(); } BufferedWriter bw = new BufferedWriter(new...
fa62d3d4-464f-43d6-a100-c4bbb5b7cb39
6
private void encodeRefresh(ItemInfo itemInfo, Object[] orderEntries, boolean completed, boolean solicited) { OMMMsg outmsg = _mgr.getPool().acquireMsg(); outmsg.setAttribInfo(itemInfo.getOMMAttribInfo()); outmsg.setItemGroup(0); // Set the message type to be refresh respons...
19a5f86b-2517-4467-8b50-301fe0c6e32e
1
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { PrimaryUserTable model = (PrimaryUserTable) table.getModel(); Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, c...
373801ec-eeb9-4373-9625-32cf036dde51
1
public void pause() { if (!isPlaying()) { return; } synchronized (MP3Player.this) { isPaused = true; MP3Player.this.notifyAll(); } }
9888c26b-2b88-4140-9ecd-1dc8e4da747b
9
public short getIntValue() { short result; switch (code) { case iconst_0: result = 0; break; case iconst_1: result = 1; break; case iconst_2: result = 2; break; case iconst_3: result = 3; brea...
c359620c-94bb-41bb-95e8-f0d11dab86ed
3
@Override public void run() { while(true) { boolean b; synchronized (requests) { b = !requests.isEmpty();; } Request req; while (b) { synchronized (requests) { req = requests.remove(0); } searchPage(req); synchronized (requests) { b = !requests.isEmpty(); } } ...
4227c5fd-8324-4da3-b2f4-3a98911a963c
7
public boolean searchMatrix(int[][] matrix, int target) { // Start typing your Java solution below // DO NOT write main() function if (matrix.length == 0 || matrix[0].length == 0) { return false; } if (matrix.length == 1) { return searchRow(matrix[0], target); } int row = 0; for (row = 0; row < ma...
0bcdeb78-1e45-48a0-a360-e0a81a9213ed
6
public static Stella_Object accessConditionalAntecedentProofAdjunctSlotValue(ConditionalAntecedentProofAdjunct self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_PROVABLE_RULE) { if (setvalueP) { self.provableRule = ((Proposition)(value)); } el...
359a8519-ca7c-42d1-8761-b11c24c2adbf
2
public Grille randomize() { for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { grid[i][j] = new Random().nextBoolean(); // Ça devrait être une méthode statique } } return this; }
9fd167bc-3615-4f32-9261-7d538f3ccedf
4
public void setSpeedAbs(double xspeed, double yspeed) { if (xspeed < 0.0) { xdir = -1; this.xspeed = -xspeed; } else if (xspeed == 0.0) { xdir = 0; this.xspeed = 0; } else { xdir = 1; this.xspeed = xspeed; } if (yspeed < 0.0) { ydir = -1; this.yspeed = -yspeed; } else if (yspeed == 0...
8e8abce5-3645-4f19-82ae-5a9e07c83a0a
1
@Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (DATA_FLAVOR.equals(flavor)) { return mDockable; } throw new UnsupportedFlavorException(flavor); }
9a20044d-2a26-4db0-9206-a441f26dd86e
9
@Override protected void drawInternalU(UGraphic ug, Area area) { final StringBounder stringBounder = ug.getStringBounder(); final double textHeight = getTextHeight(stringBounder); ug = ug.apply(new UChangeColor(getForegroundColor())); final double xRight = arrowWidth - 3; if (getArrowConfiguration().isDott...
b978b4f0-a943-4f79-a37e-696fe73db5b7
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 ItItemHasEmpleado)) { return false; } ItItemHasEmpleado other = (ItItemHasEmpleado) object; if ((this.itItemHas...
5ffaabc2-a8cf-4f2e-bad2-5a49e67229bd
9
public static int[] getWindowsAttributes(String portName) throws IOException, SerialException { String[] command = { "cmd.exe", "/c", winCmd.replace("?", portName)}; Process p = Runtime.getRuntime().exec(command); String output = new BufferedReader(new InputStreamReader(p.getInputStream())).read...
d5c7172b-e6b4-4d93-97d6-0fbc054f6696
0
public void setBumoncode(int bumoncode) { this.bumoncode = bumoncode; }
9cac1527-7ea7-4d54-ada6-50eb744050e1
4
public synchronized void setOperator(String op) { if (op.equals(ADD)) { this.op = ADD; } else if (op.equals(SUBTRACT)) { this.op = SUBTRACT; } else if (op.equals(MULTIPLY)) { this.op = MULTIPLY; } else if (op.equals(DIVIDE)) { this.op = DIVIDE; } else { System.out.println("Undefined Operator in...
591f1703-1048-432e-b60f-677149ebc678
8
@Override public void unsafe_set(int row, int col, double val) { if( row != 0 && col != 0 ) throw new IllegalArgumentException("Row or column must be zero since this is a vector"); int w = Math.max(row,col); if( w == 0 ) { a1 = val; } else if( w == 1 ) { ...
ec7c3ed7-324f-4f89-ae4c-7a8f13428659
8
private void getActionsResults(String actionItem) { titleDLM.removeAllElements(); switch (actionItem) { case CASECLAIM: getClaimList(); break; case CASESUBCLAIM: getSubClaimList(); break; case CASEEVIDENCE: getEvidenceList("evidence"); break; case CASECOUNTERCLAIM: getCounterClaimList()...
7dc8ad61-d7e8-4cef-b7cf-455ffe950e30
7
public void test_23() throws IOException { String vcfFileName = "tests/test.chr1.vcf"; int MAX_TEST = 1000; Random random = new Random(20130217); // Index file System.out.println("Indexing file '" + vcfFileName + "'"); FileIndexChrPos idx = new FileIndexChrPos(vcfFileName); idx.setVerbose(verbose); idx...
5324a4a1-7367-4f5d-84e3-fd2daafc7f0f
3
@Override public boolean evaluate(Auction t) { ArrayList<Auction> temp = new ArrayList<Auction>(searches.values()); for(Auction auc : temp){ if(auc.getName().equalsIgnoreCase(criteria)){ temp.add(auc); } } return t.getName().contains(criteria) || t.getDescription().contains(criteria); }
2c43e5af-c423-4627-b6c7-fab1b383b83e
2
public void mouseReleased(MouseEvent e) { if (!enabled) return; pressed = false; if (entered) { setModal("entered"); } else { setModal(""); } }
d378c7a0-63de-4d7b-be11-e1d8d3ab01d7
1
public void dispose() { try { in.close(); System.out.println("dispose() successful"); } catch (IOException e2) { throw new RuntimeException("in.close() failed"); } }
73b8fd35-8cc4-4986-8f56-1cb5a62b733f
3
public static JSONValue parse(TokenReader tokens, String token) throws IOException, ParseException { JSONArray result = new JSONArray(); if ((token = tokens.next()).equals("]")) { return result; } do { result.add(JSONValue.parse(tokens, token)); if (!(token = tokens.next()).equals(",")) { brea...
6b803b4f-6451-4040-b17e-522012873194
3
public String toRow() { if (columns.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); Iterator iterator = columns.iterator(); while (iterator.hasNext()) { builder.append(iterator.next()); if (iterator.hasNext()) { builder.append(outputDelimiter); } } return builder.t...