method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1d691fb3-dffd-46b6-85dc-3c67b93728e6
0
public synchronized void beginXmit() { active = true; }
5bf08f0a-fc2b-4316-a099-d1e98bf29d25
4
public boolean sendCarToNextSeg(double requestedPostion) { //check if this road has a next segment set. if (this.getCurrentRoad().getNextSeg(this) != null) { VehicleAcceptor next = this.getCurrentRoad().getNextSeg(this); //now make sure there is space for it and that is will accept it //Syste...
13afca4d-4830-433f-b333-b25089f65475
0
public void setSaleid(String saleid) { this.saleid = saleid; }
af2f128a-e498-4edf-8b1e-be4c3122c9d3
3
@Override public List<String> recvMakeOffer(String serviceName, String seller, String price) { loggerGui.info("[ " + user.getUsername() + "] received make offer packet for service " + serviceName + " from seller " + seller); // update buyer's status (add price to status) String newStatus = StatusMessages....
2a070f5a-a5bd-4d99-a4f8-81552ecd2389
4
public void updateAsScheduled(int numUpdates) { super.updateAsScheduled(numUpdates) ; updateLandingStrip() ; if (! structure.intact()) return ; final Batch <Venue> depots = Deliveries.nearbyDepots(this, world) ; for (Service type : ALL_COMMODITIES) { final int level = exportLevel(type) ; ...
958b1148-ed38-4980-ac9e-208f57a98b9c
1
public static AbstractTableModel get2DBounded(final CSProperties p, final String pname) throws ParseException { String m = p.getInfo(pname).get("bound"); String[] dims = m.split(","); final int rows = DataIO.getInt(p, dims[0].trim()); final int cols = DataIO.getInt(p, dims[1].trim()); ...
f0fc5f4f-3e7c-411a-950d-17c799af2002
7
public void loadFile(String path) throws IOException { String thisLine; // variable to read each line. BufferedReader myInput = null; try { FileInputStream fin = new FileInputStream(new File(path)); myInput = new BufferedReader(new InputStreamReader(fin)); // for each line until the end of the file in...
580e7b47-57df-4f9d-8980-ba8f5898a9fb
1
private void collectInput(final String input) { String n, s; StringTokenizer st = new StringTokenizer(input,"-"); n = st.nextToken(); s = st.nextToken(); if (students.containsKey(n)) { students.get(n).addScore(s); } else { Student student = new Student(n); student.addScore(s); studen...
52e7522d-e3d8-478a-af6a-6d13c74f233e
3
public static boolean isZip(final File file) { FileInputStream fis = null; try { fis = new FileInputStream(file); final byte[] m = new byte[4]; fis.read(m); fis.close(); return (m[0] << 24 | m[1] << 16 | m[2] << 8 | m[3]) == 0x504b0304; } catch (final IOException ignored) { } finally { if (fis...
2f79410d-7c25-4f6a-b683-eb0a60010d3a
4
public ResultSet callCommandGetRow(PreparedStatement _sqlCommand, Connection _con) { //Benchmark time start ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); long startTime; long finishTime; if (_enableSqlMonitor) startTime = threadmxbean.getCurre...
20e5cd0e-ba22-4e12-b599-ffd0580f2932
7
public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof WaterfallBarRenderer)) { return false; } WaterfallBarRenderer that = (WaterfallBarRend...
a64ad551-db9b-406e-ad7d-8a82e4045bc0
9
private boolean crossingInternal(Point2DInt direction1, Point2DInt direction2) { if (angles.size() < 2) { return false; } final double angle1 = convertAngle(new LineSegmentInt(center, direction1).getAngle()); final double angle2 = convertAngle(new LineSegmentInt(center, direction2).getAngle()); Double las...
d02c7d28-1cb7-473d-9437-3fb88b5fe550
6
private final FloatControl getVolumeControl() { Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); Port.Info speakerInfo = Port.Info.SPEAKER; mixerInfoLoop: for (Mixer.Info info : mixerInfo) { Mixer mixer = AudioSystem.getMixer(info); if (AudioSystem.getMixer(info).isLineSupported(speakerInfo)) { Por...
2dd65e1c-24e8-4b98-9808-32bb82db1e19
4
public Deck( Set<DefaultRank> usedRanks, Set<? extends Suit> usedSuits, int numberOfJokers ) { List<Card> deck = new ArrayList<Card>(); for ( Suit suit : usedSuits ) { for ( DefaultRank rank : usedRanks ) { deck.add( new Card( rank, suit ) ); ...
b5262c8d-a926-4899-bbcc-ac88a9317eff
5
public void body() { // wait for a little while // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(GridSim.PAUSE); LinkedList resList = super.getGridResourceList(); // initialises a...
fff12b10-b074-4e1a-9e7d-2a77292d76eb
3
public static String callgraphAlgorithmToString(CallgraphAlgorithm algorihm) { switch (algorihm) { case AutomaticSelection: return "AUTO"; case VTA: return "VTA"; case RTA: return "RTA"; default: return "unknown"; } }
f7f6e452-2894-493d-9db2-c37c6b879935
3
public static void main(String[] args) { Scanner s = new Scanner(System.in); String palin; boolean isPalin = true; System.out.println("Please enter a text that may or may not be a palindrome: "); palin = s.nextLine(); for(int i = 0; i <= palin.l...
3fb5bd70-8072-46f3-a9dd-fb2769d63a66
0
public static void main(String[] args) { // Instantiating New Objects Rectangle rectangle = new Rectangle(50, 75); System.out.println(rectangle.getWidth()); }
1f3bd545-a892-4665-9224-d1f5b11cd778
8
public boolean lastrun(byte col) { /* the board is checked to see if the player * with color 'col' is in lastrun mode. * (the gathering phase of the game) */ boolean lastrun = true; if(col==W) { for(int j=0; j<19; j++) { if(positions[j].getCol()==W && positions[j].getNum()>0) { lastrun = f...
cabc23d8-9131-4a38-966c-22d729dd87e4
3
public Juego() { setTitle("Deep in the shadows"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800, 600); //tamaño del jframe addKeyListener(this); addMouseListener(this); fontPuntajes = new Font("Cambria", 0, 34); cont = 0;//contador de tiempo d...
fa999147-2ebd-4ea7-bd3f-1932bc408f13
1
@Override public void main(String pushedMessages) { try { instructionsToModel.put(name + "-" + pushedMessages); } catch (InterruptedException e) { e.printStackTrace(); } }
afc5c439-dcd8-437b-97d5-a33d04091d9f
5
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jTextArea1 = new javax.swing.JTextArea(); setDefaultCloseOperation(javax.swi...
63a38eaf-e5a7-4b8f-a52f-f34de099fc58
5
@Override public boolean contains(long element) { if (layout.length == 0) { return false; } int currentPos = 0; while (currentPos >= 0) { int rightChildPointer = getRightChildPointer(currentPos); int leftChildPointer = getLeftChildPointer(currentPo...
a93933af-ea40-48b1-8cbd-25227d00b9b5
0
public ConnectOnServerEvent(Object server, ISocketServerConnection clientConnection) { super(server); this.clientConnection = clientConnection; }
7f7f8713-b07e-44f2-88eb-7d8754e1b1df
0
public Grub(Animation left, Animation right, Animation deadLeft, Animation deadRight, Animation standingLeft, Animation standingRight, Animation jumpingLeft, Animation jumpingRight) { super(left, right, deadLeft, deadRight, standingLeft, standingRight, jumpingLeft, jumpingRight); th...
a23b317f-7427-4f59-81e7-809cffadc19f
7
private List<TagNode> findMatchingTagNodes(ITagNodeCondition condition, boolean isRecursive){ List<TagNode> result = new LinkedList<TagNode>(); if (condition == null) { return result; } for (Object item : children) { if (item instanceof TagNode) { ...
4acb4b40-179a-471d-842b-beb5c333eff2
9
private static Cell construct(Sequence s1, Sequence s2, float[][] matrix, float o, float e, byte[] pointers, short[] sizesOfVerticalGaps, short[] sizesOfHorizontalGaps) { logger.info("Started..."); long start = System.currentTimeMillis(); char[] a1 = s1.toArray(); char[] a2 = s2.toArray(); int m = s1....
903ac6c4-37a2-4e19-b6f8-bc03f0d36d78
2
public int compareTo(BinaryTreeNode n) { int diff = this.key - n.key; if (diff > 0) return 1; if (diff == 0) return 0; return -1; }
28df213e-63b8-49ce-a3fd-9525c7b796f6
3
public static boolean isBlank(String text) { if (isEmpty(text)) { return true; } int length = text.length(); for (int i = 0; i < length; i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; }
121350d7-e703-448f-a71b-b86cff51b86e
1
@Override public int getRowCount() { return pu == null ? 0 : pu.size(); }
2de5e1e1-9b47-40db-ba24-03c89b1acd9c
2
public void update(long deltaMs) { if(!sequence.isEmpty()) { sequence.peekFirst().update(deltaMs); if(sequence.peekFirst().finished()) { sequence.pollFirst(); } } }
dc684706-41a6-4c90-9f1f-404ca6d6566f
9
public static Boolean findPlugins(){ File dir = new File(System.getProperty("user.dir") + File.separator + pluginDirectory); ClassLoader cl = new PluginClassLoader(dir); if (dir.exists()) { if(dir.isDirectory()){ String[] files = dir.list(); for (int i=0; i<files.length; i++) { try { if (! f...
74658e1e-8c62-4a35-a3f9-f920ad2fef21
6
public ModifierMatcher forbidAccess(int accessModif, boolean andAbove) { if (andAbove) { if (accessModif == Modifier.PRIVATE) // This forbids all access. return denyAll; if (accessModif == 0) return this.and(Modifier.PRIVATE, Modifier.PRIVATE); if (accessModif == Modifier.PROTECTED) return th...
564833ef-73db-421b-b3ef-9e0e17ef681d
9
private static char recLetter(int[][] pixels, int leftCol, int rightCol, char expChar) { int[][] matrix = new int[LETTER_HEIGHT][LETTER_WIDTH]; for (int row = 0; row < pixels.length; row++) { for (int col = leftCol; col < rightCol; col++) { if(pixels[row][col] > 0) {...
b3b95a31-18c2-42a7-ac49-8e8b4dd91246
9
@Override public int behavior(int num) { int roll1 = (int) (Math.random() * 6 + 1); int roll2 = (int) (Math.random() * 6 + 1); String message = ECRB.get("DontThinkTheyreDead.player") + (getTargetPlayer().getNumber() + 1) + ECRB.get("DontThinkTheyreDead.message_1") //$NON-NLS-1$ //$NON-NLS-2$ + roll1 + ECRB....
e8abb193-766c-42c3-9c46-1667c5c35ead
5
private ArrayList<ArrayList<String>> getPath(HashMap<String, HashSet<String>> reverseLinks) { ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>(); if(startWord.endsWith(endWord)){ ArrayList<String> tmp = new ArrayList<String>(); tmp.add(endWord); ...
90e74004-4997-4aa4-8a54-67fe96706457
7
public Stardata Fk524(Stardata j2000) { /* Miscellaneous */ double r, d, ur, ud, px, rv; double sr, cr, sd, cd, x, y, z, w; double v1[] = new double[6], v2[] = new double[6]; double xd, yd, zd; double rxyz, wd, rxysq, rxy; int i, j; /* Radians per year t...
8a45761f-20b2-4307-b4f7-38fe890be00f
2
@Override public void add(Client element) { //Добавляем запись в список getList().add(element); Statement statement = null; ResultSet result = null; try { //Создаем изменяемую выборку statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_S...
779b0bd0-bde7-416b-8e9f-564887f24587
0
public void sort(int [] arrs) { sort2(arrs,0,arrs.length-1); }
63f161a1-477e-4210-8b92-b66bb6ec3ce2
6
public void setAgents(Vector agents) { this.agents = agents; // Recalculate the graph space angle incase we need it, // and adjust the number of Agents where appropriate. if (numberOfAgents != agents.size()) { numberOfAgents = agents.size(); ...
bd911c17-0a64-4293-aa93-0aa68cd5fbb4
8
public void setOptions(String[] options) throws Exception { String tmpStr; String[] spec; String classname; tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { spec = Utils.splitOptions(tmpStr); if (spec.length == 0) throw new IllegalArgumentException...
87eb3bbf-a512-47b9-ae40-61a8956cd96a
8
public String chessCoordinates(){ String fileValue; switch (file) { case 0: fileValue = "A"; break; case 1: fileValue = "B"; break; case 2: fileValue = "C"; break; case 3: fileValue = "D"; break; case 4: fileValue = "E"; break; case 5: fileValue = "F"; break; case 6...
b5084ad4-5cf2-4cea-b779-f53a2faf97bd
6
public static void main(String[] args) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
db2af17f-d769-4539-9d48-e763b48cd1c2
0
public void setRegExes(String[] regexes) {this.regexes = regexes;}
cac9dea3-66d2-452f-b05d-9ab0776dd58c
4
public void protect(xAuthPlayer xp) { Player p = xp.getPlayer(); if (p == null) return; plugin.getPlyrDtHndlr().storeData(xp, p); xp.setCreative(p.getGameMode().equals(GameMode.CREATIVE)); if (xp.isCreativeMode()) p.setGameMode(GameMode.SURVIVAL); xp.setLastNotifyTime(new Timestamp(System.currentTi...
9e45166e-8552-4035-a1ef-f74bb91c2ed3
2
private void registerPermission(Permission permission) { if (permission != null) { try { this.pm.addPermission(permission); } catch(IllegalArgumentException e) {} } }
5c7586a7-e9d7-441f-9e7a-1feb04f67bf3
8
@Override public int compareTo(NewId other) { if (_a != other._a) return (_a < other._a) ? -1 : 1; if (_b != other._b) return (_b < other._b) ? -1 : 1; if (_c != other._c) return (_c < other._c) ? -1 : 1; if (_d != other._d) return (_d < other._d) ? -1 : 1; return 0; }
cd6333af-3df3-4be7-a63d-7b9d81425343
7
private Item unfoldSCC(Item i, Item from, Map<Item, Set<Item>> scc, Set<Item> current) { if (i instanceof EndItem) { return i; } Pair<Item, Item> p = new Pair<Item, Item>(i, from); Item clone = unfolds.get(p); if (clone != null) { return clone; } if (from == null) { clone = i; } else { ...
dfe7ef4a-ffb3-47ad-b5e5-eb44aa4a9bb8
9
public static void main(String args[]) { Scanner file1 = null, file2 = null; try { // Create a scanner to read the file, file name is parameter file1 = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/prg404a1.dat")); file2 = new Scanner(new File(System.getProperty("user.dir") + "/src/File...
e5207d63-d102-410b-b4e4-69ad133e9b30
2
public int find(Person friend) { for (int i = 0; i < friends.size(); i++) { if (friends.get(i).equals(friend)) { return i; } } // If the person is not found by the end of the friends list return -1; }
c6075acf-865b-4aac-9213-309a5b97745b
4
public boolean equalsContent( Variant other ) { if ( this.mvd != other.mvd || this.data.length != other.data.length ) return false; else { for ( int i=0;i<data.length;i++ ) { if ( this.data[i] != other.data[i] ) return false; } return true; } }
2e0ea4b6-b5bf-4f72-8b04-95fb7901436d
8
private static void populateExecutors(Configuration configuration, Document factory) { NodeList nodeList=factory.getElementsByTagName("executors"); if(nodeList!=null && nodeList.getLength()==1){ Element element=(Element)nodeList.item(0); NodeList executors=element.getElementsByTagName("executor"); if(ex...
02ceda3f-93ca-4014-a993-aef532340358
6
public Coordinate discoverAndPrintRoute(int locX, int locY){ boolean[][] visitedMatrix = new boolean[sizeX][sizeY]; Stack<Coordinate> route = new Stack<Coordinate>(); route.push(new Coordinate(locX, locY)); Coordinate ePoint = discoverEndPoint(locX, locY, visitedMatrix, route); System.out.println("\n\nRoute :...
bddddf8b-5add-46d1-9ff0-ebc8f0ade73b
8
private boolean checkHealth1(Node node) { boolean ok = false; java.net.Socket socket = null; try { socket = new java.net.Socket(node.getHostname(), node.getPort()); if (!node.isOptionsEnabled()) { ok = true; } else { OutputStream os = socket.getOutputStream(); os.write(getRequest(no...
316a65f9-f43d-4c9d-b218-5a0dfbeb2aa6
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PlayerState other = (PlayerState) obj; if (own ==...
3c57628c-bb78-4409-956b-4932c18611c8
4
@Override protected Pizza createPizza(String type) { Pizza pizza = null; PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); if (type.equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.setNam...
35c8af2a-32ba-4f6e-acac-75d2b6a9c10a
8
public static void main (String[] args) { int combos = 0; for (int a = 0; a <2; a++) for (int b = 0; b <=4; b++) for (int c = 0; c <= 10; c++) for (int d = 0; d <= 20; d++) for (int e = 0; e <= 40; e++) ...
ea3a0374-4fc8-4473-843f-3430b465d156
4
public List<String> getModuleKeys(String module) { ArrayList<String> keys = new ArrayList<>(); Enumeration<Object> keyEnum = mPrefs.keys(); while (keyEnum.hasMoreElements()) { String key = (String) keyEnum.nextElement(); if (key.startsWith(module)) { key = key.substring(key.indexOf('.') + 1); if (...
fab50e7e-239e-4cf0-b112-cec830af6e5f
5
@Override public void deserialize(Buffer buf) { int limit = buf.readUShort(); quantities = new int[limit]; for (int i = 0; i < limit; i++) { quantities[i] = buf.readInt(); } limit = buf.readUShort(); types = new int[limit]; for (int i = 0; i < limi...
4e3efcd8-879f-4eea-a466-5356f17a73e2
5
public static Locale parseLocaleString(String localeString) { String[] parts = tokenizeToStringArray(localeString, "_ ", false, false); String language = (parts.length > 0 ? parts[0] : ""); String country = (parts.length > 1 ? parts[1] : ""); validateLocalePart(language); validateLocalePart(country); String...
13c7e619-9d25-45ae-afc9-7aa86e0ecac1
9
public SyntheticAnalyzer(MethodInfo method, boolean checkName) { this.method = method; if (method.getBytecode() == null) return; if (!checkName || method.getName().equals("class$")) if (checkGetClass()) return; if (!checkName || method.getName().startsWith("access$")) if (checkAccess()) return;...
a9d527ef-5fb5-47c8-b38f-cd314680fc8e
7
ValueGrid( GridRange gr, double low, double up, ValueAxisUnit vAxis, double base ) throws RrdException { double grLower = Double.MAX_VALUE; double grUpper = Double.MIN_VALUE; if ( gr != null ) { this.rigid = gr.isRigid(); grLower = gr.getLowerValue(); grUpper = gr.getUpperValue(); } thi...
a5e32c0c-0ceb-4cf9-aaee-b8ef82415538
8
private void btnenvoyerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnenvoyerActionPerformed if (jTextNom1.getText().isEmpty() || jTextAdresse.getText().isEmpty() || jTextAdresseCP.getText().isEmpty() || jTextAdresseV.getText().isEmpty() || ...
f6d8215b-b0a9-46e6-8a59-507c383c41ad
5
@Override public boolean equals(Object other){ if(other instanceof HttpHeaderResponse){ HttpHeaderResponse otherHeader = (HttpHeaderResponse) other; return serverInformation.equals(otherHeader.serverInformation) && date.equals(otherHeader.date) && ...
16d55c61-a04d-463d-ba1a-5727c929aa66
8
public Room prison() { if((prisonRoom!=null)&&(!prisonRoom.amDestroyed())) return prisonRoom; Room myPrison=null; int x=0; if((text().length()>0)&&((x=text().indexOf("<P>"))>0)) myPrison=CMLib.map().getRoom(text().substring(0,x)); if(myPrison != null) { prisonRoom = (Room) myPrison.copyOf(); } ...
9ffadc13-18f0-4395-9c98-9c1d48966fbb
3
public void updateBlockPaint(Graphics g){ Graphics2D g2d = (Graphics2D) g; // Parcous la table des coordonnées du jeu for(int x=0; x < coordonneJeu.getNombreColonne(); x++) for(int y=0; y < coordonneJeu.getNombreRangee(); y++) // Si un Tetrominoe est présent on le pai...
800ff205-ae64-46c5-8cdf-9d23cf206b31
8
public void update(){ if (walking){ anim++; } if (anim > anim_wait * 4){ anim = 0; } int xa=0, ya=0; if (input.up){ ya--; } if (input.down){ ya++; } if (input.left){ xa--; } if (input.right){ xa++; } if (xa != 0 || ya != 0){ move (xa, ya); walking = true; } else { walking = false...
2b111c9f-6d9a-476c-8311-aebb490088af
3
public void put(Key key, Value val) { if (val == null) { delete(key); return; } for (Node x = first; x != null; x = x.next) if (key.equals(x.key)) { x.val = val; return; } first = new Node(key, val, first); N++; }
bd8ce59c-c16a-4b4f-9cd8-f88415028db0
3
public void listLogradouros() { facesContext = FacesContext.getCurrentInstance(); requestContext = RequestContext.getCurrentInstance(); logradouro.setLog_bairro_id(bairro); try { listaLogradouro = genericDAO.searchObject(Logradouro.class,"logradouro", null, null, ...
36e7c7bc-5e05-4437-90fb-7edaac557e01
9
public void playGame() { playerNumber = 0; playerLocation = 0; int increment = 1; // used for skipping a player if they do a suggestion boolean humanPlayer = false; //System.out.println("in playGame"); Card roomCard, personCard, weaponCard; while(true) { if(gameControlPanel.getNextButton()) { ...
9c2aa314-7436-489e-b26b-e185fad004ba
3
@Override public boolean createTable(String query) { Statement statement = null; try { if (query.equals("") || query == null) { this.writeError("SQL Create Table query empty.", true); return false; } statement = this.connection.cre...
1ca0284b-b0cc-4f9a-97ff-9c48ca82d2f2
6
private CreditCardReceipt updateRecurringPurchaseHelper( PeriodicPurchaseInfo periodicPurchaseInfo, CreditCard creditCard, String storageTokenId, VerificationRequest verificationRequest, PurchaseCardRequest purchaseCard) { if (periodicPurchaseInfo.getPeriodicTransactionId() ...
db8e87fe-18a9-4639-a1fa-68f511374805
3
public synchronized void update(long elapsedTime) { if (frames.size() > 1) { animTime += elapsedTime; if (animTime >= totalDuration) { animTime = animTime % totalDuration; currFrameIndex = 0; } while (animTime > getFrame(currFrame...
2e9a1612-dd4a-4c1b-b074-86d2bbd6f038
5
public void run() { long start = System.currentTimeMillis(); long sleepTil = start; while(System.currentTimeMillis() - start < duration && !stop) { sleepTil += interval; try { sleep(sleepTil - System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); } if (!st...
58d4e149-22eb-4fd1-957c-eedc967f2bdc
0
public JButton getjButtonSauvegarder() { return jButtonSauvegarder; }
e16d77ea-cbb6-4df9-81b9-0bd395c32623
1
boolean EvaluateVote() { int sum = 0; for(int i : votes) { sum += i; } boolean resultVotation = sum > 0; return resultVotation; }
2abea2dd-5828-4ebe-b5f1-7b808e1dfc95
2
public void testGJCutover() { DateTime dt = new DateTime("1582-10-04", GJChronology.getInstanceUTC()); try { dt.dayOfMonth().setCopy(5); fail(); } catch (IllegalFieldValueException e) { assertEquals(DateTimeFieldType.dayOfMonth(), e.getDateTimeFieldType()); ...
844b9a2a-f4e5-43a6-8d77-6daa3e137f88
2
public String BuildString(World world, int x, int y, int z) { if (world.getBlockAt(x, y, z).getState() instanceof Sign) { if (string.length() > 0) { string.delete(0, string.length()); } string.append(world.getName()); string.append(":"); ...
37ae3a44-146b-4c35-8043-3d60b427940b
8
public boolean containsValue( Object val ) { byte[] states = _states; V[] vals = _values; // special case null values so that we don't have to // perform null checks before every call to equals() if ( null == val ) { for ( int i = vals.length; i-- > 0; ) { ...
a0bd28c0-a79b-47f3-b715-c53453d1b897
3
@Override public boolean onMouseDown(int mX, int mY, int button) { Iterator<IGameScreen> it = screens.iterator(); while(it.hasNext()) { IGameScreen screen = it.next(); if(screen.onMouseDown(mX, mY, button)) { return true; } } ...
bd208c58-ea53-482c-9aa1-8166af0e696b
0
public void setIsWaiting(boolean isWaiting) { synchronized (gpm.getThreadStates()) { gpm.setThreadState(id, isWaiting); gpm.getThreadStates().notify(); } }
2dc4a66d-5e57-4ac7-a3de-2933ed5d7015
3
public static void xmlToHtml(File xmlFile, File xslFile, File htmlFile, Vector params) { InputHandler inputHandler = new InputHandler(xmlFile, xslFile, params); try { if (!htmlFile.exists()) { // htmlFile.getParentFile().mkdirs(); if(htmlFile.createNewFile()){ ...
c994102a-6369-435a-9492-65f77b0d4078
5
private GameText(String string, String string_7_, String string_8_, String string_9_) { try { languageText = new String[] { string, string_7_, string_8_, string_9_ }; } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929 (runtimeexception, ("va.<init>(" + (s...
b43f2a24-7578-43ee-b270-e514679a3221
8
private void handleGameInput() { while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == KeyPress.PAUSE.getKeyID()) { GameState.pauseUnpause(); } else if (Keyboard.getEventKey() == KeyPress.FIRE.getKeyID()) { Vector direction = this.getMousePositionInGame(...
28848531-eeff-4a2b-9af5-0f6b6ede3e6f
5
public void insertPath(Tree<FileNode> t, QueueList<String> filePathQueue) throws InvalidOperationException{ // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Implement this method. Hint: You will need to use // recursion, at each step dequeuing the next path and then // searching to see if the directory ...
c44195e2-facf-4498-a436-68d043f1dbc3
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
c8dfdcd8-21c6-43d6-bc82-fc34db377ffb
9
public void BasicSpaceReasoning(int changeX, int changeY){ //功能: //找到当前激活强度最高和次高的节点,然后将激活强度最高的节点的位置属性值根据次高节点的位置属性值进行修改 //找到激活强度最高和次高的节点的激活强度 int low; int high; //先找high int imagespacesize=imagespace.size(); high=imagespace.get(0).ActivatedLevel; low=imagespace.get(0).ActivatedLevel; for(int i=0;i...
b0663ad8-4d63-4058-bcc3-a598b00dc3b1
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...
1610f681-abe2-4e9a-9e7f-4505ffbf3e01
2
public boolean shipHitAsteroid() { for (MoveableObject asteroid : asteroids) { if (asteroid.contains(ship.position)) { return true; } } return false; }
8cf638a2-6baa-4827-9c95-c2cb0572c2ce
1
public Symbol insert(String name) throws RedeclarationError { if (table.containsKey(name)) { throw new RedeclarationError(new Symbol(name)); } Symbol symbol = new Symbol(name); table.put(name, symbol); return symbol; }
decc2407-90f8-4f32-827b-c190191deba0
8
public int[][] makeMove(Player player, Position startPos, Position destPos) throws PlayerNotActiveException, IllegalPieceMovementException, GameNotRunningException { if (state != RUNNING) { throw new GameNotRunningException(); } if (player != activePlayer) {...
e3bba904-460e-436e-b00b-78bbdd81e2ca
0
public String getDescription() { return description; }
f793e17d-2ff5-4b10-a343-db727fab68dc
0
public void setSoundPaths(ArrayList<String> soundPaths) { SoundPaths = soundPaths; }
03f0a5ba-4769-4373-9106-cf8fce9683d2
2
public static ArrayList<QuizCreatedRecord> getCreatedQuizByUserID(int userID) { ArrayList<QuizCreatedRecord> records = new ArrayList<QuizCreatedRecord>(); String statement = new String("SELECT * FROM " + DBTable + " WHERE userid = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(st...
07eddca0-f689-47d7-b758-a0468962572c
1
public AnnotatedWithType( Class<? extends Annotation> annotationType ) { this.annotationType = annotationType; }
4fc7564c-4134-4734-883e-3577b0cddf42
3
public Production[] revealObjectProductions(Object object) { Production[] p = (Production[]) objectToProduction.get(object); if (p == null || p.length == 0) { // There are no productions! JOptionPane.showMessageDialog(convertPane, "There are no productions for that object!"); return null; } if (al...
11bd6ef0-f5e9-4bae-9926-1a1394232ce0
5
public NumericViewer(Setting s) throws Exception { super(s); if (s.getType().isInteger()) { int val = s.getValue().getInt(); int min = Integer.MIN_VALUE; int max = Integer.MAX_VALUE; if (s.getMax() != null) { max = s.getMax().getInt(); } if (s.getMin() != null) { min = s.getMin().getInt();...
a0b0a7af-c8ae-4f43-8c77-7fb4d8ae983f
8
private void expression(){ simple(); while( is(TK.EQ) || is(TK.LT) || is(TK.GT) || is(TK.NE) || is(TK.LE) || is(TK.GE)) { if( is(TK.EQ) ) gcprint("=="); else if( is(TK.NE) ) gcprint("!="); else gcprint(tok.string); scan(); simple...
50660e8d-6e04-4c0e-81d9-729cf07288c6
7
private Set<String> getLockingPids(String mountpoint) { List<String> lines = new ArrayList<>(); ProcessBuilder task = new ProcessBuilder(new String[] { "lsof", "-F", "p", "+D", mountpoint }); task.redirectErrorStream(true); // Channel errors to stdOut. task.redirectInput(Redirect.INHERIT); try { Proc...
2bc9b742-dbf9-4801-8a80-f497917ffb0d
0
public IntDataType getTimeInterval() { return timeInterval; }