method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cbb33bc5-d533-4063-b818-d2120fb3966f
6
@Override public boolean equals(final Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; MoreMethodStatistics other = (MoreMethodStatistics) obj; if (count != other.count) return false; if (max != other.max) retur...
2e442896-b771-4c4c-8caa-96dcf9d496d9
7
private void switchCommand(String[] cmd) { if (cmd[0].equals("exit")) { Exit e = new Exit(); e.execute(wd, cmd); } else if(cmd[0].equals("pwd")) { PWD pwd = new PWD(); pwd.execute(wd, cmd); } else if(cmd[0].equals("cd")) { CD cd = new CD(); wd = cd.execute(wd, cmd); } else if(cmd[...
7faa3a3e-e378-4990-9584-efbb00b52c34
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ChefNode other = (ChefNode) obj; if (ip == null) { if (other.ip != null) return false; } else if (!ip.equals(other.ip)) return f...
080f7792-5bac-498e-81de-085ab9746b9b
1
public void addToGrid(String code) //Afegim un nou valor al Grid { String[] values = code.split("&"); for(String value : values) { String[] component = value.split(","); int x = Integer.parseInt(component[0]); int y = Integer.parseInt(component[1]); int val = Integer.parseInt(component[2]); ...
809bc42a-36af-4618-b823-89f9f1ba5149
4
private static void close() { try { if (resultSet != null) { resultSet.close(); } if (statement != null) { statement.close(); } if (connect != null) { connect.close(); } } catch (Exception e) { e.printStackTrace(); } }
62b73938-80dd-4de9-8904-0f127376b1ed
2
public static SpecialChar check(char charValue){ for(SpecialChar specialChar: SpecialChar.values()){ if(specialChar.value == charValue) return specialChar; } return null; }
d546af8b-e6fb-492a-b5c7-8479002a7dd2
6
private void GetSubParam(String diValue) { int Indexfrom = 0; int Indexto = 0; String paraSpace = null; String trimValue = null; //check if(diValue.length() <= directiveName.length()){ //do not have param return; } this.SetNameupspace(diValue); //setUpSpace use Indexfrom = diValue.indexOf(...
01bcc56b-ed03-462e-8224-47f48b092fd8
9
@Override public long solve() throws IOException { final List<List<Node>> nodes = new ArrayList<List<Node>>(80); try (final BufferedReader reader = FileUtils.readInput(this)) { String line = null; int y = 0; while ((line = reader.readLine()) != null) { ...
30f8a3d2-7b9d-4ab1-87f4-2feb6aea08b9
1
public Set getDeclarables() { if (exceptionLocal != null) return Collections.singleton(exceptionLocal); return Collections.EMPTY_SET; }
418ab80d-b7f4-4a23-bb55-82e07ae9cc6d
1
public void testToStandardSeconds() { Hours test = Hours.hours(3); Seconds expected = Seconds.seconds(3 * 60 * 60); assertEquals(expected, test.toStandardSeconds()); try { Hours.MAX_VALUE.toStandardSeconds(); fail(); } catch (ArithmeticException e...
352d65e3-7566-4c7b-854a-7f8d787237c5
0
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); super.doFilter(req, res, chain); }
a16ec61c-2c74-400b-906c-ff733a71de1c
0
public String getDescription() { return description; }
be9005f2-9441-4484-bf4f-7b3715fcc85a
4
@Override public Message build() { try { Message record = new Message(); record.to = fieldSetFlags()[0] ? this.to : (java.lang.CharSequence) defaultValue(fields()[0]); record.from = fieldSetFlags()[1] ? this.from : (java.lang.CharSequence) defaultValue(fields()[1]); record.body...
824885af-ec3b-416a-acf7-7cdc53a61ca1
4
@Override public int rename(String from, String to) throws FuseException { try { if (fileSystem.isReadOnly()) return Errno.EROFS; fileSystem.rename(from, to); } catch (PathNotFoundException e) { return Errno.ENOENT; } catch (DestinationAlreadyExistsException e) { return Errno.EEXIST; } catch (A...
f0fc8558-d888-4358-8a97-296dbbb5bf8b
3
public final void dispatchEvent(final NativeInputEvent e) { eventExecutor.execute(new Runnable() { public void run() { if (e instanceof NativeKeyEvent) { processKeyEvent((NativeKeyEvent) e); } else if (e instanceof NativeMouseWheelEvent) { processMouseWheelEvent((NativeMouseWheelEvent) e); ...
d1875d31-5d60-49f2-9166-7bd9b13d0daf
3
public boolean hasFolderFile(SPFolder spFoler) { int i = 0; boolean found = false; while(i < files.size() && !found) { if(files.get(i).getParent().equals(spFoler)) { found = true; } i++; } return true; }
1705ec77-2e50-47cd-9016-67abfb380eae
3
public Card(JSONObject data) throws JSONException, IOException { // Populate object properties ID = data.getInt("id"); Points = data.getInt("points"); sImage = data.getString("src"); sMatch = data.getString("match"); sMisMatch = data.getString("mismatch"); sReveal = data.getString("reveal"); MatchSo...
31d5fb74-22d8-4916-a8e7-1398e23b3e63
9
public void updateProgress() { setStage(getStage() + 1); if (getStage() == 1) player.getInterfaceManager().sendSettings(); else if (getStage() == 2) player.getPackets().sendConfig(1021, 0); // unflash else if (getStage() == 5) { player.getInterfaceManager().sendInventory(); player.getInventory().unl...
94948bd1-5ff1-48b7-b733-217565f69ddc
0
@Override public void restoreTemporaryToDefault(){tmp = def;}
d924ff00-2193-492f-b4f6-aed5d668d854
2
@Override public String toString() { StringBuilder sb = new StringBuilder("codon." + name + ": "); ArrayList<String> codons = new ArrayList<String>(); codons.addAll(codon2aa.keySet()); Collections.sort(codons); for (String codon : codons) sb.append(" " + codon + "/" + aa(codon) + (isStart(codon) ? "+" : ...
c5d16eea-e8a3-4f24-b5ec-0b2689b0a411
2
public List<Animation> getAnimations() { List<Animation> old = new LinkedList<>(animations); animations.clear(); for (Animation a : old) { if (a.isAlive()) { animations.add(a); } } return animations; }
095ff57e-7a84-4955-825b-21792e36b300
7
public int ginjectEncPayload(byte[] info, int start) { int i, j, n_ent, k = start; if (isInput()) { return 0; } // Create vector and array of the correct size n_ent = 1 << n_inputs; encrypted_truth_table = new Vector<byte[]>(n_ent); encrypte...
efd1c86a-8005-4552-a803-ab425bc43321
8
protected void sendMergeView(Collection<Address> coords, MergeData combined_merge_data, MergeId merge_id) { if(coords == null || combined_merge_data == null) return; View view=combined_merge_data.view; Digest digest=combined_merge_data.digest; if(view == null || digest == nu...
d282152e-19bd-4cd1-92e1-437c9029733f
8
public void stepPhysics(double timeStep) { // Collision for (int i = 0; i < COLLISION_ITERATIONS; i++) { collisionBroadphase.updateCollisionPairs(timeStep); processCollisions(timeStep); } // Velocity update for (int i = 0; i < rigidBodies.size(); i++) { RigidBody rigidBody = rigidBodies.get(i); i...
76fb56de-2bdd-4369-916f-f1ac70a341a3
5
public Vector3f checkCollision(Vector3f oldPos, Vector3f newPos, float objectWidth, float objectLength) { Vector2f collisionVector = new Vector2f(1,1); Vector3f movementVector = newPos.sub(oldPos); if(movementVector.length() > 0) { Vector2f blockSize = new Vector2f(SPOT_WIDTH, SPOT_LENGTH); Vector2f o...
533e9978-60eb-449a-b1c3-5a18581b9e7c
1
private void displayPrevious() { try { refresh(ekd.previous(ek)); } catch (NoPreviousEmailKontaktFoundException e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); } }
2324138a-4faf-4be8-a525-973b406907f6
0
@Test public void runTestActivityLifecycle2() throws IOException { InfoflowResults res = analyzeAPKFile("Lifecycle_ActivityLifecycle2.apk"); Assert.assertEquals(1, res.size()); }
537fd73c-85e1-42a0-a84f-de49e81e2c1a
6
private boolean getFirstPlayerTurn() { boolean playersTurn = false; if (gameType == GameType.FairGo) { //Get the user input console = new Scanner(System.in); //Determine whether the player wants to go first System.out.println("Do you want to go first? [Y|N]?\n"); String playFirst = console.nex...
e075e107-6650-4bfe-9ca1-7ddd4428ad54
1
public void removeRole(User user, Role role) throws Exception { try { session = HibernateUtil.getSessionFactory().openSession(); Query q = session.getNamedQuery(getNamedQueryToRemoveRoleUser()); q.setString("role", Integer.toString(role.getId())); q.execu...
d3d65eb1-8b43-452a-8c6f-7dcfd8ec1f51
0
public void setMemory(double memory, int index){ this.memory[index] = memory; }
943943ec-77fd-4b7a-92c5-df243be20fa8
8
public void genBFSEdges() { ArrayList<Edge> tempEdges = new ArrayList<Edge>(); Collection<Node> pairedNodes = new HashSet<Node>(); int radius = 2 * (int) Math.sqrt(widthBound * heightBound / nodes.size()); // Find all local edges by BFS for (Node n : nodes) { for (int x = n.x - radius; x < n....
4e1e751f-2beb-4355-801a-07c556140ab0
2
public static BookCategoryDO bo2do(BookCategory bookCategory) { if (bookCategory == null) { return null; } BookCategoryDO bookCategoryDO = new BookCategoryDO(); BeanUtils.copyProperties(bookCategory, bookCategoryDO, IGNORE_PARAM); if (bookCategory.getParent() != null) { bookCategoryDO.setParentId(bookC...
c92b744b-9c22-4b41-8ce9-900dab4b4bd0
3
public int getUniqueChars() { String uniques = ""; for (int x = 0; x < getWidth(); ++x) { for (int y = 0; y < getHeight(); ++y) { char c = getPixel(x, y); if (!uniques.contains("" + c)) uniques += c; } } return...
728b39bd-6282-43e8-a661-b52fe0393c0f
3
private void message(CommandSender sender, String[] args) { if (!sender.hasPermission("graveyard.command.message")) { noPermission(sender); return; } else if (args.length == 1) { commandLine(sender); sender.sendMessage(ChatColor.GRAY + "/graveyard" + ChatC...
3f12b2cd-a985-4c5d-9007-e62ecd86c0f4
1
@Override public Object clone() throws CloneNotSupportedException { ObjectGroup clone = (ObjectGroup) super.clone(); clone.objects = new LinkedList<MapObject>(); for (MapObject object : objects) { final MapObject objectClone = (MapObject) object.clone(); clone.objects...
f4904892-f084-4bf1-8a5e-f4ea374de7b3
3
public final void cleanUp() { Bucket died; while ((died = (Bucket) queue.poll()) != null) { int diedSlot = Math.abs(died.hash % buckets.length); if (buckets[diedSlot] == died) buckets[diedSlot] = died.next; else { Bucket b = buckets[diedSlot]; while (b.next != died) b = b.next; b.next ...
2b56f62e-e74b-48da-bf1f-78064528cb78
1
public boolean canDo(char symbol) { if (symbol == '}') return true; return false; }
af03edf8-42a0-4e7a-8d11-194b4bd03982
9
private void search(int k) { if(k == 0) { results.clear(); active = true; } if(k == max - known || (root.getLeft() == root && root.getRight() == root)) { active = false; for(Node n: results) out.add(new Node(n.getRow(), n.getRoot())); return; } Node col = root.getRight(); cover(col); fo...
b2b2f1a1-3123-4162-8b67-b8081ffe6141
6
public int play() { int clipIdx = -1; // Check if there are currently any free clips to play if (clipAssembly[nextPlaybackIdx].isRunning() == false) { clipIdx = nextPlaybackIdx; clipAssembly[clipIdx].setFramePosition(0); // If needed alter the playback volum...
f409b599-885c-4072-8c16-5a5aa0b3b42f
5
public void genererLabel() { Iterator it = listeBus.iterator(); int compteurCritique = 0; int compteurInte = 0; while(it.hasNext()) { Bus myBus = (Bus) it.next(); if(myBus.getVitesse() < 10) compteurCritique++; else if(myBus.getVitesse() < 30) compteurInte++; JLabel lab = new JLab...
a6fc828f-1af8-4449-95c7-c069a412fcbb
4
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) { while (in.remaining() > 0) { if (out.remaining() < 1) { return CoderResult.OVERFLOW; } final char c = in.get(); if (c >= 0 && c < 256) { out.put((byte) c); ...
7e1e4599-d80a-4d01-ad11-6b83ddb1caf1
8
static boolean isOverridden(Method method, Method other) { if (method.getDeclaringClass() == other.getDeclaringClass()) { return false; } if (other.getDeclaringClass().isAssignableFrom(method.getDeclaringClass()) == false) { return false; } if (Objects.equ...
e2c128ec-bae7-4005-a18f-1f3e4806c4a8
3
public static int spaceCount(String s) { if (s.length() == 0) { return 0; } int count = 0; char c[] = s.toCharArray(); for (int i = 0; i < s.length(); i++) { if (c[i] == ' ') { count++; } } return count; }
cae518e6-7af7-48ec-ba2d-4516f30a1902
7
public void addEffect(Player p, PotionEffectType potion) { if (!isValidWorld(p) || isExempt(p) || !isEnabled()) return; ConfigurationSection section = plugin.getConfig().getConfigurationSection("effects." + potion.getName().toLowerCase()); if (section == null) return; // If the hunger isn't the righ...
e9d8e216-02f2-4f6b-82d7-dd39942bcedf
7
final void method1524() { int i = getSpriteWidth(); int i_113_ = getIndexHeightTotal(); if (((ImageSprite) this).indexWidth != i || ((ImageSprite) this).indexHeight != i_113_) { byte[] is = new byte[i * i_113_]; if (((ImageSprite) this).alphaIndex != null) { byte[] is_114_ = new byte[i * i_113_]; ...
fac8860e-e942-46cb-8a19-217e00c9bf07
2
public PrefixTree(char[] letter, double frequency[]) { pq = new PriorityQueue<PrefixTreeNode>(); for (int i = 0; i < letter.length; i++) pq.add(new PrefixTreeLeaf(letter[i], frequency[i])); while (pq.size() > 1) { PrefixTreeNode left = pq.remove(); PrefixTreeNode right = pq.remove(); pq.add(new Pr...
9e10af28-595d-43f5-9113-1217081b3c8e
2
public static BaseProperties stringToProperties(String propString){ BaseProperties result = new BaseProperties(); if (null == propString) return result; InputStream is = new ByteArrayInputStream(propString.getBytes()); try { result.load(is); } catch (IOException e) { ...
d9a864b7-0b3d-477b-8446-76be6c990138
1
public void visitInsn(final int opcode) { minSize += 1; maxSize += 1; if (mv != null) { mv.visitInsn(opcode); } }
253b0751-17ae-425f-81ef-ea0a79e038cb
9
public LinkedList<instant> getMicrobiologicalInstants(int subject_id, int itemid1, int itemid2, int itemid3, String tableName, boolean negated, LinkedList<Attribute> attributes, IntervalDescription intDesc) throws ParseException { LinkedList<instant> instants = new LinkedList<instant>(); if(!meetsAt...
0c6a91b7-70d2-4d0c-bab2-2d6c630270f0
0
public void close() throws IOException { isClosed = true; }
0679ee72-be13-4bfd-82f0-b4069edc5c2c
2
private static void buildValidationUriMsgPane(File file){ if(!file.exists()){ JOptionPane.showMessageDialog( null,"l'uri renseignée n'est pas valide" ,"Validation de l'uri", JOptionPane.INFORMATION_MESSAGE); }else if (!file.isDirectory()){ JOptionPane.showMessageDialog( null,"l'uri renseignée ne ...
618d9d3e-0799-4fb9-b214-63804f35572d
3
private void btnEditarFuncionarioSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarFuncionarioSalvarActionPerformed try { if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) { carregaObjeto(); if (dao.S...
443e31b2-d521-421d-bf7e-f06ced0f34bb
1
public void addItemDesc(int i, String in, int size) { if (item_desc == null) { item_desc = new String[size]; } item_desc[i] = in; }
9401a22e-636c-4125-8a8f-e4642033e4e4
9
private static void checkTokenName(String namedOutput) { if (namedOutput == null || namedOutput.length() == 0) { throw new IllegalArgumentException( "Name cannot be NULL or emtpy"); } for (char ch : namedOutput.toCharArray()) { if ((ch >= 'A') && (ch <...
29a5c84a-000f-4d12-81d0-75ecb3075a84
9
private static int rpnParse(Object[] parsedQuery, int position) throws ParseException { Object curr = parsedQuery[position]; int tokens = 1; if (curr instanceof Expression) { int numArgs = ((Expression) curr).getArgumentCount(); List args = new ArrayList(numArgs); ...
ed1dcf66-588d-49cc-9621-ca4c23d30d2a
5
public static boolean is_win() throws FileNotFoundException { if (ifWin == 0) { return false; } else if (win) { return true; } if ((FieldGame.unknown == 0 && ifWin == -1) || (FieldGame.objects == ifWin)) { System.out.println("main: game is finish"); Gui.writeStatus(); win = true; return t...
ccb4144d-a60d-4965-b62d-e0c083565525
5
private static void fillOneDimArray(Object array, String[] values, IAutoConfigParser<?> parser, IAutoConfigValidator<?> validator) throws Exception { for (int i = 0;i < values.length;++ i) { String valueString = PATTERN_ELEMENT_ESCAPES.matcher(values[i]).replaceAll("$1"); Object value; if (parser.getClass...
7efdd609-7020-41fe-afd5-b5fc3892fcd4
2
private void btnSaveMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSaveMousePressed ArrayList<String> errors = getValidationErrors(); if (!errors.isEmpty()){ String errorMsg = "Please fix the following errors:\n"; for (String error : errors) { errorMsg += erro...
c77e9d24-9fae-42eb-be22-2c2ff7530450
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...
fb2b1a52-1e72-4621-b640-314856e55c09
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 Organism)) { return false; } Organism other = (Organism) object; if ((this.key == null && other.key != null) ||...
d2895a36-a263-4524-955a-52534c913077
9
public static void main(String args[]) { System.out.println("Client..."); try { AuctionClient client = new AuctionClient(AuctionServer.SERVER_HOST); String CurLine, ownerName, itemName, itemDesc, tmp; double bid, maxbid; int auctionTime, strategy; ...
d0bebfb0-f33d-4bf4-a50b-6cdabc99f5de
7
protected void addHelpFileContents(Content contentTree) { Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title, getResource("doclet.Help_line_1")); Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content line2 = HtmlTree.DIV(HtmlStyle.subT...
de25ff07-5ff0-4778-baf0-cc8d6ea17996
2
@Override public void open() throws MidiUnavailableException { if (!initialized) throw new MidiUnavailableException(); for (Synthesizer s : theSynths) s.open(); }
fb54f2fb-8303-41ac-990e-f99bb9362945
2
public static RefType forID(int refTypeID) { for (RefType refType : values()) { if (refType.getId() == refTypeID) return refType; } return null; }
83379f1a-7293-4faa-b467-fbb4029baa46
9
public void evaluate(int trainItem, int testItem){ String DataDirectory = "RandomPieces_200"; String opticsFilename = "ids200_" + trainItem + "-" + testItem + ".optics"; ArrayList<ReachabilityPoint> ordering = OpticsOrderingReader.readFile(DataDirectory + File.separatorChar+opticsFilename); int minpts ...
507f9860-ea1e-47ec-bb2a-e3700ea76e63
9
public static void write(final INode node, final Writer writer) throws IOException { if (node == null) { return; } if (node instanceof Text) { writeText((Text)node, writer); return; } if (node instanceof Element) { writeElement((E...
d64c04ac-005d-45d3-9e0d-73be9fe2ce08
0
public void removeSettingsGuiListener(SettingsGuiListener listener_) { settingsGuiListener.remove(listener_); }
2185bcca-d29e-4bce-8261-6f88ac018bf2
1
static String getInput(Scanner scanner){ StringBuilder a=new StringBuilder(); String temp=null; scanner.nextLine();//忽略掉开始的start while (!"END".equals((temp=scanner.nextLine()))){ a.append(temp).append('\n'); } return a.toString(); }
a0231259-ade1-4a8a-b2c5-c5796c9dc9fd
6
private static void readData() { try { b = new BufferedReader(new FileReader(fileDirectory + dataFile)); String line; while ((line = b.readLine()) != null) { String[] s = line.split(":"); int usr = Integer.parseInt(s[0]); int mov = Integer.parseInt(s[2]); int rat = Integer.parseInt(s[4]); ...
c4a2363a-83b4-45f1-8d2a-aa216744c3c1
4
@Override public void setValue(int row, int col, double value) throws MatrixIndexOutOfBoundsException { if ((row < 0) || (col < 0) || (row >= mas.size()) || (col >= mas.get(0).size())) { throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index."); } mas.get(row)....
9d3c6727-044d-4c08-beab-d384def7fd73
9
public static Cons idlTranslateMethodParameters(MethodSlot method) { { Cons result = Stella.NIL; Cons directions = Stella.NIL; if (method.methodParameterDirections().emptyP()) { { Symbol name = null; Cons iter000 = method.methodParameterNames().rest(); Cons collect000 = null...
b17deb18-a0cb-48aa-84d7-867f49480359
5
public CheckResultMessage checkJ04(int day) { int r1 = get(17, 2); int c1 = get(18, 2); int r2 = get(20, 2); int c2 = get(21, 2); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r2 ...
448491e4-eea4-4a31-9a1d-1b7631f6bf81
0
public void setPortServer(int port){ this.portServer = port; }
c4e407a1-b0d7-4a61-b5c0-7c3fa13f5b78
5
public static Integer[] getImageData(BufferedImage image) { final byte[] pixels = ((DataBufferByte)image.getRaster().getDataBuffer()).getData(); final int width = image.getWidth(); final int height = image.getHeight(); final boolean hasAlphaChannel = image.getAlphaRaster() != null; ...
8829b859-d5c7-4dec-bfcb-6b5a36107bda
8
public static void addLinkInfor(LinkInfo li) { if(!_HEAVY_SCIENCE || (li.getDestinationNode() != 1||li.getSourceNode()!=2)) return; if(labelsSave==null) labelsSave = new LinkedList<String>(); splitUpMetaInfo(li); String name = ""+li.getSourceNod...
cebd88e0-191b-4b7c-af9c-af5d41ab2f84
2
private void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } currentScreen.clear(); currentScreen.render(); for (int i = 0; i < currentScreen.pixels.length; i++) { pixels[i] = currentScreen.pixels[i]; } Graphics g = bs.getDrawGraphics(...
d5d92aac-c4c7-4187-a505-9b65e2f03983
0
public String getTitle() { return title; }
0e09b5e6-3cde-4617-be49-c0e92f1feece
5
@ Override public boolean writeToFile(final File file, T object, boolean replaceIfExists) { skipRemaining = false; // Delete file if it exists if (file.exists () && replaceIfExists) { file.delete (); } else return false; Path path = Paths.get (file.getAbsolutePath ()); BufferedWriter writer = ...
8695093e-72e4-4388-9bec-206acdc05266
2
private Long getSmallestIdLargerThan(Long currentId) throws SQLException { StringBuilder statement = new StringBuilder(100); statement.append("SELECT "); statement.append(Defaults.ID_COL); statement.append(" FROM "); statement.append(sourceObjectTableName); statement.append(" WHERE "); statement.append(D...
96c7d074-5cdc-4fca-9b4d-59c153c3ca33
9
public static byte[][][] computeParityTilesFromTileCube(byte[][][] tileCube) { byte[][][] parityTiles = new byte[3][tileCube.length][tileCube.length]; // tile 1 for (int tileIdx = 0; tileIdx < tileCube.length; tileIdx++) { for (int row = 0; row < tileCube.length; row++) { byte parity = 0; ...
a3c1d22d-e906-4135-94f5-e60ddfeacebb
0
private Printer03() { }
a3eb37e5-afe5-489f-be48-fad5ff01b60b
0
@Override public void setTmp(String value) {this.tmp = value;}
fcd6dd0a-cb2e-40a8-92be-f0035c91ba42
8
private ILevel chooseLevel() { if (getFirstLevels() == null || getFirstLevels().size() == 0) { return null; } if (getFirstLevels().size() == 1) { return getFirstLevels().get(0); } Integer poll = null; printLevels(); while (poll == null |...
dffbe884-6f16-4150-a9ff-094653938f3b
5
@Override public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId ) { StringBuffer cooxml = new StringBuffer(); // chart type: contains chart options and series data cooxml.append( "<c:area3DChart>" ); cooxml.append( "\r\n" ); cooxml.append( "<c:grouping val=\"" ); if( is100Pe...
731c7159-fca8-4bb7-9a1d-48c995602616
7
boolean checkValue(int Red, int Green, int Blue){ int maxValue = 1; for(int i = 0; i < bitPerPixel/numOfColorComponents; i++){ int temp = 2; maxValue = maxValue*temp; } maxValue = maxValue - 1 ; if(Red < 0 || Green < 0 || Blue < 0){ System.out.println("�G���[:RGB�l�ɕ��̒l�͎g���Ȃ�")...
0d437c34-8a83-4f1f-87bc-6b7b06ccb3d8
7
private static void TexasHoldEm() { Table tbl = new Table(); int iPlayers = 5; Deck dStud = new Deck(); // Add the players, give them empty hands for (int i = 0; i < iPlayers; i++) { Player p = new Player("Joe",null); p.SetPlayerNbr(i+1); p.SetHand(new Hand()); tbl.AddTablePlayer(p); }...
09f878e5-3056-4d73-9bb0-a1d78bad3bb8
6
private void fxInitCallbacks() { webEngine.titleProperty().addListener(new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> observable, String oldValue, final String newValue ) { SwingUtilities.invokeLater(new Runnable() { @O...
52b386b2-2cde-4505-932e-d8657c29ad94
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 fe...
b72a5823-522b-49d6-9b89-1a1014c2ee35
7
public void play(int row, int col) { if (Othello.isReversed(player, opponent, row, col)) { myCanvas.repaint(); score.setText(Othello.getScore()); comment.setText(" "); //Get turn switchPlayer(); if (!Othello.isPossible(player, opponent)) { if (!Othello.isPossible(opponent, player)) { ...
bdefed33-7b52-4c07-a17d-f98e5cab02c7
4
public List<String> getSampleNames() { if (sampleNames != null) return sampleNames; // Split header String headerLines[] = header.toString().split("\n"); // Find "#CHROM" line in header for (String line : headerLines) { if (line.startsWith("#CHROM")) { chromLine = true; // This line contains all...
f9245c53-7ace-4023-828d-a4a3ce78c8f0
2
public ArrayList<AreaConhecimento> listar(String condicao) throws Exception { ArrayList<AreaConhecimento> listaAreaConhecimento = new ArrayList<AreaConhecimento>(); String sql = "SELECT * FROM areaconhecimento " + condicao; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement...
a69597fb-f550-444b-89d3-d55850619eb6
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...
e8fb9400-1789-481e-8d4a-55712b204c87
3
private void checkPosition() { StreamsterApiInterfaceProxy proxy = new StreamsterApiInterfaceProxy(); Position[] positions = new Position[0]; try { positions = proxy.getPositions(); } catch (RemoteException ex) { Logger.getLogger(JobTradeUp.class.getName()).log(Le...
fd82cc94-281c-40da-9ab9-67e41b8bca05
3
private static Date getStartDate(HashMap<String, Object> map) { Long startDay = (Long) map.get("startDay"); Long startMon = (Long) map.get("startMonth"); Long startYear = (Long) map.get("startYear"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal...
7bdd2dfb-4e27-47d4-917a-66f2b8251663
7
protected void trainModel(InstanceStream trainStream, AbstractClassifier model) { ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvaluator(); evaluator.reset(); long instancesProcessed = 0; System.out.println("Started learning the model..."); whi...
cd6da1c6-27c2-4dd0-8093-9d79c2bb15a1
0
public ArrayList<Person> getPersons() { return Persons; }
843172f9-42dc-4459-a3a4-f9d10bc295e0
0
public GameMaster(Combination<Colors> target) { this.target = target; System.out.print("The target is : "); target.print(); }
74c5ea96-a40e-4e86-8e33-d5da80f23e42
9
public final NewFoodContext newFood() throws RecognitionException { NewFoodContext _localctx = new NewFoodContext(_ctx, getState()); enterRule(_localctx, 6, RULE_newFood); int _la; try { enterOuterAlt(_localctx, 1); { setState(56); match(16); setState(57); match(3); setState(60); _errHandler....
37dd3166-7b38-400b-8ebb-95382ca57fd1
1
private void generateHardwareSystemAlternativesGeneration() { int alternatives = 1; int possibilities[] = new int[project.getHardwareSets().size()]; int repetitions[] = new int[project.getHardwareSets().size()]; int i = 0; for (HardwareSet hws : project.getHardwareSets()) { alternatives *= hws.getHardwareS...
60244bb0-8312-407e-b147-b917efd5dd19
7
public boolean isSameTree(TreeNode p, TreeNode q) { // Start typing your Java solution below // DO NOT write main() function if (p == null && q == null) return true; if (p == null || q == null) return false; if (p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right)) return ...