method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fa44e191-4e92-4f04-b2a2-4650aff19a46
0
public void deleteComboBox(String name) { invite.removeItem(name); }
7827190f-4f84-46cf-8248-63e8cbcaf474
9
@Override public void keyPressed(KeyEvent e) { if (e.getSource() == content) { int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_W: game.getPlayer().jump(); break; case KeyEvent.VK_S: downDown = true; break; case KeyEvent.VK_A: leftDown = true; break; case KeyEvent.V...
dadf5214-3ebb-4999-a581-fefd34aafb5e
3
private void rebootDataSet() throws SQLException { switch (getLastQueryType()) { case ALBUMSEARCH: model.setBank(getAlbumsByAny(getLastQuery()).toArray()); System.out.println("ALBUMSEARCH = " + getLastQuery()); break; case BOOKSEARCH: model.setBank(getBooksByAny(getLastQuery()).toArray()); System.o...
99fd18f0-c61e-4cae-86b2-1e852a5594c1
1
private static Class getClassObject(String name) throws ClassNotFoundException { if (useContextClassLoader) return Thread.currentThread().getContextClassLoader() .loadClass(name); else return Class.forName(name); }
5449aa03-2dbc-4f01-a9d7-9d0da4866728
7
private String useTbondVariables(String s, int frame) { int n = model.getTBondCount(); if (n <= 0) return s; int lb = s.indexOf("%tbond["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; TBond bond; while (lb != -1 && rb != -1) { v = s.substring(lb + 7, rb); double x = parseMath...
16760639-df89-47e5-aea4-81b6ef6e8bf0
1
public void push(Locale Locations) throws Exception { // Check for stack overflow. if (topPtr > 0) { topPtr = topPtr - 1; arr[topPtr] = Locations; } else { // TODO: Throw an overflow exception. throw new Exception(); } }
0917a080-b027-4036-aafa-9792191461fc
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (username == null) { if (other.username != null) return false; } else if (!username.equals(other.username)) ...
d8ecb78d-17c2-4653-95fa-56f368d867d0
4
private void verifyWithBorder(Integer[] delta) { if (this.x < this.minBorder || this.x > this.maxBorder || this.y < this.minBorder || this.y > this.maxBorder) { System.out.println("Cannot move when the position is " + this.toString()); this.x -= delta[0]; this.y -= delta[1]; } }
84323708-49d7-4edc-8d24-4d9b1e8895e9
1
public void hputbuf(int val) { int ofs = offset; buf[ofs++] = val & 0x80; buf[ofs++] = val & 0x40; buf[ofs++] = val & 0x20; buf[ofs++] = val & 0x10; buf[ofs++] = val & 0x08; buf[ofs++] = val & 0x04; buf[ofs++] = val & 0x02; buf[ofs++] = val & 0x01; if (ofs==BUFSIZE)...
cb88e251-ed65-4e6b-9d5b-91cda0257ac7
7
static int nextOpcode(byte[] code, int index) throws BadBytecode { int opcode; try { opcode = code[index] & 0xff; } catch (IndexOutOfBoundsException e) { throw new BadBytecode("invalid opcode address"); } try { int len = op...
afb6dba6-84cb-4029-a347-2343c128f1f8
2
public int[] getStrategyRanking() { StrategyRanker[] temp = new StrategyRanker[numStrategies]; int[] ranking = new int[numStrategies]; for(int i = 0; i < numStrategies; i++) { temp[i] = new StrategyRanker(i, averageScoreStrat[i], averageEncountersStrat[i]); } Arrays.sort(temp); ...
0b0bac38-981a-403d-9454-3e8380aad16e
6
public VentaDia getVenta() { Connection connection = null; Statement stmt = null; ResultSet rs = null; try { connection = pool.getConnection(); stmt = connection.createStatement(); rs = stmt.executeQuery("select curdate(...
4c6898e9-addb-44c3-98fb-f5ce9da7da39
0
public void mouseExited(MouseEvent e) { }
ab45454a-fea6-4380-a0f1-bb49b14ca8d5
6
private SyntaxTree statementSequence(){ SyntaxTree node = this.statement(); SyntaxTree node2 = node; TokenType.Element type = this.currentToken.getType(); while( type != TokenType.Element.NONE && type != TokenType.Element.END && type != TokenType.Element.ELSE && type != TokenType.Element.UNTIL ){ S...
0d32c3d4-02b3-4f82-aacc-0f303198adb6
3
private void addCraftable(Craftable c) { DebugLogger.log("Adding Craftable: "+c.getName(), logging); if (itemMap.containsKey(c.name)) //it exists as material { Material oldMaterial = (Material) itemMap.get(c.name); //hold old data itemMap.put(c.name, c); //replace data //update the items the ...
efe8240b-cc40-4fd5-8f7c-538f653655a4
1
public boolean write(byte[] content, int postition){ try { file.seek(postition); file.write(content); } catch (IOException e) { e.printStackTrace(); return false; } return true; }
5481bbab-59a4-4a77-8824-3a91ad8e55e5
9
boolean checkOrientCWSeq(Vertex last, Vertex prev, Face face) { System.out.println("checkOrientCWSeq"); System.out.println("last = " + last.index); System.out.println("prev = " + prev.index); System.out.print("face = "); face.printVertices(); if (last.equals(face.verts[0])) { if (!prev.equals(face.verts[1]))...
1ffa12b6-25bf-4df0-979f-a4d2b92ad5f5
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 64 // do, line 66 v_1 = cursor; lab0: do { // call mark_regions, line 66 ...
9c8232e8-71c8-4287-854a-4270c1a63894
8
private void buildUnorientedGraph() { // a térkép minden PathTile-jának és EndTile-jának megkeressük a szomszédait for (Tile[] row: map) for (Tile t: row) { if (t.getType().equals("PathTile")) { // t szomszédai a t melletti PathTile-ok/EndTile HashSet<Tile> tNeighbours = getNeighbours(t); for ...
cd276b6f-ed19-41b0-9468-710d6007ea61
9
@Override public boolean equals(Object otherAsObject) { if (this == otherAsObject) { return true; } if (otherAsObject == null) { return false; } if (getClass() != otherAsObject.getClass()) { return false; ...
8bc6d380-9497-43fb-aa18-17c906cb1185
0
public ConcreteDecorator (Component component) { super(component); }
d1a49b35-17f8-4667-b9a5-3a1d8cc84bf5
7
public int moreRecentThan(Plugin plugin) { if (this.version == null) { return 1; } if (plugin.getVersion() == null) { return -1; } String[] v1Decomp = formatVersion(this.version).split("\\."); String[] v2Decomp = formatVersion(plugin.getVersion())....
c03769e6-33cd-4764-90ba-3afff0429800
8
protected Action updateAction(Action action, String name, String icon, String accel, Character mnemonic) { Action result; // did we already update that action for another component? if (action == null) { result = m_Actions.get(name); return result; } result = action; i...
dbaa0c95-cb89-4dff-9009-750b77fa5700
8
@Command(cmd = {"ftc", "fairytailcraft", "ft", "fairytail"}, firstArg = {"", "help"}) public boolean returnInfo(CommandSender sender, String cmd, String[] args) { if (sender instanceof Player) { Player sent = (Player) sender; if (Util.hasPermission(sent, "fairytail.general")) { ...
d2bbef80-1dbb-4bd0-8279-cb8d2916c800
8
public int getMissingInt(int[] in) throws Exception { // figure out the min value, max value, and whether zero is present int minVal = Integer.MAX_VALUE; int maxVal = Integer.MIN_VALUE; int arraySum = 0; boolean zeroFound = false; for (int i = 0; i < in.length; ++i) { if (in[i] > maxVal) maxVal = in...
3e423809-aa18-476b-861a-f8aa9662f7e4
9
public Data(String line) throws ParseException { String[] split = line.split("`"); // ID id = Integer.parseInt(split[0]); // Tweet ID split[1] = split[1].replace("*", ""); tweetId = Long.parseLong(split[1]); // Time ...
18c2a01c-6466-48db-8453-13883f09a2d9
3
public static void insertionSort(ArrayList <Employee> employee) { int i,j; for(i = 0; i < employee.size(); i++) { Employee temp = employee.get(i); j = i - 1; while (j >= 0 && employee.get(j).getLastName().compareToIgnoreCase(temp.getLastName()) > 0) ...
71534e80-2be1-4bc6-9e39-b93bb0e882df
1
private void moveCamera() { SimpleVector oldCamPos=camera.getPosition(); SimpleVector oldestCamPos=new SimpleVector(oldCamPos); oldCamPos.scalarMul(9f); SimpleVector carCenter=car.getTransformedCenter(); SimpleVector camPos=new SimpleVector(carCenter); SimpleVector zOffset=car.getZA...
4edc8dd1-cb37-45c7-aef2-27f8d082bc43
2
public boolean isDataFlavorSupported( java.awt.datatransfer.DataFlavor flavor) { // Native object if (flavor.equals(DATA_FLAVOR)) return true; // String if (flavor.equals(java.awt.datatransfer.DataFlavor.stringFlavor)) return true; // We can't do anything else return false; } // end is...
3e6f22c8-2d07-4094-8d57-22aabc95642c
5
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals("SAVE_GRAPH")) { String fileName = chooseFile(); if (fileName == null) return; if (!Utilities.getExtension(fileName).e...
5b533e6c-d5ab-4152-b499-503bc3aa81e5
8
private void newBrowserPerPercentage(String iePercentage, String firefoxPercentage, String chromePercentage, int testCaseCount, String onGrid) throws Exception { log.info("Setting up browser per percentage: ie=" + iePercentage + " firefox=" + firefoxPercentage + " chrome=" + chromePercentage + " test ca...
a5c9ebf2-0922-4e80-8a16-a45c15d53b51
4
public void setPixel(int x, int y, int color) { if (x < 0 || x >= width || y < 0 || y >= height) { throw new RuntimeException("That escalated quickly..."); } pixels[x + y*width] = color; }
2ad394c0-e883-42ea-ac0f-1d12129c77b6
8
public String toString(){ if(color == 0) return "R"; if(color == 1) return "G"; if(color == 2) return "B"; if(color == 3) return "L"; if(color == 4) return "D"; if(color == 5) return "P"; if(color == 6) return "X"; ...
26881e4c-6e84-4f0a-9a67-fee34a1f879e
0
public String getAuther() { return this.auther; }
fef9c0ec-bb44-4a23-a0d0-ad6e82f65348
7
private static void checkProperty (String id, XMLReader producer, Object newValue) { int state = 0; try { Object value; // align to longest id... final int align = 20; for (int i = align - id.length (); i > 0; i--) System.out.print (' '); System.out.print (id); System.out.pr...
b57790eb-f1ef-4735-843f-3b1a02ff1965
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...
f423f329-6b32-4d98-a47b-7ab50a728cf2
4
private void calculate(){ int cellstate = 0; for (int v = 0; v < neighbors.length; v++){ if(v == 4){self = neighbors[v];}else{if(neighbors[v]){cellstate += 1;}} } if(self){active = survives[cellstate];} else{active = born[cellstate];} }
04dd0f8a-3b7e-4eaf-ab6b-ce37ae944b38
2
public static void main(String[] args) { int count = 0; Set<String> words = new HashSet<>(); @SuppressWarnings("resource") Scanner input = new Scanner(System.in); String str; while (!(str = input.nextLine()).equals("")) { count++; words.add(str); } System.out.println(". . ."); System.out.println...
e7b797d1-baa6-4137-a5fc-60bf546c92e1
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = (User) request.getSession().getAttribute("user"); try { String nickname = request.getParameter("nickname"); String typeStr = request.getParameter("type"); ...
a2747a53-1099-40a3-b3a0-509507dd036d
1
public void addAllNonUnitProductionsToGrammar(Grammar oldGrammar, Grammar newGrammar) { Production[] productions = getNonUnitProductions(oldGrammar); for (int k = 0; k < productions.length; k++) { newGrammar.addProduction(productions[k]); } }
15cd960b-95e6-4e59-a91a-a3a3c03b6468
0
@Column(name = "NOV_UNIDAD") @Id public String getNovUnidad() { return novUnidad; }
d731acd5-5fbb-45bf-9613-03d05e809b51
6
private int writeJumpPointer(BufferedWriter bw, int curAddress, int end) throws Throwable { for(;rom.type[curAddress] == ROM.DATA_JUMPPOINTER && curAddress < end;curAddress+=2) { addLabel(bw, curAddress); String dataString = "$"+Integer.toHexString(((rom.data[curAddress]&0xFF) | ((rom.data[curAddress+...
f9889650-cb63-4957-9556-d4f2c7b44738
9
public static void main(String[] str) throws IOException { BufferedReader br = new BufferedReader(new FileReader("words.txt")); List<String> anagrams = new ArrayList<>(); String line = br.readLine(); String[] words = line.split(","); SIZE = words.length; for (int i = 0; i < SIZE; i++) { for (int j = 0; ...
09bfda61-c430-4597-85c2-c2594dd1c77c
6
public static boolean runStressTest(String[] args) { if (args[0].equals("-s")) { if (args.length > 3) { try { widthFactor = Integer.parseInt(args[1]); heightFactor = Integer.parseInt(args[2]); iterations = Integer.parseInt(a...
99a2f2c8-9161-4c6b-b19e-14699898254d
6
public void startAndRegisterClientToMBusServer(){ MBusConfiguration.initConfig(); MBusConfiguration.initializeClientQueue(); ServerSocket clientSocket = null; try { clientSocket = new ServerSocket(this.onlineClientPort); this.registerOnlineClient(); } catch (IOException e) { System.err.println("MBus ...
4bfd6ac5-10b0-4ad4-aee8-312362e4491f
0
@Size(min = 2, max = 20) public String getImie() { return imie; }
0abd793a-c839-4369-9867-b6f4aab7ad0a
2
public int getInt(int index) throws JSONException { Object object = get(index); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONExceptio...
62f358b0-076e-4580-be83-7459560e92f6
2
@Override public void finalize () { try { selector.close (); } catch (IOException e) { } try { super.finalize (); } catch (Throwable e) { } }
af0e1177-2c17-49dc-ad4e-f303ca076c31
1
private ParseTree convertNode(Tree ast) { ParseTree parent = new ParseTree(); parent.value = ast.toString(); parent.attribute = EsperCompiler.getTokenName(Integer.parseInt(Integer.toString(ast.getType()))); for (int i = 0; i < ast.getChildCount(); i++) { parent.children.add(convertNode(ast.getChild(i)));...
d359544e-ff2f-4b47-bf7e-f5702e7396ea
2
public Object readWrite(String key) { Object value = null; System.out.println("1.首先开启读锁去缓存中取数据"); rwLock.readLock().lock(); try { value = map.get(key); if (value == null) { System.out.println("2.数据不存在,则释放读锁,开启写锁"); rwLock.readLock()...
67b37cd2-81c1-4c84-a4ef-e443c903d111
0
public String getPreNote() { return preNote; }
c92d1539-16c0-4081-a242-56d14022e809
7
public void sortAndCountOpti(int []array, int lowIndex, int highIndex){ if(lowIndex==highIndex) return; int midIndex = (lowIndex+highIndex)/2; this.sortAndCountOpti(array, lowIndex, midIndex); this.sortAndCountOpti(array, midIndex+1, highIndex); int i = lowIndex; int j = midIndex+1; int n = i;...
f89fb826-0db4-44a1-9d88-74e92e21d017
6
@EventHandler public void SpiderHarm(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSpiderConfig().getDouble("Spider.Harm.Dodge...
030c7db4-b1c3-492a-be1f-af2f239695e3
1
public StateMenu() { makeFinal = new JCheckBoxMenuItem("Final"); makeFinal.addActionListener(this); this.add(makeFinal); makeInitial = new JCheckBoxMenuItem("Initial"); changeLabel = new JMenuItem("Change Label"); deleteLabel = new JMenuItem("Clear Label"); deleteAllLabels = new JMenuItem("Clear Al...
2f717e9b-faef-40a3-8b62-7ef4779ad67b
0
protected String getProperty(final String key) { return props.getProperty(key); }
a91aeb9d-9f66-4d8a-a166-50fa4e6f0f30
8
@Override public void onLockFile(String path, long byteOffset, long length, DokanFileInfo arg3) throws DokanOperationException { try { FileHandle handle; synchronized (handles) { handle = handles.get(arg3.handle); } if (handle == null) throw new DokanOperationException(net.decasdev.dokan.Wi...
9aacb357-afa6-41c0-8910-2125217b9306
0
void showWin() { Dialog d; (d = new Dialog(f, true)).addWindowListener(new CloseWindow(d)); ((Button) d.add(new Button("恭喜過關"))).addActionListener(new CloseWindow( d)); d.pack(); d.show(); }
473c71b7-d28d-49ca-9148-1bba29c968f2
1
public static void main(String[] args) { double c = MetNumericos.horner(3, new double[]{0, 3, 2, 5.2}); System.out.println("horner: " + c); // 167.4 final Double[] deNewton = MetNumericos.polinomioDeNewton(new Punto[]{new Punto(0, 0), new Punto(1, 2), new Punto(3,4)}); ...
8379b968-93ed-499c-ab67-d179306c102f
0
public void setFoo2(T2 foo2) { this.foo2 = foo2; }
e094a582-d4a2-44da-96b9-aded4cee5df1
1
@Override public void killHost(Host host) { try { SimulationHandle simulationHandle = getRemoteHandle(host); simulationHandle.die(); } catch (CommunicationException e) { logger_.warn("{}:{} is already killed.", host, host.getPort()); } }
fe38cdbb-df22-4257-bd50-13690d954a92
9
@Override public boolean forward(SliceIntArray source, SliceIntArray destination) { int srcIdx = source.index; int dstIdx = destination.index; final int[] src = source.array; final int[] dst = destination.array; final int w0 = this.width >> this.levels; final int ...
b4dd96f7-56c5-49b9-a572-32632dd957c8
7
public void run() { while(running) { ArrayList<Connection> connectionsCopy = new ArrayList<>(connections); for(Connection conn : connectionsCopy) { try { if(conn != null) { String data = ""; while(conn.in.ready()) { data += conn.in.readLine(); } if(!data.isEmpty()) ...
e90b9337-4485-47b5-9467-c07f0c9558d0
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
272371a5-dbfa-461b-a026-7d6957f8c844
8
private int getPrimitiveSize(int type) { if ((type & ARG_FLOAT) != 0) { return 4; } else if ((type & ARG_INT) != 0) { return 4; } else if ((type & ARG_BYTE) != 0) { return 1; } else if ((type & ARG_CHAR) != 0) { return 2; } else if ((type & ARG_BOOLEAN) ...
3da12830-bf8d-41db-b13f-39189ddfe919
9
private void balaTurn() { // 3% Chance a new Bala Ant is added to the linked list every turn randNum = RandomNumGen.randomNumber(1, 100); if (randNum == 3 || randNum == 6 || randNum == 9) { antAge = 0; antMode = 0; antIsAlive = true; randNum = RandomNumGen.randomNumber(0, 3); ...
a8c3b4d2-4ab6-4528-a308-bee048b65d28
6
private void updateBlocks(float delta) { for(Block b : blocks) { b.update(delta, blockSpeed); if (b.isVisible()){ if(player.isDucked() && b.getRectangle().intersects(player.getRectangleDucking())){ b.onCollision(player); }else if(!play...
6f951643-6370-4aa2-a351-fda2df261bfe
3
public boolean IsKeyTriggered(int keyCode) { if (keyCode >= LOWEST_VK_TRACKED && keyCode <= HIGHEST_VK_TRACKED) return m_keyStatesIsPressed[keyCode - LOWEST_VK_TRACKED] && !m_keyStatesWasPressed[keyCode - LOWEST_VK_TRACKED]; return false; }
655b1c2f-042a-4947-88e5-4d53386f8488
7
protected Integer doInBackground() throws Exception { if (login.getText().isEmpty()) { status.setText("Login isEmpty"); password.setText(""); confirmPassword.setText(""); } else { if (Arrays.equals(password.getPassword(), (confirmPa...
77087b1c-cbe7-40df-8e04-ca2e33922476
1
public String getMFENameVersion() { if (mfeNameVersion == null) { return "Music Feature Extractor (MFE)"; } else { return mfeNameVersion; } }
ddf6c818-153d-4d7b-b759-adaddade30d4
8
public void update() { super.update(); if (Game.game.server != null) { time = (time > 1000000000) ? 0 : time + 1; if (time % 60 == 0) { nx = (rand.nextInt(3) - 1) * speed; ny = (rand.nextInt(3) - 1) * speed; if (isCollision(x + nx, y)) { nx *= -speed; } if (isCollision(x, ny + y)) { ...
bea7143f-a8ab-409c-98de-29f3f04fd81c
4
private void checkEmployeeID() { if(employeeField.getText().length() > 0) { try { int employeeID = Integer.parseInt(employeeField.getText()); if(employeeID > 0) { if(employeeID < ReadFromFile.getNumberFromFile("employee.txt")) { Employee [] checkEmployees = ReadFromFile.findAllEmployeeData(); ...
309bb1e6-e338-4583-b41f-64e40bd80991
4
private String subEdit(String retval, String pattern, String value, Pattern p) { int pos = retval.indexOf(pattern) + pattern.length(); if (retval.charAt(pos) == '}') { return retval.replace(pattern + "}", valueOf( value )); } if (retval.charAt(pos) == ':') { int endpos = retval.indexOf('}', pos); S...
2291a34b-81d6-4312-95f1-b78cab57ebdb
8
private static boolean validLinePath(Node a, Node b) { /* float angle = -(float) Math.atan2(b.getX() - a.getX(), b.getY() - a.getY()); float dx = (float) -(Math.cos(angle - Math.PI / 2)); float dy = (float) -(Math.sin(angle - Math.PI / 2)); System.out.println(dx + ", " + dy); ...
f8afad3b-8c99-4e35-87ff-49cf382242f8
8
public void testValidEdge1a() { try { TreeNode tree = new TreeNode("tree", 1); tree.setBranch(new TreeNode[]{ new TreeNode("leaf") }); TreeNode subtree = new TreeNode("subtree"); setTree(tree); TreeNode realTree = ((Question1)answer); ((Que...
1afe9431-f4e4-458e-b241-4077f1005bf6
9
private synchronized void updateImage(int width, int height) { image = createImage(width, height); int w = width - (leftMargin + rightMargin); int h = height - (topMargin + botMargin); if (w <= 0 || h <= 0) return; if (xmin >= xmax || ymin >= ymax) return; xscale = (double) w / (double) (xmax - xmin);...
b77f2721-9a5e-4b20-9074-d8f971fd133e
4
private void aniadirCitaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aniadirCitaActionPerformed // TODO add your handling code here: CitaCompleta aC = new CitaCompleta(); boolean antiErrores= !( (aC.extraerAsunto().length()>0) & (aC.extraerHoraFin().diferenciaHoraria(aC.extraerHoraI...
28ace5ff-ebdb-4b2a-a8b5-2f5673159d42
1
@Override public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException { if(pObject instanceof String) { return new ExplicitStringSerializer(); } else { return super.getSerializer(pConfig, pObject); } ...
13ab3273-48dd-4e1c-8128-8f4fb2d72c15
7
public boolean addShrine(String name, String godName, Location p1, Location p2) { if(name == null || p1 == null || p2 == null) return false; God god = gH.getGod(godName); if(god == null) return false; //sort the points after there max and minimal coord value int maxX, maxY, maxZ, minX, minY, minZ, p1X, p1...
c9e67eeb-d4cb-41b0-93bc-39f8ff64f3a6
8
public void CollapseAllDead(){ // Collapses the roles of any dead characters UpdateProbabilities(); int[] KnownRoles = getKnownRoles(); double[] ProbLive = LivingProbabilities(); boolean repeat = true; while(repeat){ repeat = false; // Generating a random ordering: double[] randArray = new double[...
3a6932b1-6c43-4788-87ff-5be314250db2
4
public static synchronized void userStatusChanged(UserStatus status) { if(status.getStatus() == UserStatus.USER_LOGGED_IN) { usersOnline.add(status.getUser()); if(updateListener != null) { updateListener.userLoggedIn(status.getUser()); } } else if(status.getStatus() == UserStatus.USER_LOGGED_OUT) { ...
c62ef211-e66c-4cc3-b334-33f2d152a2d7
6
private Blob[] getMySQLPackets(DatabaseAccess JavaDBAccess, Blob Packet) { Blob[] MySQLPackets = null; int MySQLPacketsID = 1; int pos = 1, MySQLPacketLength = 0; long PacketLength = 0; byte[] b = new byte[3]; int extra = 0; try { PacketLength = Packe...
b240dcf6-4296-4fb1-aa81-d38cbd0171bd
7
public void handleInput() { // Simple input handling obviously referencing // Keys.class if (Keys.isPressed(Keys.ENTER)) { sfx.get("menuselect").play(); select(); } else if (Keys.isPressed(Keys.LEFT) || (Keys.isPressed(Keys.DOWN))) { if (currentChoice > 0) { sfx.get("menuoption").play(); cu...
646a2f00-ec7b-45aa-8d21-266f32e8a50b
6
public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = ...
fd4f3b93-3734-46a9-a3ab-603359974c00
5
private Integer s_to_int(String s) { if (s.equals("Integer")) { return 0; } if (s.equals("String")) { return 1; } if (s.equals("Date")) { return 2; } if (s.equals("Boolean")) { ...
3371b20d-fa1f-486a-90c3-35dd2b167d9f
8
public ArrayList<Integer> findSubstring(String S, String[] L) { // Note: The Solution object is instantiated only once and is reused by each test case. ArrayList<Integer> results = new ArrayList<Integer>(); int len = 0; for (int i=0; i<L.length; i++) { len += L[i].le...
450e482d-c4e5-4382-9c43-bc45990a3753
6
@Override public final void computeData() { for (Building b : _player.getBuildings()) { switch (b.getType()) { case "water_turbine": _buildings[WATER]++; break; case "wind_turbine": _buildings[WIND]++; ...
bf5a3b2c-c463-499c-a209-2d657885ea28
8
void update(boolean isIndexed, boolean storeTermVector, boolean storePositionWithTermVector, boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads, boolean omitTermFreqAndPositions) { if (this.isIndexed != isIndexed) { this.isIndexed = true; // once in...
b629e927-5448-4b55-818b-d58e37d84ac4
3
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length>1){ String timing = ""; for(String data: args){ if(!data.equals(args[0])); timing+=data+" "; } BansManager.tempBanPlayer(sender.getName(), args[0], timing,command); retur...
9a576bfe-9cd6-42e6-a729-14757e141686
6
public void addHyperSpin(String hyperPath) { if (!(new File(hyperPath + "\\Databases")).isDirectory()) { JOptionPane.showMessageDialog(this, "No HyperSpin databases found!", "Warning", JOptionPane.WARNING_MESSAGE); return; } final File[] hyperList = (new File(hyperPath + "\\Databases")).list...
3ac5e1ce-9955-456c-ad76-eb146f48f65b
9
@Override public void lock(int myId) { while(true) { flag[myId] = true; x = myId; if (y != -1) { flag[myId] = false; while(y != -1) { // no-op() } continue; } else { y = myId; if (x == myId) { return; } else ...
ad6fd088-66fd-41e8-929c-70d99e0464bb
6
public static double asinh(double a) { boolean negative = false; if (a < 0) { negative = true; a = -a; } double absAsinh; if (a > 0.167) { absAsinh = FastMath.log(FastMath.sqrt(a * a + 1) + a); } else { final double a2 = a...
f44843ec-0c19-4653-ad3c-a69bec541c7f
6
public int[] getBlock(AsciiImage img, int x, int y) { int[] brightness = new int[size*size]; //Increment x and y coordinates so we get the bottom right corner of the box x += (size / 2); y += (size / 2); //Starting from bottom right corner we decrement x and y until we reach the...
729b1f81-5982-4a04-9be4-ec6c84cd8820
9
@Override protected Boolean doInBackground () throws Exception { String installPath = Settings.getSettings().getInstallPath(); TexturePack texturePack = TexturePack.getSelectedTexturePack(); String compDir = texturePack.getSelectedCompatible(); ModPack compPack = ...
7f2d443b-82bd-47a7-90aa-e7f736e7151f
2
PatternReference(String reference, int depth) { Pattern pattern = Pattern.compile("([A-Z_]+)\\(([0-9]+|\\-)\\)"); Matcher matcher = pattern.matcher(reference); if (matcher.find()) { String argument = matcher.group(2); if (argument.equals("-")) { this.limit = depth-1; } else { this.limit ...
48635078-bd09-454e-a8b5-b9756ead080e
1
public void visit_dstore(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
e05305ef-ad0d-4802-874f-f507e90ef904
1
synchronized public static org.omg.CORBA.TypeCode type() { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init().create_enum_tc(pgrid.service.corba.repair.IssueTypeHelper.id(), "IssueType", new String[]{"SINGLE_NODE", "SUBTREE"}); } return __typeCode; }
44ce8f7d-85db-44cf-b31c-6805fa4d43b5
7
public void addMenu(JFrame frame) { JMenuBar bar = new JMenuBar(); JMenu menu; JMenuItem item; menu = new JMenu("File"); item = new JMenuItem("Garbage collect"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { System.gc(); System.runFinalization(); }...
6f9c36f6-cc85-4019-997c-524658f8b449
8
@Override public void itemStateChanged(ItemEvent e) { Object sourceBox = e.getItemSelectable(); int indexBox = 0; for (JCheckBox box : listCheckBoxes) { indexBox++; if (sourceBox == box) { break; } } if (e.getSta...
3e2690e8-f15b-4e3e-ae6b-935a4501f850
9
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception { MapleCharacter pl = c.getPlayer(); if (splitted[0].equals("whosthere")) { MessageCallback callback = new ServernoticeMapleClientMessageCallback(c); StringBuilder builder = n...
8dd85e9d-02d1-4ab1-9fb0-74286fdf9ad2
1
public MyKeywordRule( String[] words, IToken token ) { super(new MyKeyrordDetector()); for (String word : words) { addWord(word, token); } }