method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
69b480df-8e2c-4180-ba69-8448fce3af75
7
private static Pair<Boolean, Integer> huntDown(ChemistryUnit in, ChemistryUnit inExpression, ChemistryUnit outExpression){ if(inExpression != null && in.equals(inExpression)){ return Pair.make(true, 1); } else if(outExpression != null && in.equals(outExpression)){ return Pair.make(false, 1); } else i...
3fe7b32b-30b7-466d-a1cd-c654c889ea8f
5
public void run() { AudioFormat format =new AudioFormat(8000,16,2,true,true);//AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian BufferedInputStream playbackInputStream; try { playbackInputStream=new BufferedInputStream(ne...
cf559651-6b57-4c54-a048-023b96edb39f
5
@AfterGroups("Insertion") @Test(groups = "Random BST") public void testRandomBSTSearch() throws KeyNotFoundException, EmptyCollectionException { Integer count = 0; Reporter.log("[ ** Random BST Search ** ]\n"); try { timeKeeper = System.currentTimeMillis(); for (Integer i = 0; i < seed; i++) { r...
60385bd5-6726-4572-80f4-d45ee64c370e
1
@Override public void update(long deltaMs) { super.update(deltaMs); for(ShopItemButton sib : itemSlots) { sib.update(deltaMs); } }
29233c40-e758-4f88-b65a-28a27c1a7fa6
9
public static ListNode reverseBetween(ListNode head, int m, int n) { ListNode newHead = new ListNode(0); if(head == null) { return head; } if(head.next == null) { return head; } if(m==n) { return head; } ListNode currentNode = head;...
afbbd4bd-a65e-499a-9c89-7d99c670a178
4
private void renderTex(float fadeVal) { // //You draw a diamond-shaped area around the four points- final float w = xdim(), h = ydim(), x = xpos(), y = ypos() ; GL11.glBegin(GL11.GL_QUADS) ; if (fadeVal == -1) GL11.glTexCoord2f(0, 0) ; else GL11.glTexCoord3f(0, 0, fa...
8d405f0c-e9a9-4375-a8de-6cb22ba18f26
6
* @return String */ public static String stringTrim(String string) { { int start = 0; int last = string.length() - 1; int end = last; while ((start <= end) && (Stella.$CHARACTER_TYPE_TABLE$[(int) (string.charAt(start))] == Stella.KWD_WHITE_SPACE)) { start = start + 1; ...
0efebc16-2fda-4e3a-abdd-caaddbc796c5
5
public void crossover() { // Chromosome lengths int chr_length_1 = chromosome1.getBrainStates().length; int chr_length_2 = chromosome2.getBrainStates().length; // Longest length int shortest = (chr_length_1 < chr_length_2) ? chr_length_1 : chr_length_2; // Determine crossover point int cr_point =...
4bf1d1af-3be6-404b-acd9-23267ec085e0
9
public Matrix solve(Matrix B) { if (B.getRowDimension() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!this.isNonsingular()) { throw new RuntimeException("Matrix is singular."); } // Copy right hand side with pivoting int nx = B.getColumnDime...
1be68169-77c4-4a1a-a429-72325266c783
2
public void confirmMessage() { if(pendingMessage == null) { throw new IllegalStateException("Message was confirmed although messageBuffer was not waiting for a confirmation."); } else { pendingMessage = null; deliveredPackages++; if(messageBuffer.isEmpty()) { long interval = System.currentTim...
d082464d-436d-4226-a7a1-d8a891873d7f
8
private int ten(String num) { switch(num) { case "twenty": return 20; case "thirty": return 30; case "forty": return 40; case "fifty": return 50; case "sixty": return 60; case "seventy": return 70; case "eighty": return 80; case "ninety": return 90; } return 0; }
1d8db8c3-fba1-44ec-9b6f-73e96b64b228
0
public Encargo getEncargo() { return encargo; }
1aaa239b-be9b-4ead-8c4d-cab63221515c
0
public synchronized void stop() { running = false; }
dcc6726d-2e27-4c02-b9c1-c60576a6ca8e
2
@EventHandler(priority=EventPriority.MONITOR) void onPlayerLogin(PlayerJoinEvent e) { String group = mPlugin.getPermissionsManager() .getPrimaryGroup((String) null, e.getPlayer().getName()); if(group == null) return; mData.put(e.getPlayer().getName(), group); if(mPlugin.syncPlayerGroups(mDa...
17483774-e466-4f49-969e-9c6630b11bfa
8
public Table parseTable(String statement) { String[] statementSplit = statement.split("\""); Table table = new Table(); table.setName(statementSplit[1]); for (String line : statement.split("\r\n")) { line = line.trim(); String keyField = line.split(" ")[0]; String[] splitValues = lin...
f62b46f6-3287-4808-a0de-b64c51edc798
5
private void setNextDestination() { lastDest ++; if(lastDest == 70) { lastDest = 0; destInverted = !destInverted; } if(lastDest == 35) { currentX = !currentX; } int xDiff = destInverted ? 5 : -5; int yDiff = destInverted ? 5 : -5; if(currentX) yDiff = 0; else xDiff = 0; //this....
fdbcdeca-0cf3-4e8c-a3a6-9a7548f157fc
0
public void setNode(Node node) { this.node = node; }
509c1144-40e7-4cf4-93a0-13790eaac448
8
private void load(final List<String> clientSuites, final List<String> serverSuites) throws IOException { BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream( Constants.SUITES_FILE))); String line = null; while ((line = in.readLine()) != nul...
2cd91d7d-895d-41e9-8761-a5f8ef0f15ed
0
void hide() { lblDate.getScene().getWindow().hide(); }
6b415638-3e4a-4742-845b-a7677a88153a
9
public void SaveNews(News[] news){ try{ File xmlFile = new File(xmlFileName); DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder xmlBulder = dFactory.newDocumentBuilder(); Document doc; doc = xmlBulder.newDocument(); Node wrap = doc.createElement("items"); Str...
c7ab5133-4994-42c0-ad29-3bbf2bfd1eff
5
protected void save() { try { File fFile = new File("test.jpeg"); this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); JFileChooser fc = new JFileChooser(); // Start in current directory fc.setCurrentDirectory(new File(".")); // Set to a default name for save. fc.setSelectedFile...
80983603-87eb-4f1c-9ca2-fe5ccf928248
0
public SkillsMain getSkill1() { return skill1; }
b7ecaacb-afa0-4da4-94bb-4497351ec4e8
6
public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Cut")) { if (tf != null) { tf.cut(); } else { ta.cut(); } } if (actionEvent.getActionCommand().equals("Copy")) { if (t...
1fdbb506-bca5-4d8f-b1f4-50dac92ce3ae
3
public Texture getSlickTexture(String resourceName) throws FailedTextureException { Texture tex = (Texture) table.get(resourceName); if (tex != null) { return tex; } try { tex = org.newdawn.slick.opengl.TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(resourceName)); ...
f2e043bd-781f-41dc-adbe-d17242ae3387
5
private void RemoverEquipa_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverEquipa_ButtonActionPerformed try { if (EquipaSelecionada_Label.getText().equals("nenhuma")) { JOptionPane.showMessageDialog(null, "Não está nenhuma equipa seleccionada! Tem que ...
a77a63ae-4323-40ae-80d2-dde8f848dd1b
6
public static String sortedWord(String s) { int size = StringDemo.wordCount(s); String s1[] = new String[size]; String temp; for (int i = 0; i < size; i++) { if (i == (size - 1)) { s1[i] = s.substring(0); } else { s1[i] = s.substring(0, s.indexOf(' ')); s = s.substring(s.indexOf(' ') + 1); ...
8434e419-952e-460e-9740-8b70e0b08a7b
9
@Override public void process(GameContext context) { if (name.length() >= 15) { client.receivedChatMessage("That's a terribly long name. Choose a shorter name."); } else if (client.getName() == null) { if (name.toLowerCase().equals("boss") || name.toLowerCase().equals("dragon") || name.startsWith("#")) { ...
5736a4f9-2b0e-4f17-b3f8-f36c2709edf8
9
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); try{ String s = request.getParameter("n"); DataModel dataModel = new DataModel(s); dataModel.setAll(); response.getWriter().println(dat...
e91c4a34-92d6-4099-98e5-782cf316ad66
6
public boolean setDirection(String directionArg){ if(directionArg.equals("up") || directionArg.equals("down") || directionArg.equals("left-up") || directionArg.equals("left-down") || directionArg.equals("right-up") || directionArg.equals("right-down")){ direction = directionArg; return true; } else...
5f7da18d-70c2-41aa-b49a-05100e0202b8
1
public int rate(String from, String to) { if(from.equals(to)) return 1; Integer rate = rates.get(new Pair(from, to)); return rate.intValue(); }
1ceb7655-f1b9-4362-8095-03e813445ff0
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...
7a5977ac-5214-4984-b567-2b3d0ee84b6b
3
public Vector2f findNearestIntesection(Vector2f a, Vector2f b, Vector2f posRel) { if(b != null && (a == null || a.sub(posRel).length() > b.sub(posRel).length())) { return b; } return a; }
5ff5fe08-631e-4972-96fc-1bc1dd7501d6
5
public static String transactionIsolationToString(int txisolation) { switch(txisolation) { case Connection.TRANSACTION_NONE: // transactions not supported. return "TRANSACTION_NONE"; case Connection.TRANSACTION_READ_UNCOMMITTED: // All three phenomena can occur return "TRANSACTION_NONE"; ca...
984881c7-4d96-42f8-920d-4ff7890d9976
5
public static void addRepresentationCaddie (String numS, String dateRep, String zone, String nofp) throws BDException { String requete = null; PreparedStatement pstmt = null; Statement stmt = null; ResultSet rs = null; Connection conn = null; try { conn = BDConnexion.getConnexion(); BDRequetesTest.t...
b42d7ef0-7359-40ee-a3f5-3ab424228955
5
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: getAisha().stopUp(); break; case KeyEvent.VK_DOWN: getAisha().stopDown(); break; case KeyEvent.VK_LEFT: getAisha().stopLeft(); break; case KeyEvent.VK_RIGHT: getAisha().stopRight(); break...
bc263b94-ecba-4ffb-b2ad-79f8f40bbbbd
6
public void body() { LinkedList resList; // waiting to get list of resources. Since GridSim package uses // multi-threaded environment, your request might arrive earlier // before one or more grid resource entities manage to register // themselves to GridInformationService (...
0c50d64b-cd90-4850-a5c4-7349be8ca3bc
2
public static void main(String[] args) throws IOException { //make a TCP server socket final ServerSocket TCP_Socket = new ServerSocket(7007); //make UDP server socket final DatagramSocket UDP_Socket = new DatagramSocket(7007); //thread to handle TCP specific connections ...
dc70994d-16e6-4bc5-8d83-416a58269561
0
@Override public void characters(char ch[], int start, int length) throws SAXException { super.characters(ch, start, length); }
541d1489-f1fb-4d72-b160-f6dfcbb92716
6
private void renderIntersections(Graphics2D g2) { Viewport gameViewport = ((pathXMiniGame)game).getGameViewport(); Iterator<Intersection> it = data.intersectionsIterator(); while (it.hasNext()) { Intersection intersection = it.next(); // ONLY RENDER IT THIS W...
80d75d7e-24ad-4afc-bbaa-5087865ebe19
2
public CommandWords() { validCommands = new HashMap<String, CommandWord>(); for(CommandWord command : CommandWord.values()) { if(command != CommandWord.UNKNOWN) { validCommands.put(command.toString(), command); } } }
e45ee714-aa3f-4859-bdcb-ee9ab4434e4b
5
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); this.setBorderPainted(false); String name="/images/"; ...
099d730f-a41e-4b61-b53c-76c1031e0b14
8
public void loadElements(VisibleElements type) { this.visibleElements = type; // ZOrder index int index = 0; // Remove all drawed elements. draw.removeAll(); List<GenericTreeNode<LayoutParserTreeElement>> list = this.layoutParser.XMLTree .build(GenericTreeTraversalOrderEnum.PRE_ORDER); // Go thro...
8722dd14-8856-4dff-b9ed-38dab14b7687
2
public static Date getTriggerTime(Boolean morning) { int hour; if(morning) { hour = 7; } else { hour = 13; } Date currentTime = new Date(); Calendar cal = new GregorianCalendar(); cal.setTime(currentTime); cal.set(Calendar.HOUR_OF_...
bd60f331-d4da-4c66-9fd5-9295fa8b3ce0
8
public static int compareTo(byte[] lhs, byte[] rhs) { if (lhs == rhs) { return 0; } if (lhs == null) { return -1; } if (rhs == null) { return +1; } if (lhs.length != rhs.length) { return ((lhs.length < rhs.length) ? ...
a4d5d149-949d-4015-83ff-18274cf23126
4
public int countOpenChains() { int chainCount = 0; for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { int vertex = j + i * width; List<List<Integer>> chains = getAllChains(vertex); for(int chainIndex = 0; chainIndex < chains.size(); chainIndex++) { if(chains.get(chai...
23f6fe8d-6078-4b58-a0cd-104665601477
7
File[] getRoots() { /* * On JDK 1.22 only... */ // return File.listRoots(); /* * On JDK 1.1.7 and beyond... * -- PORTABILITY ISSUES HERE -- */ if (System.getProperty ("os.name").indexOf ("Windows") != -1) { Vector /* of File */ list = new Vector(); list.add(new File(DRIVE_A)); list.add(...
29c12e7a-70cb-4c95-adb2-a29c13ceba10
8
public boolean similar(Object other) { if (!(other instanceof JSONArray)) { return false; } int len = this.length(); if (len != ((JSONArray)other).length()) { return false; } for (int i = 0; i < len; i += 1) { Object valueThis = this.ge...
bc30d9df-179b-4491-b679-8723e6c40991
0
public Graph() { }
ee1556d1-e9a5-47f5-811c-46c553329351
8
@Override public boolean tick(Tickable ticking, int tickID) { if(tickID==Tickable.TICKID_MOB) { if((affected!=null) &&(affected instanceof MOB) &&(invoker!=null)) { final MOB mob=(MOB)affected; if(((mob.amFollowing()==null) ||(mob.amDead()) ||(!mob.isInCombat()) ||(mob.location()!=...
5e271998-3c8c-4546-a1e2-449f34c745fb
6
public static void e117(long n) { if(counts[(int)n] != 0) count += counts[(int)n]; else if(n <= 4) switch((int)n){ case 1 : count += 1; break; case 2 : count += 2; break; case 3 : count += 4; break; case 4 : count += 8; break; } else { e117(n-1); e117(n-2); e117(n-3); e117(n-...
27894f7d-4518-48cb-908c-124c4f90bdf2
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[][] grid = new int[n][n]; for (int y = 0; y < n; y++) for (int z = 0; z < n; z++) { grid[y][z] = in.nextInt(); if (z > 0) grid[y][z] += grid[y][z - 1]; // pre-processing } int maxSubRect = -127 * ...
f431262b-26c2-4031-b8f2-ffc6e6006321
8
public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (obj.getClass() != this.getClass()) return false; Picture that = (Picture) obj; if (this.width() != that.width()) return false; if (this.height() != that.height()) return...
d07459ef-8b7a-4b84-8dbe-fcedfcfc159d
4
private void Accept(Socket connection) throws IOException { DataInputStream reader = new DataInputStream(connection.getInputStream()); byte firstsend = reader.readByte(); switch (firstsend) { case 0: //Minecraft player new Player(connection, this, firstsend, server); break; case (by...
97d7f4f2-6ad3-4ddb-9438-92f68b2765c7
2
@Override public void move() { Grid<Actor> grid = getGrid(); if(grid == null) return; Location loc = getLocation(); Location next = loc.getAdjacentLocation(getDirection()); if (grid.isValid(next)) moveTo(next); else removeSelfFromGrid(); Uranium uranium = new Uranium(super.getColor()); uraniu...
f1e6d5f1-23db-489c-893b-afbd786b42f6
2
@Override public TexInfo getTexInfo(int metadata){ switch(metadata){ default: case 0: return normal; case 1: return striped; } }
175fe7b9-1f90-427e-9d66-e9811fcf607c
9
private void jBDescartesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDescartesActionPerformed if(!bicho || (bicho && combatido && !muerto)){ if(tesorosVisiblesSeleccionados.isEmpty() && tesorosOcultosSeleccionados.isEmpty()) dialogo = new Dialogo(this,true, "¡Muy bien! Pe...
7809558e-e9c3-45d8-9e25-320a88f20b1b
2
public int read(InputStream outputStream) throws IOException { long l = 0; int in = 0; for( int i = 0; i < 8; i++ ) { in = outputStream.read(); if( in < 0 ) return in; l = (l << 8) | (in & 0xff); } nmer = l; return in; }
e198a311-86b3-49f3-95ee-0ee34af17721
8
@Override public void actionPerformed(ActionEvent e) { if ("Timer".equals(e.getActionCommand())) {doTimerActions();} if ("Display Log".equals(e.getActionCommand())) {displayLog();} if ("Display Help".equals(e.getActionCommand())) {displayHelp();} if ("Display About".equals(e.getActionCommand())) {di...
b856c417-e33a-4014-8daf-5da8362ba34a
1
public static void deleteObject(RestS3Service ss, S3Bucket sb, String key) { try { ss.deleteObject(sb, key); } catch (S3ServiceException e) { e.printStackTrace(); } }
c9ff906e-9160-4f2f-849f-a33ed4d05e9a
1
public static void main(String[] args) { /** * Creating an array of Shapes with random number of cells; */ Shape[] shapes = new Shape[getRandomNumber(1, 100)]; /** * Filling an array cells with random Shapes. */ for (Shape shape : shapes){ ...
b10ce276-b5a5-447f-9fc2-4cd0429755be
3
public void fireSelectEvent(final SelectEvent EVENT) { final EventHandler<SelectEvent> HANDLER; final EventType TYPE = EVENT.getEventType(); if (SelectEvent.SELECT == TYPE) { HANDLER = getOnSelect(); } else if (SelectEvent.DESELECT == TYPE) { ...
01cc07c6-1649-4b89-8924-e778982b04fb
8
public void putAll( Map<? extends K, ? extends Byte> map ) { Iterator<? extends Entry<? extends K,? extends Byte>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends K,? extends Byte> e = it.next(); this.put( e.getKey(), e.getValue() ); ...
ff34b07d-5b93-40af-93ae-58b9d9c103c0
7
public void actualizarQuantum(Proceso p) { Boolean asigno = false; int prioridadEstatica = p.getPrioridadEstatica(); int quantum = p.getQuantum(); int tcpu = p.getTiemposCPU(); p.setQuantum(--quantum); // Disminuye num de Ticks que necesita para terminar ejecucion ...
ecdd0ffb-4de1-4099-a8b0-2c93a39f9d79
8
public List<Short> getShortList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Short>(0); } List<Short> result = new ArrayList<Short>(); for (Object object : list) { if (object instanceof Short) { r...
b2179b0c-3e68-48bf-bd3f-3835970b9b91
9
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: Validaciones v = new Validaciones(); if (jCheckBox1.isSelected()){ jLabel4.setVisible(false); Cargar_Tabla("SELECT * FROM "...
0a6fff96-b64b-44eb-9b07-00433d2e7de2
3
private void processMessage(String s){ String[] tokens = s.split(" "); for(int i = 0; i < tokens.length; i++){ //System.out.println(tokens[i]); } if (tokens[0] != null && tokens[0].contains("GET")){ PageServer ps = new PageServer(); sendMessage(ps.getPage(tokens[1].substring(1))); } }
06da10c7-da3d-4a26-9dfc-f5b762ca03a8
6
public static void main(String[] tArgs) throws IOException { File f = null; JFrame frame = new JFrame(); if(tArgs.length>0&&tArgs[0] != null) { f = new File(tArgs[0]).getAbsoluteFile(); } else { f = FileChooser.chooseFile(frame, "Load", JFileChooser.FILES_ONLY); } FileWriter FW = new FileWriter();...
0f3432c6-289a-4122-bdb0-1013d3e006c4
6
public static boolean isActive(JComponent c) { if (c == null) { return false; } boolean active = true; if (c instanceof JInternalFrame) { active = ((JInternalFrame) c).isSelected(); } if (active) { Container parent = c.getParent(); ...
2023c224-faf5-4212-a10a-e45031ea731e
0
public static void home(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { // Record the EditingNode, Mark and CursorPosition tree.setCursorMarkPosition(0); tree.setCursorPosition(0, false); tree.getDocument().setPreferredCaretPosition(0); // Redraw and Set Focus layout.draw(currentNode, Outlin...
25f77a3d-e28d-4f69-919c-ae935bb2e163
1
public void eliminarBD() { File basedatos= new File(this.ruta); if(basedatos.exists())basedatos.delete(); }
8bc83bdb-fd2e-47ec-935b-b4911852c3b5
4
public static boolean correctISBNFormat(String isbn) { String regex = "\\d+"; if (isbn.length() == 10) return isbn.matches(regex); if (isbn.length() == 14) { String i[] = isbn.split("\\-"); if (i[0].length() != 3) return false; return i[0].matches(reg...
46b0652a-1dfe-468f-8f97-a190468f8e10
6
public boolean update(float tslf, LinkedList<Bullet> bullets) { if(path.size() > 0) { float absx = path.get(path.size() - 1).getX() * Texture.tilesize + Texture.tilesize / 2 - (xpos + look.getWidth() / 2); float absy = path.get(path.size() - 1).getY() * Texture.tilesize + Texture.tilesize / 2 - (ypos + look....
b642b939-19af-4a32-bd42-b875609e8984
9
@Override public void actionPerformed(ActionEvent e) { Random r = new Random(); int d = r.nextInt() % 5; switch (d) { case 0: break; case 1: // move right if (dx < 0) { dx = -dx; // if moving left, m...
8db2b5cd-5971-4a6d-a2d5-ea631d0e2dea
0
public ChangePwdServlet() { super(); // TODO Auto-generated constructor stub }
f1a684b4-2f87-453a-8215-0233fc874b6d
8
public boolean ajout(Personne pers){ boolean exists = false; if (!this.estVide()) { int i = 0; while (i<contacts.size() && !exists) { if (contacts.get(i) instanceof Particulier && pers instanceof Particulier) { Particulier part = (Particulier) pers; P...
274420f0-7f11-41cd-bbf4-40e7f9dd1371
2
private void debug() { if ( Input.getKey( Input.KEY_F5 ) ) glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); else if ( Input.getKey( Input.KEY_F6 ) ) glPolygonMode( GL_FRONT_AND_BACK, GL_POINT ); else glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); }
a238057f-04ee-4d21-9e8f-3c9d35eaea69
4
public void actionPerformed(ActionEvent event){ //set string equal to nothing in it. String string = ""; //so basically we do here is we look to see if anyone typed //Anything into any of these text boxes and hits enter, we want to //set string equal to field (whatever one you entered in),...
67f51e9e-bfb3-4a02-b09e-2eacbff85b9b
9
public void update(double mod){ for (int i = 0; i < points.size(); i++){ if (!points.get(i).isFrozen()){ points.get(i).setY(points.get(i).getY()+mod*speed); //freeze point if it reaches the bottom if (points.get(i).getY() > maxHeight){ ...
4c54f593-ba50-4ca6-975c-06f86357a163
8
private void setupRepeatRun(BigInteger numPrunedConfsToAllow, int numRotForResNonPruned[], int numLevels, int numMutable){ BigInteger totalNumConfsUnpruned = new BigInteger("0"); Iterator<RotInfo<Boolean>> elimRotIter = eliminatedRotAtRes.iterator(); Iterator<RotInfo<Boolean>> prunedStericIter = prunedIsSt...
77bcadc1-61b4-4d69-a8a4-da26d24bf699
9
public boolean handleInput(String line) { // start new Game if (line.matches("start[0-9]+")) { String param = line; param = param.replaceAll("start", ""); int cash = Integer.parseInt(param); controller.start(cash); } else if (line.equalsIgnoreCase(...
857af02c-bdfa-4603-9af9-dcb508972640
9
public static void main(String[] args)throws Exception{ if(args.length < 1){ System.out.println("Usage: java ThreadRequest <u=url> <t=threads> <r=runs> <f=foundReturnMessage> <s=sleep>"); return; } for(int i=0;i<args.length;i++){ if(args[i].startsWith("u=")){ spec = args[i].substring(2); }else ...
d62d338a-3096-425d-8cff-f9e61730f3d4
4
public Color unique(Object o) { if (!uniqueColors.containsKey(o)) { Random rand = new Random(); Color bestColor = null; double bestDelta = -1; for(int x = 0; x < 10; x++) { Color unique = colorFromHash(rand.nextInt()); int delta = 0; for(Color other : uniqueColors.values()) { delta +...
7430df27-234e-4191-854a-0998b0ed653f
8
private static Path processPoly(Element element, StringTokenizer tokens) throws ParsingException { int count = 0; ArrayList pts = new ArrayList(); boolean moved = false; boolean reasonToBePath = false; Path path = null; while (tokens.hasMoreTokens()) { try { String nextToken = tokens.nextToken(...
cba5eb7a-88ad-4b63-83d2-d5f3039274d8
3
public void render(Graphics2D g) { Graphics2D g2d = (Graphics2D) finalBoard.getGraphics(); g2d.drawImage(gameBoard, 0, 0, null); for (int row = 0; row < ROWS; row++) { for (int col = 0; col < ROWS; col++) { Tile current = board[row][col]; if (current == null) continue; current.render(g2d); ...
ea0c860d-ea77-42d9-85ca-8b97b62957a1
2
public static String decrypt3DES(byte[] message, String encrKey) { try { final MessageDigest md = MessageDigest.getInstance("md5"); final byte[] digestOfPassword = md.digest(encrKey.getBytes("utf-8")); final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24); ...
bd85b005-964c-42fc-a564-7f587548dd4b
8
private ApplyDeletesResult closeSegmentStates(IndexWriter.ReaderPool pool, SegmentState[] segStates, boolean success, long gen) throws IOException { int numReaders = segStates.length; Throwable firstExc = null; List<SegmentCommitInfo> allDeleted = null; long totDelCount = 0; for (int j=0;j<numReader...
878784c3-e442-4698-aa03-421f46009ee2
8
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (int t = 0, T = parseInt(in.readLine().trim()); t++ < T;) { StringTokenizer st = new StringTokenizer(in.readLine()); int C = parseIn...
6aae9597-4a19-4dad-a5b2-2ec9ef7715e4
1
public void secondThread() throws InterruptedException { Random random = new Random(); for (int i = 0; i < 10000; i++) { acquireLocks(lock2, lock1); try { Account.transfer(acc2, acc1, random.nextInt(100)); } finally { lock1.unlock(); ...
7e2ed738-4936-4614-b291-583081f7f4a3
9
private void addItem(int numToAdd, ArrayList<Location> locations, boolean checkTargets) { Random rand = new Random(); //Random number generate to determine locations of spaces randomly for(int i = 0; i < numToAdd; i++) { //Generate random location Location newItem = new Location(rand.nextInt(MAX_X),rand....
69c5fa57-c8a0-4d82-a70d-a524c81fec42
1
private boolean jj_2_59(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_59(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(58, xla); } }
f1ee3781-0f24-471a-8467-c79526ad68ca
6
public static void main( String[] args ) { Scanner input = new Scanner( System.in ); int number1; int number2; System.out.println( "Enter The First Integer: " ); number1 = input.nextInt(); System.out.println( "Enter The Second Integer: " ); ...
681677e6-f8b6-46c5-9592-83ee0841b363
2
private void readObject(ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); this.bytes = new byte[size]; int index = 0, remainder = size; while (index < size) { int numOfBytes = stream.read(bytes, ...
f8eea263-cb9a-4d2b-93d3-37a588dd4e8c
0
public Map getMyCustomEvent() { return myCustomEvent; }
aed70ca3-c9bf-47c3-b5bb-8a3a8a5e3340
0
void setModuleManager(ModuleManager manager){ this.manager = manager; }
40d8225c-6345-4248-82d3-cf28d5523611
3
public static String[] search(String[][] clientArray, String queryString) { // Durch das Array iterieren und schauen, ob der Suchstring // in den Spalten 1 und 2 eines Datensatzes vorkommt for(String[] client: clientArray) { if(client[1].toLowerCase().indexOf(queryString.toLowerCase())!=-1 || client[2].to...
60d9cda4-9f34-47fa-9028-56d861c8a515
0
public void setjButtonOK(JButton jButtonOK) { this.jButtonOK = jButtonOK; }
63c46246-ec10-4f8c-b860-9cb1418d3629
2
public static String act(String text) { text = text.replace("{{עשר המכות}}", ""); text = text.replace("{{אבני החושן}}", ""); text = text.replace("{{פירוש לקוי}}", ""); text = text.replace("{{תחבורה ציבורית}}", ""); // line break - we dont need them text = text.replaceAl...
e0ed97c5-4768-4e22-a298-7e1f5b8bc15e
3
public double rateBoard(Board board) { final int width = board.getWidth(); final int maxHeight = board.getMaxHeight(); int sumHeight = 0; int holes = 0; // Count the holes, and sum up the heights for (int x=0; x<width; x++) { final int colHei...
0f75ca2d-2318-46df-9f85-881d47df543c
3
public static double atom(char s) { switch (s) { case 'C': return C; case 'H': return H; case 'O': return O; } return N; }
b190cfed-7e45-4026-a95f-05885f3e068b
7
private Map<ProcessModel, Set<Action>> getNoActivityInputActions() { Map<ProcessModel, Set<Action>> noActivityInputActions = new HashMap<ProcessModel, Set<Action>>(); Set<Action> mainSTSActions = new HashSet<Action>(); for (Action action : mainSTS.getInputActions()) { if (!action.isRelatedToAnActivity() && !ac...