method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
36653370-c9b8-45a0-b2f4-1715c92cb6bc
2
public boolean equals(final Object o) { if (!(o instanceof Method)) { return false; } Method other = (Method) o; return name.equals(other.name) && desc.equals(other.desc); }
4c00b1c6-d8bc-47d1-a712-f26fbcc28daa
9
public void changeDictionary(String filePath) { updateDictFile(filePath); if (!configFileUpdated) { try { duplicateConfigFile(); } catch (IOException e) { e.printStackTrace(); } } // Update the dict file info in the se...
5ee75401-b528-4db3-8788-f922c8dbd48b
6
public boolean estEntoureDeMurs() { int imax = Xsize() - 1; int jmax = Ysize() - 1; for (int i = 0; i < Xsize(); i++) { if (carte[i][jmax] != ContenuCase.MUR) return false; if (carte[i][0] != ContenuCase.MUR) return false; } for (int j = 0; j < Ysize(); j++) { if (carte[0][j] != ContenuCase.M...
1b7fd283-955c-4a2c-91fa-165f20ff1bb2
8
public boolean checkIllustrationValues(String imageId, String name, String author){ boolean resultCheck = false; if(imageId.length() <= Model.getInstance().getIllustrationIdSize() && name.length() <= Model.getInstance().getIllustrationNameSize() && author.length() <= Model.getInstance().getIllustrationA...
db2742e0-c417-4ecd-8e44-85f3f5c35796
3
public byte decodeWithMatchByte(com.swemel.sevenzip.compression.rangecoder.Decoder rangeDecoder, byte matchByte) throws IOException { int symbol = 1; do { int matchBit = (matchByte >> 7) & 1; matchByte <<= 1; int bit = rangeDeco...
174464bd-03b5-4d37-b89b-755e6c1a5b89
0
@Override public String toString() {return String.valueOf(cur);}
4ad8bc4b-8999-4097-b45a-1b4d4cb6a327
3
public static void assign4ElementArrayFromYamlObject(float[] output, Object yamlObject) { if (!(yamlObject instanceof List)) throw new RuntimeException("yamlObject not a List"); List<?> yamlList = (List<?>)yamlObject; output[0] = Float.valueOf(yamlList.get(0).toString()); output[1] = Float.valueOf(yamlList...
fe81c4e0-8357-4f02-b8ef-a75e07cd04e8
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 fe...
9c86e8f6-fdb1-43d3-83b1-532b3dcc7703
5
public static void createFacility(int[][] blockSheet) { Scanner s = null; try { s = new Scanner(new File("res/facility/FacilityInfo.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } ArrayList<ArrayList<Integer>> textInfo = new ArrayList<ArrayList<Integer>>(); while(s.hasNext()) ...
99a4f312-ac31-464e-9f00-5ed19f1936ba
2
public String getForcePanelCityName() { if (playerForce == null){ return ""; } else if (playerForce.getCityList().size() == 1) { return playerForce.getCityList().get(0).getCityName(); } else { return playerForce.getCityList().size() + ""; } }
9588aef2-eb29-4b71-aef4-32ce5e2e32fa
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just did a silenced attack!"); return random.nextInt((int) agility) * 2; } return 0; }
e2ec57f9-7b14-4e4e-a691-2f99df736637
4
public void handleRestart() { restarting = true; if(config.getBoolean(ServerRestarterConfigNodes.CREATE_STATE_FILE)) { File file = new File(config.getString(ServerRestarterConfigNodes.STATE_FILE)); if(file.isDirectory()) getLogger().severe("Status file is a directory!"); try { file.createNewFile();...
c264073c-6ed6-42de-aef6-3dd0af36d411
6
public void visit(Graph<String, String>.Vertex v) { if (!done.contains(v.getLabel()) || fileInfoMap.get(v.getLabel()) < currTime) { circle.add(v.getLabel()); if (preReq.get(v.getLabel()) != null) { for (String x : preReq.get(v.getLabel(...
ebc946e8-d51a-417d-8ae0-23a87c2e8c11
5
String finder(String s, int start, int currentMax) { if (s.length() - start <= currentMax) return null; int stop = start + currentMax - 1; for (int i = s.length() - 1; i > stop; i--) { if (isPalindorme(s, start, i)) { String next = finder(s, start + 1, i ...
0fa8b072-d906-4b24-9938-16da66f29a21
6
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String userId = request.getParameter("userId"); String eventName = new String( request.getParameter("eventName").getB...
5ac3f163-23fd-4462-a1a2-5f464904458c
1
public void insert(Key v) { // Insert pq[++N] = v; swim(N); // resizing if (N >= pq.length - 1) pq = resize(pq, 2 * pq.length); }
ae003191-aa3f-4034-88eb-49339f4e8f4a
9
public static int DateOfWeekday(int date, int weekday) { if (weekday == 0) { return date; } int curweekday = date % 7; boolean isPos = false; if (weekday > 0) { isPos = true; } weekday = weekday % 7; if (weekday >= 0) { if (weekday == curweekday && isPos) { return date + 7; } else if (w...
95304bc5-a946-4f6c-adad-5109a416aca2
5
public void createFolder(String folderName) throws UpYunExcetion { try { StringBuffer url = new StringBuffer(); for (String str : folderName.split("/")) { if (str == null || str.length() == 0) { continue; } url.append(Ur...
8ac719c9-78fb-444f-a8d1-84602c453d8c
7
public TBlock createBlock(TBlkType type, Color cl, TBlockBox box) { TBlock blk = null; switch (type) { case Z: blk = new TBlock_Z(box); break; case ZOPPOSITE: blk = new TBlock_ZOpposite(box); break; case L: blk = new TBlock_L(box); break; case LOPPOSITE: blk = new TBlock_LOpposite(box);...
ef946aea-1bbf-4316-9bb1-83d30802fba8
7
Object unpack(Info vi, Buffer opb){ InfoFloor0 info=new InfoFloor0(); info.order=opb.read(8); info.rate=opb.read(16); info.barkmap=opb.read(16); info.ampbits=opb.read(6); info.ampdB=opb.read(8); info.numbooks=opb.read(4)+1; if((info.order<1)||(info.rate<1)||(info.barkmap<1)||(info.numbo...
3cad61bc-5673-479e-9242-ee6b89aca20f
0
public void action(){ }
79d178f9-a0f9-4df5-8699-78d29e423204
4
private String validateMnemonic(String mnemonic) { int space = mnemonic.indexOf(" "); // Get the location of the closest space if (space == 3) { mnemonic = mnemonic.substring(0, 3); // Get the 3 char mnemonic } else if (space == -1) ; // Mnemonic is the entire line for (String i : mnemonics) { if ...
82629c30-768a-4538-aaba-50a9f720b154
5
private String getCipherInitString() { if (algName.equals("Blowfish")) { return "Blowfish/CBC/PKCS5Padding"; } else if (algName.equals("DES")) { return "DES/CBC/PKCS5Padding"; } else if (algName.equals("TripleDES")) { return "TripleDES/CBC/PKCS5Padding"; ...
238d4e69-9134-4793-a315-e90ce078a897
8
private void classificationDiagramUpdate() { DefaultListModel definitiveModel = new DefaultListModel(); DefaultListModel dominantModel = new DefaultListModel(); DefaultListModel dangerousModel = new DefaultListModel(); DefaultListModel dependentModel = new DefaultListModel(); ...
892a8667-d182-4d72-aa36-81c847ed52ee
1
@RequestMapping(value = "/speciality-list/{hallEventId}", method = RequestMethod.GET) @ResponseBody public SpecialityListResponse specialityList( @PathVariable(value = "hallEventId") final String hallEventIdStr ) { Boolean success = true; String errorMessage = null; List<...
a8ee2763-38bf-4306-86ca-a45fc46c438e
6
public void buildLeft(PathQuad quad) { if(!quad.noChildren()) { this.buildLeft(quad.getChild(1)); this.buildLeft(quad.getChild(3)); } else if(!quad.isBlocked() && ((this.getBox().getY() >= quad.getBox().getY() && this.getBox().getY() < quad.getBox().getMaxY()) || (quad.getBox().getY() >= this.getBox().ge...
414787ca-fb78-4ad0-a120-f28b83817721
3
public SingleTreeNode uct() { SingleTreeNode selected = null; double bestValue = -Double.MAX_VALUE; for (SingleTreeNode child : this.children) { double hvVal = child.totValue; double childValue = hvVal / (child.nVisits + this.epsilon); childValue =...
16b0906f-af72-4d47-9d42-13fe4c6069e1
8
public synchronized static void dealWith (final Throwable t) { // First, print the stack trace t.printStackTrace(); // Second, write the exception to a log file String osName = System.getProperty ("os.name"); String userHome = System.getProperty ("user.home"); String propertiesDirectory; if (osName....
1af86578-9cf0-4744-a46b-32423986f2a3
0
public final int getCamsize() { return cam.size(); }
6754ae9c-a1a1-43bf-a645-8e025b05fb4c
1
public ConfirmPaymentResponse confirmPayment(ConfirmPaymentRequest request) throws GongmingConnectionException, GongmingApplicationException { URL path = _getPath(CONFIRM_PAYMENT); ConfirmPaymentResponse response = _POST(path, request, ConfirmPaymentResponse.class); if (response.code != GMResponseCode...
fbb0265f-12aa-4dd4-8ca5-1176f4f91e8a
0
public TrapStateTool(AutomatonPane view, AutomatonDrawer drawer, AddTrapStateController controller) { super(view, drawer); myController = controller; }
3566bea5-7626-45a9-93f8-93bab9a64d1a
3
public void setVar(PVar node) { if(this._var_ != null) { this._var_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
f8948354-1dff-4159-b0c6-9b83e7105692
3
public boolean saveTemplate(){ try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); try { //writer.write(tabletoString(columnnames)); writer.newLine(); } catch (IOException e) { e.printStackTrace(); } writer.close(); return true; } catch (FileNotFoundE...
82c005f0-2c48-4879-a011-f9fef7773e7b
5
@Override public void run() { try { listenSocket = new ServerSocket(SERVER_PORT); System.out.printf("CommandListener listening on port %s.\n", SERVER_PORT); while (true) { dataSocket = listenSocket.accept(); System.out.printf("Accepted connection.\n"); ObjectInputStream ois = new ObjectInputStre...
26e0cd40-5f8d-4cf7-a0cf-5c11ffc99d3b
3
protected static String getString(String name, JSONObject json, boolean decode) { String returnValue = null; try { returnValue = json.getString(name); if (decode) { try { returnValue = URLDecoder.decode(returnValue, "UTF-8")...
219ecd64-56e1-4b1e-896c-8418c8b9526f
2
public TypedObject decodeInvoke(byte[] data) throws NotImplementedException, EncodingException { reset(); dataBuffer = data; dataPos = 0; TypedObject result = new TypedObject("Invoke"); if (dataBuffer[0] == 0x00) { dataPos++; result.put("version", 0x00); } result.put("result", decodeAMF0()); ...
d620e86a-368d-4824-807d-e0f7f232ffc6
0
@Override public Iterator getExtensions() { return extensions.keySet().iterator(); }
ad0e8620-e35c-4629-b442-031a09c3a517
8
private void selectedOrderSleeve1() { if(ord == null) { txtOrderName2.setText(""); txtOrderId3.setText(""); lblSleeves.setText(""); } if(operator == null) { txtId.setText(""); txtName.setText(""); txtLast...
36ddee48-75b5-4f57-9346-9a6a51d67770
3
public static String md5Java(String message) { String digest = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(message.getBytes("UTF-8")); //converting byte array to Hexadecimal String StringBuilder sb = new StringB...
31c84d0e-ad4b-4ebd-bd5b-9f8c1075ca95
5
public static int changeEnergy(float x, float y, int amount) { if (x < 0) x = 0; if (x > Game.width - 1) x = Game.width - 1; if (y < 0) y = 0; if (y > Game.height - 1) y = Game.height - 1; energy[(int) (x / 20)][(int) (y / 20)] += amount; if (energy[(int) (x / 20)][(int) ...
b624ef19-83bc-4076-a37e-d9b9d1e2b16b
5
private void manageClients() { manage = new Thread(this, "Manage") { public void run() { while (running) { sendToAll("/i/server"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i < clients.size(); i++) { ServerClie...
c9d65091-825d-42c3-801e-c3925f751156
8
@Override public void serialEvent(SerialPortEvent event) { if (!event.isRXCHAR()) {//Ensure data is avaiable return; } if (event.getEventValue() <= 0) {//Ensure there is data to read return; } //Get the data from the se...
2d778609-9aa5-4d38-8c6a-3eafa124a066
0
public KeyType createKeyType() { return new KeyType(); }
5efa9075-45b7-4f8d-b076-ba4b617aa20f
6
private Drawable parseDrawable() { String token = this.scanner.next(); Drawable drawable = null; if ("Circle".equals(token)) { // Circleの場合 int x = this.scanner.nextInt(); int y = this.scanner.nextInt(); int r = this.scanner.nextInt(); drawable = new Circle(x, y, r); } e...
e53f00f6-02c6-4dc9-8030-8dfafff006c3
0
public int getVidas(){ return this.vidas; }
f6b4f895-8af6-49a8-8b25-272250b01bf8
6
public static void removeDuplicates(char[] str) { if (str == null) return; int len = str.length; if (len < 2) return; int tail = 1; for (int i = 1; i < len; ++i) { int j; for (j = 0; j < tail; ++j) { if (str[i] == str[j]) break; } if (j == tail) { str[tail] = str[i]; ++tail; }...
620ef63a-b7a9-4a48-8734-87089cbb3186
5
public int checkDiag() { int found = 0; boolean same; char[][] checker = new char[2][3]; int x = 0; int y = 0; for(x=0; x<ROWCOL; x++, y++){ checker[0][x] = titato[x][y]; } for(x=2, y=0; y<ROWCOL; x--,y++) { checker[1][y] = titato[x][y]; } for(x=0; ((x<DIAGS) && (found==0)); x++) { same ...
1c571bd9-576f-4789-8aab-9bfba079866a
3
public boolean esta(Nodo x) { if (nodos.isEmpty()) { return false; } for (Nodo n : nodos) { if (x.equals(n)) { return true; } } return false; }
c2fa23f4-a8f6-4d85-9a3a-7ace3b85b4fd
9
public Schematic(String resourceName) { Scanner sc = new Scanner(getClass().getResourceAsStream(resourceName)); Vector<String> lines = new Vector<>(); while (sc.hasNextLine()) lines.add(sc.nextLine()); this.height = lines.size(); int h = 0, w, d; for (String line : lines)...
2d80b51b-65df-414b-8708-9084b9eb71f9
5
public static boolean sudoku(int[][] feld) { // 1-9 durchgehen for (int zahl = 1; zahl <= 9; zahl++) { // vorbelegen, dass Zahl nicht gefunden wurde boolean gefunden = false; // Sudoku feld nach Zahl absuchen for (int i = 0; i < feld.length; i++) { for (int j = 0; j < feld[i].length; j++) { if...
2c99eb26-28f3-41fb-a5a2-384a2777c75b
5
@Override public Object getValueAt(int row, int col) { Entry entry; try { entry = dic.getEntry(ids.get(row)); } catch (Exception ex) { return Localization.getInstance().get("error") + " " + ex; } switch(col) { case 0: return escapeString(entry.getWord()); case 1: return escapeString(entry.get...
80c6d32d-9f33-4379-bb68-3140f9aba8aa
9
@Override public void applyMoveAction(double s_elapsed) { switch (next_action.move) { case NONE: double move_velocity = Math.hypot(move_x_velocity, move_y_velocity); double delta = s_elapsed * SPEED_DECREASE_PER_SECOND * move_x_velocity / move_velocity; if (Math.abs(move_x_velocity) ...
f4342cfe-4c37-492c-895e-fb8b19ebe45f
5
public boolean newProductoAction(String id_productos, String nombre, String cantidad, String precio_venta, String descripcion) throws SQLException, EmptyFieldException { boolean res; conn = ConexionBD.getInstance(); if(id_productos.isEmpty() || nombre.isEmpty() |...
4f95d4dc-2501-4b20-b6d5-845074f552bb
0
public void setRequestWrapper(RequestWrapper requestWrapper) { this.requestWrapper = requestWrapper; }
2f4c9c28-c3a4-4fb5-965a-8030a885728f
6
protected void rotateRight(Node<T> node) { Position parentPosition = null; Node<T> parent = node.parent; if (parent != null) { if (node.equals(parent.lesser)) { // Lesser parentPosition = Position.LEFT; } else { // Greater ...
4c5e621d-6989-4778-8f29-bd58fb05409d
0
public CommandResult getDBStats() { return db.getStats(); }
ccda8854-e2ad-41c5-9678-a6bf9dfc4c8a
9
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == typeComboBox) { if (myRecipe != null) { selectedRow = notesTable.getSelectedRow(); myRecipe.setNoteType(selectedRow, (String)typeComboBox.getSelectedItem()); if(((JComboBox)o).isPopupVisible() && (String)typeCombo...
5c12ac9c-c2c0-414a-a324-fe080f48556f
9
public static void select(GlkEvent e) { long cur = 0l; GlkEvent ev = null; boolean done = false; synchronized(EVENT_QUEUE) { if (Window.root != null) Window.root.doLayout(); while (!done) { if (!EVENT_QUEUE.isEmpty()) { ev = (GlkEvent) EVENT_QU...
1fd2c3e7-476c-4e5b-8f78-d4d7fdfeb93a
7
private void runBlottoProblem(Evolution evo){ int generations = Integer.parseInt(generationsField.getText()); int populationSize = Integer.parseInt(populationSizeField.getText()); double[] avgEntropy = new double[generations]; double[] stdDev = new double[generations]; L...
b9834b66-f11d-4ad2-9910-02f12777ef2f
5
public void evolvePlayers() { for (NPC npc : NPC.getNPCList()) { Direction nextDir = npc.getCurrentDirectionInScript(); Move move = npc.getMove(); if (nextDir != Direction.NONE) { if (!npc.canWalkOnSquare(nextDir)) { npc.setPosture(Posture...
c25c6e1d-7df0-4a57-a2e2-fae825a3c7ff
8
public static void printHand(Hand hand) { // print hand header ArrayList<String> attrs = new ArrayList<String>(3); if(!hand.getDescription().equals("")) attrs.add(hand.getDescription()); attrs.add("score: " + hand.getScoreString()); if(hand.getBet() > 0.0f) attrs.add("bet: $" + hand.getBet()); outpu...
628edb1d-eb32-4e29-9b0e-81cc3d8027a7
0
public EchoFilter(int numDelaySamples, float decay) { delayBuffer = new short[numDelaySamples]; this.decay = decay; }
06b449a4-40ca-43c2-867b-072c6a7c4c35
5
public void faceObject(Entity obj){ if (obj==null) return; float dx = obj.getPosition().x - getPosition().x; if(dx > 0 && facingLeft) changeDirection(); else if(dx < 0 && !facingLeft) changeDirection(); }
591e51aa-1d2f-4058-93d6-8c5c27ca9492
9
private static void begin() { Scanner sc = new Scanner(System.in); while (sc.hasNextLine()) { StringTokenizer st = new StringTokenizer(sc.nextLine()); int nbrInts = Integer.parseInt(st.nextToken()); if (nbrInts <= 0) { System.out.println("Not jolly");...
233dca4c-d66b-4d9c-b21f-5b20b76f2b2a
5
public static void setLevel(Block block, int level) { if (!isApplicable(block)) return; TileEntityBeacon beacon = (TileEntityBeacon) ((CraftWorld) block .getWorld()).getHandle().getTileEntity(block.getX(), block.getY(), block.getZ()); Field lvl = null; try { lvl = TileEntityBeacon.class.getDeclaredFi...
1dea441f-aabc-4596-91e4-96a0beeb5544
5
public List<Warehouse> getWarehouseByBranch(int branchid) { List<Warehouse> warehouses = new ArrayList<Warehouse>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = D...
17fc330c-d291-4866-abae-ca544355f876
5
private void processIdentifiers(Expression e) { String type=e.getType(); if(type.equals("identifier")) { identifiers.add(e.getValue()); } for (int i = 0; i < Expression.unaryTypes.length; i++) { if (type.equals (Expression.unaryTypes[i])) { processIdentifiers(e.getSubexpression()); } ...
31b7973f-5797-4806-96ff-eb94481e0913
1
public void setDateNull() { for (int i = 0; i < 42; i++) { labelDay[i].setText(""); } }
b12b1474-54a4-4cee-b476-90a02c2ab5e6
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Domain)) return false; Domain other = (Domain) obj; if (price == null) { if (other.price != null) return false; } else if (!price.equals(other.price)) return fa...
efdbc21d-1d1a-4256-a4b7-81fa952cca4d
2
public static void main (String[] args) { int meanGoal = 5; //arrival interval of people int m = 10; //15; //amount of numbers needed int n = m; //3000; Random tmpRnd = new Random(); Exponential p0 = new Exponential(meanGoal, tmpRnd); System.out.println("First " + m + " of ...
3ed12400-9777-4ecf-9336-c6b33bce39c3
5
public Image getTileImage(int x, int y){ switch(level.fields[y][x]){ case dest: return iDest; case floor: return iFloor; case grass: return iGrass; case src: return iSrc; case wall: return iWall; default: return null; } }
401bd969-4430-4286-aa49-7f68fca5f152
0
public void setDefinition(String value) { this.definition = value; }
aeee1954-de31-453c-bf16-fc8d5c7ddd2d
6
public static void main(String[] args) { Input objInput = new Input(); boolean blnGoon = true; do { switch(Main.showMenu()) { case 1: System.out.println("[1] Encrypt text\n\n" + "Please enter the text you whant...
3a67e23f-4308-4d5f-be3c-d6dc580e0713
1
public int compareTo(final Object o) { Item other = (Item) o; int retVal = name.compareTo(other.name); if (retVal == 0) { retVal = desc.compareTo(other.desc); } return retVal; }
913f9a00-c738-4511-84cf-fe48a58c7684
0
public ArrayList<int[]> getWalk() { return walkList; }
23474988-f58c-45b2-a81f-112a52023f40
5
private void processIdentifiers(Expression e) { String type=e.getType(); if(type.equals("identifier")) { identifiers.add(e.getValue()); } for (int i = 0; i < Expression.unaryTypes.length; i++) { if (type.equals (Expression.unaryTypes[i])) { processIdentifiers(e.getSubexpression()); } ...
eec39c2b-bfed-4844-b8d4-a692357973a8
8
public void addPoint(float x, float y) { if (includes(x,y) && (!allowDups)) { return; } ArrayList tempPoints = new ArrayList(); for(int i=0;i<points.length;i++) { tempPoints.add(new Float(points[i])); } tempPoints.add(new Float(x)); tempPoints.ad...
9f105bf0-2a26-4e09-b9e2-3a0862076e21
9
public Integer board(Integer newPassengers) throws TrainException { if (newPassengers < NO_PASSENGERS) { throw new TrainException( "The number of new train passengers must by positive"); } if (trainSeatsAbility == NO_SEATS) { throw new TrainException("There are no seats on the train."); } // If ...
248a9006-20e2-42d5-9603-fcc9504a1bbc
4
private boolean checkForOutOfBoundsForPiece(Piece piece) { int x = piece.getX(); int y = piece.getY(); if (x > width || x < 0 || y < 0 || y > height) { return true; } return false; }
66afd79c-2cac-47ef-8376-cb489a74852e
1
private void renderCurrentPlayer(Graphics2D graphics) { if (objectTron.getPlayerNumber(objectTron.getActivePlayer()) == 0) graphics.drawImage(playerRed, 41 + startPointXCoordinate, 41 + startPointYCoordinate, 40, 40, null); else graphics.drawImage(playerBlue, 41 + startPointXCoordinate, 41 + startPo...
f7b472e7-c2ed-4de1-a7a9-a3264fcb0507
0
public String getCardStatusInformation() { String cardInfo = ""; // card value, card suit, x-position of the card, y-position of the card, the card has been removed boolean and, lastly, the card is face up boolean cardInfo = value + " " + suit + " " + cardArea.x + " " + cardArea.y + " " + hasB...
219bdb08-355f-4713-8282-4a9f9f8f6a8d
7
static String readAndValidate(File file) { StringBuilder source = new StringBuilder(); try { int lineNumber = 1; String line; int nestedLoops = 0; BufferedReader reader = new BufferedReader(new FileReader(file)); while ((line = reader.readLin...
afd05374-35a9-4fa8-86b8-e3cf3e384b29
6
public static Segment intersectionTrianglePlan(Face f, double z) { Point a = intersectionSegmentPlan(f.p1, f.p2, z); Point b = intersectionSegmentPlan(f.p2, f.p3, z); Point c = intersectionSegmentPlan(f.p3, f.p1, z); if (b != null && c != null) { return new Segment(b, c); } else if (a != null && c != null...
e0b79d94-c361-4b77-898a-5e79aae19028
0
private void doDestroy() throws Exception { serverStopListenerList = null; clientConnectListenerList = null; clientDisconnectListenerList = null; receiveDataOnServerListenerList = null; serverExceptionListenerList = null; setConnections(null); setInitial(false); }
58df727a-f043-4fa3-b9f7-7e0377b0377f
3
public void deleteCourseByName(Scanner a_scan, Student s1) { for (int i = 0; i < test.getStudentList().size(); i++) { if (s1.equals(test.getStudentList().get(i))) { System.out.println("Please input course name: "); String courseName = a_scan.next().toLowerCase(); Course a_course = findCourse(co...
d88e458f-5db5-462a-819d-b687d39611e8
3
private int calcNumberOfNodes(double serialProb, double pow2Prob, double uLow, double uMed, double uHi, double uProb) { double u = random.nextDouble(); if (u <= serialProb) {// serial job return 1; } double par = twoStageUniform(uLow, uMed, uHi, uProb); if (u <= (serialP...
90d6e047-c71b-4e84-a98b-30340cc9a16c
1
public WidgetUnits(List<core.GroupOfUnits> u1, List<core.GroupOfUnits> u2, core.Hero h1, core.Hero h2) { super(); units1 = u1; units2 = u2; hero1 = h1; hero2 = h2; setSizePolicy(Policy.Fixed, Policy.Fixed); left.setMaximumSize(32, 32); right.setMaximumSize(32, 32); split.setMaximumSize(32, 3...
c842a2c3-8e8a-4032-a672-a183851b51ae
4
private PDFPage createPage(int pagenum, PDFObject pageObj) throws IOException { int rotation = 0; Rectangle2D mediabox = null; // second choice, if no crop Rectangle2D cropbox = null; // first choice PDFObject mediaboxObj = getInheritedValue(pageObj, "MediaBox"); if...
9f111800-dcc0-47ce-b3e5-d6e1775fc501
0
public void printChildren(Graphics g) { }
a6ab1364-de10-4a4d-9b8b-03840664d087
3
public static void main (String[] args){ int beerNum = 99; String word = "bootles"; while (beerNum > 0 ){ if (beerNum == 1 ){ word = "bootles"; //no singular como em uma garrafa } System.out.println("beerNum "+ " word "+ "of beer on the wall");// O erro eram sinais ++ juntos ou repetidos System.out...
300dd205-af0c-4882-ad66-0701d75ba344
3
private int LoadMapFromFile(String mapFilename) { String s = ""; BufferedReader in = null; try { in = new BufferedReader(new FileReader(mapFilename)); int c; while ((c = in.read()) >= 0) { s += (char)c; } ...
ecc6eb03-ef8f-44ab-8faf-815063b4f714
4
public static void moveSelectedX(int x) { if (Main.selectedId != -1 && !Main.getSelected().locked) { RSInterface rsi = Main.getInterface(); if (rsi != null) { if (rsi.children != null) { rsi.childX.set(getSelectedIndex(), rsi.childX.get(getSelectedIndex()) + x); } } } }
e007c9a9-3c21-484e-8bec-5e693549452a
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 3) { final String remoteVersion = title.split(delimiter)[2].split(" ")[...
c1eee073-4fe4-43e0-8e2d-2ac7b6a25661
9
protected boolean isPrimitiveType(String typeSignature) { if (typeSignature == null) return true; if (typeSignature.equals("Ljava/lang/String;")) return true; if (typeSignature.equals("Ljava/lang/Integer;")) return true; if (typeSignature.equals("Ljava/lang/Double;")) return true; if (typeSignature.equals("Lj...
60631cb9-98e2-41d5-8442-0a7cd91850ab
3
public static String fastUnicode(String str) { byte[] bytes = str.getBytes(Charsets.UTF_16);// 转为UTF-16字节数组 int length = bytes.length; if (length > 2) { int i = 2; char[] chars = new char[(length - i) * 3]; int index = 0; boolean isOdd = false; for (; i < length; i++) { if (isOdd = !isOdd) { ...
4148ec67-865d-4a42-984e-8291d97300bf
3
public void playSong(String song) { //Don't play a song if the jukebox has been muted if(muted) { return; } //If no song with that name exists if(!songs.containsKey(song)) { System.err.println("Breakout: No song called " + song + " exists"); return; } //Stops and rewinds the current so...
5f184627-0bc2-4772-a1ff-ea6224bc1897
1
public void testToDateTime_wrongChronoLocalTime_Zone() { LocalDate base = new LocalDate(2005, 6, 9, COPTIC_PARIS); // PARIS irrelevant LocalTime tod = new LocalTime(12, 13, 14, 15, BUDDHIST_TOKYO); try { base.toDateTime(tod, LONDON); fail(); } catch (Ille...
02a13937-d986-4de4-8c0d-5580f895ee32
0
public void turnRight() { handler.sendCommand("right"); }
4f0084bc-35ad-435c-a3d3-09584153194e
1
@Override public void run() { for (final Xpp3Dom testCase : results.getChildren()) { apply(testCase); } }
01247361-288b-45b5-b564-2c9d40f2abb5
8
public String getArrowDotSvek() { if (this == LinkDecor.NONE) { return "none"; } else if (this == LinkDecor.EXTENDS) { return "empty"; } else if (this == LinkDecor.COMPOSITION) { if (OptionFlags.NEW_DIAMOND) { return "empty"; } return "diamond"; } else if (this == LinkDecor.AGREGATION) { i...