method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d3f4cf6e-5070-4dba-ae6d-2fc933419f5b
8
public int draftArmies(Territory[] a, Continent[] c){ int terOwned = 0; int retVal = 0; for(Territory I: a){ if(I.getOwnedBy().equals(this)){ terOwned++; } } if(terOwned / 3 < 3){ retVal += 3; } else { retVal += terOwned /3; } boolean contOwn = true; for(Continent J: c){ contOwn = t...
bb988480-102b-4f49-b0e0-88447dc769dd
7
public static void main(String[] args) throws Exception { ServerSocket server = null; try { // apertura del socket server server = new ServerSocket(12345); // dichiarazione del socket client e del buffer di ingresso Socket client; BufferedReader in; PrintWriter out; System.out.println("Server...
b3883653-a87f-422a-94a9-267583ffd8ce
3
@Override public int compareTo(final User o) { int ret; if (this.getId() == null) { ret = 1; } else if (o == null || o.getId() == null) { ret = -1; } else { ret = this.getId().compareTo(o.getId()); } return ret; }
e4ee2cc1-9e5b-4b06-b5bb-7a65e9914fa8
3
@Override public Event next() { String input = null; try { input = br.readLine(); } catch (IOException e) { } if(input == null || input.equals("")){ return new DefaultState(as); } else{ return new UserHomeState(as, input); } }
6d146384-4bbe-44c0-81a5-a9e4f29b2600
2
protected static CycSymbol getCycSymbol(GenerationMode mode) { switch (mode) { case Text: return TEXT; case HTML: return NLFormat.HTML; } throw new UnsupportedOperationException("Can't turn " + mode + " into a CycSymbol."); }
7236a91c-b3d6-4705-a46c-38d57564b74a
6
private static void generateMap() { // TODO Auto-generated method stub if (choiceCombination == null || choiceCombination.length == 0) { return; } for (int i = 0; i < choiceCombination.length; i++) { String itemString = choiceCombination[i]; if (itemString == null || itemString.length() == 0) { co...
bba8b31b-8bb7-48c6-880e-e53a0df06e39
0
public static void main(String[] args) { Twitter twitter=new Twitter(); twitter.postTweet(1,4); twitter.postTweet(2,5); twitter.unfollow(1,2); twitter.follow(1,2); System.out.println(twitter.getNewsFeed(1)); }
c6bbaee1-5d34-419f-bfd7-f465bda61952
4
@Test public void testBrandstofBestellen() throws Exception { File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/BrandstofBestellenTest.csv"); if (f.exists() && f.isFile()) { String voorraadnaam; String minimalevoorraad; String voorraad; String producten; FileReader fr = new FileR...
8455b73a-e555-4581-ae17-ed0ae626ff9c
7
@Override public String toString() { String output = "\t\t"; for (String letter : alphabet) output += letter + "\t"; output += "\n"; for (State state : states) { if (state.isStart()) output += "->\t" + state.getName() + "\t"; else if (state.isFinal()) output += "*\t" + state.getName() + "\t"; ...
2b76fc34-2802-4f47-9621-17650e4043fe
4
private void add(CommandSender sender, String[] args) { if (!sender.hasPermission("graveyard.command.add")) { noPermission(sender); return; } else if (!(sender instanceof Player)) { noConsole(sender); return; } Player player = (Player) send...
6dd76e3c-ec5d-46f8-8ac9-d1e4602ef16a
4
public void initORB(String[] args) throws IOException { Properties props = System.getProperties(); props.setProperty("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB"); props.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton"); // 启动参数 props.setProperty("...
2d884176-3dbc-4c4a-94ee-774e7714bd1f
2
private Product queryForProduct(String sql) { Product product = null; Connection con = null; try { con = getConnection(); PreparedStatement statement = con.prepareStatement(sql); ResultSet resultSet = statement.executeQuery(); resultSet.next(); product = buildProduct(resultSet); } catch (SQLExcep...
4635b892-b4c2-4684-b967-e10f33b39210
1
public void test_other() throws Exception { assertEquals(1, DurationFieldType.class.getDeclaredClasses().length); Class cls = DurationFieldType.class.getDeclaredClasses()[0]; assertEquals(1, cls.getDeclaredConstructors().length); Constructor con = cls.getDeclaredConstructors()[0]; ...
34dac907-06dd-403a-a40a-5176c924be37
9
@Override public void run() { while (true) { if (!in.isEmpty()) { String s = in.poll(); //System.out.println("the server updater heard "+s); String header = s.substring(1, s.indexOf(")")); s = s.substring(s.indexOf(")") + 1); ...
83a9d3dc-fec2-4ca7-977e-4b4a5e4669e5
1
public static SimulatedPlanetWars fakePW(){ // Tested List<Planet> asw = new ArrayList<Planet>(6); double x = -5; double y = -10; for (int i = 0; i<3; ++i){ Planet a = new Planet(i*2,i,3,5,x*i,y*i); Planet b = new Planet(i*2+1,i,10,4,-x*i,-y*i); asw.add(a); asw.add(b); ...
76a48d35-b21d-44c0-a956-e6e5f509831d
8
public ArrayList<ACTION> GetPossibleActions(State state) { ArrayList<ACTION> ret = new ArrayList<ACTION>(); for(ACTION action: ACTION.values()) { if(action == ACTION.UP) { if(state.YCoord + 1 < this.States[0].length )//&& !this.States[state.XCoord][state.YCoord + 1].IsWall) { ret.add(action); ...
8422c9df-351e-4f37-94f9-6357501031ef
2
public ScoreBoard() throws SlickException, IOException{ //Carregando o Score Table do arquivo: File arquivo = null; try{ arquivo = new File("ScoreBoard.txt"); //Se o arquivo não existe, criando o mesmo: if(!arquivo.exists()){ ...
91f3a377-9250-408c-a27c-db84f7c9a0ce
9
private void renderHierarchy(Hierarchy<T> hierarchy, int level, String path) { Map<Key, Hierarchy<T>> dimension = hierarchy.getChildren(); Key[] keys = dimension.keySet().toArray(new Key[dimension.size()]); Arrays.sort(keys, comparator); int colspan; int index = 0; String parentId = null; for (Key...
a07846e3-eea2-48f1-840f-852950bca924
6
private LinkedList<Booking> getNextPossibleBookings(Date walkAlongStartDate, Date endDate, long duration){ LinkedList<Booking> possibleBookings = new LinkedList<Booking>(); Date walkAlongEndDate = new Date(walkAlongStartDate.getTime()+duration*1000); if(this.bookings.size()==0){ if(walkAlongStartDate.getTime()...
33eaa4b7-6214-454a-afc9-c0574cfc2e20
6
@SuppressWarnings("deprecation") public static void main(String args[]) throws IOException { System.out.println("Enter 5 nodes:"); traversal t=new traversal(); DataInputStream in=new DataInputStream(System.in); String inp=new String(); String temp[]=new String[20]; node1 n[]=new node1[5]; for(int i=0;i<5;i++...
20513764-a5e0-4d79-828e-7d29e5b61e54
8
@Override public void execute() { Item bar = Inventory.getItem(Constants.STEEL_BAR_ID); if (furnace != null) { if (Constants.SMITH_WIDGET.validate()) { if (Constants.BALL_WIDGET.interact("Make")) { Mouse.move(Random.nextInt(0, 515), Random.nextInt(51, ...
66e5d317-9c67-4701-83ca-846d41c3935b
9
private static String[] getDefaultFontSearchPath() { String osName = null; try { osName = System.getProperty("os.name"); } catch (SecurityException e) { // preserve null osName } if (osName == null) { // Makes it a bit tricky to figure out...
280a7cd5-e170-491f-b465-e43d4129860d
7
private static int[] getColor() { int[] color = { 0xFF111111, 0xFFD50000, 0xFFFFFFFF }; switch (random.nextInt(8)) { case 0: { // red color color[1] = 0xFFD50000; break; } case 1: { // yellow color color[1] = 0xFFFFF115; break; } case 2: { // blue color color[1] = 0xFF6997FF; b...
e529971d-c226-4ebd-84dd-69c175bc86bf
7
public search(String file_name) { this.file_name = file_name; try{ while(hopcount<16 && !computer.found) { //Send search request to all neighbors to start the process of searching for a file. String message="SEARCH_REQ"+" "+computer.id+" "+computer.myhost +" "+computer.port+" "+file_name+" ...
dad99b12-039e-450f-b458-0d58cfeb2a58
0
public FileMenu() { super(); Outliner.menuBar.fileMenu = this; }
55498e88-42e0-47bd-b4fe-ce950aaaa693
4
public String getLanguageName(String id) { String back = "" ; if (id != null) { boolean found = false ; int hash = id.hashCode() ; ListIterator it = liste.listIterator() ; while ( (it.hasNext()) && (!found)) { ISOLanguage dummy = (ISOLanguage) it.next() ; ...
c8433de8-fac1-4ce5-8dd5-d699bc1e3f81
0
public Chat(Socket s) { player=s; }
16f5b053-3f83-4a47-a1c1-fbaab92d8ab3
6
public Test(){ //initialize logger org.apache.log4j.BasicConfigurator.configure(); _log.info("Please log-in to upload data."); SessionForm sf = new SessionForm(); sf.showDialog(); try{ mutex.acquire(); } catch(InterruptedException ie){ _log.error(ie.getMessage()); } sf.dispose(); if(mainUs...
a71eb506-bdc2-4188-b29a-148eb14a3394
0
public void setEndDate(LocalDate value) { this._endDate = value; }
983de4a7-6881-4e75-9cab-d300d2905ef0
1
@GET @Path("/v2.0/ports") @Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF}) public Response listPort(@HeaderParam("Accept") String accept) throws MalformedURLException, IOException{ if (accept.equals(OpenstackNetProxyConstants.TYPE_RDF)){ System.out.println(accept); String dataFrom...
bdf8dada-31d2-404d-9771-2dce2d49b4e0
2
public void mouseReleased(MouseEvent e) { //mouse_x=0; //mouse_y=0; mDragged=false; markerRect.stopDraw(); if(markerRect!=null){ markerRect.cleanUp();} if(e.isControlDown()){ MapGetter.setGoogleMarkers(markerRect); MapGetter.getMapImage...
ee3068d3-28b1-4d84-bfc9-78d1c319594c
7
public State getState() { if (timeout == 0) { if (callFrame == null) { if (exception == null) { return State.TERMINATED; } return State.ERRORED; } if (generator && caller == null) { return State.YIELDING; } if (calling != null) { return State.GENERATOR_WAIT; } return Stat...
3e6e83d1-6034-4d6e-b332-7e4017d2ea94
5
public Scene getCurrentScene() { if (this.currentScene == null) { this.currentScene = this.world.getCurrentScene(); if (this.currentScene == null) this.currentScene = this.world.getNextScene(); if (this.currentScene != null) { Vector localVector = this.currentScene.getO...
9eba1800-38d4-499b-a77a-69be0a821327
4
public InetAddress getValueAsInetAddr() throws IllegalArgumentException { if (!isOptionAsInetAddr(code)) { throw new IllegalArgumentException("DHCP option type ("+ this.code +") is not InetAddr"); } if (this.value == null) { throw new IllegalStateException("value is null"); ...
4a843856-068d-44ea-9505-3116272f400b
4
public static void main(String[] args) { Scanner scan = new Scanner(System.in); ArrayList<Integer> primos = numerosPrimos(51); do{ int n = scan.nextInt(); if(n==0) break; BigInteger ans = BigInteger.ONE; for (int i = 0; i < primos.size(); i++) { int current = primos.get(i); if(current>n) ...
9d4a2648-6776-4802-b05e-e438e9dd2905
9
public static void main(String[] args) { String dir = "data/"; CoastlineXMLtoDatHandler clh = new CoastlineXMLtoDatHandler(); try { XMLReader reader; reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(clh); reader.parse(dir + ...
af103352-f1f2-4285-ab45-42a5c89c14c2
1
private boolean inSameRankOrFile(Field from, Field to) { return from.inSameRankAs(to) || from.inSameFileAs(to); }
fc76a71c-02ca-4bd8-bdd1-5a9e57e43173
5
private long memoryAuditReport() { long companionOverHeads = 0; long bufferMem = 0; long maxMem = 0; int bufferCount = 0; for (ConcurrentHashMap<Integer, IntegerBuffer> map : buffers.values()) { companionOverHeads += 4; for(IntegerBuffer buf : map.values(...
7902029f-7fb7-4bbc-a8ee-5297a499d567
4
@SuppressWarnings("unchecked") public Provider updateProvider(String token, HashMap<String, Object> provider){ if(provider.containsKey("contact")) this.setContact((String)provider.get("contact")); if(provider.containsKey("name")) this.setName((String)provider.get("name")); if(provider.containsKey("picture"...
0974a91f-3ed7-47d4-b672-264911877261
9
public void writeType(Class typeClass) { // A big ol' else-if chain -- what's polymorphism mean, again? // I really wish I could extend the base classes! if (Integer.class.equals(typeClass)) { stream.write('i'); } else if (Long.class.equals(typeClass)) { stream.write('h'); } else if (Date.class.equals(...
177be065-b076-476c-9af3-f8c4611a03bb
5
public Rendering( int xd, int yd, int hz, boolean full ) { try { DisplayMode choices[] = Display.getAvailableDisplayModes(), chosen = choices[0] ; float bestFit = Float.POSITIVE_INFINITY, fit ; for (DisplayMode mode : choices) { if (mode.getWidth() < xd) continue ...
6b48263c-c6ae-46f8-9d22-079406e9819c
6
@Override public void execute(Host host) throws CommunicationException { if (host.compareTo(routingTable_.getLocalhost()) == 0) { logger_.info("Exchange service stopped because the given host was the local host."); return; } logger_.info("Executing exchange service.")...
96fff57c-8af8-4926-88b8-54301fa0454b
0
@Test public void success() { }
fc04effc-9fb5-4091-9bb5-cfbcfed5b845
9
public Vector2f checkIntersection(Vector2f lineStart, Vector2f lineEnd, boolean hurtMonsters){ Vector2f nearestIntersection = null; for(int i = 0; i < collisionPosStart.size(); i++){ Vector2f collisionVector = lineIntersect(lineStart, lineEnd, collisionPosStart.get(i), collisionPosEnd.get(i...
e7c8d772-8dfe-4da9-aea8-add1b8a622f0
5
public boolean validate(T object) { Board board = new Board(object); // Move the space to the bottom right corner for (Square sq = board.squareOf(Board.EMPTY_SQUARE);;) { if (sq.x() < board.width() - 1) { sq = new Square(sq.x() + 1, sq.y()); } else if (sq.y() < board.height() - 1) { sq = new Square...
829fc1be-0da0-4f5a-98d9-8d37bd107a30
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Cerchio other = (Cerchio) obj; if (centro == null) { if (other.centro != null) return false; } else if (!centro.equals(other.centro)) ...
881511da-9d11-4f81-9bb9-a7cc23ffcfa9
5
private static Bean takeOut(ArrayList<Bean> list) { while (list.size() > 1) { //get two random beans Bean one = list.get((int) Math.random() * list.size()); Bean two = list.get((int) Math.random() * list.size()); //if they are both black if (one == Bean.BLACK && two == Bean.BLACK) { list.remove(Bea...
25ed45e7-5ef2-4048-b4a4-f7cac9cbe98b
3
public void singleStepParse() { String parsedLine = ""; try { String line = reader.readLine(); parsedLine = line; if (line != null) { parseLine(line); label.setText("Parsed line: \n" + line); } else { label.setText("Drawing Complete"); } } catch (IOException e) { label.setText("IO Ex...
61623cf1-afdf-4a5c-ad87-c25e5b1ad789
4
static private void verifyXAndY() { if (x < 0 ) { x = 0; } else if ((x + cropWidth) > imageWidth) { x = imageWidth - cropWidth; } if (y < 0 ) { y = 0; } else if ((y + cropHeight) > imageHeight) { y = imageHeight - cropHeight; ...
3f0f5ab1-df36-4a7b-b4ca-eac1c7b79d2d
9
public void run() { try{ Scheduler.debug("running thread"); DataInputStream dis = new DataInputStream(socket.getInputStream()); DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); int code = dis.readInt(); //We need to create a ne...
ac710778-5c0c-4bf3-a59b-705a99141782
2
@Override public int compareTo(BlastResultEntry bre) { // Compare 'query' ID int res = qseqid.compareTo(bre.qseqid); if (res != 0) return res; // Compare 'chromosome' res = sseqid.compareTo(bre.sseqid); if (res != 0) return res; // Compare start position return sstart - bre.sstart; }
1786c127-3bdd-4b38-b872-469a48df476a
6
@Override public void mouseReleased(MouseEvent e) { if (!isListening) return; //can only click if dirty is not true boolean left = e.getButton() == MouseEvent.BUTTON1; boolean right = e.getButton() == MouseEvent.BUTTON3; if (!dirty) { int xClick = e.getX() / squareSize; int yClick = e.getY() ...
be783a83-d5af-416a-adcb-9128690ef613
6
@Override protected void doAction() { //won't play multiples if (this.getTurnPlays() >= 1) { this.endPlay(); return; } //tries to play eight matching suite ArrayList<Card> cards = this.getCardsOfValue(Card.EIGHT); if (!cards.isEmpty()) { ...
134e9d15-7cd1-4610-a1b2-7780479a1f34
4
private void collectUpdates() { console.printf("Scanning %s for updates ...\n", updatesfolder.toString()); updates = new ArrayList<DBUpdate>(); DirectoryStream<Path> files; try { files = Files.newDirectoryStream(updatesfolder); } catch (IOException e1) { e1.printStackTrace(); return; } for...
f57c227b-566b-4b09-9c09-c8da219db18e
4
@Override public void visitMethod(ClassNode c, MethodNode m) { if(m.name().equals("finalize") && ((m.info.modifiers() & Modifiers.PUBLIC) == 0) && ((m.info.modifiers() & Modifiers.PRIVATE) == 0) && (m.info.modifiers() & Modifiers.PROTECTED) == 0) { m.info.setModifiers(m.info.modifiers() | Modifiers.PUBLIC); co...
8b47651f-fd47-4d95-af5a-fd087bd6773b
3
protected Map<String, String> getParams(ApiRequest request) { Map<String, String> result = new HashMap<String, String>(); result.put("version", Integer.toString(request.getVersion())); ApiAuth<?> auth = request.getAuth(); if (auth != null) result.putAll(auth.getParams()); Map<String, String> params = reque...
3e4c0dc1-6e7b-456f-9c84-08462f9d317b
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...
0444fdd2-3623-48dc-8781-eba7829bae60
2
public void writeToFile( String content ) { File file = new File( fileNameWithPath ); file = new File( file.getParent() ); if ( file.exists() == false ) { file.mkdirs(); } try { PrintWriter pw = new PrintWriter( fileNameWithPath ); pw.write( ...
811318d9-ee78-4d04-9076-1a9b79caa11a
1
private void notifyOfRowsWereRemoved(Row[] rows) { for (OutlineModelListener listener : getCurrentListeners()) { listener.rowsWereRemoved(this, rows); } }
98b20ae0-3f3c-4853-bbe7-651a8b0b2aae
3
@Override public String toString() { String name = getName(); String append = ""; if(name != null && !name.equals("")) { append = "(\"" + this.getName() + "\")"; } StringBuilder bldr = new StringBuilder(); bldr.append("TAG_Compound" + append + ": " + value.size() + " entries\r\n{\r\n"); for(Map.Entry<...
ea6cd423-bc18-4df5-9b12-762c93333d8f
2
public void ImageSetDCT_Color(int _numCoeffcient) { //1@ Split the picture to 8*8 blocks DCT _dct = new DCT(); Block[][] picBlock = _dct.SplitChanneal(this.bytes, 3*this.height, this.width); //Traverse the blocks matrix. for(int i=0;i<this.height/Block.N;i++) { ...
293a1fa7-2bf5-449c-8a52-166e18259563
5
public void pieces(Graphics g) { for(int x=0; x<pieces.length;x++) { for(int y=0; y<pieces.length; y++) { if(pieces[x][y]==-1) { g.fillOval(x*74,y*72,71,71); g.setColor(Color.black); } else if(pieces[x][y]==1) { g.drawOval(x*74,...
4a35bdfa-a480-46a5-938d-990baabd217e
7
@Test public void testServerUseMessageQueueSend() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerUseMessageQueueSend -----"); String client_hash = ""; String server_hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutException e) { ...
88f47392-fb75-41f9-b2c5-3b0da076e220
4
public double rawPersonTotal(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive"); if(!this.variancesCalcul...
ef2e822a-9cae-4841-8985-2a5d7e624318
2
@Override public String toString() { String lsAttrs = ""; for (int i = 0; attrList != null && i < attrList.size(); i++) { lsAttrs += " " + attrList.get(i).toString(); } return "Registrant [additionalInfo1=" + additionalInfo1 + ", additionalInfo2=" + addit...
a4129268-6eca-44f0-8d3c-862d657d12a7
6
public void tryWay(int programPointer, int stackSize, int[] sizes){ while(instructions.size()>programPointer){ XInst inst = instructions.get(programPointer); int size = sizes[programPointer]; stackSize += inst.getStackChange(); if(stackSize<0){ int i = 0; for(XInst instr:instructions){ System...
861c5393-202b-490c-b12d-b8d2fe4e1adc
6
public void loadPacks(File folder) { if(!folder.exists() || !folder.isDirectory()) return; Globals.getInstance().oldVersionsFlag = false; for(File pack : folder.listFiles()) { if(pack.getName().equals(Globals.curseFileName)) continue; //System.out.println("Loading "+pack.getName()...
b5713e11-5cc8-48e4-bbad-837fdb10c8c0
6
public int getPriority() { switch (getOperatorIndex()) { case 26: case 27: return 500; case 28: case 29: case 30: case 31: return 550; } throw new RuntimeException("Illegal operator"); }
4bba9804-adaa-4322-9c84-7d8aa297abe5
2
public IAnimal getAnimal(String animal) { if ( animal.equalsIgnoreCase("bir") ) return new Birmaneza(); else if ( animal.equalsIgnoreCase("sia") ) return new Siameza(); return null; }
a18e7597-58f3-4c54-a26c-bcb0487866e6
0
public boolean isIgnoreCase() { return this.ignoreCase; }
eaae612b-ce19-4a7f-b859-979ed43ffc9f
8
@Override public String getResource() { String html = null; if (openResourceConnection()) { Elements aLinks = doc.select("a[href]"); Elements media = doc.select("[src]"); Elements links = doc.select("link[href]"); for (Element src : media) { src.attr("src", src.attr("abs:src")); } for ...
cbb0a316-e75e-4734-928b-88b00d0e2f80
6
public void drawInfo(Graphics2D g) { // IF TYPE IS BANK if(this.getType() == BANK) g.drawString("BANK", this.getX()+5, this.getY()+25); // IF TYPE IS SHOP else if(this.getType() == SHOP) { // IF SHOP IS OWNED if(this.isOwned()) ...
93d12382-c9ee-443e-92bc-2f78bbde685b
8
public static ArrayList<CardCombination> getBasicCardCombinations( ArrayList<Card> cardsToSearchForCardCombinations) { // Make sure that the list // Store a list of the temporary hand cards so that the given list can // be manipulated ArrayList<Card> tempHandCards = (ArrayList<Card>) (cardsToSearchForCardCo...
6cc51763-0e69-4faa-a352-e0a2fe598456
2
public void runServer () { try { ServerSocket serverS = new ServerSocket(PORT, 10); while (!over) { Socket clientSocket = serverS.accept(); ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream()); String inType = (St...
67095279-8fc7-4211-a5d2-5ce6e1e0d778
2
public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File file = new File("C:/1.txt"); BufferedReader in = new BufferedReader(new FileReader(file)); String line; double x1 = 0, x2 = 0, y1 = 0, y2 = 0, distance = 0; while ((...
60029fe2-8ecc-42c8-a641-caf57e8fe4a5
4
public void initializeServerWithPersistDataInServer() throws IOException, CubeXmlFileNotExistsException, DocumentException, CubeAlreadyExistsException, CorrespondingDimensionNotExistsException, SchemaAlreadyExistsException, CorrespondingSchemaNotExistsExceptio...
1062b7ab-6665-4ba7-a0e0-014ab6e990d5
1
public void load30DegreeSlopeRight(Rectangle2D e) { for(int x = 0; x < e.getHeight() / 4; x++) { platforms.add(new Platform(new Rectangle2D.Double(e.getX() + ((e.getWidth() / (TileSet.tileWidth / 4)) * x), e.getCenterY() - (((e.getHeight() / 4) / (TileSet.tileHeight / 8)) * x), (e.getWidth() / (TileSet.tileW...
42b26ddd-1cfb-44e1-8229-afbf6ac7845d
0
public boolean isCatched() { return catched; }
d0ac32a0-8ac1-4ade-a85c-182cf7733285
6
static final void method168(byte i) { do { if (!((Signlink) Class348_Sub23_Sub1.signlink) .aBoolean3794) { try { Method method = (aClass5208 != null ? aClass5208 : (aClass5208 = method169("java.lang.Runtime"))) .getMethod("maxMemory", new Class[0]); if (method != null) { try ...
fece3e72-b4ee-4108-9181-aa7cc109b19f
6
public cell getCell(int x, int y){ int myx; int myy; if(x >= xmin && x < xmax){myx = x-xmin;}else{myx = -1;} if(y >= ymin && y < ymax){myy = y-ymin;}else{myy = -1;} if(myy == -1 || myx == -1){ return new cell();} else{ return culture[myx][myy];} }
caff9b4d-08de-4777-aa16-031d1189ce30
7
protected double kernelHelper2(int n, char[] s, int endIndexS, char[] t, int endIndexT) { //recursion ends if one of the indices in both strings is <0 if (endIndexS <0 || endIndexT <0) { return getReturnValue(n); } int adr = 0; if (m_useRecursionCache) { adr=m_multX*n+m_multY*endI...
26c18bf9-126d-49b5-ae31-91a61d5b1012
4
@Override public boolean deleteAlbum(int id) { try { CDOrganizer cdOrganizer = XmlDAOFactory.unmarschallFile(); for (ArtistXML a : cdOrganizer.getArtistList()) { for (AlbumXML b : a.getAlbumList()) { if ( b.getID() == id ) { a.delAlbum(b); XmlDAOFactory.marshallFile(cdO...
6122998b-7d1d-426b-b41b-e428efa20587
7
public boolean hasMoves() { // Checking if a free slot exists (and thus another move can be made) if (hasFreeSlot()) { return true; } // Up/Down directions for (int x = 0; x < cols - 1; x++) { for (int y = 0; y < rows; y++) { if (Tile.canC...
152d0dbd-0b63-4f35-b084-336c9fa42d74
2
private void createMenu(){ loadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(panel); if (returnVal == JFile...
d489af7f-f74a-46ae-9c25-2c840d17fcbf
2
public JSONObject putOpt(String key, Object value) throws JSONException { if (key != null && value != null) { put(key, value); } return this; }
eae3c7e8-73f0-42e6-8f30-d55d60b46e31
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Body other = (Body) obj; if (Double.doubleToLongBits(this.px) != Double.doubleToLongBits(other.px)) { return false; } if (Double....
cb96cf50-82ec-42c7-98c3-d227ae691602
7
@Override public AUTOMATON initObj() { Class<AUTOMATON> classTypeDef = getClassTypeDef(); try { return classTypeDef.getConstructor(new Class[] { Class.forName("[C"), Integer.TYPE}).newInstance(new Object[] {alphabet, 2}); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printS...
6a15fcce-4d74-4068-90bb-815f1887bbce
7
public DataSet(String path) { try { BufferedReader reader = new BufferedReader(new FileReader(path)); String[] attInfo = reader.readLine().split(","); // attributes info numAttributes = attInfo.length - 1; isCategory = new boolean[numAttributes + 1]; f...
e884eb0f-fc32-494e-8128-1d2c2bf18e37
4
private boolean updateStrict(T model, UpdateStatementPreparer<T> usp, Long oldUpdatedAt) throws TooManyRowsUpdatedException, StaleModelException, IOException { try { final PreparedStatement saveStmt = conn.getPreparedStatement(usp.getSaveStmt()); usp.setParams(this, model, saveStmt); saveStmt.exec...
48523460-1223-44e2-a9b7-cee0562a3e3a
3
public RemoteTestRunner() { super(); Utils.checkJMeterVersion(); ServerStatusController serverStatusController = ServerStatusController.getServerStatusController(); serverStatusController.start(); BmTestManager.getInstance().userKeyNotificationListeners.add(new IUserKeyNotifica...
4405964a-dfe4-4fba-87b8-9672dcf2baf2
9
public static String builDOMMethodStructureString(XMLStreamReader xmlsr) throws XMLStreamException { int deepLevel = 0; String builderDOMStructure = "<root>"; int eventType; while (xmlsr.hasNext()) { eventType = xmlsr.next(); if (eventType == XMLEvent.END_ELEMENT && xmlsr.getLocalName().matches(...
7c45d4e7-bf64-451b-8666-61c8e2a3762e
3
@SuppressWarnings("unchecked") public String getTeamPieChart() { PreparedStatement st = null; ResultSet rs = null; JSONArray json = new JSONArray(); try { conn = dbconn.getConnection(); st = conn.prepareStatement("SELECT sum(auton_top)*6 + sum(auton_middle)*4 ...
831e4718-4855-47eb-8c6c-694a5dbbdf09
5
public void replaceWordsOfGivenLength(int length, String substring) throws IOException{ for(int i = 0; i < text.numberOfParagraphs(); i++){ Paragraph currParagraph = text.getParagraph(i); for(int j = 0; j < currParagraph.numberOfSentences(); j++){ Sentence cur...
a861e8a5-a1cb-43de-9fb5-e30b8468d14c
9
public void handle(HttpExchange exchange) throws IOException { String httpMethod = exchange.getRequestMethod(); if ( "Post".equalsIgnoreCase(httpMethod) ) { Headers respHeaders = exchange.getResponseHeaders(); String requestBody = readPostRequest(exchange); Ma...
ecb8b5e3-0b70-4dd6-b1b0-b3911b409dd1
7
@Override public void run() { try { byte[] writeBuf = "111111111111111111111111111111111111111111111111111111111111111111".getBytes(); double random = Math.random(); if(random < .3) { myDfs.write(new DFileID(0), writeBuf, 0, writeBuf.length); } if(random > .3 && random < .7) { writeBuf = "2222...
80b22d6f-a393-47e8-8c67-2a6d345b1506
2
private boolean hasWall(Square square) { for (Element e : square.getElements()) { if (e instanceof Wall) return true; } return false; }
13277596-e939-4d77-af9f-0d7cae062741
6
public GameObject createObject(LevelColor color){ GameObject object = null; /* * reserves colors: * 255.255.1-255 portals */ // DevObjects if(color.hasColors(120, 60, 0)) object = new GameObject(true,false,4*32, 2*32, new Tile("res/objects/house.png")); // Objects with soft Color if...
7a05578d-8d11-419d-8aba-3a2b05fee4ac
7
public static int invCheck(String name,TelnetService TN) throws InterruptedException, IOException{ int cnt=0; int amt=0; TN.write("sys god "+name+" inv"); String in=TN.readit("Wealth:", "Cannot find user"); if (!in.equals("Cannot find user")&&!in.contains("You are carrying Nothing!")){ String[] b=in.split(...
672ba061-745f-4fd8-b0a6-c010823e8079
2
private void accept(SelectionKey key) throws IOException { // For an accept to be pending the channel must be a server socket channel. ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel(); // Accept the connection and make it non-blocking SocketChannel socketChannel = serverSocketChann...
f0b12a72-2f11-406d-b119-06d8e11e12f6
7
public static void main(String[] args) throws IOException{ file = new File("regras.txt"); if(file.exists()){ fr = new FileReader(file); br = new BufferedReader(fr); String line; while(br.ready()){ line = br.readLine(); rules.add(line); } line = rules.get(0); String[] rule = ...