method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
acc24a77-66be-4f9c-bb79-498ce88e3519
5
public static mxFibonacciHeap union(mxFibonacciHeap h1, mxFibonacciHeap h2) { mxFibonacciHeap h = new mxFibonacciHeap(); if ((h1 != null) && (h2 != null)) { h.min = h1.min; if (h.min != null) { if (h2.min != null) { h.min.right.left = h2.min.left; h2.min.left.right = h.min.right; ...
d0278e5e-9dad-49e9-b228-d1671985a871
6
private static List<VoieDeCirculation> parcoursGraphe(Intersection intersectionPrecendente, Intersection depart, Intersection arrivee) { List<VoieDeCirculation> parcours = new ArrayList<VoieDeCirculation>(); parcours.add(depart); for (Route r : depart.getRoutes()) { List<VoieDeCircul...
618a605f-570d-42cb-b642-c5faa0783961
2
public User getUser(String ID) { for (User u : allUsers) { if (u.getID().equalsIgnoreCase(ID)) { return u; } } return null; }
4f3e44ed-dce2-436e-a3f1-8e2196a6e4a3
0
public void zerosFit(){ this.bestBinsCount = 100; this.bestFitBinsCount = 100; }
029b5025-11ad-4d77-833e-a4e46c179d1c
1
public void testMaximumValue() { DateMidnight dt = new DateMidnight(1570, 1, 1); while (dt.getYear() < 1590) { dt = dt.plusDays(1); YearMonthDay ymd = dt.toYearMonthDay(); assertEquals(dt.year().getMaximumValue(), ymd.year().getMaximumValue()); assertEqual...
abebc369-167e-4b9e-9aed-63cf95a81d72
0
public ProtocolResultFromServer() { isAccept = false; mClientContacts = null; }
02973d49-bd34-450a-9dac-ef34e5483499
6
public static void floodFill(int r, int c) { for (int i = 0; i < dir.length; i++) if (r + dir[i][0] >= 0 && r + dir[i][0] < n && c + dir[i][1] >= 0 && c + dir[i][1] < m && map[r + dir[i][0]][c + dir[i][1]] == '@') { map[r + dir[i][0]][c + dir[i][1]] = '*'; floodFill(r + dir[i][0], c + dir[i][1]);...
ae17d488-6699-4aa5-b24b-dc6014412b77
3
private void deleteCache(Object[] args) throws CacheUnreachableException { List<CacheDeleteDefinition> deletes = cacheDefinitionCollection.getCacheDeleteDefinitions(); if (deletes == null) { return; } // 根据cacheDefinitionCollection中配置的所有删除缓存操作,循环调用,删除缓存 for (CacheDeleteDefinition definition : deletes) { ...
e73eea1a-26a8-4920-8973-7f61b1084fa5
2
public int compareTo(LessFileStatus other) { long diff = getLastModified() - other.getLastModified(); return diff > 0 ? -1 : (diff < 0 ? 1 : other.getLessName().compareTo(getLessName())); }
df81080d-c01e-4ab1-b7c3-14e3dbeee503
7
public double pow(double x, int n) { if (x == 1) { return 1; } if (x == -1) { return (n % 2 == 0) ? 1 : -1; } if (n < 0) { return pow(1 / x, -n); } if (n == 0) { return 1; } else if (n == 1) { r...
cddda3a9-a046-4398-940e-d25021fa1877
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
5eb880dc-4f40-4229-a737-a9258d90a67f
5
private void fillZipEntries(int nr) { Enumeration zipEnum = zips[nr].entries(); zipEntries[nr] = new Hashtable(); while (zipEnum.hasMoreElements()) { ZipEntry ze = (ZipEntry) zipEnum.nextElement(); String name = ze.getName(); // if (name.charAt(0) == '/') // name = name.substring(1); if (zipDirs[nr...
212ac82d-25d2-4abc-8d0f-1d307882b9dc
5
@Override protected void updateAnimation(double p) { double dTheta; switch (rotationStrategy) { case (ROTATE_CLOCKWISE): { dTheta = (fTheta - iTheta >= 0) ? (fTheta - iTheta) : ((fTheta - iTheta) % (2 * Math.PI) + (2 * Math.PI)); break; } ...
be7c6ddc-2602-47e8-9a59-c91825bb9d15
3
public void endElement(String uri, String localName, String qName) throws SAXException { String elementName = localName; if ("".equals(elementName)) { elementName = qName; } if(elementName.equals("systemlist")){ currentElement = ProcessingElement.NONE; } else if (elementName.equals("system")){ ...
9be5ff5d-60f9-49f7-95d7-1d63625b882a
5
private static int bcd(char digit) { if (digit >= '0' && digit <= '9') { return digit - '0'; } switch (digit) { case '.': return 10; case '-': return 11; case '+': return 12; default: return 13; }...
f2e86e8c-e796-46ef-b902-f45580c93934
3
public static void battleEvent(Character hero, NPC baddie) { while (baddie.getHealth() > 0) { hero.attack(baddie); System.out.println("baddie HP: " + baddie.getHealth() + "\n"); // Test whethdkafj baddie is dead already b4 we continue if (baddie.getHealth() <= 0) { ...
f4a94401-edf7-43b2-818a-12fa729a89f6
3
public static void checkChangesInTestPlan() { GuiPackage guiPackage = GuiPackage.getInstance(); if (guiPackage.isDirty()) { int chosenOption = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(), "Do you want to save changes in current test-plan?", ...
25663c98-7e36-4e31-9e3b-9ddb69eb03cc
6
public Expression simplify() { if (!staticFlag) { subExpressions[0] = subExpressions[0].simplify(); subExpressions[0].parent = this; if (subExpressions[0] instanceof ThisOperator) { FieldAnalyzer field = getField(); /* * This should check for isFinal(), but sadly, sometimes jikes * doesn't ...
3842094e-1b07-4c30-82b6-760ebcf030bf
1
public static boolean getMouseDown(int mouseButton) { return getMouse(mouseButton) && !lastMouse[mouseButton]; }
b4c8347e-88aa-409d-974b-d1a743b17143
1
final void setAppWindow(AppWindow appWindow) { if (mAppWindow != appWindow) { mAppWindow = appWindow; adjustForAppWindow(mAppWindow); } }
268e4e0f-8929-4858-a5ee-7d85413b4315
0
public String getProperty(String property) { return properties.getProperty(property); }
86079be5-9d19-4849-b932-614c3ce76bb1
5
@Override public ArrayList<Integer[]> crossover(ArrayList<Integer[]> population, int size, double crossProbability) { int popSize = population.size(); ArrayList<Integer[]> newPopulation = new ArrayList<>(); Integer[] t1; Integer[][] t; for (int i = 0; newPopulation.size() < s...
5b421ebd-5998-46a4-8214-4a8be4dd5eeb
8
public List<String> getSourceTree(String commitID) { try { List<String> fileList = new ArrayList<String>(); List<CommitFamily> commitPath = getCommitPathToRoot(commitID); List<CommitFamily> shortestCommitPath = new ArrayList<CommitFamily>(); Map<String, List<String>> commitCaches = getCommitCachesFromC...
1a3ff387-2ddf-4b99-8068-74f95eb653c2
5
public double getAccuracy(Matrix features, Matrix labels) { double sum = 0; for (int i = 0; i < labels.getNumRows(); i++) { List<Double> result = predict(features.getRow(i)); if (labels.getNumCols() != result.size()) { throw new MLException(String.format( ...
2569c177-df46-4b33-a60d-98d503d314d3
3
public void checkWin(){ for (PlayerPawn v : playerPawns){ if (v.checking){ //Only shows if it's the only player left if (playerPawns.size()==1){ JOptionPane.showMessageDialog(frame, "Player " + v.getId() + " wins!, game exiting"); //Sends the client the exit comma...
8f21e801-25b2-48f4-b419-30f2b1488877
6
public void stop(){ if(isMovingRight() == false && isMovingLeft() == false){ speedX = 0; } if(isMovingRight() == false && isMovingLeft() == true){ moveLeft(); } if(isMovingRight() == true && isMovingLeft() == false){ moveRight(); } }
e080fd2d-a02a-4ae4-bec5-2955ad77b81f
5
@Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { if(args[0] != null && sender instanceof Player) { Player player = (Player)sender; plugin.getLogger().info(""+plugin.kitsList.size()); if(plugin.checkIsKit(args[0]) == true) { Kits kits = plugi...
731f6cbd-2c84-4b4d-9eb4-8722b4d796de
6
public void mouseMoved(MouseEvent e) { super.mouseMoved(e); if (getHyperlinksEnabled()) { if ((e.getModifiersEx()&linkScanningMask)!=0) { isScanningForLinks = true; Token t = viewToToken(e.getPoint()); Cursor c2 = null; if (t!=null && t.isHyperlink()) { hoveredOverLinkOffset = t.offs...
9f5d4089-6627-45f7-87ba-f2c1d22f1a2c
2
public void readModelFromFile(String fileName) throws IOException{ BufferedReader in = new BufferedReader(new FileReader(new File(fileName))); //read smoothingValue in.readLine(); smoothingValue = Double.parseDouble(in.readLine()); //read featureValueRelativeRoleFrequency in.readLine(); featureValueRel...
1677e770-58e7-4f81-9824-e9bb68d004e1
2
@Test public void test() { if (!MongoHelper.delete(proposal, "proposals")) { TestHelper.failed("delete failed"); } if (MongoHelper.fetch(proposal, "proposals") != null) { TestHelper.failed("proposal was not deleted"); } System.out.println("Deleted p...
7b8e1b87-c103-4b00-861c-4a9e91c562a5
3
public void run() { if (SystemTray.isSupported()) { //only launch if supported MouseListener mouseListener = new MouseListener() { @Override public void mouseClicked(MouseEvent e) { //show and hide the server window when left-click on the tray icon ...
f42784d7-b539-49a1-a3bb-b95743f16fb3
0
public String getAtTime() { return AtTime; }
d6366c21-b2f1-4140-8902-715f99a02247
7
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { Player player = (Player)sender; if(commandLabel.equalsIgnoreCase("feed")); if(sender.hasPermission("basics.command.feed.self") || sender.isOp()) { if(args.length == 0) { player.setExhaustion(20); pl...
f3591a6a-8c6e-4435-87df-f944e78bf0d4
1
private static Customer CustomerObject(ResultSet rs) { Customer newCustomer = null; try { newCustomer = new Customer(rs.getInt(rs.getMetaData().getColumnName(1)), rs.getString(rs.getMetaData().getColumnName(2)), ...
5894ede4-d712-4de4-8254-45c76076ae40
2
private TMState getAutomatonFromFile(int i, Point point) { TMState block = new TMState(i, point, this); Serializable serial = OpenAction.getLastObjectOpened(); File lastFile = OpenAction.getLastFileOpened(); if (lastFile == null || OpenAction.isOpened() == false) { return null; } // block = putBl...
90d3015c-734e-4868-a5c8-9cdd53381728
1
public static int getNumber(Scanner scanner, String message) { int number = 0; System.out.println(message); while (!scanner.hasNextInt()) { System.out.println("Error: incorrect data.\n" + message); scanner.next(); } number = scanner.nextInt(); retu...
5de5670b-9f06-4c1d-9b3f-5d8128860b62
2
public void replace(PumpingLemma pl) { for(int i = 0; i < myList.size(); i++) { if(pl.getClass().equals(myList.get(i).getClass())) { myList.remove(i); myList.add(i, pl); } } }
d2b0b58a-5cb9-4583-bac4-e3b534f205bd
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Numbers numbers = (Numbers) obj; if (id != null ? !id.equals(numbers.id) : numbers.id != null) { ...
8b2c5370-5471-4ccf-9348-5f913dd3db70
7
static Vector square(int face, float bottom, float left, float top, float right, float d) { Vector<Vector3d> sq = new Vector<>(); Vector3d[] ps = new Vector3d[5]; for (int i = 0; i < 5; i++) { ps[i] = new Vector3d(d, d, d); sq.addElement(ps[i]); } switch...
311bfd3a-10be-497b-9cdb-1bfdf993e2a2
0
public AutomataNoteEvent(Automaton auto, Note note, boolean add, boolean change) { super(auto); myNote = note; myAdd = add; myChange = change; }
41611d5b-72eb-4c4a-a21c-a00f0e03f275
4
public Object getValue(Object self) { try { Object[] params = {}; if (readMethod != null) { return readMethod.invoke(self, params); } else if (field != null) { return field.get(self); } else { throw new RuntimeExcept...
2bb9cb03-f060-4dbc-b291-a3b597ce595f
0
public final void setNeedDraw(Boolean needDraw) { this.needDraw = needDraw; this.repaint(); }
6d653ad7-f70f-4b28-a6b2-2ac6e1eef407
6
public void sendMessage(ChatPlayer player, String message) { message = formatMessage(player, message); for (String data : members) { ChatPlayer cp = plugin.getChatPlayer(data); if (!cp.ignoringPlayer(player.getName()) || cp.isChatSpying()) cp.getPlayer().sendMessage(message); } for (String d...
f9854736-4fc9-4495-a34a-e666dce71f48
7
@EventHandler public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { event.getPlayer().setDisplayName(event.getPlayer().getName()); int rank = 0; try { rank = HyperPVP.getStorage().readInt32("SELECT rank FROM users WHERE username = '" + event.getPlayer().getName() + "'"); } catch (SQLException e...
9ab4cd08-c0c9-4dcb-b9a4-63863fd40d2b
1
@Override public String getResourceDescriptor() { return resourcedescriptor == null ? "" : resourcedescriptor; }
8c6a697e-fa0f-42ed-9d5d-b4dc153f4b90
8
protected static ChattyGroup matchChatGroup(MOB meM, String myName, ChattyGroup[] chatGroups) { myName=myName.toUpperCase(); if(myName.equals("DEFAULT")) return chatGroups[0]; for(final ChattyGroup CG : chatGroups) { if(CG.entries!=null) { for(final String name : CG.groupNames) { if(name....
f4becf11-1146-468c-bb8f-a60a112386e5
2
public static boolean isAdmin(String uid) { boolean result = false; Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = con.prepareStatement("select u_admin from mstx_user where uid=?"); pstmt.setInt(1, Integer.parseInt(uid)); rs = pstmt.execut...
53b74d80-7e3e-47c2-ad33-231475acf6c3
5
SingleRevisionIterator(final String elementType, final Object elements, final boolean getContentImmediately) { if ((elementType == null) || (elementType.length() == 0)) throw new IllegalArgumentException("elementType is null or empty"); if (!((elements instanceof String[]) || (elements instanceof long[]))) ...
528f58e8-8d6a-4b33-bab9-93950b816df2
1
public void poistaPalaute(int palauteID) throws DAOPoikkeus { //Avataan tietokantayhteys Connection yhteys = avaaYhteys(); try { //Suoritetaan haku String sql = "DELETE from Palaute WHERE palauteID=?"; //Alustetaan sql-lause PreparedStatement lause = yhteys.prepareStatement(sql); ...
85710baf-e21f-4433-85f5-72731c9f06b4
2
@Override public void keyPressed(KeyEvent arg0) { int code = arg0.getKeyCode(); if(code < 0 || code >= keys.length)return; keys[code] = true; }
165dd38b-7791-4107-819f-0df536171651
5
public synchronized void agree(String x){ Utils.out(pid,"x " + x); for ( int i = 1 ; i <= getNo(); i++){ if ( i == pid){ if ( i == 4){ while (true); } broadcast(Utils.CONSENSUS,x); } else if (collect(i)){ x = buffer[i-1]; } } Utils.out(pid,"decided " + x); }
7a3919c0-39fc-47c4-a5be-fd4633f5b413
3
public String getResultValue(int index) { if (!value) return null; if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index"); return values.get(index); }
0e34756a-f969-4c62-bcb4-25d04aa5308b
6
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { config = plugin.getConfig(); if (args.length == 1){ if (sender instanceof Player) { Player player = (Player) sender; if (commandLabel.equalsIgnoreCase("ctp")) { if (sender.hasPermission("darkcommand.coo...
67f2b2a0-e9e9-4ef2-a11d-b5a83f47f973
0
public String getStringItem(String... names) throws ReaderException { return getItem(names).toString(); }
4e6bf321-b40d-4779-a26b-bd045f235249
7
boolean isHbonded(int indexDonor, int indexAcceptor) { if (indexDonor < 0 || indexDonor >= monomerCount || indexAcceptor < 0 || indexAcceptor >= monomerCount) return false; return ((min1Indexes[indexDonor] == indexAcceptor && min1Energies[indexDonor] <= -500) || (min2Index...
d90e3bc3-60dd-4ec1-aff0-76727f1a0098
2
public String sendToServer(String str) throws IOException { if (client_socket != null) { try { os.println(str); String line = is.readLine(); return line; } catch (SocketException e) { return "connection problem..."; ...
abaf6dd2-68c3-49f4-88e3-c4ad064aedcb
2
public void portCheck(){ String p = socket.getRemoteSocketAddress().toString(); int i = p.indexOf(':'); p = p.substring(0, i); for(int j = 100; j <= 65535; j++){ try (ServerSocket mal = new ServerSocket(j)) { System.out.println(currentUser + " has a vulenerable port on: " + j); mal...
8a26bb23-5e6c-40db-affe-53e40f57a93f
0
public List<RoomEvent> findRoomEventsBySpecialityId(final Long specialityId) { return new ArrayList<RoomEvent>(); }
b5d6a2d9-a243-49ce-a582-f1a6d4006a93
0
public WindowButtons(final Stage stage) { super(4); this.stage = stage; this.getStyleClass().add("window-buttons"); Button closeBtn = new Button(); closeBtn.getStyleClass().add("window-close"); closeBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent...
8836cc46-b8c0-4ae6-bdfd-84979baf580e
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
b2755d56-2e39-4d94-8cdf-0e592ce10888
0
public Cluster rest(int i) { Cluster c = new Cluster(); c.merge(this); c.remove(i); return c; }
a5358980-7028-422d-b61e-34b7e82499fe
6
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (topButton.getSelection ()) style |= SWT.TOP; if (bottomButton.getSelection ()) style |= SWT.BOTTOM; if (borderButton.getSelection ()) style |= SWT.BORDER; if (flatButton.getSelection ()) style |= SWT.FLAT; ...
ed6fbfc6-f946-4b0c-b1b0-e4c6e93a099f
5
void blendingBenchmark(String[] args) { int iterations = args.length > 1 ? Integer.valueOf(args[1]) : 100; int testW = args.length > 2 ? Integer.valueOf(args[2]) : 512; int testH = testW; CPLayer l1 = new CPLayer(testW, testH), l2 = new CPLayer(testW, testH); System.out .println("Benchmarking layer blend...
31042a83-396a-4b7d-b3fe-2854614c23d8
2
public void pickup() { // by iterating backwards, removing objects won't break the remaining // loop cycles. for (int i = _gumballs.size() - 1; i >= 0; i--) { if (isDownLow(_gumballs.get(i))) { _gumballs.remove(i); } } }
d9f91a21-e30d-4ba5-9d44-655307bfac2f
2
public ArrayList<Resource> getFilled() { ArrayList<Resource> res = new ArrayList<>(); for (Resource r : Resource.values()) if (getF(r) != 0) res.add(r); return res; }
7cace354-5eab-4761-9d48-56b9ffd3df0c
7
public static void Parser_comand(String cmd) { int length_cmd = cmd.length(); StringBuilder aaa = new StringBuilder(); char str; for (int k=11; k<length_cmd-9;k++) { str= cmd.charAt(k); aaa.append(str); } cmd = aaa+""; WritePaymen...
905ffb3c-12c8-4204-86db-d5416a83e012
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...
5d5105d9-f30b-4f2d-85fd-e64ae6a50bd7
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CanDDeliveryOrder other = (CanDDeliveryOrder) obj; if (!Objects.equals(this.szDocId, other.szDocId)) { ...
8ab881da-557c-4a85-b1a2-2472734a4a7d
4
public void mousePressed(MouseEvent event) { JButton source = (JButton) event.getSource(); Point point = buttonMap.get(source); if(!running) { // activate mouse listener when program isn't running if(SwingUtilities.isLeftMouseButton(event)) { lifeModel.changeCell(point.x, point.y, Color.RED);...
2a170bd1-fc82-4d52-a4df-98d1c5be106a
2
private void getMainPage(HttpServletResponse response, UserSession session, Map<String, Object> pageVariables) throws ServletException, IOException { Long userId = (session != null) ? session.getId() : null; if (userId != null) { pageVariables.put("userId", userId); pageVariables...
3cba8262-5e60-4c70-b748-d9dc49908b8b
9
public void move(Direction dir) { double change; if (modify instanceof Player) { change = ((Player) modify).getStats().moveSpeed; } else { change = 1.0; } Level level = modify.getLevel(); switch (dir) { case UP: if (level.tryMove(this, x, y - change)) { y -= change; } break; case DO...
a296637f-66d1-4188-8fb1-39490d1d8074
2
static Type valueOf(int i) { for(Type t: Type.values()) { if (t.val == i) return t; } return null; }
806be8a3-43f2-48d7-9f6d-e6c325a1d354
8
public void processDoneString() { String doneString[] = input.split(" "); String date = IsValidDate.validateDate(doneString[0]); if (!date.equals("") && !date.equals("overdue") && !date.equals("archives")) { // Check Date setDate(date); if (doneString.length == 1) { // Check Empty File String index ...
1711dcfd-a93e-47d3-a2d6-a554195d0ba3
5
public static Complex[] fft(Complex[] x) { int N = x.length; // base case if (N == 1) return new Complex[] { x[0] }; // radix 2 Cooley-Tukey FFT if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); } // fft of even terms Complex[] even = new Complex[N / 2]; for (int k = 0; k ...
b07820aa-5074-4a49-aa45-3a9a2b0b4286
8
public static void printMeanConnectedDistance(double maxDist) { double total = 0.0; double count = 0.0; // double maxDist = 10000; double totalNumCon = 0.0; double countNumCon = 0.0; HashMap<Integer,Double> cLocsX = new HashMap<Integer,Double>(10000); HashMap<Integer,Double> cLocsY = new HashMap<Integer,Do...
226ef719-1933-4eb1-8823-dab120d0c8d1
3
public void displayDbProperties() { java.sql.DatabaseMetaData dm = null; java.sql.ResultSet rs = null; try { con = this.getConnection(); if (con != null) { dm = con.getMetaData(); System.out.println("Información del controlador"); ...
88d64406-bb8b-49cb-b1ec-00946fa1adf3
6
public void setAccButtonPosition(Position position) { if (position == null) { this.buttonAccess_position = UIPositionInits.ACC_BTN.getPosition(); } else { if (!position.equals(Position.LEFT) && !position.equals(Position.RIGHT) && !position.equals(Position.NONE)) { ...
25837903-0d2c-46a0-b82c-f8702931d5ae
8
private void init() { pid = 0; pcluster = 0; pparent = 0; if (parts.length < 4) { LOGGER.error("invalid argument!!!"); } else { for (int i = 0; i < parts.length; i++) { if ("ID".equals(parts[i])) { pid = i; ...
12c50ee0-3b63-459a-ba5b-67e043b2bd16
5
public void act() { // Add your action code here. if (Greenfoot.isKeyDown(" ")){ fire();} if (Greenfoot.isKeyDown("left")){ move(-speed);} if (Greenfoot.isKeyDown("right")){ move(speed);} if (bullet != null) { ...
e018f8cf-80ed-4923-8add-115fb1cc98c1
2
public static void save(Skin skin) { if ((skin != null)) { if (!model.saveSkinToDefaultDirectory(skin)) { showProblemMessage("Main.save: Skin was not saved!"); } } else { throw new InvalidParameterException(); } }
af92dff7-14cf-4b36-9d6f-abce8ddf60c3
9
public ControlImpl(String prefix) { this.name = prefix; this.pid = Configuration.lookupPid(Configuration.getString(prefix + "." + ControlImpl.PROTOCOL)); if (Configuration.contains(prefix + "." + ControlImpl.PAR_INIT_STEP)) { this.initStep = Configuration.getInt(prefix + "." + ControlImpl.PAR_INIT_STEP); ...
c3051cf0-8e16-4192-9a68-b33f98cecfab
4
public static boolean deleteDirectory(File directory) { if(directory.exists()){ File[] files = directory.listFiles(); if(null!=files){ for(int i=0; i<files.length; i++) { if(files[i].isDirectory()) { deleteDirectory(files[i]); } ...
2c50aa37-1829-4d85-919f-28c4721dbe53
4
@Override public void ParseIn(Connection Main, Server Environment) { int ItemId = Main.DecodeInt(); if (ItemId == 4896) { if(Main.Data.Credits < 10) { Environment.InitPacket(68, Main.ClientMessage); Environment.Append(true, Main.Cl...
238dac9f-c8fe-4fc7-8701-9c488c3e4b45
2
public void escribirObjeto (String path, String nom, Object ob) /*throws FileNotFoundException, IOException*/ { File f = new File("./Data/Barrios/" + path); if (!f.exists()) { f.mkdirs(); } f = new File("./Data/Barrios/" + path + nom + ".o"); try{ FileOutp...
b410f540-531f-4bfc-9edb-fb4410bfd44f
1
@Override public int compare(PersonModel lhs, PersonModel rhs) { if (lhs.exp > rhs.exp) { return -1; } else { return 1; } }
7d31bfa3-2bc6-4c75-900e-4c2628c23b2f
0
@Test public void testComplexComputation(){ calculator.pushOperand(3.0); calculator.pushOperand(4.0); calculator.pushOperand(7.0); calculator.pushPlusOperator(); calculator.pushTimesOperator(); calculator.evaluateStack(); assertEquals(33.0, calculator.popOperand(), 0); }
cc065c80-4f60-4629-97cc-e1f8151d9698
7
public Capabilities(CapabilitiesHandler owner) { super(); setOwner(owner); m_Capabilities = new HashSet<Capability>(); m_Dependencies = new HashSet<Capability>(); // load properties if (PROPERTIES == null) { try { PROPERTIES = Utils.readProperties(PROPERTIES_FILE); } ...
cef0b33c-d515-489d-bb70-27d546641133
3
protected void setParams( BasicType[] params ) { if( params == null || params.length == 0 ) { this.params = new ArrayList<BasicType>( 1 ); } else { this.params = new ArrayList<BasicType>( params.length ); for( int i = 0; i < params.length; i++ ) this.params.add( params[i] ); } }
a19b5a17-4e51-454d-b6a1-44aa7cc8ce50
0
public void writeChar(char character) { buffer.deleteCharAt(tapeHead); buffer.insert(tapeHead, character); cachedHash = 0xdeadbeef; }
31321419-ed6e-462a-a611-4c7e6e8119b5
7
public DayRoute GetProbableRoute(String mode) { double groupSel = Math.random()*100; int grpIndex = 0,leftVal=0; ArrayList<DayRoute> groupSet = new ArrayList(); Random routePicker = new Random(); for(Double groupFactor : GroupLoading) { //System.o...
6c9230bf-fd79-4cd0-8207-9fd4614d0c68
2
@Override public double getJoystickAxis(int joystick, int axis) { int numAxes = getNumJoystickAxes(joystick); if (axis < 0 || axis >= numAxes) { return 0.0; } return (double) joystickAxes[joystick].get(axis); }
3a77bcbc-41b2-4b05-8187-afd983b2dad1
5
public void onEnable() { getServer().getPluginManager().registerEvents(getEvents(), this); files.loadConfiguration(); if (!wgClass.checkWorldGuard()) { this.getLogger().info("WorldGuard has not been found. Custom flags cannot be used!"); } if (!wgClass.checkWGCustomFlags()) { this.getLogger().info("WGC...
d716e301-59fd-4911-b1a7-07bd3f647818
7
public Square(char c) { if(c == '#' || c == '.' || c == '$' || c == '*' || c == '@' || c == '+' || c == ' ') { setValue(c); } else { throw new IllegalArgumentException("Invalid square type"); } }
859cff46-088d-4b22-aed2-fda8e32284af
6
public void run() { if (url != null) { // Obtain the results of the project's file feed if (readFeed()) { if (versionCheck(versionTitle)) { String fileLink = getFile(versionLink); if (fileLink != null && type != UpdateType.NO_DOWNLOAD) { String name = file.getName(); // If it's...
2d3473e2-46a5-4468-be70-ec44a35b9157
3
@Override public void caseABooleanType(ABooleanType node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(BooleanType"); inABooleanType(node); if(node.getBoolean() != null) { node.getBoolean().apply(this); }...
54dd7fe0-d829-45c0-aafc-e007c2ccce5b
6
public ListNode removeNthFromEnd(ListNode head, int n) { // Start typing your Java solution below // DO NOT write main() function if (n < 1 || head == null) return null; ListNode newHead = new ListNode(0); newHead.next = head; ListNode cur = head, pre = newHead; while (n > 0 && cur != null) { cur = ...
3f6593b2-4a9c-4687-b373-a5a33cf1658d
8
public double defuzzify() { double result; boolean isValid = this.enabled && !this.fuzzyOutput.getTerms().isEmpty(); if (isValid) { result = this.defuzzifier.defuzzify(fuzzyOutput, minimum, maximum); } else { //if a previous defuzzification was successfully perfor...
f960b717-0a46-47ab-8a8a-218d9119a315
1
@Override public Float getFloatProp(String key, Float value) { Float result = value; String propValue = getProperty(key); if (null != propValue) result = new Float(propValue); return result; }
b51e77dd-ca5b-46cb-90a6-527290d3ce4c
7
private Node divideTree(int left, int right, BoundingBox bbox) { Node node = new Node(); // If too few objects remain, then make this a leaf node. if (right - left <= maxPointsInOneLeafNode) { node.child1 = node.child2 = null; node.leftObjectIndex = left; node.rightObjectIndex = right; // Compute bo...
ada10a3b-491c-4c09-ac2b-959bf85ca344
7
final ItemDefinition method1560(int i, byte i_33_) { if (i_33_ != 97) ((ItemDefinition) this).anIntArray2762 = null; anInt2768++; if (((ItemDefinition) this).anIntArray2762 != null && (i ^ 0xffffffff) < -2) { int i_34_ = -1; for (int i_35_ = 0; i_35_ < 10; i_35_++) { if (i >= ((ItemDefinition) ...