method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a2bfc5b1-8e9c-4164-ae7f-8f63537bc54b
1
@Override public void updategram(Ngram ngram) { Connection conn = JDBC.createConnection(); String sql = "update ngram set frequence = " + ngram.getFrequence() + " where " + "wordGroup = '" + ngram.getWordGroup() + "';"; PreparedStatement stat = JDBC.getSatement(conn, sql); try { stat.executeUpdate()...
f4412230-861e-4bad-a16c-3887d7c691f6
1
public List<String> getCheck() { if (check == null) { check = new ArrayList<String>(); } return this.check; }
72534ebd-1988-49e9-a1f9-cc30a76c179e
3
public static int convertDirX(DirectionX dirx) { int r; switch (dirx) { case LEFT: r = -1; break; case NOTHING: r = 0; break; case RIGHT: r = 1; break; default: r = 0; break; } return r; }
859ab670-57cc-42d9-ae74-a00f93025e22
2
String getDescription() { switch(this) { case WRONG_LOGIN_DATA: return "Wrong username or password."; case SERVER_DOWN: return "Server is down."; } return ""; }
d49cf3aa-bcfa-454c-8ed1-2bc1db22302e
0
public void makeParticle() { particle1 = new Circle(0, 0, 4, Color.YELLOW); particle2 = new Circle(0, 0, 2, Color.RED); particle3 = new Circle(0, 0, 2, Color.ORANGE); particle4 = new Circle(0, 0, 2, Color.WHEAT); particle5 = new Circle(0, 0, 2, Color.AQUA); particle1.setEffect(glow); particle2.setEffect...
ce16c9b6-68f4-4bc4-8419-14738ec86cf4
2
@Override public int compareTo(final CallKey other) { if(position < other.position) { return -1; } else if(position > other.position) { return 1; } return 0; }
f8306507-96e1-4f2f-99c5-4b3fcf8375eb
1
@Override public Grid generate() { List<Player> players = generatePlayerList(); for (Player p : players) addPlayerOnGrid(p); return grid; }
72a47d8a-75f0-427e-b796-e16dd1bef018
1
@Override public int doEndTag() throws JspTagException { try { JspWriter out = pageContext.getOut(); out.write("</option>"); } catch (IOException e) { throw new JspTagException(e.getMessage()); } return EVAL_PAGE; }
5b1a14b1-e667-42c5-b42b-48cfdef753cb
2
@Override public void doAction() { super.setAnimation(death); sound.playSound("/sound/dead.wav"); if (heightTeller < 20) { marioObject.setY(marioObject.getY() - WALKSPEED, true); heightTeller++; } else if (heightTeller > 130) { ...
f7bc2279-0dbd-4614-ab58-5712f3838738
9
public static PlagResult run(String s1, String s2, int mML, float threshold) { if (mML < 1) System.err .println("OutOfRangeError: minimum Matching Length mML needs to be greater than 0"); if (!((0 <= threshold) && (threshold <= 1))) System.err .println("OutOfRangeError: treshold t needs to be 0<=t<=1");...
888e5aaa-2414-4362-bbbf-95490b3a5cd5
5
public void merge(int A[], int m, int B[], int n) { // Start typing your Java solution below // DO NOT write main() function m--; n--; while (m >= 0 || n >= 0) { if (m < 0) A[n] = B[n--]; else if (n < 0) break; else { if (A[m] >= B[n]) A[m + n + 1] = A[m--]; else A[m + n + 1...
3ca27c8e-8f68-47cc-941b-35032eb4ecda
2
public static void mergeB2A( int[] a, int[] b , int lenA, int lenB) { assert( lenA + lenB < a.length ) : "invalid array size"; int iA = lenA - 1; // last element of A int iB = lenB - 1; // last element of B int k = lenA + lenB - 1; // position of the ret array we r modifying // iterate through ...
245e79d9-d6f4-483f-bcc8-ac33234e5dd3
6
@EventHandler public void WolfSpeed(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.getWolfConfig().getDouble("Wolf.Speed.DodgeChan...
c00f3d01-6d21-4398-a7dd-1fafe21c101f
1
public void testWithEndInstant_RI2() { Interval test = new Interval(TEST_TIME1, TEST_TIME2); try { test.withEnd(new Instant(TEST_TIME1 - 1)); fail(); } catch (IllegalArgumentException ex) {} }
8a706287-d5eb-4b26-b591-43c6deaed3a1
0
public void setMimeType(String mimeType) { this.mimeType = mimeType; }
ee7ffdb5-e100-42f9-8a94-25b55a5fd934
6
public void performAction() { if (isConnected()) { boolean first = getOutput()[0].getStatus(); if (this.isTurnedOn() && (getInput()[0].getStatus() && getInput()[1].getStatus())) { getOutput()[0].setStatus(true); } else { getOutput()...
aaed7bbd-1393-471f-92bd-fcd4836e4752
1
public void testMergePeriod_RP2() { MutablePeriod test = new MutablePeriod(100L, PeriodType.millis()); try { test.mergePeriod(new MutablePeriod(11, 12, 13, 14, 15, 16, 17, 18)); fail(); } catch (IllegalArgumentException ex) {} assertEquals(0, test.getYears()); ...
09ed20fb-bd54-4fa3-8498-21552b714512
9
String requestAuthorizationTicket(String strLoginURL, String strUserName, String strPassword, String strChallenge) { if ((strLoginURL != null) && (strUserName != null) && (strPassword != null) && (strChallenge != null)) { String strAuthSt...
a33cc675-26a1-44ba-8ab2-b5ebbb62d063
6
public static int getDirection() { String message = ""; int selected = 0; Scanner sc = new Scanner (System.in); boolean inputOK = false; while (! inputOK) { String choice = sc.nextLine(); if (choice != null) { if ( choice.equals("0") || choice.equals("1")) { inputOK = true; if (choice.equa...
d13c433b-b42c-4842-b8d4-3bf3e4b7efac
6
public static Tetromino getTetromino(Type type) { switch (type) { case I: return new IBlock(); case O: return new OBlock(); case T: return new TBlock(); case Z: return new ZBlock(); case S: return new SBlock(); case L: return new LBlock(); default: return new JBlock(); } }
24c8b6c8-4e4a-49c5-8a1d-f6858f2974bd
4
private static char lookChar() { // return next character from input if (buffer == null || pos > buffer.length()) fillBuffer(); if (buffer == null) return EOF; else if (pos == buffer.length()) return '\n'; else return buffer.charAt(pos); }
b0ed45e7-f397-4414-a21b-5bd8bbca70be
4
@EventHandler public void oreGinExploded(EntityExplodeEvent event) { List<Block> destroyedBlocks = event.blockList(); List<Block> cancelBlocks = new ArrayList<Block>(); for (Block destroyedBlock : destroyedBlocks) { if (oreGinMan.machineExistsAt(destroyedBlock.getLocation()) || oreGinMan.oreGinLigh...
754700b3-98e8-4e3a-bf99-651d0f1e9cc9
3
@Override public int[] sort(int[] a) { this.a = a; for (int i = 0; i < a.length; i++) { for (int j = a.length - 1; j > i; j--) { if(a[j] < a[j-1]) swap(j, j -1); } } return a; }
1205dce8-146d-4f10-8746-c715f4d907e9
1
public static void main(String args[]) throws InvocationTargetException, InterruptedException { new Thread() { public void run() { CardFrame frame = new CardFrame(); try { Thread.sleep(200); } catch (InterruptedException e) { ...
2902f55f-334e-4309-ac6a-060bc15917d5
4
public void randSpeed(){ if(width > 25){ STARTING_SPEED = 1; size = 2; } if(width > 20 && width <= 25){ STARTING_SPEED = 2; size = 1; } if(width <= 20){ STARTING_SPEED = 4; size = 0; } setyVel(STARTING_SPEED + rand.nextInt(4)); }
ed8bc928-e5d9-47ca-9781-c8e0a6643d88
1
public void resetGroundDecoration(int z, int y, int x) { GroundTile groundTile = groundTiles[z][x][y]; if (groundTile == null) { return; } groundTile.groundDecoration = null; }
b4784fa6-0b68-4b13-b121-0492f614b4c2
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
2d1bacd3-d654-4d80-9c39-df6e281d640b
3
private static int decodeGray(char c) { // Check the char if (c == WHITE) { return 255; } else { for (int i = charTable.length -1; i >= 0; i--) { if (charTable[i] == c) { int level = 2 + i * 36; // Range 2 .. 254 (not too bad) ...
c705e8f9-08b4-4cbf-909b-7803dbf5f9cc
2
public static byte calc(byte[] buf, int count) { int sum = 0; int i = 0; while((count--) != 0) { sum += (buf[i] & 0x000000FF); i++; if((sum & 0x00000100) != 0) { sum &= 0x000000FF; sum++; } } return (byte)~(sum & 0xFF); ...
a730b0ca-2d15-48bc-82c9-7791882be2c4
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...
36345e4a-9466-4d6e-80ca-9efcbe21d82b
7
public void spaceVertical(FastVector nodes) { // update undo stack if (m_bNeedsUndoAction) { addUndoAction(new spaceVerticalAction(nodes)); } int nMinY = -1; int nMaxY = -1; for (int iNode = 0; iNode < nodes.size(); iNode++) { int nY = getPositionY((Integer) nodes.elementAt(iNode)); if (nY < nMinY ...
7ccaa3fc-821e-4c55-b773-b36936863bcc
9
private static void firstrun() { File f = new File(data + "/"); if(!f.exists()) f.mkdir(); f = new File(data + "/config.yml"); if(!f.exists()) { try { f.createNewFile(); YamlConfiguration config = YamlConfiguration.loadConfiguration(f); config.set("debug"...
8cb1aaa9-e7ca-45e0-975c-a52dbb183eba
5
public Vector<Integer> getTarget() { int[] voteCount = new int[players]; Vector<Integer> victem = new Vector<Integer>(1, 1); int max = -1; for (int i : votes) { if (i != -1) { max = Math.max(++voteCount[i], max); } } if (max == -1) { return victem; } for (int i = 0; i < players; i++) { i...
00a78055-e726-46b3-85c8-3e5cc24ad786
0
protected JPanel initInputPanel() { JPanel bigger = new JPanel(new BorderLayout()); JPanel panel = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); panel.setLayout(gridbag); c.fill = GridBagConstraints.BOTH; c.weightx = 0.0; panel.add(new JLab...
815959d1-104e-4b4a-83f5-974a08b5119f
8
public void execute() { String type = getInstructionType(IR); if (type.equals("H ")) { setSI(3); } else if (type.equals("LR")) { int op = getOperand(IR); LR(op); Trace.write("Operand " + Integer.toString(op) + " "); Trace.write("Real Address "); Trace.writeln(Integer.toString(r...
b1639722-a54f-4edd-979b-01644b036e91
1
public String getLastRequestUrl() { String url = null; RequestWrapper requestWrapper = this.getLastReferRequestWrapper(); if (null != requestWrapper) { url = requestWrapper.getUrl(); } return url; }
888da4ab-3bd2-4ac2-baf2-61855528eba5
9
public Tile[] returnBestCityScores(int settlerR, int settlerC, double distBias) { evalBefore(); int[][] cityScores = new int[rows][cols]; for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { int dist = (int)Math.sqrt(Math.pow(r-settlerR,2) + Math.pow(c-settlerC,2)); if (dist > 10 || ...
577097f8-05ec-4fbc-afcc-5313d977dcd4
6
public double getProbability(Direction dir) { switch (dir) { case TOP_LEFT: return calculatedProbabilites[0]; case TOP: return calculatedProbabilites[1]; case TOP_RIGHT: return calculatedProbabilites[2]; case BOT_RIG...
06877156-925f-40fc-952d-0cd6d7499c90
1
public void keyReleased(KeyEvent e) { if (stage != null) { stage.keyReleased(e); } }
8602c84d-0357-4def-bf67-4d96a36b8e07
3
public Vector3i abs() { if(x < 0) x = -x; if(y < 0) y = -y; if(z < 0) z = -z; return this; }
c006e007-8d84-429e-b918-a9d92dbce0f9
4
public final void initUI() { pos = new int[][]{ {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11} }; centerPanel = new JPanel(); centerPanel.setLayout(new GridLayout(4, 4, 0, 0)); ImageIcon sid = new ImageIcon("./files/img/sid.jpg"); source = sid.getImage(); width = sid.getIconWidth(); he...
b16235f9-2342-47d1-a4b1-f834bdc6fae1
6
public void initUserMap(){ //ʼuserMap once = OnceClass.getOnce(); File file = new File(Util.USERMAPPARH); if(!file.getParentFile().exists()){ file.getParentFile().mkdirs(); } //ʵuserMapļ if(file.exists() && file.length()!=0){ try { ObjectInputStream objIn = new ObjectInputStream(new FileInputStr...
ef07e317-8e31-45ab-9b3f-a39477891ca3
3
@Override public void execute(CommandSender sender, String gateName, List<String> args) { this.sender = sender; if (gateName == null || args.size() == 0) { error("No gate given."); reply("Usage: /gate rename <gatename> <new_gatename>"); } else if (!gateExists(gateName)) { reply("Gate not found: " + g...
4bcf7762-3f04-4046-b721-241df964f9ea
6
private List<Rule> removeDefeater_transformRule(Rule origRule) throws TheoryNormalizerException { List<Literal> origBodyLiterals = origRule.getBodyLiterals(); List<Literal> origHeadLiterals = origRule.getHeadLiterals(); if (origHeadLiterals.size() > 1) throw new TheoryNormalizerException(getClass(), "rule he...
6f8a5fdb-63f8-46fb-84c2-82190c39c371
6
private boolean isNumber(String st) { if (st.charAt(0) == Tokenizer.minusSign && st.length() == 1) return false; for (char ch : st.toCharArray()) { if (!Character.isDigit(ch) && ch != Tokenizer.minusSign && ch != Tokenizer.decimalSeparator) return false; } return true; }
648636b6-596e-4436-9dba-3ac6940afb38
3
private void toonOnderdelen(JPanel buttonsPanel, ArrayList<Onderdeel> onderdelen) { int cell = 0; ArrayList<Onderdeel> buttonOnderdelen = new ArrayList<Onderdeel>(); for (Onderdeel optie : onderdelen) buttonOnderdelen.add(optie); Collections.shuffle(buttonOnderdelen); for (final Onderdeel optie : button...
fee05c18-d9c3-491b-b3d8-1deeda4e724e
2
private final void writeIdent() throws IOException { int n = ident; while (n > 0) { if (n > OFF.length) { w.write(OFF); n -= OFF.length; } else { w.write(OFF, 0, n); n = 0; ...
f41c258e-f24e-47e8-9cb6-709b47608284
2
public void push(char[][] field){ for (int i = 0; i < field.length; i++) { for (int j = 0; j < field[i].length; j++) { fields[current][i][j] = field[i][j]; } } current++; }
8cdec490-4bab-4703-9e12-0e603cedb19c
2
public static void main(String[] args) { char again; int n; do{ print("Enter the dimension of the matrix: "); n = scan.nextInt(); double[][] matrix = new double[n][n]; print("\nEnter the matrix data:\n"); input(matrix); print("\nContinue?(Y/N): "); again = scan.next().charAt(0); }while(...
f0174987-fe66-45cb-8a1a-af97ae023140
3
private void solve(String outFile, int startAt, int endAt) throws IOException, InterruptedException, ExecutionException { Set<Result> set = new TreeSet<>(); ExecutorService exe = Executors.newFixedThreadPool (Runtime.getRuntime().availableProcessors()); CompletionService<...
7bdc1001-3154-4f65-a548-da1f957af627
2
@EventHandler public void onBlockPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); if (!plugin.canBuild(player)) { event.setCancelled(true); if (message != null) message.sendMessage(player); } }
5ab3f2dc-2a9d-4d24-9613-6299f5b87b41
9
private void initTransferLNLW(Query currQuery) { currQuery.nodesVisited.get(currQuery.nodesVisited.size()-1).transferFile(currQuery.requester, currQuery.requestedFile, true); // passive replication File mostAccessed = files.get(0); int totalFileWeight = 0; int totalRequestedFiles = 0; int fileWeight = 0; ...
8d96b54c-d32c-497b-9b50-4aaec4e44538
9
public static boolean isJPMobile(String agent){ if (StringUtil.isEmpty(agent)) { return false; } boolean isJMobile = false; agent = agent.toUpperCase(); if(agent.indexOf("DOCOMO") > -1 || agent.indexOf("VODAFONE") > -1 || agent.indexOf("SOFTBANK") > -1 || agent.indexOf("MOT-") > -1 || a...
13814a70-247d-4002-98ef-7d445c272e99
6
public static JSONValue parseArray(ParseInfo info) throws Exception { // STUB (yeah, not a very small stub, but a stub nonetheless) // Sanity check if (info.peek() != '[') { giveup(info, "Failure to begin an array with open brace"); } // if (info.peek() != '[') JSONArray arr = new JSONArray(); String start ...
40450968-af09-4525-bb85-3abc812ee13b
6
public boolean handleClick(Point clickPoint) { HUD hud = null; boolean doUpdate = !gameController.getIsMasterPaused(); //start from the top and work our way down to "layer" the huds for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (doUpdate |...
f6b94057-f833-4d7a-97f6-15355d3abe11
8
protected BigDecimal coerceToBigDecimal(Object value) { if (value == null || "".equals(value)) { return BigDecimal.valueOf(0l); } if (value instanceof BigDecimal) { return (BigDecimal)value; } if (value instanceof BigInteger) { return new BigDecimal((BigInteger)value); } if (value instanceof Numb...
bebe9bfc-bde7-4dcb-b4f7-cf86f6ee795e
8
private static void run(){ Matrix standart = new Matrix(); //erzeuge standart Matrix String eingabe; String file = null; boolean run = true; String re = null; // re fuer restriktionsenzym while(run){ eingabe = Frage("Was moechten sie tun ?"); switch(eingabe){ case "g": re = Frage("Geben ...
b66c7c7b-edab-4144-b50d-842790af6bd6
0
public void setUsuarioCollection(Collection<Usuario> usuarioCollection) { this.usuarioCollection = usuarioCollection; }
27957e15-c413-432e-9428-6a71db66eb4d
8
protected void changeAnimationFrame() { if (this.isAttacking || gameOver) { if (this.framesToChangeTexture < 5) { framesToChangeTexture++; } else if (this.frameNum < this.currentTextures.length - 1) { framesToChangeTexture = 0; this.frameNu...
944ae5f1-3ca9-42ed-9aa7-dcb34247191b
5
public static String nameToNumber(String name) { StringBuilder s = new StringBuilder(); for (char c : name.toLowerCase(Locale.ENGLISH).toCharArray()) { if (Character.isLetter(c)) { int index = c - 'a'; if (index < 0 || index > REV.length) { continue; } int i = REV[index]; if (i > 0) { ...
6b4d3cd9-766d-4d74-9cd6-dce04555e869
5
public static void openSchematic(File file) { try { FileReader reader = new FileReader(file); BufferedReader bReader = new BufferedReader(reader); String currentLine; //A list to hold all bubbles read from file List<Bubble> bubbles = new ArrayList<Bubble>(); //Current bubble being built fro...
5053e2b6-bd49-4701-854d-1f87b07293c4
8
void processEvents() { while (active) { // wait for key to be signalled final WatchKey key; try { key = watcher.take(); } catch (Exception ignore) { return; } final Path dir = keys.get(key); if (dir == null) { LOG.error("WatchKey not recognized! {} does not exist in {}", key, keys);...
4ccb4c7c-418b-4077-8d21-e1ffcac21b9b
6
@Override protected boolean xsend (Msg msg_, int flags_) { byte[] data = msg_.data(); // Malformed subscriptions. if (data.length < 1 || (data[0] != 0 && data[0] != 1)) { return false; } // Process the subscription. if (data[0] == 1) { ...
9983ecf1-8e89-44e9-91fa-c19274149dea
9
public static void main(String[] args) { String filename = args[0]; In in = new In(filename); StdDraw.show(0); // initialize the data structures with N points from standard input PointSET brute = new PointSET(); // KdTree kdtree = new KdTree(); while (!in.isEmp...
e475a94c-3e8a-471b-a1ce-3c2b65551e55
4
@EventHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent e) { Player player = e.getPlayer(); String playername = player.getName(); String cmd = e.getMessage(); CmdLogger cl = new CmdLogger(); cl.cmdLogger(playername, cmd); cl.privMsgLogger(playername, cmd); //The following w...
b8132e11-53ad-4b40-9f54-2ac577ae51a9
3
public VoronoiGraph(Voronoi v, int numLloydRelaxations, Random r) { this.r = r; bumps = r.nextInt(5) + 1; startAngle = r.nextDouble() * 2 * Math.PI; dipAngle = r.nextDouble() * 2 * Math.PI; dipWidth = r.nextDouble() * .5 + .2; bounds = v.get_plotBounds(); for (int...
c3b491be-e6c8-4f84-8505-d7c9cd8a8af0
9
public boolean equals(FeedforwardNetwork other) { Iterator<FeedForwardLayer> otherLayers = other.getLayers().iterator(); for (FeedForwardLayer layer : this.getLayers()) { FeedForwardLayer otherLayer = otherLayers.next(); if (layer.getNeuronCount() != otherLayer.getNeuronCount()...
3b521029-8f57-4046-b6f5-282c1141a1e8
1
private Type simplePop(Frame frame) { Type type = frame.pop(); return (type == Type.TOP) ? frame.pop() : type; }
d2772afd-267c-434e-8ffd-04426f589cec
5
ArrayList<Labyrinth> LoadFile(File file) throws Exception { try { ArrayList<Labyrinth> labyList = new ArrayList<Labyrinth>(); String extension = ""; int i = file.getName().lastIndexOf('.'); if (i > 0) { extension = file.getName().substring(i + 1); ...
cce9028e-0786-4c04-9269-e588c0c514c9
1
@Override public <T> Iterable<T> getTable(Class<T> clazz, Long id) { if (id == 0){ return getAllModels(clazz); } return null; }
3037bdc5-235a-4c82-b702-1c4af89e060c
2
public void method477() { for (int j = 0; j < vertexCount; j++) { zVertex[j] = -zVertex[j]; } for (int k = 0; k < triangleCount; k++) { int l = facePointA[k]; facePointA[k] = facePointC[k]; facePointC[k] = l; } }
5c067e15-66a5-46b6-80a4-4a8d96b0b659
2
public static void drawGradientText(Graphics g, String text, int x, int y, Color c) { g.setFont(new Font("Calibri", 13, Font.PLAIN)); Graphics2D g2 = (Graphics2D) g; Color color3 = new Color(51, 51, 51, 205); Font font1 = new Font("Arial", 0, 12); g.setFont(font1); FontMetrics FONTMETRICS = g.getFontMetrics...
7e289db4-94b6-4ec4-8014-bccfcb6517b3
5
public static String getCookieValue(HttpServletRequest request, String name) { Cookie cookies[] = request.getCookies(); if (cookies == null || name == null || name == "") { return null; } for (int i = 0; i < cookies.length; i++) { if (name.equals(cookies[i].getName())) { return cookies[i].getValue(); ...
7fdb2fd0-5452-4a19-b489-212b65bce51a
5
public void setAttackValueToBlock(int x, int y, int attackValue, String player) { // if(chunkID < 0) // x = 15-x; if(attackValue < 0 || x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length) return; this.attackValue[x][y] = attackValue; lastAtta...
3f7576a0-9465-4aac-874c-3f4a901481cc
0
public String getNomFichier() { return nomFichier; }
2b0a9f24-5a40-4bb5-b3b5-41fdc2b427f5
1
private void writeAllMetrics() { for (String key : metrics.keySet()) { // See: http://docs.appdynamics.com/display/PRO13S/Build+a+Monitoring+Extension+Using+Java#BuildaMonitoringExtensionUsingJava-YourMonitoringExtensionClass MetricWriter metricWriter = getMetricWriter(metricPath + key, ...
8dca21f5-7882-4b47-9a30-e4fd9fb6e82a
2
public void init() { // Get the file location where it would be stored. tempDir = new File(getServletContext().getRealPath("/") + "/tmp/"); saveDir = new File(getServletContext().getRealPath("/") + "/data/"); // make dir if they are not exsit if (!tempDir.isDirectory()) tempDir.mkdir(); if (!saveDir.isDi...
e82d43a7-a3cc-40bf-a07b-a390e32b2dce
0
void setStopped(boolean value) { final ReentrantLock l = lock; l.lock(); try { stopped = value; } finally { l.unlock(); } }
6b000756-fa5a-435f-81c6-7af6032b861f
2
private static void expandMoveRecursivelyForWhite(Board board, Vector<Vector<Move>> outerVector, Vector<Move> innerVector, int r, int c){ Vector<Move> forcedMoves = White.ObtainForcedMovesForWhite(r, c, board); if(forcedMoves.isEmpty()){ Vector<Move> innerCopy = (Vector<Mov...
adbee613-dc7f-41c2-97d3-7d4dfc7c302e
6
public void keyTyped(KeyEvent e) { if (curIndex < 0) curIndex = 0; if (curIndex > currentText.length()) curIndex = currentText.length() - 1; currentText = new StringBuffer(currentText).replace(curIndex, curIndex + 1, "").toString(); switch (e.getKeyChar()) { ...
a8f56aad-e21d-4270-8089-684d8dd2c7bc
7
@Override protected void parseInternal(Method method, Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexes) throws DaoGenerateException { MongoCollection collection = method.getAnnotation(MongoCollection.class); if (collection != null) { globalCollectionName = collection.value(); } ...
cb2dec64-ecf2-459d-b03d-94d80b6ed130
2
public void back() throws JSONException { if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.index -= 1; this.character -= 1; this.usePrevious = true; this.eof = false; }
c396c1ef-dfab-4d34-b5f8-f46df6ae987c
5
public static boolean removeContact(String contactID) { boolean status = false; AddressBook addressBook = Helpers.getAddressBook(); if (addressBook == null) { System.out.println("removeContact - addressBook returns null"); return false; } for (int i = 0; i...
360843cc-adf1-4707-b2db-bc7dd3c1629c
2
public QueueArray<E> enqueue(E e){ if(arr.length == total) resize(arr.length*2); arr[next++] = e; if(next==arr.length) next = 0; total++; return this; }
3275399a-87f9-48f6-a97e-2181a4663cfa
5
@Override public void process(Deque<String> par1Args) { String s; for(;;) { if((s = par1Args.poll()) == null) return; for(ParseOption<?> t : optionList) if(t.accept(s)) t.process(par1Args); } }
a99249d1-cd45-45bf-9251-2f53915d6e67
1
@Override @Command public MessageResponse exit() throws IOException { //System.out.println("Shutting down client now"); logout(); loggedInUserName = null; if(clientSocket != null) clientSocket.close(); UnicastRemoteObject.unexportObject(this,false); shellThread.interrupt(); shell.close(); System.in.cl...
b8b4035d-f6bf-4704-a13b-efcc3237b86d
9
public static List<Livro> getBookList(User baseUser, boolean toRemove) { if(baseUser == null) return null; if(conn == null) getConnection(); List<Livro> bookList = new ArrayList<Livro>(); PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement...
46fd3a81-9050-45e6-be82-fc08bd81f4e4
0
public boolean hasNext() { return current != null; }
9877ec38-91d1-4145-98fa-5faed45fe953
2
public static void main(String[] args) throws Exception { int j = 1; while (j <= 10) { int i = 1; while (i <= 10) { System.out.print("A"); i++; } System.out.println(); j++; } }
6b0272c0-c2d7-4b3d-951c-91f8d0efca85
9
public JPanel createPanelGenerateExercises() { //create // Données : int longueurExercice = 10; JPanel pan = new JPanel(); // Panel haut JPanel panHaut = new JPanel(); panHaut.add(new BmgLabel("Générer des exercices de manière aléatoire : ", "#E43B01")); ...
29b03c23-410e-443a-9fab-1899057e2903
2
private static String getHexString(int dec) { if(dec<0 || dec>255) { return "00"; } else { return Character.toString(hexNums[(int)Math.floor(dec/16)]) + Character.toString(hexNums[dec%16]); } }
15e2967e-e0c8-4a29-97a7-20617693daad
2
@Override public void Write(IOClient player, Server server) { PacketPrepareEvent event = new PacketPrepareEvent(player, this, server); server.getEventSystem().callEvent(event); if (event.isCancelled()) return; try { player.WriteData(new byte[] { ID }); } catch (IOException e) { // TODO Auto-generate...
767bda85-0ca3-4021-9033-42fa4096ec90
6
@Override public void run() { Player[] players = plugin.getServer().getOnlinePlayers(); Player player; long configTime = plugin.getConfig().getInt("KICK_TIMER") * 60 * 1000; for (int i = 0; (players.length - 1) >= i; i++) { long lastMoved = 0; player = players[i]; UserTable ut = plugin.getDatabase().f...
e93db066-ffc9-48f3-9f4e-976fc728d6c9
1
private void preserveSelection() { int anchor = mSelection.getAnchor(); mSavedAnchorRow = anchor != -1 ? getRowAtIndex(anchor) : null; mSavedSelection = getSelectionAsList(); mNotifyOfSelections = false; deselect(); }
83740b78-5cdb-436a-a481-aa339b2871f3
4
public void actionPerformed(ActionEvent arg) { Object ev = arg.getSource(); if(ev == m_exit) { System.exit(0); } else if(ev == m_newClient) { addNewClientTab(); } else if(ev == m_export) { m_clientmanager.saveClient(((ClientPanel) m_tabbedPane.getSelectedComponent()).getAssociatedClient().get...
5abd9725-48d3-4463-b883-0832e42e0ab5
8
public void execute(String[] args) { if ((args.length > 0) && (args[0].equalsIgnoreCase("-s"))) { Server server = new Server(true); try { server.Listener(); } catch (Exception ex) { ex.printStackTrace(); } } else if ((args.length > 0) && (args[0].equalsIgnoreCas...
b26abb55-6388-4171-a56c-4b0d9d209086
1
public static List tokenify(String string) { StringTokenizer st = new StringTokenizer(string); ArrayList list = new ArrayList(); while (st.hasMoreTokens()) list.add(st.nextToken()); return list; }
22f72a33-7951-4578-aa87-29163b952dab
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, Account__typeInfo)) { ...
6dbe46ba-3468-4cbc-beda-44fc0125e34c
4
private String getColumnName(String str) { int j = 0; for(int i = str.length() - 1; i != 0; i--) { if(str.charAt(i) == '_') { j = i; break; } if(i == 1 && str.charAt(0) != '_') { return str; } } str = str.substring(j + 1, str.length()); return str; }
b140d2bd-967d-4721-88f3-954d62482a66
0
public Calculator(int start, int end) { this.start = start; this.end = end; }