method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b89a1897-672c-47c1-a808-4f342f70856c
7
private void addDifferenceOccurrences(List<TraceDifference> differences, String traceID) { for (TraceDifference difference : differences) { TraceDifference matchingDiff = null; for (TraceDifference diff : this.differenceOccurences.keySet()) { if (this.strictComparisons && diff.equals(difference) || ...
e1e642b3-feb7-42c4-8982-33c776193519
3
public String toString() { StringBuilder builder = new StringBuilder(); switch (typeOfEmployee) { case JUNIOR: builder.append("Junior"); break; case MEDIOR: builder.append("Medior"); break; case SENIOR: builder.append("Senior"); break; } builder.append(" employee " + fullName); builder...
bb916f2d-8e4d-4dfc-be98-a20ccf82c787
7
public void setAsignaNumeroDientesPinon(int numerodientes[]) { int i = 0; boolean compruebadientes = true; if (dientespinon.length == numerodientes.length) { i = 1; while (i < dientespinon.length && compruebadientes) { if (numerodientes[i - 1] <= numerodientes[i]) { compruebadientes = false; }...
50368cd3-4556-4e5b-8762-918aab190235
9
public String moveNotation(int[] move, NotationType notationType) { StringBuilder result = new StringBuilder(); char pieceMoved = pieces[move[0]][move[1]]; if (pieceMoved == 'k' || pieceMoved == 'K') { if (Arrays.equals(move, new int[] { 0, 4, 0, 2 }) || Arrays.equals(move, new int[] { 7, 4, 7, 2 })) { ...
700ade0e-8fbe-4250-a68b-49eb72b7299d
4
@Override public boolean axisMoved (Controller controller, int axisIndex, float value) { if(axisIndex == 4) { if(Math.abs(value) <= .02f) { MyController.setTrigger(MyController.LT, false); MyController.setTrigger(MyController.RT, false); } else if(value > .02f) { MyController.setTrigger(MyControlle...
b3fb6b35-0f78-48ea-9555-0f8cf13238e1
5
public MenuDialog(JFrame owner, Point pos) { super(owner); parent = owner; this.setLayout(new BorderLayout()); ePane = new JEditorPane(); //ePane.getEditorKit(). ePane.setPreferredSize(new Dimension(250, 400)); ePane.setEditable(false); JScrollPane scroller = new JScrollPane(); JViewp...
2c16191c-7004-4c47-a1ca-d72d8ff4495d
3
private List<Teleporter> getNewTeleporters() { List<Teleporter> teleports = new ArrayList<Teleporter>(); while (getTeleporterCoverage() < coverage) { int randomX = (int) Math.round(Math.random() * grid.width); int randomY = (int) Math.round(Math.random() * grid.height); Teleporter teleport = new Tel...
3bc5632b-7d01-4617-94a5-fe734e208352
8
public static void dswap_f77 (int n, double dx[], int incx, double dy[], int incy) { double dtemp; int i,ix,iy,m; if (n <= 0) return; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%3; for (i = 1; i <= m; i++) { d...
1413544f-d458-45d0-99a4-38f7ae374e04
1
void deprecated() { if(!JSBotUtils.sWarnings) return; java.lang.Exception e = new java.lang.Exception(); StackTraceElement ste[] = e.getStackTrace(); String oldmethod = ste[1].getMethodName(); String newmethod = oldmethod.replace("jsFunction_", ""); Character c = Character.toUpperCase(newmethod.charAt...
d9d2b770-5701-41ab-af31-322cebdd7db3
1
public void loadFile(String excelPath) { try { File excelFile = new File(excelPath); InputStream myxls = new FileInputStream(excelFile); wb = new HSSFWorkbook(myxls); } catch (Exception e) { throw new IllegalStateException("Cannot load excel file - " ...
ab680e37-2baf-4b66-9829-2047e4c045d9
6
protected static Ptg calcMaxA( Ptg[] operands ) { Ptg[] alloperands = PtgCalculator.getAllComponents( operands ); if( alloperands.length == 0 ) { return new PtgNumber( 0 ); } double max = Double.MIN_VALUE; for( Ptg alloperand : alloperands ) { Object o = alloperand.getValue(); try { doubl...
6af8afb9-aa3f-48aa-9a1d-6025131bd5d7
9
public static MatchingQuestion getMatchingQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) { int quizID = quiz.quizID; int position = pos; Object question = null; Object answer = null; double score = 10; ArrayList<String> questionList = new ArrayList<String>(); ArrayList<String> answerList = new Arr...
2d2e8f65-9c06-44c0-a978-12a650875c58
7
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...
e9658373-1795-4136-87ec-192abf37a5d3
8
public static void main(String[] args) throws JSONException { long startTime = System.currentTimeMillis(); Planet[] planets = Planet.getMap(); for (Planet a : planets) { JSONObject json = a.toJSON(); Planet b = Planet.fromJSON(json); assert a.getAttack() == b.getAttack(); assert a.getDefense() == b.ge...
208a33af-deda-4cc3-b644-36d75c41f1b0
7
public int convert_msgtobin(String msg) { int m = msg.length(); if (m < 14) { return -1; // Too short for a valid CAN msg } if (m > 30) { return -2; // Longer than the longest CAN msg } if ((m & 0x1) != 0) { ...
cd3b4de5-9986-47f4-833b-29781af622f9
1
public static void confirmFriendRequest(int senderID, int receiverID) { try { String statement = new String("UPDATE " + DBTable + " SET isConfirmed = true " + "WHERE uid1 = ? and uid2 = ? and isConfirmed = false and isRejected = false"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement)...
37bd515d-603f-4241-ac6b-69109090ab4f
5
static final boolean method552(int i, int i_28_, byte i_29_, int i_30_, int i_31_, int i_32_, byte[] is) { anInt5282++; int i_33_ = i_31_ % i_30_; int i_34_ = 39 / ((31 - i_29_) / 63); int i_35_; if ((i_33_ ^ 0xffffffff) != -1) i_35_ = i_30_ - i_33_; else i_35_ = 0; int i_36_ = -((i_28_ - -i_30_...
0bda297f-281a-4b1d-a04f-5a7bb35477e2
2
@Override public int salve(Usuario u) { if (u.getCodigo() == 0) { try { return insert(u); } catch (SQLException ex) { Logger.getLogger(UsuarioDAOImplements.class.getName()).log(Level.SEVERE, null, ex); } } return -1; }
cce10a0c-094e-4bb2-a0b0-934123d0b535
5
private Point[] progressSplines(Stack<Point> stack) { Point p = null; Point begin = null; Spline s = last; Spline next = null; while (s.prev != null) { next = s; s = s.prev; if (s.prev != null) { Point q ...
88ba080f-ac7f-4ebe-ac41-db5fb827804b
1
public Game(Cong cong, SpriteSheet header_ss, History h){ // Load the spritesheets for the game objects and the scoreboard elements try{ ss_cong_image = loader.loadImage("/sprite_sheet_cong.png"); cong_ss = new SpriteSheet(ss_cong_image); ss_scoreboard_image ...
72742849-1511-4887-bad3-e2bad5c87698
0
public void setTurn(Player playersTurn) { this.playersTurn = playersTurn; this.setWindowTitle(); }
237af542-b618-446d-8af5-cc7d235ec2dc
9
private static boolean isREWhiteSpace(int c) { return (c == '\u0020' || c == '\u0009' || c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029 || c == '\u000C' || c == '\u000B' || c == '\u00A0' || Character.getType((char)c) == Ch...
9bafca0e-8251-4c2c-97cc-d59bb4e8ee7d
6
public void changeColor(int[] i, int b) { if (b == 1) { int c = getColor(i).getInt() + 1; if (c > 5) c = 0; setPiece(i, TileColor.get(c)); } else if (b == 2) { int c = getColor(i).getInt() + 3; if (c > 5) c -= 6; setPiece(i, TileColor.get(c)); } else if (b == 3) { int c = getColor(i)....
bdbf4690-eb05-4a96-953b-1a465aa1f400
0
@Override public String getGUITreeComponentID() {return this.id;}
3ff3a57b-f6d3-4838-9668-3e67ec9b4209
5
public boolean isOpp(Dir two) { if (id==(two.id+2)%4) return true; else if (id==Dir.Down.id() && two==Dir.Up) return true; else if (id==Dir.Up.id() && two==Dir.Down) return true; else return false; }
68b92813-a52a-40e9-95e5-bc08969a7a12
2
public DbInit () { try { Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:test.db"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStac...
8f638549-e2ae-4f27-881f-f663baeea649
8
public static File getDirectoryChoice(Component owner, String defaultPath, String title) { // // There is apparently a bug in the native Windows FileSystem class that // occurs when you use a file chooser and there is a security manager // active...
9584c0e6-3100-4956-91f5-cbb768bbf879
2
@Override public void onEnable() { instance = this; getServer().getPluginManager().registerEvents( new ChunkLoad(), this); getServer().getPluginManager().registerEvents( new ChestOpenEvent(), this); config=getConfig(); saveDefaultConfig(); ChestManager.loadChestTypes(); for(World w:Bukkit.getWorl...
c54ad930-00ca-46a7-ae10-3727f718d278
3
public void run(){ long lastTime = System.nanoTime(); double ns = 1000000000 / 60; double delta = 0; long timer = System.currentTimeMillis(); while(running){ long now = System.nanoTime(); delta += (now - lastTime) / ns; lastTime = now; while(delta >= 1){ update(); delta--; ups++; }...
1e5dce09-8e2f-4301-a727-4040ac8ba37d
1
public void yypushback(int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; }
6b9f45da-1d19-474b-8559-6b8b7d0c8d1c
8
@Override public boolean tick(Tickable ticking, int tickID) { super.tick(ticking,tickID); if(ticking==null) return true; if(!(ticking instanceof MOB)) return true; final MOB mob=(MOB)ticking; if(this.lastKnownEaterM!=mob) this.lastKnownEaterM=mob; if(mob.location()!=null) lastKnownLocationR=...
569c5fa7-ba54-4eac-8533-1ab1b4d4c20a
8
public UpdateSort() { super("修改分类"); setSize(240,300); setLayout(new FlowLayout(FlowLayout.CENTER, 10, 30)); id = new JLabel("题号:"); sort = new JLabel("分类:"); inputID = new JTextField(14); sortBox = new JComboBox(item); save = new JButton("修改"); ...
656cec7c-8959-452c-a445-d1ea6d0f52b6
1
private JButton getJButton0() { if (jButton0 == null) { jButton0 = new JButton(); jButton0.setText("SELECT"); jButton0.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton0MouseMouseClicked(event); } }); } return jButton0; }
c6c9300f-2d8e-4d1e-a987-020e9e58466e
5
private void read() { try { int bytesRead = 0; int bytes, limit, pos, size; // clear buffer _buffer.clear(); // read first message size do { if((bytes = _socketChannel.read(_buffer)) < 0) { _LOGGER.log...
4c7881c5-d112-43bc-9766-c5b975fc3109
3
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL; if (verticalButton.getSelection ()) style |= SWT.VERTICAL; if (borderButton.getSelection ()) style |= SWT.BORDER; /* Create the example widgets */ ...
40b7528a-b73b-48fa-abfd-83f74bb4f948
1
public void mousePressed(MouseEvent arg0) { returnValue = buttonHovered; if(returnValue != 0){ running = false; } }
59853e3e-56f6-4784-a2a4-f95cb224ff7d
7
public static void viewFile() throws FileNotFoundException { File[] files = FileLister.getFilesArrayFile(); int selection = FileChooser.chooseFile(); Scanner input = new Scanner(System.in); int shiftEnd = 0; int shiftMid = 0; if (selection < files.length) { Scanner in = new Scanner(files[selection]); ...
3208d239-f2bc-4091-8822-237fb234aefe
5
public Dimension preferredLayoutSize(Container target) { synchronized (target.getTreeLock()) { Dimension dim = new Dimension(0, 0); boolean ltr = target.getComponentOrientation().isLeftToRight(); Component c = null; if ((c = getChild(EAST, ltr)) != null) { Dimension d = c.getPreferredSize(); dim...
27a19116-5d31-4233-bb49-ec8f2e9e30c3
2
@Override public double getAverageClientWaitTime() { int clients = 0; int totalWaitTime = 0; for (int j = 0; j < servingClients.size(); j++) { clients++; totalWaitTime += servingClients.get(j).getExpectedServiceTime(); } for (int j = 0; j < waitingClients.size(); j++) { clients++; totalWaitTime +...
ae704013-b08e-4905-98e3-e95a71586b80
2
public long inserir(PalavraChave palavrachave) throws Exception { String sql = "INSERT INTO palavrachave (palavra) VALUES(?)"; long idGerado = 0; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, palavrachave.getP...
558417ad-7a54-48b7-8bdb-edbb694419ba
0
public static String[] getArgs(ActionEvent e) { return e.getActionCommand().split("``"); }
7e1da783-cfc4-4539-b8db-7abc9dcdfac0
7
private void findMinMaxX(int y) { xMin = Integer.MAX_VALUE; xMax = Integer.MIN_VALUE; for (int i = rasterCount; --i >= 0;) { if (yRaster[i] == y) { int x = xRaster[i]; if (x < xMin) { xMin = x; zXMin = zRaster[i]; } if (x > xMax) { xMax = x; zXMax = zRaster[i]; } } ...
4c0f8e88-ab15-4bda-8f20-7c70689ae639
2
private void initialize() { if (!QcUtil.isEmpty(configData.getString("qc.testset.id"))) { this.qcTestSetId = configData.getLong("qc.testset.id") ; } if (!QcUtil.isEmpty(configData.getString("qc.testset.name"))) { this.qcTestSetName = configData.getString("qc.testset.name") ; ...
38580f9e-31d6-4c64-9396-3e63ae90f3dc
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } else if (obj == this) { return true; } else if (!getClass().isAssignableFrom(obj.getClass())) { return false; } return Arrays.equals(significantAttributes(), getClass().cast(obj).significantAttribute...
15869e28-c990-4e9d-b2e7-ab622cb20002
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean f = true; while(true){ int a = sc.nextInt(); int b = sc.nextInt(); if((a|b)==0)break; if(!f)System.out.println(); f = false; List<Integer> l = new ArrayList<Integer>(); for(int i=a;i<=b;i++){ if(i%4==0&&...
6165b116-815c-47eb-93d0-0add1560cff2
6
public static int ladderLength(String start, String end, Set<String> dict) { if (dict.size() == 0) return 0; Queue<String> wordsQueue = new LinkedList<String>(); Queue<Integer> distanceQueue = new LinkedList<Integer>(); wordsQueue.add(start); distanceQueue.add(1); dict.ad...
d3eead16-63df-4aa0-a22a-061362813491
6
@EventHandler public void ZombieNightVision(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.getZombieConfig().getDouble("Zombie.Nig...
e3b719ee-1ad6-40e5-8214-3a648d88d687
7
public static void restartApplication(final Runnable runBeforeRestart) throws IOException { try { // java binary final String java = System.getProperty("java.home") + "/bin/java"; // vm arguments final List<String> vmArguments = ManagementFactory .getRuntimeMXBean().getInputArguments(); final S...
433938f4-ecc6-4a2b-bd14-d1a810892538
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int[][] map = new int [n+1][n+1]; for(int i=0;i<n;i++){ map[i][n] = Integer.MAX_VALUE; } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ map[i][j] = sc.nextInt()...
f26b1d29-0831-47b3-bac4-3d70cfe084ca
5
public static boolean route(int src,int dst){ q.add(src); visited[src] = true; while(!q.isEmpty()){ int t =(int) q.poll(); if(t == dst){ return true; } for(int i=0;i<map.length;i++){ if(map[t][i]&&!visited[i]){ q.add(i); visited[t] = true; } } } return false; }
c40c29dd-7751-44dc-a118-1a2ccf557be1
8
private void BatimentActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: switch(etat){ case Debut: this.donner1.frame_Batiment(); this.donner1.setVisible(true); this.donner1.setEtat("Batiment"); ...
8a1995b6-1fa6-4ed3-8a80-db656c3c175f
2
private static void dumplist(Collection<Resource> list, String fn) { try { if (fn != null) { Writer w = new OutputStreamWriter(new FileOutputStream(fn), "UTF-8"); try { Resource.dumplist(list, w); } finally { w.close(); } } } catch (IOException e) { throw (new RuntimeExcepti...
912b4a46-b5d7-451a-9afa-01a78a58df4d
6
public void updateOffset(){ final int tilesPerX = WINDOW_X/TileData.TILE_X, tilesPerY = WINDOW_Y/TileData.TILE_Y; final int width = map.getWidth(), height = map.getHeight(); final int posX = ((CMoving)player.getComponent(CMoving.class)).getX(), posY = ((CMoving)player.getComponent(CMoving.class)).getY(); ...
23f63f30-c4a9-4aa4-b00a-73edaa4c6ffd
2
@Override public void run() { while (true) { AisRecorder.sleep(PAST_TRACK_CLEANUP_INTERVAL); try { pastTrackCleanup(); } catch (Exception e) { LOG.error("Failed to cleanup past track: " + e.getMessage()); } } }
125c9f16-3c0b-4226-b601-6c356356de46
7
public Candlestick constroiCandleParaData(Calendar data, List<Negociacao> negociacoes) { // double maximo = Double.MIN_VALUE; //negociacoes.get(0).getPreco(); double maximo = negociacoes.isEmpty() ? 0 : negociacoes.get(0) .getPreco(); // double minimo = Double.MAX_VALUE; //negociacoes.get(0).getPreco()...
8044cee7-e69f-4e08-b00b-c373e607103d
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("SelectInverseAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c...
a262686b-6ea4-4591-a2df-cce96ed1aa9c
6
public void render(Screen screen, Graphics g) { parent.getInventory().render(screen); parent.getHealth().render(screen); if (messages.size() > 0) { for (int i = 0; i < messages.size(); i++) { messages.get(i).render(g); if (messages.get(i).isRemoved()) { messages.remove(i); } } } if (ui....
2b1ff132-d6b8-47d7-903c-d3c6f91b573e
5
public static String presenceValueToDisplayString(int value) { switch(value){ case Presence.ONLINE: return "电脑在线"; case Presence.BUSY: return "电脑忙碌"; case Presence.AWAY: return "电脑离开"; case Presence.OFFLINE: return "离线"; case Presence.ROBOT: return "机器人在线"; default: return "未知状态...
3246e2ab-d22a-4c0c-adeb-05d7641cd427
6
public void recursiveOpen(int x, int y) { if (x < 0 || x > 9 || y < 0 || y > 9 || field[x][y].checkOpen()) return; field[x][y].open(); if (field[x][y].getVal() == 0) { recursiveOpen(x - 1, y - 1); recursiveOpen(x - 1, y); recursiveOpen(x - 1, y + 1); recursiveOpen(x, y - 1); recursiveOpen(x, y +...
6db5b288-3e4c-4989-8b33-6fb4ca27d1ed
6
private void method130(int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2) { Class30_Sub1 class30_sub1 = null; for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext()) { if(...
6d9500fc-c707-4d35-a8b3-676e306baabf
4
public void clickOn(int cellX, int cellY) { Ball ball = _state[cellY][cellX]; if (ball != null) { _selectedBall = ball; _selectedCellX = cellX; _selectedCellY = cellY; } else if (ball == null && _selectedBall != null) { if (canMove(_selectedCellX, _selectedCellY, cellX, cellY)) { _state[cellY][cel...
ddb4a574-fd7f-4abe-9a2c-e08826483d09
2
public static List<String> getLivePlayers(){ // returns a sorted list of all live players' names List<String> output = new ArrayList<String>(); double[] LiveProbs = RunningGame.LivingProbabilities(); for(int i = 0; i < NumPlayers; i++){ if(LiveProbs[i] != 0) output.add(getPlayerName(i+1)); } Collections.so...
679bc9f5-eb76-4775-8c60-7086fb5ddf7b
6
@Override public void delete(Key key) { if (key == null) return; for (int i = hash(key); keys[i] != null; i = (i + 1) % M) if (key.equals(keys[i])) { // delete keys[i] = null; vals[i] = null; N--; // Re-insert all keys and vals which are to the right of keys[i], // thereby ...
01bcd1fe-fb23-4c9b-9da5-8e87bced2956
9
public synchronized void reqScannerSubscription( int tickerId, ScannerSubscription subscription, Vector<TagValue> scannerSubscriptionOptions) { // not connected? if( !m_connected) { notConnected(); return; } if (m_serverVersion < 24) { error(EClientErro...
13e0f333-2e77-4d38-9f48-b21851a8c8c4
0
public String getNome() { return nome; }
02314efe-f19b-43e9-9f8a-713d6c3833fe
7
public void generateLakes() { for(int l = 0; l < SIZE/1024; l++) { int x = this.random.nextInt(SIZE); int y = this.random.nextInt(SIZE); int w = this.random.nextInt(16); int h = this.random.nextInt(16); if(w > 0 && h > 0 && x+w < SIZE && y+h < SIZE) { for(int i = x; i < x+w; i++) for...
4bee74b2-d60f-4dc2-ba3a-e737788aafc6
8
* @param numberOfTraces the number of traces to be created * @param hops the number of hops for each trace */ public void createTimeTraces(int numberOfTraces, int hops, int timeInterval){ packets = new ArrayList<MACPacket>(); nodes = new ArrayList<Node>(); int numberOfNodes = 21; for(int i = 0; i ...
f855f64a-56d4-4856-9cb3-4717b8db96e1
4
private void itmMnuEncarregadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuEncarregadoActionPerformed // Menu - Cadastro > ItemMenu - Encarregado DepartamentoBO depBO = new DepartamentoBO(); Departamento DEPexistente = null; try { DEPexistente =...
48fb6feb-787d-4794-896e-9c872bc3c4e6
8
protected void createTree(LinkedHashMap<BitSet, Integer> set1){ if (set1.size() <= 1){ return; } LinkedHashMap<BitSet, Integer> part1 = new LinkedHashMap<>(); LinkedHashMap<BitSet, Integer> part2 = new LinkedHashMap<>(); Iterator<Entry<BitSet, Integer>> it = set1.entr...
bba20320-e0ce-47b4-a516-248f2525a869
9
protected Node put(T elem, Node x) { if (x == null) { x = new Node(); x.entity = elem; x.count = 1; x.isRed = true; } else { int compareResult = elem.compareTo(x.entity); if (compareResult < 0) { x.left = put(elem, x.left); } else if (compareResult > 0) { x.right = put(elem, x.right...
53d147bb-ee31-4d11-ac9c-0f672d96afe5
2
public void visitLocalVariable( final String name, final String desc, final String signature, final Label start, final Label end, final int index) { buf.setLength(0); buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' '); appendDes...
0ea84f97-8f96-42a6-9167-9dc832431aca
1
public static void main(String[] args) { try { sw.on(); // Code that can throw exceptions... throw new OnOffException(); } catch (OnOffException e) { System.out.println("OnOffException"); } finally { sw.off(); } }
1aea8431-6bfe-4ef7-81ef-58152697ed24
2
public Recipe getRecipeById(int recipeId){ for(Recipe recipe : recipeRepository){ if(recipe.getRecipeId() == recipeId){ return recipe; } } return null; }
1c9baa9c-b178-4805-a097-5b50629eba98
0
@Override public void warning(SAXParseException e) { System.out.println(padding + "XML PARSER WARNING: Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber()); System.out.println(padding + e.getMessage()); }
e7521504-983e-4849-a774-ecf99e4ac09e
1
@Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if(source == sizeSlider){ gui.updateSize(source.getValue()); } }
14e08b78-f344-4568-b057-2188224ef742
0
public Long getPlainValue() { return plainValue; }
779db783-47dd-41bb-89c4-a3c81168b0d8
3
@Override public TileMap loadTileMap(String filename) throws MapLoadException{ try { JavaImage image = loadImage(filename); TileMap tileMap = new TileMap(image.getWidth(), image.getHeight()); for(int i = 0; i < image.getWidth(); i++) { for(int j = 0; j < ...
f762a599-32d3-4bca-a393-34408d379e75
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); InputStreamReader reader = new InputStreamReader(request.getInputStream(), "utf-8"); String receivedString = ""; cha...
ead5c498-d1a7-4ff1-b84e-a7bf4d8c418d
9
@Override public DeadBody killMeDead(boolean createBody) { final DeadBody body=super.killMeDead(createBody); if((createBody)&&(charStats().getMyRace()!=undeadRace)&&(body!=null)&&(undeadRace!=null)) { if((name().toUpperCase().indexOf("DRACULA")>=0) ||(name().toUpperCase().indexOf("VAMPIRE")>=0)) body....
2210864a-2e55-4f6a-a9e3-008948fd7049
6
@EventHandler public void MagmaCubeWaterBreathing(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.getMagmaCubeConfig().getDouble("M...
0be0b5d9-031e-4928-92f5-cc5629911cce
2
public static void start(String userKey) { if ((task == null || task.isDone()) & !userKey.isEmpty()) { final TestsChecker testsChecker = new TestsChecker(userKey, notification); task = scheduler.scheduleAtFixedRate(testsChecker, 30, 30, TimeUnit.SECONDS); BmLog.info("TestList...
94a735ed-823b-4a1c-a35d-fde1f0d8d501
5
private static String getHash (String hashThis) { String hashType = "MD5"; String encodingType = "UTF-8"; StringBuffer hexString = new StringBuffer (); MessageDigest digester = null; byte[] byteDigest = null; byte[] bytesOfInput = null; /** Set our digester type to MD5 */ try { digester = Messa...
b2b2a7c6-7849-4346-99e6-d8575270c534
8
public Bossy() { //create a new logger first and foremost this.logger = new Logger(); this.logger.setDebugText(debugText); this.logger.setScrollPane(debugTextScrollPane); //create the client (to send stuff to a client) this.client = new Client(); this.client.setL...
6b2d65cd-7a12-482b-9f57-0efcdbb3317b
8
public ArrayList<String> tokenize(String text) { char[] textContent = text.toCharArray(); ArrayList<String> tokens = new ArrayList<String>(); // Initialize the execution int begin = -1; transducer.reset(); String word; // Run over the chars for(int i=0 ; i<textContent.length ; i++) { Signal s = trans...
8c4467ee-f06b-4df0-843b-616c66e29079
1
public static List<User> list() throws SQLException { ResultSet result = Data._findAll(User.class.getSimpleName()); List<User> rtn = new ArrayList<User>(); while(result.next()) { rtn.add(User.createOneFromResultSet(result)); } return rtn; }
69d847f7-35cf-4fd8-8a73-5fbb8b923a45
2
public Connection establishConnection(){ try { Class.forName(driver); con = DriverManager.getConnection(url,login,pwd); System.out.println("Connexion established"); } catch (ClassNotFoundException ex) { //Logger.getLogger(MyConnection.class.getName()).log(...
0453ab8c-08a3-420b-966d-0eddb90e1e6a
4
protected void adjustRepair(float inc) { final int max = maxIntegrity() ; integrity += inc ; if (integrity < 0) { state = STATE_RAZED ; ((Element) basis).setAsDestroyed() ; integrity = 0 ; checkMaintenance() ; } else if (integrity >= max) { if (state == STATE_INSTALL) b...
359a03d1-0b3a-40fb-96d1-316aa0aa9367
5
private boolean check_overlap( String passed_min_lat_string, String passed_min_lon_string, String passed_max_lat_string, String passed_max_lon_string, Node id_node, Node lat_node, Node lon_node ) { boolean node_overlaps = false; try { Double min_lat_d; Double min_lon_d; Double max_lat_d; Doub...
c0e27327-d8c4-48f6-8cd9-b1e88ddfa207
3
public void draw(Graphics2D g) { bg.draw(g); tileMap.draw(g); player.draw(g); for (int i = 0; i < enemys.size(); i++) ((Enemy) enemys.get(i)).draw(g); teleport.draw(g); for (int i = 0; i < explosions.size(); i++) { ((Explosion) explosions.get(i)).setMapPosition((int) tileMap.getx(), (int) tileMap.gety...
c355b8ab-297a-435f-baea-fe505122e950
5
void notifyReceived (Object object) { if (object instanceof Ping) { Ping ping = (Ping)object; if (ping.isReply) { if (ping.id == lastPingID - 1) { returnTripTime = (int)(System.currentTimeMillis() - lastPingSendTime); if (TRACE) trace("kryonet", this + " return trip time: " + returnTripTime); ...
37535d90-ca90-476e-b77f-e9b75c2706ed
8
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("setCardName")) { String s = JOptionPane.showInputDialog(frame, "Set Card Name...", property.getValue()); if (s == null) { s = property.value; } if (s != null && s.isEmpty()) { s = property.defaultValue; } property.v...
362ab42e-bb13-436e-a6a9-139233b1c4d9
8
public boolean execute(Robot paramRobot) { this.ArmAnimator = paramRobot.getAnimationComponent("GrabberArm"); this.Arm = ((GrabberArm)paramRobot.getAssembly("GrabberArm")); switch (this.state) { case 0: if (this.Arm.getCarrying() != null) { Position localPosition = paramRobot....
aab9915f-a442-420e-ba5b-c6bb91beab32
1
public int replace( FindReplaceResultsModel model, FileFilter fileFilter, FileFilter dirFilter, String startingPath, String query, String replacement, boolean isRegexp, boolean ignoreCase, boolean makeBackups, boolean includeSubDirectories ) { // Setup the Crawler String lineEnd = Platform...
bffee1d8-a515-45c9-84e0-e662be24d06d
6
protected static Bytecode makeBody(CtClass declaring, ClassFile classfile, int howToCallSuper, CtMethod wrappedBody, CtClass[] parameters, ConstParameter cparam) ...
815e9bff-b2d6-4bd1-8593-85e3b3d33d5a
6
protected int num_adjacent(HantoCoordinate location) { int count = 0; if(getPieceAt(new BasicCoordinate(location.getX(), location.getY() + 1)) != null) { count++; } if(getPieceAt(new BasicCoordinate(location.getX() + 1, location.getY())) != null) { count++; } if(getPieceAt(new BasicCoordinate(locat...
30925d21-9391-4f52-923d-b3628ead85ca
0
public long poll() { return System.currentTimeMillis() - startTime; }
b2f1ab63-831d-485d-9bd9-a1e25e14b3ab
1
public ConnectionPool() throws Exception { for(int cnt=0; cnt<initialConnectionCount; cnt++) { availableConnections.addElement(getConnection()); } cleanupThread = new Thread(this); cleanupThread.start(); }
5f0793e5-d521-4e00-81cd-5d6091bc38da
4
public boolean checkRow (int row) { int i = 0, j = 0, count = 0; /* Uses nested for loops to check the entries in the row */ for(i = 1; i < 10; i++) { count = 0; for (j = 0; j < 9; j++) { if (i == Integer.parseInt(entries[row][j].getText()) ){ count++; } if ( count >= 2) { System...
b52e9e02-a5b0-4007-aaa1-055ae2230839
2
public void assignTiles() { int assignTileInt = 0; switch (tileSet) { case INDOORS: assignTileInt = assignTileIntIndoors; break; case OUTDOORS: assignTileInt = assignTileIntOutdoors; break; } currentArea[location.x][location.y]=assignTileInt; }
0a92ca95-54d2-4c23-a8c2-ec94ca0101bb
0
public void clickPlayGame(ArrayList<MainMenuHeroSlot> heroies) { System.out.println("You need to set the character skills first."); }