method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
65768b4f-3ac3-42a0-a0d2-5327187e2ebc
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...
168a4953-abb1-4b93-95d7-d5e0857275e5
5
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In soldier handler"); String responseMessage = ""; if(exchange.getRequestMethod().toLowerCase().equals("post")) { exchange.getResponseHeaders().set("Content-Type", "appliction/json"); try { //TODO verif...
e9a43b8c-1f3b-4b70-9b3c-fe80746cf69b
7
public void open() throws IOException { try { CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier(comm); CommPort p = pid.open(this.getClass().getName(), 2000); //timeout of 2 milliseconds if (p instanceof SerialPort) { port = (SerialPort)p; //set up the port port.setSeri...
675a33a8-3082-49b0-8274-b674c43f77de
0
public String getName() { return name; }
93ffc86c-1f7d-491d-a248-6629511f376f
5
public void changeTache(PrintWriter out, String [] choix){ try{ if((choix[2].equals("libre")||choix[2].equals("affectée")||choix[2].equals("réalisée")) && taches.containsKey(Integer.parseInt(choix[1]))){ taches.get(Integer.parseInt(choix[1])).setStatus(choix[2]); out.println("OK"); out.flush(); }els...
81d48257-8a5f-4844-90e7-443eb19ea664
3
private String getRead( String variable ) { StringBuilder sb = new StringBuilder(); if ( countRead == 0 ) { sb.append( "\n" + TAB + TAB + TAB + variable + " readRecord = " + toJavaCase( variable ) + "Dao.read( "); sb.append( param + " );\n" ); sb.append( TAB + TAB + ...
96a85ae5-86c9-46ff-92ca-3cf81b449805
7
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("result")) callList = new CallList(); if (qName.equals("rowset")) { String name = attrs.getValue("name"); if (name.equals("callGroups")) { callGroups = true; } ...
394145e4-0a34-4c44-932c-937476db284a
0
public void specialAttack() { skill1.attack(this.getAgility(), this.getLuck()); }
efb9a2e0-8742-4e92-9497-3246e3bc38ce
5
@EventHandler(priority = EventPriority.HIGH) public void onPlayerInteract (PlayerInteractEvent event) { Player player = event.getPlayer(); Location playerLoc = player.getLocation(); if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_AIR) || eve...
d383c668-d651-4aee-aa08-307f19ba1585
6
public static void main(String[] args) { Scanner meinScanner = new Scanner(System.in); int meineZahl = meinScanner.nextInt(); switch(meineZahl) { case 1: System.out.println("ist 1"); break; case 2: System.out.println("ist 2"); break; case 3: System.out.println("ist 3"); break; defa...
f874e924-fddf-460a-bb76-6ddf72019002
1
CesheSkypeStatusRequester(SkypeStatusRequester sreq) throws IOException { file = new File("File.txt"); if (!file.exists()) { file.createNewFile(); System.out.println("New file File.txt has been created in the current directory"); } sk = sreq; }
1ab7e570-ad48-4c97-8015-3e5d8eb1ad9d
3
public void tick(LinkedList<GameObject> object) { x += velocityX; y += velocityY; if (jumping || falling){ velocityY += gravity; if (velocityY>MAX_SPEED) velocityY = MAX_SPEED; } collision(object); }
cc9d69c4-4afa-4393-8ce3-8256e9ca1dbf
2
public void setLocal(String local) { if(local.length() < 65) { try { isValidLocal(local); this.local = local; } catch(Exception e) { System.out.println(e.getMessage()); System.out.println("Local not set."); } } else System.out.println("Local part length must be less than 65 characters"...
8e21e000-52cc-47b4-9567-cbfeb81370c1
8
@Override public void run() { while (!close) { SocketChannel socket = null; try { socket = this.socket.accept(); socket.socket().setTcpNoDelay(true); socket.configureBlocking(true); socket.socket().setKeepAlive(true); socket.socket().setSoTimeout(WAIT_SOTIMEOUT); //get I...
880123a8-1f0a-47dd-a743-eecc7f2ce817
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Library library = new Library(); JSONObject patronJSON = new JSONObject(); int cardNumber = 0; try { cardNumber = Integer.parseInt( request.getParameter("cardNumber")); } catch ...
e376f967-13e1-4b64-b1f8-4f6ba85753c3
8
final private boolean jj_3R_117() { if (jj_scan_token(SWITCH)) return true; if (jj_scan_token(LPAREN)) return true; if (jj_3R_40()) return true; if (jj_scan_token(RPAREN)) return true; if (jj_scan_token(LBRACE)) return true; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_1...
5f2513f3-c7aa-45fc-b122-d94e597454bc
1
private void jouerUnCoup(Joueur unJoueur) throws Exception { Position positionDesiree = unJoueur.obtenirPositionProposee(); Case laCaseOuPoserLePion = this.plateau.obtenirCase(positionDesiree); Couleur couleurDuJoueur = unJoueur.obtenirCouleur(); if (positionJouable(couleurDuJoueur, positionDesiree)) { ...
901b5c33-966b-4c64-8ea5-64bf2a609c88
6
private static void startHttpServer(String s, String s1) { Class class1; try { class1 = Class.forName(s); } catch(ClassNotFoundException classnotfoundexception) { throw new UserError("Could not find http server \"" + s + "\"."); } ...
63fa34a2-f03a-4d74-8fd8-2ac24e54ac8b
8
private int minValue(int[][] grid, int depth, int alpha, int beta) { //check if the board is in a terminal (winning) state and //return the maximum or minimum utility value (255 - depth or //0 + depth) if the max player or min player is winning. int winner = checkForWinner(grid); if ( winner != GV.PLAYER_E...
dee22cfd-38b3-4932-ac50-198b46194209
4
private boolean isGameMotivatedMove(Location from, Location to){ return (from.equals(Location.R_BEAR_OFF) || from.equals(Location.B_BEAR_OFF) || to.equals(Location.B_BAR) || to.equals(Location.R_BAR)) && (isMove(from,to)); }
f2eae253-e154-4f6b-a3af-989c8e21f609
3
public String toString(){ String result = ""; for (int i = 0; i < grid.length; i++){ for (int j = 0; j < grid.length; j++){ if(visited[i][j] == RoomState.HIDDEN) result += RoomState.HIDDEN.getValue() + " "; else result += grid[i][j].getValue() + " "; } result = result.trim() + "\n...
d95f91e6-b1cd-408c-b4df-395d386c0f86
5
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; AffineTransform old = g2d.getTransform(); g2d.drawImage(backGround, 0, 0, null); g2d.translate(64 + p.getPosX(), 64 + p.getPosY()); g2d.rotate(-p.getAngle()); g2d.drawImage(p.getPlayerImage(), -64, -64, null); g2d.setTransform(old); g2d...
ab52dd3a-7a8e-4946-872b-5c23d6806c50
2
protected HttpResponse execute(HttpRequestBase method) { try { method.setHeader(new BasicHeader("Accept", "application/json")); method.setHeader("Content-Type", "application/json; charset=UTF-8"); HttpResponse rsp = getHttpClient().execute(method); checkResponse(...
02c27e5e-109f-4d19-8aaf-c096794a2036
7
public void copySummaries(String base){ File F = new File(base); for(File filter : F.listFiles()) { if(filter.isDirectory()) { String filterName = filter.getName(); System.out.println(filterName); for(File threshold : filter...
fbfc95d7-7927-4dea-b45a-059b13a8914f
7
public double getMeleeAttack() { double level = c.playerLevel[0]; double levelMultiplier = 1.00; if (c.prayerActive[2]) levelMultiplier *= 1.05; else if (c.prayerActive[7]) levelMultiplier *= 1.1; else if (c.prayerActive[15]) levelMultiplier *= 1.15; els...
8a74ccbd-82d5-4b7a-8419-394565364a23
7
public Instrument1 next() { switch(rand.nextInt(7)) { default: case 0: return new Wind1(); case 1: return new Percussion1(); case 2: return new Stringed1(); case 3: return new Keyboard(); case 4: return new Brass1(); case 5: return new WoodWind1(); case 6: return new Piano(); } }
4759bda6-4393-460e-9b35-a9bebff0c254
8
private NoteIndex translatePointToNoteIndex(Point point) { // centreer de punten int rx = point.x - this.getWidth()/2; int ry = point.y - this.getHeight()/2; int rr = (int)Math.sqrt(rx*rx+ry*ry); double radr = Math.atan(((double)ry)/((double)rx)); if(rx < 0 && ry >= 0) { radr += Math.PI; } else if(r...
113a05f9-8f8d-4c95-82f7-21ac1c71c1b6
4
public static boolean isSelXmlNode(Element elem) { NodeList childrens = elem.getElementsByTagName(XmlFunction.ATTRIBUTESGRP); if ((elem.getNodeName().equals(XmlFunction.ATTRIBUTESGRP) || elem.getNodeName().equals(XmlFunction.ATTRIBUTES)) && childrens.getLength() > 1 && elem.getAttribute(XmlFunction.CON...
8a2445c0-c230-45f1-b633-dcce312f1565
8
public final WaiprParser.triggers_return triggers() throws RecognitionException { WaiprParser.triggers_return retval = new WaiprParser.triggers_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token char_literal40=null; Token char_literal42=null; ParserRuleReturnScope trigger39 =null; Par...
2a044a8c-6d01-498b-b5e4-4111bf6e9d5f
6
@Override public boolean doMove() { int startSteps = curGb.stepCount; prepareMovement(); while(true) { if(!check) { curGb.step(dir); // walk break; } else { State s = curGb.newState(); int add = Util.runToAddressNoLimit(0, dir, curGb.pokemon.walkSuccessAddress, curGb.pokemon.walkFailAddr...
86734495-450d-4880-8bb4-4e396a3781d4
0
@Override public void close() throws IOException{ cb.close(); super.close(); }
4a076913-5af6-416c-bc0e-2c78dd25646b
5
public ArrayList<String[]> solveNQueensNew(int n) { // Start typing your Java solution below // DO NOT write main() function int[] res = new int[n]; ArrayList<String[]> resArr = new ArrayList<String[]>(); Arrays.fill(res, -1); int i = 0, j = 0; while (i >= 0) { // the ith row for (j = res[i] + 1; j < n...
b28f7703-8565-402f-950e-40544ceac1f7
0
public int next() { return (int)(-scale*Math.log(rnd.nextDouble())*((double)mean)); }
d82d5d46-b514-4ae2-8eff-ad6afdbd59d3
8
public HashMap<Integer, Integer> getCreateItemRequirements() { if (clientScriptData == null) return null; HashMap<Integer, Integer> items = new HashMap<Integer, Integer>(); int requiredId = -1; int requiredAmount = -1; for (int key : clientScriptData.keySet()) { Object value = clientScriptData.get(key);...
805e9730-eaa9-4ddf-8526-5da5df19d398
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { BotManager frame = new BotManager(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
af06c20b-5a2e-408c-974c-bf3d4c555100
4
public int ermittleSabotageAnteil() { int angreifersoldaten = this.getSoldateneinsatz(); int opfersoldaten = this.opfer.getSoldaten(); int sabotageAnteil = 0; if ( opfersoldaten == 0 ) { sabotageAnteil = 100; } else if ( opfersoldaten != 0 ) { sabotageAnteil = (int) ( angreifersoldaten / opferso...
22de52ee-a163-4b16-b7fb-0c3d9125e107
5
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { Component res = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus ); if( res instanceof JLabel ) { synchronized( re...
2c1c6a3a-d1a2-4878-9cc4-ddfefce0d607
3
@Override public void mouseClick(int X, int Y) { for(int i = 0; i < this.Matrix.size(); i++) { if(this.Matrix.get(i).contains(X,Y)) { this.SelectedCellIndex = i; break; } } if(this.getMouseListener() != null) ...
80b23ff3-f09b-4a0a-9a4c-c3ec96a4c882
8
public Vector2D getAim() { switch(aim) { case UP: return new Vector2D(0,-1); case DOWN: return new Vector2D(0,1); case LEFT: return new Vector2D(-1,0); case RIGHT: return new Vector2D(1,0); case UP_LEFT: return new Vector2D(-1,-1); case UP_...
9bffc410-6eed-4c01-a82f-c23ef31b4786
0
@Test public void itShouldDeserializeAPointWithAltitude() throws Exception { GeoJsonObject value = mapper.fromJson("{\"coordinates\":[100.0,5.0,123],\"type\":\"Point\"}", GeoJsonObject.class); Point point = (Point)value; assertLngLatAlt(100, 5, 123, point.getCoordinates()); }
07d4c470-6b2f-4e62-a54c-4a4004b111aa
5
public static boolean chkBox(char[][] arr,int x,int y){ boolean res = true; Set<Character> set = new HashSet<>(); for(int i=x;i<x+3;i++){ for(int j=y;j<y+3;j++){ if(arr[i][j]!='.') if(set.contains(arr[i][j])){ res = false; break; }else{ set.add(arr[i][j]); } } if(!res) ...
d2a5838a-6cb8-4fdc-8da4-e61d40cd5bab
6
@Override public void caseADeclEscrevaDefinicaoComando(ADeclEscrevaDefinicaoComando node) { inADeclEscrevaDefinicaoComando(node); if(node.getPontoVirgula() != null) { node.getPontoVirgula().apply(this); } if(node.getRPar() != null) { node.g...
227bac18-6954-4d8f-ba7d-dabcc6d2164c
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 ...
0cedc1af-0bf7-48a3-b4c9-917cf997e6c0
1
public String toString() { return (parent == null) ? "base package" : getFullName(); }
6eeb2cfb-f699-41fe-b663-860ce4e62805
0
private void jButtonNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewActionPerformed //Récupération de la méthode contrôleur 'nouveauRapport' ctrlCR.nouveauRapport(); }//GEN-LAST:event_jButtonNewActionPerformed
2c290aad-963e-4877-8b33-9d4c639a1ff2
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Email other = (Email) obj; if (this.id != other.id) { return false; } if (!Ob...
8e878ba3-2f7e-4862-b033-0ac11d10b6a6
4
public void run() { try { int size = this.Destructed.size(); synchronized (this) { //fix for new launcher if (size == 0) { wait(); size = this.Destructed.size(); } for(int i = 0; i < size; i++) { ((Thread) this.Destructed.get(i)).start(); if (i == size-1) { wait(); ...
917bdd90-22c5-4f33-9270-0883d81d4b6a
1
public static Options load() { Options o = new Options(); try { File f = new File(Main.loc + "Options.cfg"); DataFile dF = new DataFile(); FileInputStream stream = new FileInputStream((new StringBuilder()).append(f.getAbsolutePath()).toString()); dF.load(stream); stream.close(); o.mSounds = Bo...
a655fdce-e8c1-472d-9009-d87dd4e61dcf
5
public float getSize(){ if(age >1.0f && super.gender) return 1.1f; else if(age >1.0f && !super.gender) return 1.4f; else{ if(super.gender) return age + 0.1f; else return age + 0.4f; } }
c239f417-5d05-41c9-8eb1-979bee7cbe66
2
public static Grammar getTerminalGrammar(Grammar grammar) { Grammar g = new ContextFreeGrammar(); Set terminalVars = getCompleteUsefulVariableSet(grammar); Production[] prods = grammar.getProductions(); for (int i = 0; i < prods.length; i++) { Set v = new HashSet(Arrays.asList(prods[i].getVariables())); v...
7f9bccb1-45e0-4d86-9973-2ad89461e7da
6
void explode(int damage){ int baseDamage = (int)Math.round(damage + 0.2*turnsLeft*damage); int aoeDamage = (int)Math.round(10 + 0.2*turnsLeft*10); position.damageTile(baseDamage, dealingPlayer); if(position.up != null) position.up.damageTile(aoeDamage, dealingPlayer); if(position.down != null) position.down.damage...
45deb950-815e-4e0c-b116-a5bc68a57aaa
0
public void setCode(String code) { this.code = code; }
b27ffd1a-8f45-47f0-a57a-abfe59c6c843
9
public boolean execute() { BufferedReader in = null; if (filename != null) { try { in = new BufferedReader(new FileReader(filename)); } catch (FileNotFoundException e) { throw new IllegalParameterException(prefix + "." + PAR_FILE, filename + " does not exist"); } } else { in = new BufferedReader( ...
3b177f65-a81f-4abe-a21d-a7ef5eaa4b3f
7
private static boolean areLeftRightEmpty(CatCage leftCage, CatCage rightCage) { return (leftCage.getTopCell() == null && leftCage.getRightCell() == null && leftCage.getBottomCell() == null && leftCage.getLeftCell() == null) && (rightCage.getTopCell() == null && rightCage.getRightCell() == null && rightCage.getBottom...
abe47fc9-3de1-4527-9e7d-b5ccef88ae45
8
private void heapDown(char[] str, int end) { int parent=0; while (parent<end){ int leftChild=2*parent+1; int rightChild=leftChild+1; if (leftChild==end){ //Only Left Child exists if (heapData[parent] < heapData[leftChild]) { swap(parent,leftChild); parent=leftChild; } else{break;...
335924bb-2d09-43c9-a19f-05cc4319abc6
9
private void progressiveRun() { final Thread current = Thread.currentThread(); //if(animated) DjVuOptions.err.println("bcr progressiveRun "+this); GRect lastFullRect = null; boolean repeat; do { final boolean decoding = page.isDecoding(); repeat = decodin...
336e5557-e28d-4078-a1fa-19e3ed64f5ad
2
public float[] getOutput() { float[] output = new float[outputNs]; for (int i = 0; i < outputNs; i++) { output[i] = getOutputNeuron(i).getFired() == FiringState.FIRED ? 1f : 0f; } return output; }
9134b310-5720-4c35-a3a3-fe82527c7463
1
@Override public void keyPressed(KeyEvent event) { // Wenn die Taste "Enter" gedrückt wird, wird die Anmeldung versucht if (KeyEvent.VK_ENTER == event.getKeyCode()) { loginButton.doClick(); } }
a7a82258-f092-40fd-a29b-a74cba03a1e2
6
public void loadFromFile() { if (filename==null) return; try { BufferedReader reader; try { File file = new File(filename); // ignore call if file does not yet exist if (!file.exists()) return; reader = new BufferedReader(new FileReader(file)); } catch (java.security.AccessControlException ...
936815cb-3f6a-45fd-aa22-141c121ebf01
0
@Override public String getDesc() { return "GuidedAttack"; }
d5cbda20-6bb3-4ebd-9045-2835dc2ca786
0
private void setPhysicalWidthDpi(int newValue) { physicalHeightDpi = newValue; }
b97958f2-e510-4994-a101-acb35cde36ab
9
int insertKeyRehash(byte val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
59440d08-3712-4a94-a6d8-2c5789499b53
8
public void searchByAuthor (LYNXsys system, String query, int page) { displayedSearchResults.removeAll(displayedSearchResults); for (int i = 0; i < system.getBooks().size(); i ++) { // loop through arraylist of books if (system.getBooks().get(i).getAuthorFirstName().equalsIgnoreCase(query) || system.getBooks()....
6c6e9176-f199-4fce-b1e7-64c5be71701e
1
public MapView(MapModel model) { this.model = model; initComponents(); this.setTitle("BomberMan"); this.mapTable.setModel(this.model); this.mapTable.setCellSelectionEnabled(false); this.mapTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); Tabl...
bdf13ef2-a662-4d29-91cf-08705c11fbbf
3
public int addFutureMeeting(Set<Contact> contacts, Calendar date) { try { if(inPast(date) || !contactList.containsAll(contacts)) { throw new IllegalArgumentException(); } Meeting newMeeting = addNewMeeting(date, contacts, ""); this.meetingList.add(newMeeting); return newMeeting.getId(); }...
1d1b1523-8044-43d7-b3b5-73f3a152ca10
7
public int solution(int[] v, int[] w, int C) { int[] sol, mySol; int i, myFinalSol; sol = new int[v.length]; mySol = new int[v.length]; /* * --------------------------- Base cases --------------------------- */ if (C == 0) { return (0); } /* * =============================================...
e85dc7f3-9e20-467e-80a9-b8c613b733fc
5
public void importSong(Song song) { // Fetch important data from the song. // Meaning, metadata and the song itself. Beat[] beats = song.getBeatArray(); this.song = song; // Create a track for each voice. int numVoices = song.getNumVoices(); for (int voiceCount = 0; voiceCount < numVoices; voiceCount++...
e2a2314b-9af8-4f65-91b3-ce7bc81db2e0
3
public ListNode reverseKGroup(ListNode head, int k) { if (head == null) return null; if (k <= 1) return head; ListNode preHead = new ListNode(0); preHead.next = head; ListNode preNode = preHead; while(preNode.next != null){ preNode =...
f391798b-44ec-418e-9065-ca003f02a3e9
9
private String useEllipseVariables(String s) { int n = view.getNumberOfInstances(EllipseComponent.class); if (n <= 0) return s; int lb = s.indexOf("%ellipse["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; EllipseComponent ellipse; while (lb != -1 && rb != -1) { v = s.substring(l...
ac1b99c6-2c02-4d64-81b9-5439f7f323f6
6
* @param goods The <code>Goods</code> to use in a goods party. * @param accepted Whether the tax raise was accepted. * @param cs A <code>ChangeSet</code> to update. */ public void csRaiseTax(int tax, Goods goods, boolean accepted, ChangeSet cs) { GoodsType goodsType...
cac30d75-4f5b-40bf-929b-a3098f62bf4a
1
public static void insertFournisseur(int idville, String nom, String adresse1, String adresse2) throws SQLException { String query = ""; try { query = "INSERT INTO FOURNISSEUR (ID_VILLE,FOUNOM,FOUADRESSE1,FOUADRESSE2) VALUES (?,?,?,?); "; PreparedStatement pStatement = Connecti...
1c6e2dd4-a47f-49b7-8a23-951ad0a0ec4e
6
@Override public PlayerAction chooseAction(State state, IPlayer player) throws Exception { lastAction = new PlayerAction(); lastAction.oldStake = player.getCurrentBet(); // minimum raise double payToCall = state.getBiggestRaise() - player.getCurrentBet(); double handStrength = 0; if (state.getStage() == ...
b0dc0bb7-f966-494b-9e35-e82ada1a9b25
3
@Override public void run() { while(!close){ try { Socket client = server.accept(); System.out.println("ȴ"); synchronized (Server.LOCK) { ClientId++; Server.connects.add(new TankConnect(client,ClientId)); } Thread.sleep(500); } catch (IOException e) { e....
726e3139-e73b-4f8c-81e2-7e6ba6a3bf9d
0
public void setY(float y) { this.y = y; }
0005526d-d805-4b70-b090-01da4f8e5283
7
private void init(String botname, String botIP, int listenPort, int UDP_listenPort, String password, String description, String conn_type, String email, String sharesize, int uploadSlots, int downloadSlots, boolean passive, ShareManager share_manager, DownloadCentral dc) throws IOException, BotException { if(!...
9d1713db-68d5-4b0c-8dd3-5c13200d134a
7
public static void main(String[] args) { List<Rider> riders = new ArrayList<Rider>(); riders.add(new Rider(75)); riders.add(new Rider(170)); riders.add(new Rider(230)); riders.add(new Rider(5)); List<Raceable> raceables = new ArrayList<Raceable>(); for (Rider ...
ba67f0bd-9b07-43b9-86ec-f4a4318d657f
4
private double[] dichotStringToDouble(String[] responses){ boolean test0 = false; int n = responses.length; double[] converted = new double[n]; for(int i=0; i<n; i++){ boolean test1= false; for(int j=0; j<this.nDichotomousS; j=j+2){ if(responses[i]...
57df89cd-b10c-4138-9b66-0a2781595c83
3
private service getNextService() { int startTime = 1500; int index=0; for(int i=0; i<todayServices.length; i++) { if(todayServices[i].starttime < startTime && !todayServices[i].used) { index = i; startTime = todayServices[i].starttime; } } todayServices[index].used =...
233069f1-71d7-40d9-b10e-0c61f2260a92
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...
4dabfdb0-3ea1-44d9-ad3b-bb51093e881e
9
public void actionPerformed(ActionEvent e){ String aparencia = ""; if (e.getSource() == janelaPrincipal.getMenuJanela().getCadastro()) { janelaPrincipal.limparTela(); janelaPrincipal.telaCadastrar(); } else if (e.getSource() == janelaPrincipal.getMenuJanela().getExibir()) { janelaPrincipal.limparTela(); ...
b825fb00-3c80-46d9-b67e-ddbe5f70068c
8
@Override public void handleAutoCloseElementEnd( final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException { if (!this.insideAllSelectorMatchingBlock) { this.someSelectorsMatch = false; ...
af861826-fbc6-4294-ae00-905ef1c79504
8
private void scoreGame() { int roundScore = 0; int lineMultiples = 0; boolean scored = false; boolean hasBonus = false; List<Integer> rowsToKill = new ArrayList<>(); for (int r = 0; r < boardState.length; r++) { boolean isComplete = true; for (int ...
58c82ca9-f10b-4cef-80c1-477cd8ace2f6
1
public void testConstructor_ObjectLocalDate() throws Throwable { LocalDate date = new LocalDate(1970, 4, 6, BUDDHIST_UTC); try { new LocalTime(date); fail(); } catch (IllegalArgumentException ex) {} }
36103991-42f9-4921-a143-2cdb46cd5975
5
@Override public boolean equals(Object obj) { if(obj instanceof Player) { Player player = (Player)obj; long ip = Util.ip2long(player.getAddress().getAddress().getHostAddress()); if(start <= ip && ip <= end) { return true; } } if(obj instanceof DataCIDR) { DataCIDR data = (DataCIDR)obj; if(d...
5ce90256-0d46-434e-82bc-5e2b36aaceb3
5
@Override protected Map<spindle.core.dom.Literal, Map<spindle.core.dom.ConclusionType, spindle.core.dom.Conclusion>> generateConclusions( InputStream ins) throws ParserException { Map<spindle.core.dom.Literal, Map<spindle.core.dom.ConclusionType, spindle.core.dom.Conclusion>> conclusions = new TreeMap<spindle.cor...
9cca5c9f-5d0d-4d31-a281-2bc660f5c2e3
5
public static double[] stdDeviation(final SampleSet set, final double[] mean) { if (set.size() == 0) return null; // final int inputsize = set.get(0).getInputSize(); final double[] result = new double[inputsize]; long ctr = 0; // // compute the squared differen...
5bb493f3-a4ff-467d-8bc5-70fab065aec4
2
public Crawler(TileMap tm) { super(tm); moveSpeed = 0.7; maxSpeed = 1; fallSpeed = 0.2; maxFallSpeed = 10.0; width = 25; height = 25; cwidth = 20; cheight = 10; health = maxHealth = 20; damage = 3; try { BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Ene...
5cc0200a-6130-488e-9eff-65a4038a28b7
4
public static void printStepCounts(SingleGbState state) { System.out.println("size: "+state.stateBuffer.size()); int minStepCount = Integer.MAX_VALUE; int maxStepCount = Integer.MIN_VALUE; int minDelayStepCount = Integer.MAX_VALUE; int maxDelayStepCount = Integer.MIN_VALUE; for(State s : state.stateBuff...
61027db3-b799-435b-95b3-66af3b691d03
0
public void setIdSolicitud(int idSolicitud) { this.idSolicitud = idSolicitud; }
f85dcc10-7e9e-49f7-8d08-c6c01ceb7807
0
public int getPort() { return clientPort; }
daaf18bf-256c-4486-a230-f7680c7b474b
0
public void setMeta(Map<MetaEnum, Object> meta) { this.meta = meta; }
8af02f43-be46-4b75-83a0-8947844aa757
4
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (ClassNotFoundException ex) { Logger.getLogger(truncate.class.getName()).log(Level.SEV...
8447fd22-5271-4378-a050-904688edb34c
7
@Override public void Play(PlayerResponse response) { try { // Try to get bid from JSONObject int bid = response.getBid(); System.out.println("bid : " + response.getBid()); System.out.println("bid from : " + mP.getCurrentTurn()); // Bidder passed, remove from remaining if(bid == 0) { ...
7a582c93-41f5-4799-9795-14ec648d76fd
6
@Override public String toString() { StringBuilder triangle = new StringBuilder(); char blank = ' '; int x = 1; int numBlanks = 0; for (int row = 1; row <= height - 1; row++) { numBlanks = height - row; int printedBlanks = 0; while (printedBlanks < numBlanks) { triangle.append(blank); pri...
a6f856fd-2430-4497-bc13-ee7353cd6495
3
@Override public void display(GLAutoDrawable drawable) { gl = drawable.getGL(); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glShadeModel(GL.GL_SMOOTH); // try setting this to GL_FLAT and see // what happens. gl.gl...
efc5225b-86a7-4b0e-9104-37fb6813c885
1
protected boolean controlSizeInput(JTextField textfield) { boolean ret = true; String tmp = textfield.getText(); if (!tmp.matches(Constants.SKIN_NUMBER_REGEX)) { ret = false; } return ret; }
8a30821e-0d67-409f-aedc-903ba7e5db88
8
public CreateRandom(String connectStr, String userName, String pass, String outputTable) throws SQLException { this.connexion = DriverManager.getConnection(connectStr, userName, pass); this.outputTable = outputTable; this.rand = new java.util.Random(System.currentTimeMillis()); ...
87aa2fef-370c-410d-9240-be5afe53ec11
1
protected void addDocumentEnd() { try { h.endDocument(); } catch (SAXException ex) { throw new RuntimeException(ex.toString()); } }
a39d17c1-7ef0-4a53-b694-fa4206124518
8
private int compairNameIgnoreCase(String a, String b) { if(a == null && b == null){ return 0; } if(a == null){ return -1; } if(b == null){ return 1; } a = a.toLowerCase(); b = b.toLowerCase(); for (int i = 0; i < a.length() && i < b.length(); i++) { if (a.charAt(i) > b.charAt(i)) { ret...
dc5757fd-9144-4872-88b7-3ad1727bff2e
5
private void injectDependencies() throws Exception { // objPool에서 빈을 꺼내어 setXXX() 메서드를 찾는다. Class<?> clazz = null; Object dependency = null; for (Object obj : objPool.values()) { clazz = obj.getClass(); // 객체의 클래스 정보를 가져온다. log.debug(clazz.getName()); // 셋터 메서드를 찾는다. for (Method m : clazz.ge...