method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3b2ae304-8371-4103-bff6-27230dd22f47
1
public void leftClick(Tile tile, boolean shift){ if(shift) { } else { select(tile); } }
c1e43ea0-7b25-46ba-af62-bad75c8cd25f
0
@Test public void test_Divide() throws DivideByZeroException { assertEquals("FAILED: test_Divide", simpleObject.divide(4,2), 2); }
e88d96dc-c168-4fd9-b564-f60278238b36
1
public int hashCode() { return myCurrentState.hashCode() ^ (parent == null ? 0 : parent.primitiveHashCode()); }
c4310177-87a8-4356-95fc-6f81967e642b
9
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { log.info("Loading data."); final Map<String, Repository> repositories = DataLoader.loadRepositories(); final DataSet data_set = DataLoader.loadWatchings(); if (args.length > 0) { // Perform...
99a21af6-3870-4b3b-b7fc-6c4059282358
6
protected Object readObject() throws IOException { Field[] objTable = readObjectTable(); Object[] newTable = new Object[objTable.length]; Object obj; for (int i = 0; i < newTable.length; i++) { obj = createObject(objTable[i].id, objTable[i].fields); if (obj == null) { newTable[i] = objTable[i...
f41eb954-58d1-4562-9203-8181e56b6e5d
7
public void generateCode ( ) { // generate the output code for the menus StringBuilder sb = new StringBuilder( 8192 ); StringBuilder sbCode = new StringBuilder( 4096 ); String sLabels = ""; //$NON-NLS-1$ String sMenus = "PROGMEM const char *menu_items[] = {\r\n"; //$NON-NLS-1$ String s; sb.append( "#inclu...
8155f713-223a-4fd9-ae37-4150e379284f
9
static final boolean method2496(int i, int i_9_, boolean bool) { if (bool != true) method2497(null, (byte) -29, null, 73); anInt6396++; if (i >= 1000 && (i_9_ ^ 0xffffffff) > -1001) return true; if ((i ^ 0xffffffff) > -1001 && i_9_ < 1000) { if (NativeLibTracker.method2308((byte) 26, i_9_)) return ...
e45ec665-55c4-4719-8233-68fb3e0b7e43
2
private static void test_itostrx(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { String exp = (String) t.tests[i]; int arg1 = (Integer) t.tests[i + 1]; S...
0b750d55-9d97-4df8-9ff4-5a6cc186eb01
0
@Override public void startSetup(Attributes atts) { // Add this menuItem to the parent menu. Preference pref = (Preference) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2); pref.setValidator(this); }
cb701035-1889-4039-9b52-a434b39cd2e4
6
@Override public String intern(String s) { int h = s.hashCode(); // In the future, it may be worth augmenting the string hash // if the lower bits need better distribution. int slot = h & (cache.length-1); Entry first = this.cache[slot]; Entry nextToLast = null; int chainLength = 0; ...
bb7f862e-84a5-4599-9f6b-19f48a35f986
3
public String getTypeString(Type type) { if (type instanceof ArrayType) return getTypeString(((ArrayType) type).getElementType()) + "[]"; else if (type instanceof ClassInterfacesType) return getClassString(((ClassInterfacesType) type).getClassInfo()); else if (type instanceof NullType) return "Object"; ...
07146397-9521-4257-a1e3-c0f6776939dd
0
private void resetOders() { this.orderTotal = BigDecimal.valueOf(0); this.order=null; this.order=""; this.lastErrors.clear(); }
ddc8081a-9782-4d22-af60-1e9fc15c59ae
4
public static void offset(int x, int y) { xOff = x >= 0 && x <= map.width - fieldWidth ? x : xOff; yOff = y >= 0 && y <= map.height - fieldHeight ? y : yOff; }
f6812396-1ed3-4ca5-8274-931a179f555c
0
public void setRole(Role role) { this.role = role; }
dc003e91-942d-4df7-b899-caa9292dad58
6
public boolean coalesceText(boolean recursively) { final Iterator<Content> it = recursively ? getDescendants() : content.iterator(); Text tfirst = null; boolean changed = false; while (it.hasNext()) { final Content c = it.next(); if (c.getCType() == CType.Text) { // Text, and no CDATA! final T...
4a1dd4fb-d37c-4e70-9c18-1e458fe9cff4
2
public static boolean isTerminalInProduction(String terminal, Production production) { String[] terminals = production.getTerminals(); for (int k = 0; k < terminals.length; k++) { if (terminals[k].equals(terminal)) return true; } return false; }
35073a69-7972-4be2-8344-00c17f3f41fd
7
protected String buildQualifyingClassList(MOB mob, List<CharClass> classes, String finalConnector) { final StringBuilder list = new StringBuilder(""); int highestAttribute=-1; for(final int attrib : CharStats.CODES.BASECODES()) { if((highestAttribute<0) ||(mob.baseCharStats().getStat(attrib)>mob.baseChar...
9f7b58b1-b6af-45d4-97b3-ef0cefe0f19d
3
public List<AsciiPoint> getPointList(char color) { List<AsciiPoint> points = new LinkedList<AsciiPoint>(); for (int x = 0; x < getWidth(); ++x) for (int y = 0; y < getHeight(); ++y) if (getPixel(x, y) == color) points.add(new AsciiPoint(x, y)); ret...
b83fbc0c-522b-42f3-ac54-f2d408f2ea4d
8
public static WavFile newWavFile(File file, int numChannels, long numFrames, int validBits, long sampleRate) throws IOException, WavFileException { // Instantiate new Wavfile and initialise WavFile wavFile = new WavFile(); wavFile.file = file; wavFile.numChannels = numChannels; wavFile.numFrames = numFrames;...
70ced347-cb34-4d8c-b932-7c23332582f7
1
private String getCacheDescription(CacheDefinition cache) { String desc = "@Cache(key=[" + cache.getKey() + "],pool=[" + cache.getPool() + "],expire=[" + cache.getExpire() + "(毫秒)]"; if (StringUtils.isNotBlank(cache.getVkey())) { desc = desc + ",vkey=[" + cache.getVkey() + "]"; } desc = desc + ")"; ...
5a9e9b0c-c589-4f7a-aa6c-df3425834193
2
public BufferedImage scaleBufferedImage(BufferedImage image, Dimension size){ int imageWidth = image.getWidth(); double scalingFactorWidth = (double)size.getWidth() / imageWidth; int imageHeight = image.getHeight(); double scalingFactorHeight = (double)size.getHeight() / imageHeight; if(scalingFactorHeight ==...
3328e5db-b531-4070-afcd-7399a9ab7824
5
public void initDependancies() { if (!setupEconomy() ) { logger.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())); getServer().getPluginManager().disablePlugin(this); return; } setupPermissions(); ...
972fc8ab-ce79-4161-8da5-702f2173a884
4
public Smoothie createSmoothie(String s){ Smoothie smoothie = null; SmoothieIngredientFactory sif = new StoreIngredientFactory(); if(s.equals("Banana")) { smoothie = new BananaSmoothie(sif); smoothie = new Milk(smoothie); return s...
22eeacb9-f961-46a7-9f36-cea928e9ffc4
4
@SuppressWarnings("unchecked") public <T extends Event> void registerEvent(T event , EventHandler<T> handler){ String eventType = event.getEventType(); List<EventHandler<? super Event>> handles = handleStore.get(eventType); if(handles == null){ handles = new ArrayList<EventHandler<? super Event>>(); handle...
7988957b-b8ec-47ee-9edc-a15730da3768
8
public void print() { switch(ordinal()){ case 0: System.out.println("KKMMM"); break; case 1: System.out.println("HHMMM"); break; case 2: System.out.println("MMMKM"); break; case 3: System.out.println("MMMHH"); break; case 4: System.out.println("MMKHH"); break; case 5: System.out.println("MMKHM"); b...
50a38f71-26de-4b79-9cb1-082b5b58c637
9
private static String calc(String s) { Stack<String> num = new Stack<String>(); Stack<Character> op = new Stack<Character>(); char[] cs = (s + "#").toCharArray(); StringBuilder numV = new StringBuilder(); boolean inputNum = false; op.push('#'); int i = 0; ...
30b3dbfa-bbcd-41f1-9b00-7b341af6bd64
0
private long getSlot(int i) { return this.startOfDay + i * Appointment.TIME_UNIT; }
e70f9aba-399b-4d8e-8950-a33eacbfc7fb
7
private static void computeSplitMap(int[] splitMBs, Configuration fConf, String jobNameDir, Boolean hasSplitFile) { if(hasSplitFile) { try { BufferedReader reader = new BufferedReader(new FileReader(jobNameDir + File.separator + "splits.txt")); String line; int splitMB; long splitByte; whi...
0f35b8d5-f84f-402f-aabb-1796c3dd8f08
0
private void resetButtons(){ startStrategyButton.setEnabled(true); pauseButton.setEnabled(false); continueButton.setEnabled(false); cancelButton.setEnabled(false); }
166ef5ce-4254-4bd8-bff5-a060d090d6aa
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...
f02b06d0-9645-43cb-ac48-b7fb90a43e21
7
public String toString() { String result; /* catch any internal errors */ try { result = "production [" + index() + "]: "; result += ((lhs() != null) ? lhs().toString() : "$$NULL-LHS$$"); result += " :: = "; for (int i = 0; i<rhs_length(); i++) result +=...
bee06002-7a16-4e69-9089-a50c30531de0
4
public boolean checkForPlayer(int x, int y) { for (Player p : PlayerHandler.players) { if (p != null) { if (p.getX() == x && p.getY() == y) return true; } } return false; }
1c51695a-e1c4-4c38-8463-834ce71ce2c3
7
private Integer[] determineWinnerTaIds() { BufferedReader reader = null; ArrayList<Integer> winnerTas = new ArrayList<Integer>(); try { reader = new BufferedReader(new FileReader("TransactionLog")); String line = reader.readLine(); String[] values; while (line != null) { values = line.spl...
6fee3ccc-27b4-45e2-9567-917753bc48a1
6
public void draw(Graphics g) { int cid = id > 8 ? id - 8 : id; Color c = COLORS[cid]; if (id <= 8) { g.setColor(c); } else { g.setColor(Color.WHITE); } g.fillArc((int)pos.x - SIZE, (int)pos.y - SIZE, SIZE * 2, SIZE * 2, 0, 360); if (id > 8) { g.setColor(c); g.fillArc((int)pos.x - SIZE, (int)po...
44298b75-f476-4b86-a1b6-c7cce0204c5e
0
public List<String> getErrors() { return errors; }
be6536d3-6c3f-433a-92bc-72127c53472c
1
public boolean isSymmetric(TreeNode root) { if(root == null) return true; return isSymmetricLevel(root.left,root.right); }
598628f7-50d9-422c-bfed-23f23dee785a
8
private void executeReadRequestOnReadQuorum( HashMap<Machine, String> responseMap, HashSet<Machine> successfulServers, HashSet<Machine> failedServers, int articleReadFrom) { if (failedServers != null) { if (failedServers.contains(myInfo)) { /* * as we have already implemented local read in the f...
29535aa4-59f4-4f43-99dd-25cae2e7a9a5
3
private boolean message_ready() { // Message is completely read. Push it further and start reading // new message. (in_progress is a 0-byte message after this point.) if (msg_sink == null) return false; boolean rc = msg_sink.push_msg (in_progress); ...
fe1ef08c-7769-4eae-85d4-289fbc596e3d
5
public static AuthenticationInfo extractAuthenticationInfo(String login, String encodedPassword) { try { char[] clearPwd; if (encodedPassword != null && !encodedPassword.isEmpty()) { clearPwd = decodePassword(encodedPassword); } else { clearPwd = null; } if (clearPwd ==...
f088250a-6906-4d73-9e23-6ca51555b9ed
9
private void addNewCounterEvidence() { String titleValue = titleNAJtxt.getText() , descriptionValue = descriptionNAJtxa.getText() , parentClaimTitle = null; Object parentClaimO = listOfClaimsNAJcbx.getSelectedItem(); Claim parentClaim = null; if (parentClaimO != null) { parentClaimTitle = parentClaim...
3f39ec1b-2f6d-4e8c-8a4f-df558aa8c677
8
public static void main(String[] args){ for(int iloscWatkow=10; iloscWatkow<51; iloscWatkow+=10) { watki++; for(int czasMetody=0; czasMetody<101; czasMetody+=20) { Main.ile=0; System.out.println("WATKI "+ iloscWatkow + " CZAS " + czasMetody); czasy++; sleep=czasMetody; int ilos...
51ec999e-2327-4532-9969-02833b422924
6
private void analyseInstructionFormat(String line) throws AssemblerException { if (line.trim().length() == 0) return; foundInsFormat = true; line = line.trim(); // Legit instruction format: // (!(space|colon))+ space* colon space* (letters|numbers)+ openBracket // 0-9+ closeBracket // (space* (lette...
0df22339-6fd4-4b8d-92a9-a4efbd910797
9
@Override public Page next() { boolean insidePage = false; Page page = new Page(); try { pageCount++; loop: while (true) { xmlr.next(); switch (xmlr.getEventType()) { case XMLStreamConstants.START_ELEMEN...
7f37576d-112c-4400-ab0d-a252a7c0c69d
8
public void do_ls(ParamHolder myParamHolder) { Connection dbConnection = null; PreparedStatement pstatement = null; String SelectTabSQL = "select File_Name\n" + " ," + myParamHolder.keyFieldName.toUpperCase() + "\n" + " ,round(dbms_lob.getlength(" + my...
976e7fb5-e2a4-4056-ba29-ee6b8b3c4e75
3
public static List<String> getAllTablesNames() { List<String> allTables = new ArrayList<String>(); try { DatabaseMetaData md = connection.getMetaData(); ResultSet rs = md.getTables(null, null, "%", null); while (rs.next()) { allTables.add(rs.getString(3)); } } catch (SQLException e) { while (e...
c197e334-7e66-47a0-9fb8-aed2a0a97b3e
8
public static void main(String[] args) { // Diamond types are awesome. They let us create a container of explicit type without actually // specifying the needed type, as it can be inferred from the declaration. // This was introduced in Java 7. // ... // An example of this is the...
1d92e1b0-6d7f-4b9f-ab19-2d8ae8c21fef
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
0fa460b8-c7b5-4ed4-9e76-ff0da54e5d2a
5
public static ArrayList<String> restoreIpAddresses(String s) { ArrayList<ArrayList<String>> resultLists = new ArrayList<ArrayList<String>>(); ArrayList<String> result = new ArrayList<String>(); if (s.length() == 0) return result; ArrayList<String> list = new ArrayList<String>(); restoreIpAddressesHelper(s...
ab34f9ef-b188-4523-81b0-c88209daa276
2
public void load(String fileName) { boolean header = true; for (String line : Gpr.readFile(fileName).split("\n")) { if (header) { header = false; continue; } // Split line and parse data String recs[] = line.split("\t"); String mtype = recs[0]; countBases.inc(mtype, Gpr.parseIntSafe(re...
431412cb-465c-4565-93a9-b35a22d88efa
4
@Override public void execute(Joueur jou) { Joueur proprio = this.getProprietaire(); if(proprio == null){ Scanner sc = new Scanner(System.in); if(this.getLoyerBase() <= jou.getCash()){ System.out.println("Voulez-vous acheter cette gare : y/n Ce...
252af50b-ba82-442b-a863-86cddd2ffd98
2
private void drawFields(Graphics g){ for (int[][] a : Position.time){ for (int []b : a){ //System.out.println(" x: " + b[0] + " y: " + b[1]); Position.drawEmptyCircle(g, b[0], b[1]); } } }
51a94a34-95c4-410c-9924-a8c65110d327
8
public String TitikHanya2(String strQty){ char [] data = strQty.toCharArray(); String newStrQty = ""; int JmlTitik = 0, PosTitik=0; int Pencacah=0; for (char c : data){ if (c != getTheSeparator().charAt(0)) { newStrQty = newStrQty + String.valueOf(c);...
62323d07-8144-497a-adc5-985651e088a5
0
public Task getTask() { return new Task(); }
f4b14c82-14d5-4157-ac92-383f1daf38a2
5
private static void whichTrack(String track, String dir, int[] startingPoint, LinkedList<int[]> locations) { switch (track) { case "strR": case "strL": case "statR": case "statL": straightTrack(dir, startingPoint, locations); break;...
ba65370f-ce1b-43b0-a8e8-3e6a1c5c2f44
6
public void paintComponent(Graphics g){ switch(dice){ case 1: g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, 81, 81); g.setColor(Color.WHITE); g.fillRect(v2, v2, 9, 9); break; case 2: g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, 81, 81); g.setColor(Color.WHITE); g.fillRect(v1, v1, ...
da0b9d12-7342-4a80-9c71-202001f31da8
4
public void bounceOffWalls() { if (y > FRAME_HEIGHT - FONT_SIZE || y < 0) { vy = -vy; } if (x + FONT_SIZE/2 > FRAME_WIDTH || x < 0) { vx = -vx; } }
c8c1ab17-5d6d-4c25-b2a1-93d0861dc32e
2
@Override public int compare(Creature o1, Creature o2) { float distance1 = o1.getTarget2().getDistance(o1.getPos()); float distance2 = o2.getTarget2().getDistance(o2.getPos()); float dif = distance1 - distance2; if (dif < 0) return -1; else if (dif > 0) return 1; return 0; }
10c36cc2-af38-4d3c-a030-75ae15ad1738
0
public static ScoreManager getInstance() { return instance; }
8b00293c-ea8c-48ae-a63a-0582f89eeaf3
0
protected Transition initTransition(State from, State to) { return new FSATransition(from, to, ""); }
e55bb8c6-c200-48d2-8176-3845fb9e0882
7
private int findLeftRight(String program, Character symbol) { int leftCount = 0, rightCount = 0; int maxLeft = 0, maxRight = 0; for (int i = 0; i < program.length(); i++) { if (program.charAt(i) == symbol) { if (rightCount > 0) { rightCount--; ...
dd03666a-a219-4fea-ba31-4608f60499a2
0
@Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); }
da5cbc9e-99fd-46ae-83d4-14fffa37e762
0
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new BounceFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } ...
91589db7-d6ba-4cd8-8051-47c555bb1c1a
1
@Override public void setEnabled( boolean enabled ) { if( !enabled ){ moving = false; mousePressedPoint = null; items.clear(); } }
8d092c5a-06f4-4485-a25c-394f431f25df
7
@Override public final void mouseDragged(MouseEvent me) { if (slider.inUse) if (orientation == VERTICAL) { slider.y = me.getY() - 12.5f; if (slider.y < y) slider.y = y; else if (slider.y > y + length - 25) slider.y = y + length - 25; sendTScrollEvent(new T...
59812c88-6c5a-4b81-af55-8feb95046d61
6
public void printSymbol(Integer type) { String string = program.getMainPanel().getTextField().getText(); string = string.substring(0, program.getMainPanel().getTextField() .getCaretPosition()); switch (type) { case 0: string = string + "*"; break; case 1: string = string + "+"; break; case 2...
fea82260-6240-40f8-bc57-906951089074
3
final Entry<V> removeEntryForKey(long key) { int hash = hash(key); int i = indexFor(hash, this.table.length); Entry prev = this.table[i]; Entry e = prev; while (e != null) { Entry next = e.next; if (e.key == key) { this.modCount += 1; this.size -= 1; if (prev == ...
e842a573-be31-4022-86cf-edd6c8899661
5
public String getTypeFrench() { String res = ""; switch(this.type) { case "calculation": res = "Calcul arithmétique"; break; case "fraction": res = "Calcul fractionnaire"; break; case "equation": ...
934b3f32-5fb9-49cc-8327-1b540d5ef73e
7
public void importTriples ( List<Triple> listOfTriples ) { Node subject_obj; Predicate predicate_obj; Node object_obj; String subject; String predicate; String object; String triple; // go through the list of triples to populate KnowledgeGraph with input data for ( Triple element : listOfTriple...
7d1306ca-1eec-4048-9315-b086b75c243f
5
@Override public void add(int id_task, int id_user) { try { connection = getConnection(); ptmt = connection.prepareStatement("INSERT INTO Task_executors(id_task, id_user) VALUES(?,?);"); ptmt.setInt(1, id_task); ptmt.setInt(2, id_user); ptmt.execut...
64b6749f-f0d8-4a4a-9f0b-ce6762dc65d6
6
@Override public void mouseExited(MouseEvent e) { if(!czyRozmieszczonoLosowo) { if(widokRozmiesc.cb_RodzajStatku.getItemCount() > 0) for(int i = 0;i < 10; i++) for(int j = 0;j < 10; j++) if(e.getSource() == lb_polaGry[j][i]) if(widokRozmiesc.uzytkownik.plansza.sprawdzWspolrzedneUstawianego...
966f02f4-cb96-458f-85ff-7cb290ef0946
9
static public Double[][] readFile(String fileName) { // default initializations int nbDim = 0; int nbPoints = 0; boolean textOnFirstLine = false; // count lines (points = rows) and dimensions (columns) try { BufferedReader countR...
e9feffe9-032c-4af1-bfc7-4d0f065bee9c
9
@Override public SourceValue unaryOperation(final AbstractInsnNode insn, final SourceValue value) { int size; switch (insn.getOpcode()) { case LNEG: case DNEG: case I2L: case I2D: case L2D: case F2L: case F2D: case D2L: ...
5d48916f-ad17-43ef-8ad9-ccaa56468bd5
6
public void renderTile(int xp, int yp, Tile tile) { for (int y = 0; y < 32; y++) { int ya = yp + y; for (int x = 0; x < 32; x++) { int xa = xp + x; if (xa < -32 || xa >= WIDTH || ya < 0 || ya >= HEIGHT) { break; } ...
50cc6820-ff8d-444a-8416-0e1ce96c5bf7
2
public String esp(String entree){ String str = new String(); int nbCar = 0; int taille = getTailleLigne(); if(taille % 2 == 1){ nbCar = (taille / 2)+1; } else{ nbCar = taille / 2; } for(int i=0; i < nbCar; i++){ ...
9e542503-2ed3-425b-b37a-0fd8ae3776e5
6
public int findMOOLAH(){ int index=-1; for(int q=0;q<objects.size();q++) { if ((objects.get(q).kind!=0)) continue; int searchRadius = h/2+10; //radius of whether the object will be findable boolean search = collisionCircle(getX(),getY(),searchRadius,ob...
baad5cec-7cbc-4053-a656-0b7af5a78eb3
8
public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) { // similar to 3 sum; keep two pointers, start and end; // then keep two middle pointers and compare with the target // so as to decide to move which middle pointer ArrayList<ArrayList<Integer>> res = new ArrayList<Arr...
861e2e6e-48b6-46d3-a0b6-793824743323
1
public void deleteMin() { if (isEmpty()) throw new RuntimeException("Symbol table underflow error"); delete(min()); }
25fd09f2-2d1d-41c9-b60a-ac4c3b03d537
9
public void testLoadInEurope() { Game game = ServerTestHelper.startServerGame(getTestMap()); InGameController igc = ServerTestHelper.getInGameController(); ServerPlayer dutch = (ServerPlayer) game.getPlayer("model.nation.dutch"); Goods cotton = new Goods(game, null, cottonType, 75); ...
6a382433-3bee-4ee3-9c8f-7332535f6305
0
public String getArea() { return Area; }
f8be31d5-87e8-4753-8564-c64ac735b22c
4
@Override public void actionPerformed(ActionEvent e) { Object actionObject = e.getSource(); if (actionObject instanceof JComboBox) { JComboBox selected = (JComboBox)actionObject; if (selected.equals(this.instrumentOptions)) { this.cont...
63c62d8f-cf0e-4f7c-96d6-fd3f015e4547
8
void applyTorque() { if (torque == null) return; if (Math.abs(torque.getForce()) < Particle.ZERO) return; computeCenter(); int[] exclusion = torque.getExclusion(); double k, sinx, cosx; outerloop2: for (Atom a : atoms) { if (exclusion != null && exclusion.length > 0) { for (int i : exclusion) {...
cd35147c-b20f-4c18-b359-6f9119d63c55
8
public boolean loadSign(World world, ProtectedRegion region) { ConfigurationSection sign = datacfg.getConfigurationSection("SellSigns." + world.getName() + "." + region); if (sign == null) { sign = datacfg.getConfigurationSection("RentSigns." + world.getName() + "." + region); } Block block = world.getBlockA...
d73f23eb-b5d2-46cc-b3e9-3ac87b54e6ac
9
static private short atos(byte[] in, int fromIndex, int byteLen) { int i = fromIndex; int endIndex = i + byteLen; int sign = 1; int r = 0; while (i < endIndex && Character.isWhitespace((char)in[i])) { i++; } if (i < endIndex && in[i] == '...
4d43e504-a0e3-4196-8c72-3530bebd0d21
5
public boolean commit(){ synchronized (fatherTable){ for(Map.Entry<Column, ValueWithTimestamp> entry:localData.entrySet()){ Column col=entry.getKey(); ValueWithTimestamp data=entry.getValue(); Long oldNow=fatherTable.getLatestTimestamp(row, col); if(prevData==null) System.out.println(null+"");...
8aa773b9-72b8-4443-85e4-78bf57ed8903
2
public void mutate(double prob, double variance) { Random rnd = new Random(); for (int i = 0; i < genes.size(); i++) { if (rnd.nextDouble() < prob) { double orig = genes.get(i); orig += randGaussian(variance, rnd); genes.set(i, orig); } } }
a09544c8-b9f6-4f49-b7ae-61886f6b3df2
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LocationSQL other = (LocationSQL) obj; if (worldName == null) { if (other.worldName != null) return false; } else if (!worldName.equals(...
2160d73a-0450-494a-952b-10301d115226
1
public void readMessage() { try { String statement = new String("UPDATE " + DBTable + " SET " + "isRead = true" + " WHERE mid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, messageID); stmt.executeUpdate(); } catch (SQLException e) { e.printStackT...
c2233a5a-19a0-414a-80a2-35f94572af9d
0
public void setLevelString(String newLevel) { level = newLevel; }
6b0f02e2-389c-4a52-a5c0-ea183d8f791e
9
private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(6, old0, old1); try { curChar = input_stream.readChar(); } catch (IOException e) { jjStopStringLiteralDfa_0(7, ...
4f9fea72-eb35-4086-ba11-ed1e40fd5c14
1
public void testStations() throws Exception { File climateInput = new File("c:/tmp/clim_data_test.csv"); int staid; String staname; String state; double lng; double lat; int elev; CSTable table = DataIO.table(climateInput, "Data for met test"); I...
fcf8f73f-7a82-40ca-a7b8-b0da5148a103
4
private void loadParameters() { if (loaded.get()) { return; } loaded.set(true); parameters = new LinkedHashMap<Parameter, Object>(); for (Parameter parameter : Parameter.values()) { if (clientScriptData.containsKey(parameter.value())) { parameters.put(parameter, clientScriptData.get(parameter.valu...
3559ee2a-7b14-4ffc-a4a2-aa389aa9493a
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CompiledAutomaton other = (CompiledAutomaton) obj; if (type != other.type) return false; if (type == AUTOMATON_TYPE.SINGLE) { if (!te...
e312099c-db95-4827-8bc5-98273ca02fa3
2
private boolean Transferencia(Cuenta cuentaReceptora, float importe) { float interes = importe*this.tipoInteres/100; if (this.Recargo(importe+interes)) { if (cuentaReceptora.Ingreso(importe)) { this.registerMovement(new Recargo("Intereses transferencia "+this.tipoInteres+"% "+...
4c1eb8c9-ed12-4487-8f02-8f9aa0c02b9c
2
protected int findTagByCategory (HashMap<String,TagCategory> tcHM, String strCategory, String strText) { int pos = -1; if (tcHM.containsKey(strCategory)) { TreeSet<TagCategory.Pair> pairSet = tcHM.get(strCategory).getTaggedText(strText.toString(), true); if (!pairSet.isEm...
3b092fab-425d-4829-9523-3c6db0f8b0cd
2
public void windowClosing(WindowEvent e) { if (Game.getThis() == null) { System.exit(0); } else if (confirmQuit("Exit")) { System.exit(0); } }
8499d908-a8a2-4f45-a895-1149dda87239
3
@SuppressWarnings("deprecation") public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, Location loc) { PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving(); try { Field a = ReflectionUtil.getDeclaredField(mobPacket.getClass(), "a"); ...
e67d842c-fc12-426c-be28-eb245fb9fde5
2
public Edge getEdge(Tile t1, Tile t2, Direction d1) { Edge newEdge=null; if (type.endsWith("Door")) { String keyName = getDatumValue("Key Name"); Item key = new Item(keyName, 1); newEdge = new Exit(t1, t2, true, d1, d1.getOppositeDirection(), key); } if (type.endsWith("Wall")) { newEdge =...
a5f33886-9d85-432f-8d1a-02f127790fb4
6
public void reshuffle(CardArray p1cards, CardArray p2cards) { Deck newdeck = new Deck(); CardArray shouldRemoved = new CardArray(); cards = (CardArray) newdeck.cards.clone(); shouldRemoved.add(downcard); for (Card i : p1cards) { shouldRemoved.add(i); } for (Card i : p2cards) { shouldRemoved.add(i)...
06859e02-9ca1-4cb9-879c-a905ac675734
6
@Override public void doPromote(ScriptRunner pScriptRunner, PromotionFile pFile) throws ExPromote { long lStart = System.currentTimeMillis(); Logger.logInfo("\nPromote DatabaseSource " + pFile.getFilePath()); //Read the DBSource file in String lFileContents; try { lFileContents = File...
cb1311ae-2b8a-46f9-8c52-f7a234e9639b
9
public static User getUser(int id) { String url = "jdbc:mysql://ouaamou.com.mysql:3306/ouaamou_com"; String username = "ouaamou_com"; String password = "7ttrBnUR"; try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } User user = new Us...