method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
443b7a2b-fda9-48d4-8a5d-941e842a6fef
4
private long getCPtrAddRefServerInfo(ServerInfo element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject = ele...
de676e04-21f4-4a34-8386-10b27e74442e
0
public String getSampleCode() { return this.sampleCode; }
7e59eba2-426f-417e-885d-3aa3a89ff662
7
public boolean xpathEnsure(String xpath) throws ParseException { try { //Quick exit for common case if (xpathSelectElement(xpath) != null) return false; //Split XPath into dirst step and bit relative to rootElement final XPath parseTree = XPath.get(xpath); int stepCount = 0; fo...
df46d9fa-f040-4ae9-bcea-d08fd4182171
6
public static Double beersLaw(Double absorbtivity, Double constant, Double concentration) { boolean[] nulls = new boolean[3]; nulls[0] = (absorbtivity == null); nulls[1] = (constant == null); nulls[2] = (concentration == null); int nullCount = 0; for(int k = 0; k < nulls.length; k++) { if(nulls[k])...
24f3fbb3-c79b-40f8-a37c-e3750e681483
1
public Serializable fromDOM(Document document) { ContextFreePumpingLemma pl = (ContextFreePumpingLemma)PumpingLemmaFactory.createPumpingLemma (TYPE, document.getElementsByTagName(LEMMA_NAME).item(0).getTextContent()); /* * Decode m, w, & i. */ pl.setM(Integer.p...
cb022076-1a70-4a7e-8566-e229235a21bf
5
protected void update() { if(this.random.nextFloat() < 0.07F) { this.xxa = (this.random.nextFloat() - 0.5F) * this.runSpeed; this.yya = this.random.nextFloat() * this.runSpeed; } this.jumping = this.random.nextFloat() < 0.01F; if(this.random.nextFloat() < 0.04F) { this.yRotA = (this.random.nextFloat()...
c4eed818-f59d-4e09-be25-a908944c5e41
3
public static String sanitizeWord(String word) { String result = word; for (Object obj : bannedWords) { String badWord = (String) obj; if (word.contains(badWord)) { result = ""; // RemoveInstanceOfWord and add all other parts for (String part : word.split(badWord)) { result += part + "@#$%&!"...
1b0ce7f0-4ec2-4f81-9fa2-f150f37f6588
0
public String getId() { return id; }
4d33a59e-5018-4b10-931b-93733f405b22
9
public static void main(String[] args) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; ComboPooledDataSource source = new ComboPooledDataSource(); try { conn = source.getConnection(); ps = conn.prepareStatement("SELECT * FROM users"); rs = ps.executeQuery(); ...
df75016f-382d-461d-86a0-6a66c3e65c26
5
public boolean cancelProduction() { if (isProductionInterfaceOpen()) { if (isProductionComplete()) { if (Condition.wait(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return !isProductionInterfaceOpen(); } })) { return true; } } if (ctx.wid...
27bbba70-ecbb-4b95-bd9a-e77c38234f4f
5
public static StringBuffer fetchData(final String url, final TrayIcon processTrayIcon) { URL obj = null; try { obj = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } URLConnection con = null; try { if (ApiProperties.get().getUrl().contains("https")) { setupConnection();...
e5e8263d-7076-43d3-b393-ae615a0faceb
1
public Object getChild(Object parent, int index) { Iterator iter = ((TreeElement) parent).getChilds().iterator(); for (int i = 0; i < index; i++) iter.next(); return iter.next(); }
c14668c6-51ed-4031-a044-843663de1404
7
private static void Attacking(Graphics2D gg, Base unit, int size, int resize) { //If the unit disabled MoveAndShoot, then it won't display it's attack range since it can't attack. if (unit.x != unit.oldx && unit.y != unit.oldy && !unit.MoveAndShoot) {return;} //TODO: Maybe change this into a list of points lik...
551aa6b1-e8c9-46d5-a259-c104b57163ff
2
public BatchCreatorPanel() { this.setBounds(100, 100, 606, 396); this.listModel = new DefaultListModel<String>(); this.setLayout(new BorderLayout(0, 0)); final JPanel buttonBarPanel = new JPanel(); this.add(buttonBarPanel, BorderLayout.SOUTH); final JButton btnAddNewFolder = new JButton("Add new Folder"...
297471e2-1bb5-4161-963f-8a38e0f1fe56
7
public boolean validMove(Move move) { //For place move if(move.IsPlaceMove) { if(!correctRowColSize(move)) return false; if(isJumpMove(move)) return false; if(placeMove(move))return true; else return false; } //For Jump Moves else { if(!correctRowColSize(move)) return false; if(!isJum...
1015727c-640a-4b9e-b851-0614a3b26865
2
public VoidParameter(String name_, String desc_) { name = name_; description = desc_; if (Configuration.head == null) Configuration.head = this; if (Configuration.tail != null) Configuration.tail.next = this; Configuration.tail = this; }
d9d80dbc-76a7-404d-9931-ddbd3cc6a11f
7
public static String GetRootApplicationPath() { if (s_root_application_path != null) { return s_root_application_path; } String os = System.getProperty("os.name").toLowerCase(); String path = ""; if (os.indexOf("win") >= 0) { path = "C:\\Users\\Public\\weathervane\\"; } else if (os.indexOf("mac...
16844258-886f-403d-8cd0-a6be58a2f165
5
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed String searchNum = txtSearchPartNo.getText(); if (searchNum != null && searchNum.length() > 0) { for (int i = 0; i < this.partNums.length; i++) { if (searchNum.eq...
6b8707ba-3352-43d2-b023-a771429607d7
0
final protected void dropChildren() { children=null; }
a01e09db-986d-4dc3-8cc4-64d1032f7eb0
4
private boolean askForSave() { if (changed) { int answer = JOptionPane.showConfirmDialog(frmDictionaryEditor, Localization.getInstance().get("messageSaveBeforeQuit"), Localization.getInstance().get("messageSaveBeforeQuitTitle"), JOptionPane.YES_NO_CANCEL_OPTION); switch (answer) { case JOptionPane.YES_OP...
b36c4189-9378-4b6e-811d-96384b851692
2
private void createCachedMap() { Graphics2D cachedTileImageGraphics = (Graphics2D) cachedTileImage.createGraphics(); // Start x, y from 0, and draw the total amount of visible tiles. // But add the current viewport's x,y tiles to it and draw that tile // instead. for (int x = 0, y = 0, xPos = -cameraOffsetFro...
962780af-8679-4818-b2e3-6748d152f383
5
public Ship(eShipType type) { this.type = type; switch (type) { case aircraftcarrier: size = 5; break; case battleship: size = 4; break; case destroyer: size = 3; break; ...
6f0d4cb7-e174-4273-9a0e-ff5ffd1ca116
5
public boolean transaction(Transaction trans) { Connection conn = null; try { conn = ds.getConnection(); conn.setAutoCommit(false); trans.trans(conn); conn.commit(); return true; } catch (SQLException ex) { Logger.getLogger(DB.class.getName()).log(Level.SEVERE, null, ex); if (null != conn) { ...
87e75148-a90f-4ac3-afed-359e03b92968
4
@SuppressWarnings("unused") public void writeAVI() { /* * JMF Code no longer functioned for writing AVIs. Commented out and * code below was written to use a different AVI writing library. BJD: * 11-9-09 * * JpegImagesToMovie imageToMovie = new JpegImagesToMovie(); * List<String> frameNames = getF...
fb85b9d1-65e4-493e-be88-319202ead999
8
public Crossing getDestination(Person p) { Catcher c = (Catcher) p; Clue clue = process.getClue(); if( clue == null && c.peekNextPathStep() == null ) { System.out.println(c + " is going to random Crossing..."); c.setPath( pathFinder.getPath(c.getCurr(), process.getGraph(...
8c20c789-27d4-4834-81a5-5ebd6d551cd5
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Player other = (Player) obj; if (!Objects.equals(this.name, other.name)) { return false; ...
08a51739-0eda-4068-92fc-8733b2e00b6f
7
private void repetirPassKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_repetirPassKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) { repetirPass.setText(""); repetirPass.requestFocus(); } if (evt.getKeyCode() == KeyEvent.VK_ENTER) { ManejoUsu...
f07feaf9-be41-4438-bccd-00acbf2c234a
1
public static void main(String[] args) { // TODO Auto-generated method stub try { LogUser frame = new LogUser(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
26049224-78ac-4a4b-8b72-4b16f46175d4
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...
b10446ec-05d7-4500-9f85-de438207c5a7
8
public void decelerate(Vector v2) { if(x == 0) { //do nothing } else if(x > 0) { if (x - v2.getX() > 0) { x = x - v2.getX(); } else { x = 0; } } else { if (x - v2.getX() < 0) { x = x - v2.getX(); } else { x = 0; } } if (y == 0) { //do nothing } else if(y > 0) ...
5991f058-3a22-487d-b9db-2b5d091f12cb
3
private void deleteObjects() { DictionnaireTable data = mcdComponent.getData(); String mess = Utilities .getLangueMessage("supprimer_objet_selection"); if (mcdComponent.sizeSelection() > 1) mess = "Voulez-vous vraiment supprimer les " + mcdComponent.sizeSelection() + " objets sélectionnés ?"; i...
197dba83-7823-4da3-8c57-52c63d466ef3
6
private void createCellArray(String mapFile) { Scanner fileReader; ArrayList<String> lineList = new ArrayList<>(); try { fileReader = new Scanner(new File(mapFile)); while (true) { String line = null; try { ...
52385e0b-786b-4cc8-a607-6d2cdd8dba27
3
public boolean extractFile(int libraryFK, String destinationDir){ destinationDir = destinationDir.replace("\\", "/") + "/"; FileBean fileBean = getFileBean(libraryFK); if(fileBean == null) return false; boolean isSaved = saveFile(libraryFK, Resource.getString("path.temp.zip")); if(isSaved == false) re...
c8bafdc1-0968-47d2-9304-fd83d4f99079
9
private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); return 8; } switch(curChar) { case 71: ...
71c49372-a4be-42a9-9a88-5c7d4812ee00
0
public void setNeitherNor(boolean isNeitherNor) { this.isNeitherNor = isNeitherNor; }
c5620057-6089-4ace-8a7f-651ced080bbb
0
public void addVertex(Land land) { laenderMap.put(land.getID(), land); }
ff57d32a-3d4c-4071-aee1-c4069e39bd28
8
public static void removeRow(int row) { int modelRow = LibraryPanel.table.convertRowIndexToModel(row); FileTraverse.list.remove(modelRow); Object[][] temp1 = new Object[7][modelRow]; Object[][] temp2 = new Object[7][(data[0].length-1) - modelRow]; Object[][] tempEnd = new Object[7][FileTraverse.list.size(...
f45e2851-9dd9-4226-877d-1532bcdf0833
6
public static void drawPixels(int i, int j, int k, int l, int i1) { if(k < topX) { i1 -= topX - k; k = topX; } if(j < topY) { i -= topY - j; j = topY; } if(k + i1 > bottomX) i1 = bottomX - k; if(j + i > bottomY) i = bottomY - j; int k1 = width - i1; int l1 = k + j * width; for(i...
bbf4fbb7-a32c-4922-9b64-daa6b886eaec
9
final public SimpleNode Start() throws ParseException { /*@bgen(jjtree) Start */ SimpleNode jjtn000 = new SimpleNode(JJTSTART); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { expression(); jj_consume_token(22); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if (...
74e7cde7-da9d-4eea-84ee-25794673dc8f
4
public void setBounds(float minx, float maxx, float miny, float maxy){ if(maxx < this.maxx) tempMaxx = maxx; else tempMaxx = maxx; if(minx > this.minx) tempMinx = minx; else tempMinx = minx; if(maxy < this.maxy) tempMaxy = maxy; else tempMaxy = maxy; if(miny > this.miny) tempMiny = miny; else tempMiny =...
4b9cef94-f8db-4bd2-b45d-de32ddc6b292
3
public static void main(String[] args) throws Exception { Registry reg = LocateRegistry.getRegistry(); MasterServerClientInterface masterServer = (MasterServerClientInterface) reg .lookup("masterServer"); ReplicaLoc loc = masterServer.read("file2.txt")[0]; ReplicaServerClientInterface repServer = (ReplicaSe...
60524ece-4417-4d47-a95c-d2ce6eaa3842
7
public static void logicCommandLoop(Module module) { { Stella_Object command = null; Stella_Object result = null; boolean eofP = false; boolean exitP = false; boolean exitcommandP = false; { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEX...
d8a08f0c-38b4-4233-8457-2039749b13c8
8
public void step() { int len = length(); // remove steps that cancel out for (int i = 0; i < len; ++i) { switch (at(i)) { // We don't need this case, because the lower particle performs the same // check // case -1: // if (directInteraction && at(i - 1) == 1) { // set(i ...
aafbd556-4c9d-4a79-9a29-5e26b930161a
2
protected boolean isArrayValue(final Value value) { Type t = ((BasicValue) value).getType(); return t != null && ("Lnull;".equals(t.getDescriptor()) || t.getSort() == Type.ARRAY); }
93925fac-2524-4ec5-aea0-7428d48204f2
7
public void moveDown(){ switch (polygonPaint) { case 0: line.moveDwon(); repaint(); break; case 1: curv.moveDwon(); repaint(...
f9013d28-1acd-4f1c-b971-cb97d47a3cb2
3
public int lastManStanding() //This function exists because of our 2+ player system. { if(CURRENT_PLAYER_AMOUNT == 1) { for(int i = 0; i < GameCore.PLAYER_AMOUNT;i++) { if(players[i].stillPlaying == true) { return i; } } } return -1; }
7c8b1ddd-9214-456b-bd3a-59e120339ff8
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equal...
84d291af-aea4-4668-aacf-6f9dec391988
0
public int area() { return height * width; }
95f5b837-f74e-4463-acb8-5c9986980e32
2
public static void main(String args[]) throws UserException { ORB orb = ORB.init((String[]) null, null); org.omg.CORBA.Object obj = orb.string_to_object(args[0]); Calculator stub = CalculatorHelper.narrow(obj); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { ...
99c9ea14-9caf-4353-b174-896e0d8a6ddb
2
public MultipleChoice(boolean needsAnswer){ choices = new ArrayList<String>(); answers = new ArrayList<String>(); prompt = InputHandler.getString("Enter the prompt for your Multiple Choice question:"); int numChoices = InputHandler.getInt("Enter the number of choices: "); for (int i=1; i<=numChoices; i++){ ...
de38018a-f0dc-427a-a942-29830eac76e5
7
protected Behaviour getNextStep() { if (verbose) I.sayAbout(actor, "Getting next build step?") ; if (built.structure.needsUpgrade() && built.structure.goodCondition()) { final Action upgrades = new Action( actor, built, this, "actionUpgrade", Action.BUILD, "Upgrading "+built ...
f2b8e5ce-c168-4bc8-89af-c0e8d4da519d
3
public Boolean estContent(EnvironnementSegregation univert){ int etrange = 0; ArrayList<AgentHurbain> bonhomes = univert.voisins(pos_x, pos_y); for (AgentHurbain bonhomme : bonhomes) if(bonhomme != null && bonhomme.type!=type) etrange++; return !(((float)etrange/(float)bonhomes.size())*100 > 100-confort)...
85b86696-097a-4c0c-b1a3-818a1438c81a
8
private void compressStream(CompressionStream stream) { if (benchmark) startTime = System.currentTimeMillis() ; // Create the Huffman table. huffmanTable = new HuffmanTable() ; // Quantize the stream, compute deltas between consecutive elements if // possible, and histogram the data length distribution. stream....
1901ffc1-d256-4b2a-b722-c7c4b60aeedd
1
public synchronized boolean isSeed() { return this.torrent.getPieceCount() > 0 && this.getAvailablePieces().cardinality() == this.torrent.getPieceCount(); }
630d349a-d740-4987-9673-7f2af87c5b6f
3
public static void writeImage(BufferedImage image, String fileName) throws IOException { if (fileName == null) return; int offset = fileName.lastIndexOf( "." ); if (offset == -1) { String message = "file suffix was not specified"; throw new IOException( message ); } String type = fileName.substr...
2a527799-2944-44df-a9b6-dd252c595360
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...
d7e940cd-7a8a-46ed-b3c2-bf9f9699db4e
9
public BoardCell pickLocation(HashSet<BoardCell> targets) { //If the list of targets locations includes a room, select that location unless the player was just in that room. //If the list does not include a room, or the room was just //visited, randomly choose from all locations (gives some chance that the playe...
3df75dbf-081f-4622-a85b-59e97b9c82c5
5
@Override public void actionENTER() { if (Fenetre._state == StateFen.Level && _currentBird.getTakeOff() != 0 && !_currentBird.isDestructing()){ // Test s'il existe un oiseau et s'il existe demande a l'oiseau de lacher un oeuf if (Fenetre._list_birds.size() != 0 && _currentBird.getEggLeft() > 0) { Fenetre._...
bf65c232-6f9e-4e3a-b40c-14ef76d14943
2
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("eveapi")) { getResponse().setVersion(getInt(attrs, "version")); } else if (qName.equals("error")) { error = new ApiError(); error.setCode(getInt(attrs, "code")); g...
541f363e-605a-4fa0-bdf8-495e506b9707
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...
59fc3d90-3d8b-4a63-915d-aa6f2a5467e5
4
private void launchChat() throws RemoteException { // get the index of the last message sent to the server so that client // knows from where they can start printing messages this.lastDisplayedMsgIndex = stub.getLastMsgIndex(); String userInput = "", co...
ec7dde42-461b-4f75-996c-e1d0da51698b
6
public static boolean freeVariableP(PatternVariable variable, Proposition proposition) { { Keyword testValue000 = proposition.kind; if ((testValue000 == Logic.KWD_FORALL) || (testValue000 == Logic.KWD_EXISTS)) { if (((Vector)(KeyValueList.dynamicSlotValue(proposition.dynamicSlots, Logic.SYM...
e496e947-81bb-4f2f-9257-3caff1f0c9b9
8
public void propertyChange(PropertyChangeEvent evt) { Object source = evt.getSource(); if (source instanceof JFormattedTextField && evt.getPropertyName().equals("value") && (((JFormattedTextField) evt.getSource()).getValue() != null)) { Number newValue = null; Number value ...
855ec37e-756c-4b46-9342-d00ae4cca1d6
0
@GET @Path("events") @Produces({MediaType.APPLICATION_JSON }) public List<Event> getEvents(){ System.out.println("Return the events list"); return JpaTest.eventService.getEvents(); }
18b1edd2-a6e8-443f-9db8-5796d1d59f29
1
private void setRij(int rij) throws IllegalArgumentException { if (rij <= 0) { throw new IllegalArgumentException("Rij mag niet onder 0 gaan"); } this.rij = rij; }
6f1e599e-a9a9-4144-8272-ce4ebb20c5be
2
public static LuggageFacilityEnumeration fromValue(String v) { for (LuggageFacilityEnumeration c: LuggageFacilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
8f3bfd47-2f89-41cc-a916-a0316312b4a4
7
private void handleMPClick(MouseEvent e) { xIndex = e.getX() / 100; yIndex = 0; while ((gameGrid[xIndex][yIndex + 1]).getState() == 0) { yIndex++; if (yIndex == Board.numRows - 1) { break; } } ...
702fe85d-478c-4e96-8b11-e81c87b36abd
8
public static void main(String[] args) { String rssFeed = "<rss version=\"0.92\">" + "<channel>" + " <title>BBC JIRA</title>" + " <link>https://jira.dev.example.com/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=assignee+%3D+currentUser%28%29+AND+status+%3D+Open</link>" + " <description>An...
4dba44e8-7442-443c-a3a2-ecafcbcaae8f
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TailEvent<?> other = TailEvent.class.cast(obj); if (tailContents == null) { if (other.tailContents != null) return false; } else if (!ta...
64bb2b68-22d1-4f7a-922c-d38bcc37ef83
8
public static void resize(int buffer, int newByteSize) { if (newByteSize < 0) throw new NegativeArraySizeException(); int buffPos = poses[buffer]; int buffLength = lengths[buffer]; lengths[buffer] = newByteSize; if (buffLength < newByteSize) { bytes = Arrays.copyOf(b...
9a2fb4fc-4b5e-4517-a469-674f2cb49fb2
9
public static void intersection(int x[], int y[]) { System.out.print("First Array :\t"); for (int element : x) { System.out.print(element + " "); } System.out.print("\nSecond Array :\t"); for (int element : y) { System.out.print(element + " "); } System.out.print("\n"); int len = 0; for (int i =...
e669576b-a07b-4e8f-9516-6a5b9123e482
4
protected Method getMethod(String name, boolean isStatic) { try { Method method = clazz.getDeclaredMethod(name, Map.class); if (!ConfigurationSerializable.class.isAssignableFrom(method.getReturnType())) { return null; } if (Modifier.isStatic(metho...
802ccdac-0d4a-4dc7-9b36-d666d7a9c19f
6
private static void validateProperties(Properties properties) { String portProperty = getProperty(properties, PORT_PROPERTY); try { Integer.parseInt(portProperty); } catch (NumberFormatException e) { exit("Port is not a number."); } String rootProperty = getProperty(properties, ROOT_PROPERTY); if (!(...
8cf2c735-6c61-4638-9790-8e13485a2895
3
static private float[] subArray(final float[] array, final int offs, int len) { if (offs+len > array.length) { len = array.length-offs; } if (len < 0) len = 0; float[] subarray = new float[len]; for (int i=0; i<len; i++) { subarray[i] = array[offs+i]; } return subarray; }
fc60813a-dde4-4b8c-8530-f15d01bb5eac
8
protected void modeTwo(MouseEvent e, TicTacToeSubMenu sm, Main m) { int x1 = sm.getX1(); int y1 = sm.getY1(); int w1 = sm.getW1(); int h1 = sm.getH1(); if (e.getX() > x1 && e.getX() < x1 + w1) { if (e.getY() > y1 && e.getY() < y1 + h1) { m.currentMode...
3e0edcec-ec1d-44a8-9665-52fe4c3aeaee
1
public void visit_dmul(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
8bdfddfd-c18e-45a6-8ad7-69689a853699
4
public void move() { if (direction==0) { x++; } else if (direction==90) { y--; } else if (direction==180) { x--; } else if (direction==270) { y++; } }
4f285850-24d8-469f-8f89-03dc5363cb7d
8
private void eventsInMind(CounterActionFactory CAF) { CloudComment cc = CAF.createCloudComment(""); SkinSwitch ss = CAF.createSkinSwitch(0); @SuppressWarnings("unchecked") HashMap<Time, String> events = (HashMap<Time, String>) Serializer.deserialize(this, "events.dat"); if (events == null) { ss.setSk...
16d49069-54bd-4f9d-925c-c94b3114fd23
4
public Deck() { deck = new ArrayList<Card>(); for (int i = 1; i <= NUMBER_OF_CARDS; i++) { if (i <= CARDS_FIRST_ITR) { deck.add(new Card(CardType.CLUBS, i)); } else if (i <= CARDS_SECOND_ITR) { deck.add(new Card(CardType.DIAMONDS, i - CARDS_FIRST_ITR)); } else if (i <= CARDS_THIRD_ITR) { deck.a...
4549065a-9f0e-4d39-bd0d-d1c04de01f77
4
public boolean insidePlayingField(float pf_width, float pf_height) { if(x < 0) { return false; } else if((x + brick.width) > pf_width) { return false; } if(y < Breakout.STATUS_FIELD_HEIGHT) { return false; } else if((y + brick.height) > pf_height) { return false; } return true; }
92e83682-c0a9-40e5-8dad-b59198e1eeb3
2
public static boolean is7BitASCII(String str) { int i; for(i=0;i<str.length();i++){ if(str.charAt(i)>=0x80) break; // note: change to codePointAt after we switch to java 1.5 } return (i==str.length()); }
703f6611-5f09-449c-b5a7-152a069ad59f
1
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); ...
679d7e8f-332f-448c-a22a-c1ea717da3f9
0
public boolean isHalted(){ return isHalted; }
b5a562ee-ecb7-4be1-b456-dc4eaab1fd9a
4
public static void getNum() { long n = 2 * 3 * 5 * 7 * 11; while (true) { long sq = n * n; int count = 2; for (int i = 2; i < n; i++) { if (sq % i == 0) { count++; } } if (count > 1000) { ...
a0987520-8dea-47b9-82be-03fb11f14714
5
private void buildFinalResult() { int nrPlayers = profiles.size(); double[] wins = new double[nrPlayers]; double[] loses = new double[nrPlayers]; double[] ties = new double[nrPlayers]; for (int j = 0; j < nrPlayers; j++) { wins[j] = loses...
8677e8bf-3563-49e2-a1f9-cef14b8420f5
4
public void guiForOpeningAndCheckingLogFileForXML() { frmOpeningAndCheckingLogFileForXML.setSize(400, 300); frmOpeningAndCheckingLogFileForXML .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmOpeningAndCheckingLogFileForXML.setVisible(true); frmOpeningAndCheckingLogFileForXML .add(pnlOpeningAndChecki...
da12a582-2993-4e1a-af7b-ac985a35c0a3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Login)) { return false; } Login other = (Login) object; if ((this.userid == null && other.userid != null) || (t...
723203f3-d1cd-44e2-a5b0-e72e41a056e6
9
public static JPrimitiveType parse(JCodeModel codeModel, String typeName) { if (typeName.equals("void")) return codeModel.VOID; else if (typeName.equals("boolean")) return codeModel.BOOLEAN; else if (typeName.equals("byte")) return codeModel.BYTE; else...
f2ad6bca-12ce-44ca-a86c-862f3df1bfef
2
public boolean deleteItem(int index) { int itemCount = getItemCount(); // unacceptable index - reject if (index < 0 || index >= itemCount) return false; // delete indexed entry childItems.remove(index); // successful delete return true; }
ee19c4dc-62aa-4e3c-9883-a2cac99c4e65
2
public void passEigenValues( double[] eigenValues, double[][] eigenVectors ) { int l = eigenValues.length; double power = 0.0; for ( int i = 0; i < l; ++ i ) power += Math.abs(eigenValues[i]); power /= 100.0; SortingEVFilter sevf = new SortingEVFilter(true, true); sevf.passEigenValues(eigenValues, eigenVectors)...
92f1db5b-5eba-41fe-a456-37b9dde82b28
1
int get_bowl_score(int[] bowl) { int ret = 0; for (int i=0; i<bowl.length; i++) ret += bowl[i] * pref[i]; return ret; }
53c64978-99a3-44b7-ac9c-a728c77caed7
4
@Override public Iterator<EntityInfo> iterator() { return new Iterator<EntityInfo>() { Iterator<EntityInfo> use = inner.iterator(); @Override public boolean hasNext() { return use.hasNext(); } @Override public EntityInfo next() { EntityInfo nxt = use.next(); if (attributeFs.pathExi...
8689ace9-52f6-4ffa-a042-32f16fcea258
9
private int readHexDigit() throws PDFParseException { // read until we hit a non-whitespace character or the // end of the stream while (this.buf.remaining() > 0) { int c = this.buf.get(); // see if we found a useful character if (!PDFFile.isWhite...
ef2a6806-6f41-43ab-bffd-218fa4d74d64
1
public RepairIssue removeIssue(UUID hostUUID) { RepairIssue issue = null; if (unsolvedIssues_.containsKey(hostUUID)) { issue = unsolvedIssues_.remove(hostUUID); unsolvedPaths_.remove(issue.failedPeer.path); } return issue; }
6e7176d7-8d94-4439-ba4a-84e8e9282542
0
public ResponseWrapper getResponseWrapper() { return responseWrapper; }
52288751-ca5c-4329-924a-4405be5e52ba
0
@Override public void execute(VirtualMachine vm) { super.execute(vm); ((DebuggerVirtualMachine) vm).removeSymbols(levelsOfStackToPop); }
bc0822e0-e1b8-499e-94bc-a68ff7cae511
9
public EditInfo getEditInfo(int n) { if (n == 0) { return new EditInfo(waveform == WF_DC ? "Voltage" : "Max Voltage", maxVoltage, -20, 20); } if (n == 1) { EditInfo ei = new EditInfo("Waveform", waveform, -1, -1); ei.choice = new Choice(); ...
f2fe0258-631b-485f-9e46-0c8fddd19dd9
6
public UnitType getBestDefenderType() { UnitType bestDefender = null; for (UnitType unitType : getSpecification().getUnitTypeList()) { if (unitType.getDefence() > 0 && (bestDefender == null || bestDefender.getDefence() < unitType.getDefence()) ...
283e261b-d1f8-45d6-af43-a8b16fa5723f
9
public CheckResultMessage checkSum5(int i, int j) { int r1 = get(20, 2); int c1 = get(21, 2); int tr1 = get(36, 5); int tc1 = get(37, 5); BigDecimal sum = new BigDecimal(0); if (checkVersion(file).equals("2003")) { for (File f : Main1.files1) { try { in = new FileInputStream(f); hWorkbook =...
51db4447-17fc-46b5-9149-8f92aa6e505a
5
public void action(Sac[] tabSacs, RoyaumeDuFeu rdf, JFrame page, Dieu deus) { this.avancer(1); int k = 0; int nb = 0; int val; if ("Tyr".equals(deus.getNom())) { int det1 = de.getCouleur(); int det2 = de.getCouleur(); String[] choix1 = {tabSa...