method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
80772a7b-3902-4391-8a8f-c1adee6d3b05
1
private static void displayEmployees(ResultSet rs)throws SQLException{ StringBuilder bf = new StringBuilder(); while (rs.next()){ bf.append(rs.getString("name")).append(" "); bf.append(rs.getString("username")).append(" "); bf.append(rs.getString("pass")).append(" "); bf.append(rs.getDate("dob")).app...
fc635804-a453-416d-b967-e48aee883be5
7
@Override public void run() throws Exception { try { ConfigFile importFile = new ConfigFile(plugin); ConfigSQL importSQL = new ConfigSQL(plugin); if (!importSQL.checkDatabase()) { throw new Exception("Could not connect to database !"); } for (String player : importFile.getAllPlayers()) { for ...
327eada9-807f-4987-8508-e1b3d1eba63b
8
private float[] getColors() { int c = r.nextInt(8); float[] b = new float[3]; switch (c) { case 0: // yellow b[0] = 181f / 255f; b[1] = 137f / 255f; b[2] = 0f / 255f; break; case 1: // orange ...
4ca08abb-803c-4e5f-a339-6f016d4ed6c7
3
private static void applyLocalAddressSetting(String strLclAdr, List<InetAddress> lTmp) { for(InetAddress iaTmp: lTmp) if (strLclAdr.equals(iaTmp.getHostAddress())) EzimNetwork.localAddress = iaTmp; if (null == EzimNetwork.localAddress) { EzimLogger.getInstance().warning ( "I...
ced46340-069e-43fa-a89e-ae2c56bd45dd
7
private void bottomPossibleMoves(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if(y1 >= 1 && y1 <= 7) { boolean pieceNotFound = true; for (int i = y1 - 1; pieceNotFound && (i >= 0) && (board.getChessBoardSquare(x1, i).getPiece().getPieceColor...
4f4544dc-b2e9-4694-95e6-6f00289aca6f
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int times = Integer.parseInt(line.trim()); for (in...
90b98e2a-c4d8-4c53-ae17-b3b4031c1ba2
7
public void writeResultes() { try { BufferedWriter bw = new BufferedWriter(new FileWriter(zoneID + "-results.txt")); if (!created.isEmpty()) { bw.write("New Planets\n---------------------\n"); for (Planet p : created) { bw.write(p.out...
f066d987-a3ba-456f-b733-6aabda60dc5e
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...
bc26d629-9de9-46fe-96f1-d132be0d923f
8
static String findTableName(String cmd) { if (cmd != null) { StringBuilder buffer = new StringBuilder(); Scanner scanner = new Scanner(cmd); try { while (scanner.hasNextLine()) { final String line = scanner.nextLine(); b...
5dcc55e6-d78c-4687-a8e4-438dc90a705b
6
public int getAtk(int npc) { switch (npc) { case 2627: return 30; case 2630: return 50; case 2631: return 100; case 2741: return 150; case 2743: return 450; case 2745: return 650; } return 100; }
f9cd8849-8ce7-4eaf-a113-40aa7fa8fa7c
8
public void A_Vote(String AID, String UID, int vote) // vote can be 0 or 1 { //check if this user have previously voted for this question int __c__=0; int currentVote; try (Connection conn = DriverManager.getConnection(dbURL, username, password)) { //Update the DB String sql = "SELECT ID,VOTE FROM UTA....
f8b1c4bf-f12a-4dcc-ad82-466b698fb396
6
private void calcHeading() { int lastCoordIndex = mCoordIndex - 1; if (lastCoordIndex < 0) { lastCoordIndex = COORD_BUFFER_SIZE - 1; } // only continue if all of the coords exist if (!Double.isNaN(mLat[mCoordIndex]) && !Double.isNaN(mLon[mCoordIndex]) && !Double.isNaN(mLat[lastCoordIndex]) && ...
e731fcdc-a98c-4c3b-a55a-a9c778d53ee8
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
7ecad1c6-2243-4261-ba6f-446b798caec3
0
public double getSpeedY(){ return speedY; }
96b7914e-7071-4893-9163-7c041ef6b7c4
1
@Override public void includeSource() { for (File f : layout.asdFiles()) { this.addPackage(f); } }
ffc5de53-1a65-48ce-992b-c6316e97206c
6
@Override public T deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException { T entity = createEntity(); while (true) { JsonToken token = jp.nextValue(); if (token == null) { break; } if (token.e...
7fcf991a-4b5f-4974-b9f0-669bd4c31379
6
public static void computeSlotInverses(Slot self) { if (((Symbol)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Stella.SYM_STELLA_SLOT_INVERSE, null))) == null) { return; } if (Slot.multiValuedSlotWithDuplicatesP(self)) { Stella.STANDARD_WARNING.nativeStream.println("Warning: Can't define an ...
3e38b01a-e00f-446a-8c28-75f604be4d55
9
private void createHelper() { for (Map.Entry<String, XMLLayoutData> entry : componentsLayoutMap.entrySet()) { String componentId = entry.getKey(); XMLLayoutData xmlLayoutData = entry.getValue(); Object topData = null; Object bottomData = null; Object ...
14e58ca9-2c20-4dcc-ae20-e8720196d848
0
public boolean getCell(int x, int y) { return grid[x][y]; }
b54ae1ef-23af-4e2c-b0e9-174c831a1111
2
private boolean contactsExist(Set<Contact> contacts) { Iterator contactsIterator = contacts.iterator(); while(contactsIterator.hasNext()) { if(!contactExists((Contact) contactsIterator.next())) { return false; } } return true; }
da3484f0-408d-4476-aaae-2f4eea86ef8c
7
public final Pino etsiPolku(int alkuX, int alkuY, int loppuX, int loppuY, String tietorakenne) { if (!tarkistaX(alkuX) || !tarkistaY(alkuY) || !tarkistaX(loppuX) || !tarkistaY(loppuY)) { throw new IllegalArgumentException("Annetun koordinaatin täytyy olla kartalla."); } Pino polku; ...
6eb70b81-198d-4fb3-bcee-02f745ea11ce
3
private byte[] readBytes( int db, int ln ) { byte[] b = new byte[ln]; RandomAccessFile f = ( db==0 ? fdbf : db==1 ? ffpt : fcdx ); try { f.read(b); } catch (IOException e) { e.printStackTrace(); } return b; }
55bad0d7-48f7-4b85-a02d-fbf11905c6a7
0
@Override protected void onStart() { frame = new AuthFrame(this); MineOS.getDesktop().addFrame(frame); }
9aeb9df8-0622-460a-abda-2fb84fa11663
6
@Override public void writeAVLData(OutputStream out) { PrintStream ps = new PrintStream(out); ps.print("\n#=======================================\n"); // SURFACE | (keyword) ps.print("SURFACE\n"); // SURFACE ...
08b73b5b-9be1-4701-8d45-a496e38fc395
8
private void goRoom(Command command) { if (!command.hasSecondWord()) { // if there is no second word, we don't know where to go... System.out.println("Go where?"); return; } String direction = command.getSecondWord(); if (direction.equals("bac...
051cceba-4df1-4ede-bb39-e80c988f924a
9
private void run() { ElevatorStrategy str = strategies[strategy]; //we expect 300 arrivals in an hour //lambda = 1/4 since we expect 1 arrival per 12 sec == 4 time units, the mean is therefore 1/0.25 // new value for 2hrs/300 persons: 1/0.125 ExponentialDistribution e = new ExponentialDistribution((1/0.25)); ...
782f9b27-adee-4f03-9d60-56bbbfec9edc
1
public static String booleanToString(boolean bool) { if(bool) return "ON"; else return "OFF"; }
dbe9183d-112b-419b-a659-d79fcfc32bcd
4
private boolean fill() { if (fill) return true; if (cMap.size() < tMap.size()) return false; for (Character key : cMap.keySet()) { if (cMap.get(key) < tMap.get(key)) return false; } fill = true; return true; }
0632e6c3-fb5d-4dc4-b214-d1fb652d56b3
4
@Override public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) { ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>(); DiagonalMove toTopLeft = new DiagonalMove(); DiagonalMove toTopRight = new DiagonalMove(); DiagonalMove t...
7b6e8bb0-b92c-409b-b655-b8c828a82240
9
boolean isInsertionValid(int toInsert, int x, int y) { //toInsert MUST be between 1 and TABLE_SIZE: if(toInsert < 1 || toInsert > TABLE_SIZE) { return false; } //location is not empty if(table[x][y] != 0) { return false; } //check column for(int i = 0; i < TABLE_SIZE; ++i) { if(i ...
2a63d491-35f0-4606-a77c-ac2a78bc7e17
9
public settings(){ initialize(); prefl = Preferences.userRoot().node("com.camray.bill.login$1"); db=new DBConnection(); con=db.acquireConnection(); prefs = Preferences.userRoot().node(this.getClass().getName()); tbl=new JTextField(15); tbl.setText(prefs.getInt("table", 40)+""...
76020477-c285-4b52-9971-7852dfd6a7d3
2
@Override public void onEnable() { this.saveDefaultConfig(); listeners.register(); try { this.getConfig().load(configFile); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { e.printStackTrace(); ...
e71dcfe7-dfb5-4697-bd5a-b21705f0cf98
1
public void updateTable() { if(_table != null) { _table.putNumber("Value", get()*2/255.0-1); } }
0bb8bffb-119b-4dc8-8f9f-10e43cfa5f37
3
public ActionDispatch(View _v) { this.v=_v; v.autorize.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if ((v.port1.getText()!=null)||(v.adress1.getText()!=null)||(v.name.getText()!=null)) { port=Integer.parseInt(v.port1.getText().trim());...
1b781ff4-911c-4303-a300-645cb2579bb9
4
public static BranchGroup crear(Vector3f posInicial, tipoFigura tipoFigura, Float ancho, Float alto, Float largo, Appearance apariencia, String urlObjeto, Float escala) throws Exception { // Creamos el BranchGroup que vamos a devolver BranchGroup objetoBG ...
e69cfa40-3d4e-4565-9efe-6057a6656641
9
public String[][] getResultSetTable(String where, int pageNo, int rowCount) { System.out.println("getResultSetTable" + tableNameSup); String[][] ret = new String[tableFieldSup.length][1]; //col,rowの順 Properties props = new Properties(); props.setProperty("user", rolename); props....
908248e7-5c70-4f8a-ad92-e12d821b810b
0
ENCODE(String value){ this.value = value; }
21e43bdc-f648-4c3c-8833-5272d3b302ac
4
public List<KrakenMove> actions(String color) { ArrayList<KrakenMove> moves=new ArrayList<KrakenMove>(); for(int i = 0;i<rowBoard;i++) for(int j = 0;j<colBoard;j++) if (board[i][j] != null && board[i][j].getColor().equals(color)) addActionsItem(new XYLocation(i,j),moves); return moves; }
34c00ac8-66e8-47a8-a64a-d3ab0bf79907
0
public void setLabo(Labo labo) { this.labo = labo; }
68f94196-2130-475b-a1fd-1d6e2e1edaff
4
@Override public String format( Cell cell ) { // make sure to return the empty string for blank cells // getting the calendar coerces to double and thus gets zero if( ((cell instanceof CellHandle) && ((CellHandle) cell).isBlank()) || "".equals( cell.getVal() ) ) { return ""; } if( cell.getCellType() =...
598eaf0b-cd24-4583-95ff-b8fd9b923c7c
7
private E getResult(boolean findMax) { int index = 0; Entry<Integer, Double> result = null; if (findMax == true) { Iterator<Entry<Integer, Double>> s = fitScores.entrySet().iterator(); for (; s.hasNext(); ) { Entry<Int...
9ee1a895-8405-465c-9d4b-da798751a9d2
5
private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) { int matchcount = 0; int matchbyte = -1; List<Integer> matchbytes = new ArrayList<Integer>(); for (int i = 0; i < b.limit(); i++) { if (b.get(i) == boundary[matchcount]) { ...
bcd307d2-1ca1-49b0-8277-a34ef7392f0e
7
public GamePanel(final SupportPanel supportPanel, final int numberOfPlayers) { this.numberOfPlayers = numberOfPlayers; setLocation(0, 0); setSize(600, 600); setLayout(null); setBackground(Color.BLACK); this.supportPanel = supportPanel; map = new HashMap<String, Im...
d1f1dae3-d0f3-4777-b3e4-40ec4f3426a2
0
public static void main(String[] args) { int x = 1, y = 1; int a = 0, b = 0; x++; ++y; System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y); //a = 0, b = 0, x = 2, y = 2 a = x++; b = ++y; System.out.println("a = " + a + ", ...
af9cc985-f476-439b-8aba-c984f803edf1
7
private void setupShells(HashMap<String, String> shells) { String sh = ""; String shclassstr = ""; // temporary storage for fully qualified classnames, // serves the purpose of not loading classes twice. HashMap<String, Class<?>> shellclasses = new HashMap<String, Class<?>>(shell...
ddb1a21d-5615-453c-a8d4-4224ad8d9b51
4
public void Displaymessage(String msg) { boolean test = false; if (test || m_test) { System.out.println("GameWindow :: Displaymessage() BEGIN"); } getDrawing().Message(msg); if (test || m_test) { System.out.println("GameWindow :: Displaymessage() END"); } }
7604a4b6-357a-4464-af72-db8df92d8ed0
5
public static void conexion() { try { connection = DriverManager.getConnection("jdbc:sqlite:usuarios.db"); statement = connection.createStatement(); try { statement.executeUpdate("create table usuarios (Telefono string, Nombre string, Apellido1 string, Apellido2 string, Nick string, Contrasenya s...
3c58c3c3-fedf-4f0a-b758-7d0c82b019be
2
@Override public int compareTo(Player otherPlayer) { if (otherPlayer == null) throw new IllegalArgumentException("The given arguments are invalid!"); final int res = Integer.compare(this.playerNumber, otherPlayer.playerNumber); if (res == 0) return Integer.compare(this.getRemainingActions(), otherPlayer...
cebc915f-e0b5-46d0-943c-5371e3529141
0
public String getUrl() { return url; }
3b0f5685-d7f0-4db6-9f1b-d14b5cf42d76
1
public void setGaussianKernelWidth(int gaussianKernelWidth) { if (gaussianKernelWidth < 2) throw new IllegalArgumentException(); this.gaussianKernelWidth = gaussianKernelWidth; }
edfce40c-c746-43da-8a4b-12c4481d426b
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((msg.source().location()!=null) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&((msg.value())>0) &&(msg.tool()==this) &&(msg.target() instanceof MOB)) { final int chance = (int)Math...
21e856a5-f200-4a64-841d-125eef8202e9
7
public static void startupModules() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (S...
bba3c758-6912-47ed-98ae-ad1279116ae5
8
private void node() { // Grab the string up to the colon int start = position; for (char c = current(); hasNext(); c = next()) { if (c == ':') break; if (c == '#') error("Illegal character in key. The pound sign # is reserved for comments."); } //...
f3c90edb-dc7b-4a60-8271-c397f482697f
3
private void addRelatedTag(ArrayList<Integer> tagList) { for (int tag : tagList) { if (!selectedTags.contains(tag) && !relatedTags.contains(tag)) { relatedTags.add(tag); } } }
14ee0ba5-ea9a-4597-8b45-74043659d0e4
3
private static void addFileToTarGz(TarArchiveOutputStream tOut, String path, String base) throws IOException { File f = new File(path); String entryName = base + f.getName(); TarArchiveEntry tarEntry = new TarArchiveEntry(f, entryName); tOut.setLongFileMode(TarArchiveOutputStream.LONGFIL...
f40d7319-d11a-4116-b385-b2e3e352c731
1
public void playGame(ArrayList<Player> players, Dealer dealer, int numPlayers){ initialDeal(players, dealer, numPlayers); updatePlayers(players, dealer, numPlayers); checkForWin(players,dealer,numPlayers); while (winner.isEmpty()){ moreDeals(players, dealer, numPlayers); } PlayAgain(); }
fcf9fbea-a53e-4dc9-a27a-74eb23ddfb9e
3
public boolean playGenerateScriptFile(String device, String host, String port, String path, String name) { serialNumber = device; ClientManipulationScript.host = host; ClientManipulationScript.port = port; File fOutputDir = new File(path); if (!fOutputDir.exists()) { fOutputDir.mkdirs(); } outpu...
6e80fb4b-cd13-44d9-bc7b-921748e8924f
5
@Override public void run() { try { String line; while ((line = this.in.readLine()) != null) { int space_pos = line.indexOf(" "); if (space_pos != -1) { try { Object obj = this.decodeData(line.substring(space...
22532c62-f8a9-4fb9-b75d-272e1bffe607
6
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!plugin.hasPerm(sender, "spawnmob", false)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } Player player = (Player) sender; int[] ignore = { 8...
b4d42032-b8e8-4ada-b23d-dfa99ae61ec9
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
77c5f5d5-54bd-4d90-b671-91e9249f8149
7
@Override public String format(LogRecord arg) { String resultat = ""; Level lvl = arg.getLevel(); if (lvl.equals(Level.CONFIG)) { resultat += "<tr class=\"config\">"; } if (lvl.equals(Level.WARNING)) { resultat += "<tr class=\"warning\">"; } ...
828fc510-4b5c-4878-b18f-166a69e33cde
6
private void requestHitStay(Player activePlayer, Dealer dealer, DeckInterface deck, Message mg) { if (activePlayer.getHand().getValue() == 21){ mg.displayMessage(12); } //loops while not busted while (activePlayer.getHand().getValue() < 21){ String input = null; //hit or stay message mg...
3503e781-6e62-45c4-9cdf-078ee0925e00
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...
b8ba666c-1400-42aa-ae7d-d0d1c0e40350
8
public static int checksMultiples(int[][] numberArray, int rowNumber, int columnNumber){ int largestProduct = 0; int sum = 0; //checks vertical, horizontal, and diagonal try { sum = numberArray[rowNumber][columnNumber]*numberArray[rowNumber][columnNumber+1]*numberArray[rowN...
68ae248a-91b3-40a1-878c-e8cdcedfa026
5
public void paint(Graphics g) { g.setColor(Color.WHITE); g.fillRect(0, 0, getWidth(), getHeight()); Ball[] balls = model.getBalls(); MyBall myBall = model.getMyBall(); for(int i = 0; i < balls.length; i++){ if(!balls[i].isDead){ g.setColor(colors[i]); g.fillOval(balls[i].getX(), balls[i].getY(), ...
3261920d-d242-4dfc-94a1-a56c1ebfd1e4
8
private void postPlugin(Plugin plugin, boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc PluginDescriptionFile description = plugin.getDescription(); // Construct the post data String data = encode("g...
895529f7-cd19-4eef-89c0-6290e75e484e
4
public void print(AbstractPiece [][] chessboard){ int x = 8; System.out.println(" \tA\tB\tC\tD\tE\tF\tG\tH"); for(int row = 0; row < chessboard.length; row++){ System.out.print(x); x--; ...
fc9fea17-460f-4100-a011-56907ca63446
6
public int cellToOffset(int row, int col) { // Check row and column individually to prevent them being invalid // values but still pointing to a valid offset in the buffer. if (row<0 || row>=getRowCount() || col<0 || col>15) { // Don't include last column (ascii dump) return -1; } int offs = row*16 + c...
2f22b5b2-ae34-4244-9f40-b03a3712bd44
9
public static boolean areCompatible(Class a, Class b) { if (a.isAssignableFrom(b)) return true; if (a == Integer.class && b == int.class) return true; if (a == int.class && b == Integer.class) return true; if (a == BigDecimal.class && b == Integer.class) return true; if (a == Integer.class && b == BigDec...
73897759-4165-4647-a97a-e8a986845974
4
@Override public void init() { super.init(); rwFirst = ByteTools.readShort( getByteAt( 0 ), getByteAt( 1 ) ); rwLast = ByteTools.readShort( getByteAt( 2 ), getByteAt( 3 ) ); colFirst = (short) getByteAt( 4 ); colLast = (short) getByteAt( 5 ); cchFile = ByteTools.readShort( getByteAt( 6 ), getByteAt( 7 ) )...
287b30dd-c859-4463-8527-9077572515ce
5
public void printIterative(JTreeNode n){ final Deque<JTreeNode<T>> nodeTracker = new ArrayDeque<>(); nodeTracker.push(n); while(!nodeTracker.isEmpty()){ while(n.getLeftNode()!= null && !n.getLeftNode().isVisited()) { nodeTracker.push(n.getLeftNode()); n = n.getLeftNode(); } System.out.printl...
530619a6-d512-4421-bf7d-966c79dd17ff
9
protected String separateExternalScripts(String script) { // externalScripts.clear(); // when external blocks intertwine with mouse blocks, they will be reduced to "external #". When // they are passed to the mouse callback, setScript(String) will be called, which subsequently // calls this method. If we clear ...
4c6dd945-33cd-4ae1-ba8b-8e0f8dbd52d8
9
protected void processOtherEvent(Sim_event ev) { switch ( ev.get_tag() ) { case GridSimTags.SEND_AR_CREATE: case GridSimTags.SEND_AR_CREATE_IMMEDIATE: handleCreateReservation(ev); break; case GridSimTags.SEND_AR_COMMIT_ONLY: ...
fab95a17-0b44-4a9e-8f7d-bab1ab64016e
6
public boolean equals( Object other ) { if ( _set.equals( other ) ) { return true; // comparing two trove sets } else if ( other instanceof Set ) { Set that = ( Set ) other; if ( that.size() != _set.size() ) { return false; // different sizes, no need ...
092c4882-a271-4fba-84f2-e6a5f01fd22c
2
private int testaaPystyrivi(Piste p0) { Piste p1 = new Piste(p0.getX(), p0.getY() - hahmonKorkeus); for (int i = 0; i < hahmonKorkeus; i++) { if (testaaPiste(p1)) { break; } p1.siirra(0, 1); } return p0.getY() - p1.getY(); }
20e42ad7-b204-440a-9065-df7cbb7768dd
7
public RequestLauncher(){ InputStream stream = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); factory.setIgnoringElementContentWhitespace(true); DocumentBuilder builder = factory.newDocumentBuilder(); stream = new FileInputStream("....
7b853970-7dcc-4fe7-bbdb-7c27fb0ebf1c
8
private void fixUpdateFile(String updatesFilename) throws IOException { File original = new File(updatesFilename); FileReader fr = new FileReader(original); BufferedReader br = new BufferedReader(fr); File converted = new File(updatesFilename + ".converted"); FileWriter fwr = new FileWriter(converted); Buf...
bb8cb9b8-b297-44c8-997b-4667d2ed87c3
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...
48d87613-a2e4-4dce-a5e1-a5abfe511f91
7
public static List<Class<?>> processDirectory(File directory, String pkgname) { ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); log("Reading Directory '" + directory + "'"); // Get the list of the files contained in the package String[] files = directory.list(); for (int i = 0; i < files.le...
1114dc4e-7a4d-49db-8cf1-fe628c904439
2
public POP3Server(){ sTrace = new SystemTrace(); sTrace.setDebug(Proxy.DEBUG); internAccounts.put("collector", "123"); int counter = 0; // Z�hlt die erzeugten Bearbeitungs-Threads try { /* Server-Socket erzeugen */ welcomeSocket = new ServerSocket(POP3_TEST_PORT_NUMBER); while (true) { // Server ...
cb3a7f67-5734-47b9-ac8e-23f877ea570e
8
private void notCriticalMove() { int center = gameField.getFieldSize()/2; if(!gameField.isFill(center,center)){ gameField.putO(center,center); } else { if(checkVerticalWin(2)) { finishVerticalLine(criticalVertical,1); } ...
441aa68e-d9e9-4aec-b17e-a96b61783d4a
0
@Override public void focusGained(final FocusEvent e) { JTextField tf = (JTextField) e.getComponent(); tf.selectAll(); oldValue = tf.getText(); }
a9d917ba-8182-44ab-b62e-337a93cf8cbe
8
public WorldPanel(World world) { this.model = world; this.worldMap = model.getWorldMap(); this.worldGUI = new WorldNodePanel[4][4]; try { gold = ImageIO.read(new File("src/main/resources/images/gold2.png")); pit = ImageIO.read(new File("src/main/resources/images/pit2.png")); wumpus ...
94758d88-ed49-4cba-9294-1eea8c95c956
7
public Tile(String type){ id = type; if(type.equals("G")){ tileType = TileType.GRASS; grassTiles++; } else if(type.equals("V")){ tileType = TileType.VOID; voidTiles++; } else if(type.equals("S")){ tileType = TileType.SPAWN; spawnTiles++; } else if(type.equals("E")){ tileType =...
f1fc0c1e-2bba-44b8-8a88-57b8153b08b7
6
private void computeCanBeAvail(final ExprInfo exprInfo) { final Iterator blocks = cfg.nodes().iterator(); // Go through every PHI-statement of the exprInfo. while (blocks.hasNext()) { final Block block = (Block) blocks.next(); final Phi phi = exprInfo.exprPhiAtBlock(block); if (phi == null) { cont...
316c7b8e-37a3-485e-9464-7a7a1263bf1d
4
public String addStation(String stationName) throws IOException { String message = ""; log.debug("Start method \"addStation\""); if (stationName == null || "".equals(stationName)) { message = "Введите название станции"; return message; } List<String> allSt...
ff76c466-a3b6-4671-a8db-9904dff9e0a8
3
private int getLastActivity(ASPlayer data, TableType table) { switch(table) { case DAY: return data.lastDay.activity; case WEEK: return data.lastWeek.activity; case MONTH: return data.lastMonth.activity; default: plugin.severe("Invalid Type in getLastActivity"); } return 0; }
ebd997a1-4903-4901-a475-03f76cf4a178
9
public static Field loadFieldFromFile(){ Field field = null; int wigth; int height; int[][] bombs; int[][] visibleCells = null; int[][] flags = null; try (FileInputStream inpFile = new FileInputStream(DEFAULT_SAVE_PATH)) { int flag = inpFile.read(); ...
29007637-3c33-4235-99c6-8922b649065d
5
public void run() { long lastTime = System.nanoTime(); double unprocessed = 0; double nsPerTick = 1000000000.0 / 60; int frames = 0; int ticks = 0; long lastTimer1 = System.currentTimeMillis(); init(); while (running) { long now = System.nanoTime(); boolean shouldRender = false; unprocess...
55cbfe4d-506c-49c3-a4f4-9acdde15e8bc
0
private void swap(int[] array, int left, int right){ int temp = array[left]; array[left] = array[right]; array[right] = temp; }
c2e69399-557b-4a18-a0e6-6add5881cee1
9
private Tuple<Integer, Integer> computeResizeBox(int cssWidth, int cssHeight, FSImage fsImage) { if (cssWidth == -1 && cssHeight == -1) { return null; } int newWidth = -1; int newHeight = fsImage.getHeight(); // Downsize an maintain aspect ratio... if (fsImage.getWidth() > cssWidth && cssWidth > -1)...
a335aecd-901b-4421-bb2d-bfc3ad99957f
0
public static void main( String[] args ) { System.out.println("Hello item2!"); BuilderPattern bp = new BuilderPattern.Builder("Readme of item2", "2nd day") .location("Toronto") .pageno(80) .build(); System.out.println(bp.val(99)); System.out.println(bp.val()); }
82b8be5a-e6d7-41f3-b440-5e4b1d7c1d14
3
@Override public void execute(CommandSender arg0, String[] arg1) { if(arg0.hasPermission("bungeesuite.whois")){ if(arg1.length>0){ if(PlayerManager.playerExists(arg1[0])){ PlayerManager.getPlayerInformation(arg0, arg1[0]); }else{ arg0.sendMessage(Messages.PLAYER_DOES_NOT_EXIST); } }else{ ...
8b708667-724e-4c28-a3b1-7084ac3d434c
3
public void rotate() { shape = block.rotate(); point.setLocation(location); // Check if by rotating we've gone out of bounds, and make corrections while (point.x + shape.getMinX() < 0) { point.translate(1, 0); } while (point.x + shape.getMaxX() >= pane.getCols()) { point.translate(-1, 0); } // Check a...
56262d90-260d-48d2-84f0-a04973b688fd
5
public CollisionBox getCollisionBox() { if(box == null) { box = new ComplexShape(); if(hasNorthWall()) { box.addShape(new Rectangle(this.getPosition().getX(), this.getPosition().getY() - 0.05f, 1f, 0.1f)); } if(hasWestWall()) { box.addShape(new Rectangle(this.getPosition().getX() - 0.05f, ...
6be6f431-e994-4ced-9c85-dfc637456c13
6
public void addTotal(FacWarStat stat) { if (stat instanceof CharacterKills) { characterKillsTotal.add((CharacterKills) stat); } else if (stat instanceof CharacterVictoryPoints) { characterVictoryPointsTotal.add((CharacterVictoryPoints) stat); } else if (stat instanceof CorporationKills) { corporationKill...
cb829e46-3a46-4d9f-98e7-eb12fed47833
7
public void drawPieces() { /* Iterate over pieces here */ /* xCoord and yCoord points start at the top left corner with (0,0) * and go to the bottom left corner with (n,m) where n and m are the * x and y dimensions of the board, respectively */ if (game != null) { for (int i = 0; i < yBoardDim; i++) { ...
994d90ad-a33c-4268-84aa-5052d7e430c6
2
public void secondDFSwithG() {// nodesSortedbyFt is in f(n) increasing // order, so get from the last for (int fromNode = totalNumNodes - 1; fromNode > 0; fromNode--) { curLeader = nodesSortedbyFt[fromNode]; // if not explored then go ahead, otherwise break if (!nodesStatus.get(curLeader)) { // ...
9e33bf0d-9000-446b-8efa-3e9d0a2d056c
4
private void templateWithWordList( String wikiText, String templateId ) { int idx = findTemplate( wikiText, templateId ); if( idx < 0 ) { return; } int endIdx = wikiText.indexOf( '}', idx ); if( endIdx < 0 ) { return; } String wordStr = wi...
6a5d5b1c-02a7-435e-9f4a-4d06f524d083
3
public int readLatestLoginId(String playerName) { int idLogin = 0; try { ResultSet rs = _sqLite.query("SELECT login.* FROM player, login " + "WHERE player.playername = '" + playerName + "' " + "AND player.id = login.id_player " + "ORDER BY login.time_login DESC LIMIT 1;"); ...