method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ce1bbbfd-6e62-496a-9418-2083f77e3cb2
1
public void shuffle(){ Random r = new Random(); for(int i = 0; i < this.cardList.size(); i++){ int n = r.nextInt(this.cardList.size() - 1); Card temp = this.cardList.get(n); this.cardList.set(n, this.cardList.get(i)); this.cardList.set(i, temp); } }
60fe0ac1-b887-484b-9f50-7a3100d5457c
7
private void jBConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBConsultarActionPerformed if(tipoCliente==1){ SQLServerDB sqlServerDB= new SQLServerDB(); DefaultTableModel modelo = new DefaultTableModel(); modelo.addColumn("Cedula"); ...
a51dfd21-6f96-4eb7-840e-160fc308cb09
1
@Override public Iterator<String> iterator() { if (accessed) throw new IllegalStateException("Cannot access file iterator more than once"); accessed = true; final Scanner sc = new Scanner(is); return new Iterator<String>(...
698708a0-a0f1-4c83-b945-b5ad7c535698
8
@Override public int getQualifyingLevel(String ID, boolean checkAll, String abilityID) { if(completeAbleMap.containsKey(ID)) { final Map<String,AbilityMapping> ableMap=completeAbleMap.get(ID); if(ableMap.containsKey(abilityID)) return ableMap.get(abilityID).qualLevel(); } if((checkAll)&&(completeAbl...
0d22fe6f-ff5d-47ae-a5d0-18ea86766cf4
0
@Override public void signalEndOfData() { taskAcceptor.signalEndOfData(); }
32262aa1-03ef-4de4-ac25-7029923bed11
4
private final void promoteSuccs(Instruction from, Instruction to) { if (succs == from) succs = to; else if (succs instanceof Instruction[]) { Instruction[] ss = (Instruction[]) succs; for (int i = 0; i < ss.length; i++) if (ss[i] == from) ss[i] = to; } }
f4777a53-cfb1-4b6c-bb84-22442df49dae
3
public MethodAnalyzer getMethod(String methodName, MethodType methodType) { for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName) && methods[i].getType().equals(methodType)) return methods[i]; } return null; }
f41dd055-68f7-4fd9-8367-87864d9d3bb9
4
private TreeNode rotateLeft(TreeNode rotatingNode) { TreeNode rotatedTreeRootNode = rotatingNode.right; rotatedTreeRootNode.parent = rotatingNode.parent; rotatingNode.right = rotatedTreeRootNode.left; if (rotatingNode.right != null) { rotatingNode.right.parent = rotatingNo...
789b53fa-e7d9-4495-91ae-ad23c143cc8c
3
@Override public void paint(Graphics g) { if (state == GameState.Running) { // TODO Auto-generated method stub g.drawImage(background, bg1.getBgX(), bg1.getBgY(), this); g.drawImage(background, bg2.getBgX(), bg2.getBgY(), this); paintTiles(g); ArrayList projectiles = robot.getProjectiles(); for ...
8bd2b0fd-1612-44f9-803f-f0b8c6b4ba0d
2
public int getFrame() { int frame = this.getFrameIndex(); if(!looped && frame >= frames.length) { this.stop(); return frames[frames.length -1]; }else{ return frames[frame%frames.length]; } }
50090333-f0de-4182-9807-53ca7c3e0e04
6
public void explore() { if (!isDirectory()) return; if (!isExplored()) { File file = getFile(); File[] children = file.listFiles(); for (int i = 0; i < children.length; ++i) { if (children[i].isDirectory()) add(new FileNode(children[i])); } for (int i = 0; i < children.length; ++i) { ...
598e13c6-eddb-4760-a54b-d9e682ff82d1
3
public void deleteElement(ValueType value) throws WrongActionException { if (exist(value)) { SetElement<ValueType> previous = head; SetElement<ValueType> current = head.getNext(); if (previous.getValue() == value) { head = current; } else { ...
cd8b1f2a-443b-464f-88eb-8eb8f63fc5be
8
protected void updatePotionEffects() { Iterator var1 = this.activePotionsMap.keySet().iterator(); while (var1.hasNext()) { Integer var2 = (Integer)var1.next(); PotionEffect var3 = (PotionEffect)this.activePotionsMap.get(var2); if (!var3.onUpdate(this) &&...
061f5bf0-9c8f-43da-9772-296dd9a6d53a
5
public double maxMin(HashMap<Integer, Integer> mapMax, boolean flag){ //метод находит находит max – количество появлений для наиболее часто встречающегося числа, // min - количество появлений для наиболее редкого числа double value; double max = 0; double min ...
445dba9d-7adb-444f-92dd-38c5f81114a3
3
public void func_27180_b(Map var1) { if (var1 != null) { Iterator var2 = var1.keySet().iterator(); while (var2.hasNext()) { StatBase var3 = (StatBase) var2.next(); Integer var4 = (Integer) this.field_25101_b.get(var3); int var5 = var4 == n...
0aa878d7-bf2f-4d4d-90be-0d4653e25b8b
8
public void playermove(){ if (upPressed) { if(!player.offscreentop) { player.setY(player.getY() - playerSpeed); } } if (downPressed) { if(!player...
5ecab521-c4e9-452f-9a9e-f951332167a9
5
private void btnEnterRecordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEnterRecordActionPerformed foundIndex = NOT_FOUND; partNo = this.txtNewProdNo.getText(); partDesc = this.txtNewProdDesc.getText(); try { partPrice = Double.parseDouble(this.txtNe...
a590d2ef-2720-41ec-b987-31b014086ef7
4
public char getColor(int r, int c){ if(r >= size || c >= size || r < 0 || c < 0){ System.err.println("Invalid dimentions (" + r + "," + c + ") for size " + size); System.exit(0); } return puzzle[r][c].getColor(); }
db57f5d3-aa41-4486-b5cf-3009d36fb2b5
9
public static void printSpiralMatrix(int[][] matrix) { //int circleNum = 0; int minRow = 0; int maxRow = matrix.length; int leftCol = 0; int rightCol = matrix[0].length; int i = 0; int numElem = maxRow * rightCol; System.out.println("");...
1145a82a-63e0-47c5-948b-05f20a346b20
1
private double getMean(List<Double> data) { double sum = 0.0; for (double a : data) { sum += a; } return sum / data.size(); }
a6959c6d-0c00-4f77-a547-579f028474b1
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.isEmpty()) throw new Exception("APILA_IND: pila vacia"); Valor op = st.pop(); if (op instanceof Entero) { Valor v = md.get((int) op.getValor()); if (v == null) v = new Entero(0); st....
2bd76761-268f-465b-91d2-b351e3b4d9f7
6
public JSONObject getURLSForCategoriesTag(int cat_id) { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); ResultSet rsTemp = null; Statement stmt1=conn.createStatement(); ...
e6ab25b4-f1c3-4744-bc54-420e0ff90f8f
2
public static Tank getTank(String tS){ Tank tank = null; String[] d = tS.split(","); tank = new Tank( dI(d[0]), d[1], dI(d[2]), dI(d[3]), decodeDir(d[4]), decodeBoolean(d[5]), dI(d[6]), dI(d[7]), dI(d[8]), dI(d[9]), dI(d[10]), dI(d[11]), decodeBoolean(d[12]), ...
36d76a93-65cb-4aa1-abde-493c4b25a102
8
public void spawnEnemies() { if (enemies.isEmpty()) { for (int i = 0; i < difficulty; ) { int temp = rnd.nextInt(200); if (temp < 110 - difficulty*3) { temp = 1; } else if (temp < 180 - difficulty*3 && temp > 110 - difficulty*3) { ...
bdca5abe-f335-4d0a-a659-13c7288dab3d
8
private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost if(!nombreAntiguo.equals(jTextField1.getText())){ int i = JOptionPane.showConfirmDialog(frame, "Seguro que quieres cambiar nombre: "+nombreAntiguo+ "\npor "+jTextField1.getText())...
38752b3f-2e06-40bc-b990-2dcde00a62f8
1
public ImageIcon getToolbarIcon(String name, ActionPanel actionPanel) { ImageIcon i = null; try { BufferedImage bi = ImageIO.read(actionPanel.getClass().getClassLoader().getResource("abstrys/joculus/res/toolbar/" + name + ".png")); i = new ImageIcon(bi); } catch (IOExc...
53d4ccc3-1c4d-4e75-96d9-b48b27086908
1
public void removePush() { if (stack != null) instr = stack.mergeIntoExpression(instr); trueBlock.removePush(); }
5a4466d9-e03e-42df-9ea0-5b0d6350da12
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...
f429f99f-a5f5-4ef3-a51a-460624f175a5
8
String getState() { StringBuffer commands = new StringBuffer("# orientation/center/spin state;\nset refreshing false;\n"); if (!isWindowCentered()) commands.append("set windowCentered false;\n"); commands.append("center " + StateManager.escape(fixedRotationCenter) + ";\n"); commands.append(getMoveToText(0) +...
ed1ba863-3abe-466b-b068-fae574b46d17
5
public static void main(String[] args) throws Exception { // Parse command line arguments. if (args.length != 5) usage(); String host = args[0]; int port = parseInt(args[1], "port"); String originNode = args[2]; double x = parseDouble(args[3], "X - coordinate"); double y = parseDouble(args[4], "Y - coo...
b830fd88-0c2d-4cf0-ba1d-784301450535
9
public void Populate (Node node, LinkedList<interval> list) { //System.out.println("Poblando el árbol del nodo "+node.toString()); int node_depth = 0; if (!list.isEmpty()) { if (node.CurrentInterval == null) { node.CurrentInterval = list.removeFir...
ef2521f4-59c4-4bf4-9285-8e9e854a1e86
6
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); for (int i = a; i <= b; i++) { int length = String.valueOf(i).length(); if(length == 3 && i / 100 == i % 10) { System.out.print(i + " "); } else if(length == 2 && i...
1e030cc0-e382-4633-b6e4-b6e82fd0890b
6
public boolean isLit(int var1, int var2, int var3) { return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height?var2 >= this.blockers[var1 + var3 * this.width]:true; }
5b8e3b54-db88-4b8e-8dc4-6211ba8eb667
6
public int subCnt(int[] res, int n, int x) { if (x > n - 1) return 1; // DONE int cnt = 0; for (int i = 0; i < n; i++) { boolean flag = true; // CHECK for (int j = 0; j < x; j++) { if (i == res[j] || Math.abs(i - res[j]) == Math.abs(j - x)) { flag = false; break; } } if (flag) ...
69e6ce2d-fa39-471e-8c7e-6b6c0f876195
8
protected void optimize1() throws Exception { //% main routine for modification 1 procedure main // while (numChanged > 0 || examineAll) // numChanged = 0; int nNumChanged = 0; boolean bExamineAll = true; // while (numChanged > 0 || examineAll) // numChanged = 0; while (nNumCha...
7c1b5361-f0e6-4172-a01a-18b3a0565735
9
public void moveRight() { setDirection(90); for (TetrisBug tb : blocks){ tb.setDirection(90); } if (rotationPos==0){ if (canMove() && blocks.get(0).canMove() && blocks.get(1).canMove() && blocks.get(2).canMove()) { for (TetrisBug tb: blocks){ tb.move(); } move(); } } if (ro...
d2d3ca3a-af5c-4d3d-a3ef-ccffaa993d18
6
@Override public String toString() { StringBuilder sb = new StringBuilder(); int done = 0, executing = 0; for (OsCmdRunner cmd : commands) { if (cmd.isDone()) done++; if (cmd.isExecuting()) executing++; } sb.append("Queue:\n"); sb.append("\tSize : " + commands.size() + "\n"); sb.append("\tE...
e60f2cb6-9906-4f07-8b35-5ab255586264
2
public static boolean powerOf2(int num) { /** * We first have to test if the number is negative usin a simple mask. If the number is negative then it can't be a power of 2. * The key to having a power of 2 is that in binary there can only be one 1 in the entire number. A way to test this is to subtract * on...
e85e06f2-07c1-47ef-9f00-b2b43097833a
1
@Override public void removeOne(int intId, String strTabla) throws Exception { Statement oStatement; try { oStatement = (Statement) oConexionMySQL.createStatement(); String strSQL = "DELETE FROM " + strTabla + " WHERE id = " + intId; oStatement.executeUpdate(strSQ...
4e26f596-45ba-44f1-a0e0-e63b8216c84f
7
public void open(int row, int col) { validate(row); validate(col); int idx = index(row, col); if (!isOpenV(idx)) { // open it open[idx] = true; // connect UP if (row == 1) { // if row = 1 connect to TOP if (toBottom[idx]) { percolates = true; } ...
eed55192-711e-46bc-9c27-2c1ded20cbff
4
private JPanel createStatPane(JStatView sView1, JStatView sView2, JStatView sView3, JStatView sView4) { JPanel statsPane = new JPanel(new GridLayout(3, 1)); if (sView1 != null) { statsPane.add(sView1); } if (sView2 != null) { statsPane.add(sView2); ...
01b409e8-6ac2-47ad-8f3e-c6cb6a41b107
6
public static void init() { worldThread = new WorldThread(); int availableProcessors = Runtime.getRuntime().availableProcessors(); serverWorkersCount = availableProcessors >= 6 ? availableProcessors - (availableProcessors >= 12 ? 7 : 5) : 1; serverWorkerChannelExecutor = availableProcessors >= 6 ? Executors...
0f54ea86-777f-4e3b-86a0-ab9b2db98bdd
4
public boolean notEquals(Game.PlayerTurn value) { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: notEquals() BEGIN"); } if (test || m_test) { System.out.println("Coordinate :: notEquals() END"); } return (m_Value != value); }
cbf9d8f5-64e8-49f5-ae82-fb7065f93cb4
7
private FloatQueue computeQueue(String expression, byte averageFlag) { FloatQueue q = new FloatQueue(model.getTapeLength()); if (expression.startsWith("\"")) expression = expression.substring(1); if (expression.endsWith("\"")) expression = expression.substring(0, expression.length() - 1); q.setName(expres...
63105af7-3eb0-4a65-b289-067b893f228f
0
public RecentFilesList() { recentFilesList = this; }
e9fb45ca-ee90-4252-b0a7-3cc4133fec65
5
public String getTypeSignature() { switch (((IntegerType) getHint()).possTypes) { case IT_Z: return "Z"; case IT_C: return "C"; case IT_B: return "B"; case IT_S: return "S"; case IT_I: default: return "I"; } }
f7af4fc7-fa15-4d81-94ca-9b63457a3104
9
public static Set<ImageDes> analyzeImages(Page p){ logger.debug("find the imageUrls analyzeImages begins! -----------------------------------------"); dateHelper.start(); Set<String> httpUrl = p.getHrefUrl(); Set<ImageDes> imageDeses = new HashSet<ImageDes>(); for(String url: httpUrl){ String suffix = url...
3cf78a65-1294-46f4-b126-e09a2f241edc
9
public void render(int xScroll, int yScroll, Screen screen) { screen.setOffset(xScroll, yScroll); x0 = xScroll >> 4; x1 = (xScroll + screen.width + 16) >> 4; y0 = yScroll >> 4; y1 = (yScroll + screen.height + 16) >> 4; if (SpriteSheet.levelBackground == null) SpriteSheet.levelBackground = new SpriteSheet(Ba...
20a454c9-07f5-4fa5-bc4a-2dc0e10665fc
9
public void changeplayer(String[] split, String command) { if (split.length != 4) { PrintMessage("Syntax:!switch [game] [oldplayer] [newplayer]"); return; } TournyGame m = (TournyGame) games.get(split[1]); if (m == null) { PrintMessage(split[1] + " is not an existing game"); return; } Strin...
889121ec-9aba-40d2-a683-74ddc6fa1114
7
public boolean getOpenTests(CommandSender sender, int pageNumber) throws SQLException { String database = plugin.getConfig().getString("mysql.database"); Integer numberOfQuestions = plugin.getConfig().getList("quiz-questions").size(); String query = "SELECT * FROM `" + database + "`.`quizzes` ...
2e140568-6194-4859-99da-caadb890e826
3
private void setUpRegister() { register = new JPanel(); // Controls final JTextField firstname = new PlaceholderTextField("first name"); final JTextField lastname = new PlaceholderTextField("last name"); final JTextField username = new PlaceholderTextField("username"); final JPasswordField password = new...
42efad90-c03a-49f0-adb8-4d8d8e72447e
0
@Override public String getSex() { return super.getSex(); }
4d9e5a2f-cfee-417d-9128-30c43f2c3d2e
6
public void printVector(PrintableStringWriter stream) { { Vector self = this; if (self.length() == 0) { stream.print("|i|[]"); } else { { int i = 0; int limit = 9; stream.print("|i|["); { Stella_Object element = null; Vector vector000 = s...
31b98ed7-6186-43b9-8404-66cb15624d8a
1
private void placeEnemyPathOnBoard() { int priority = enemyWaves.getPriority(); for (Point currentPoint : enemyWaves.getEnemyPath()) { int x = currentPoint.getX(); int y = currentPoint.getY(); priorityMap.setPriorityMap(x,y, priority); } }
e4bc07ef-ded7-42e4-a3b0-043fe33a459d
7
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); dp = new boolean[10000][100]; while ((line = in.readLine()) != null && line.length() != 0) { int t = Integer.parse...
2714e7f9-a3c0-46c6-b483-f08f3cec6977
9
public void update(Dimension size) { ship.limitMaximumSpeed(); ship.move(); ship.bounce(size); for (int i = 0; i < bullets.size(); ++i) { TimedObject bullet = bullets.get(i); if (bullet.isTimedOut()) { bullets.remove(i); } else { bullet.move(); bullet.bounce(size); } } for (int i ...
1f7436db-37c3-41b5-b622-14553c4700a8
7
public double calculateDaviesMeasure(){ double daviseMeasure = 0; double clusterCount = 0; for (int i = 0; i < this.clusters.size(); i++) { Cluster ci = this.clusters.get(i); if(!ci.getIsActive()) continue; // if(ci.getPointsIDs().size() < 30) continue; clusterCount ++; double maxDistaceForCi = Doub...
2aa8d8f0-a70a-4bba-b134-8dc99bc5d3fc
5
public static void runInstructions() { try { while (!goToMainMenu && !exit) { // If the display is not visible (minimised), add much more // delay if (!Display.isVisible()) { Thread.sleep(200); } // If the display is requested to close, exit the program else if (Display.isCloseReques...
0599a512-be24-45a9-a406-a914acd44f62
8
public void browseInput() { try { JFileChooser chooser = new JFileChooser(curPath); if (converter.canConvert()) { chooser.setFileFilter(new javax.swing.filechooser.FileFilter() { public boolean accept(File f) { return (f.getName().toLowerCase().matches( ".*\\.(bmp|png|ppm|pgm|jp2|raw|t...
24bc1a7e-26eb-4e62-8bda-3ed9cb3e2ab5
5
public Intersection getClosestNeighbor(ArrayList<Intersection> intersections, Intersection ci) { intersections.remove(level.startingLocation); intersections.remove(level.destination); Intersection closestIntersection = intersections.get(0); if (intersections.size() > 1) { ...
6b2758dc-14bc-4503-901a-e618f71d9191
1
private void validerNombreTotalHeuresAccumulees() { int total = getTotalHeuresAccumulees(); if (total < 40) { declaration.setComplet(false); declaration.ajouterMessageErreur("Il manque " + (40 - total) + "heures de formation pour compléter le cycle.")...
40dbedee-6873-42e5-a8d1-f0c9ace8978c
9
public static void mergeSortWithOutRecursion(Integer[] array, int size) { Integer b[]; int right, rend; int i, j, m; b = new Integer[size]; for (int k = 1; k < size; k *= 2 ) { for (int left = 0; left + k < size; left += k * 2 ) { right = left + k; ...
e3d8695a-d6c1-4d96-918c-efabeb5ff1ce
4
private void highestBuyPrice(){ if (Requests.isEmpty()) { highBuy = 0; } float highest; highest = meanBuyPrice; for (Request RequestX : Requests) { if (RequestX instanceof BuyRequest) { if (highest < RequestX.getU...
e3c8cf5f-b11f-4e09-b129-56530c2e840f
6
private void calcMovement() { final int speed2 = this.speed * this.speed; final long hyp2 = getPythag( this.location.x - this.getAim().x, this.location.y - this.getAim().y); if (speed2 > hyp2) { final int speed2primed = this.speed - 1 * this.speed - 1; if (isCloser(speed2primed, speed2, hyp2) && t...
6c827968-371b-47ad-8a67-a92a5ed478da
9
@Override /** *override the actionPerformed method *to complete the step and make decision */ public void actionPerformed(ActionEvent arg0) { //count the number of step player has done gui.count++; //disable all buttons while computer is making decision for(int i=0;i<4;i++) for(int j=0;j<5;j++){ ...
52280fa7-74de-487d-86a5-e9583111cf24
4
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed // Mettre à jour le document d'après le contenu du textarea setDocumentFromTextArea(); try { controller.closeDocument(); disableWriting(); dis...
83c7bb16-ac5c-422f-a032-cf259c61ebd4
9
public static HashMap<String,Double> getCTMeanMap() throws Exception { HashMap<String, Double> map = new HashMap<String,Double>(); BufferedReader reader = new BufferedReader(new FileReader(new File( ConfigReader.getGoranOct2015Dir() + File.separator + "PC0016 16S qPCR.txt" ))); reader.readLine(); ...
6e63369c-c9cb-4cd6-bff3-88e3d4d9b74c
8
public final Instances resampleWithWeights(Instances data, Random random, boolean[] sampled) { double[] weights = new double[data.numInstances()]; for (int i = 0; i < weights.length; i++) { weights[i] = data.instance(i).weight(); } Instances newData = new Instances(data, data...
4a6354d6-dab8-4bcb-a840-404d52fd1bd9
9
public boolean hides(MemberDeclaration sub, MemberDeclaration sup) { Symbol hider = ((DeclarationImpl) sub).sym; Symbol hidee = ((DeclarationImpl) sup).sym; // Fields only hide fields; methods only methods; types only types. // Names must match. Nothing hides itself (just try it). ...
27e7c5d2-3f4a-4d54-91cc-8018faafe42f
8
@Test public void poleIsPassed() throws SatNotFoundException { final TLE tle = new TLE(LEO_TLE); assertThat(tle.isDeepspace()).isFalse(); final PassPredictor passPredictor = new PassPredictor(tle, GROUND_STATION); DateTime cal = new DateTime(DATE_2009_01_...
15e196ab-e275-47ec-a16c-fcaa9e13e4d5
6
public static IKeyAgreementParty getPartyBInstance(String name) { if (name == null) { return null; } name = name.trim(); IKeyAgreementParty result = null; if (name.equalsIgnoreCase(Registry.DH_KA)) { result = new DiffieHellmanReceiver(); } else if (name.equalsIgnor...
648aa856-9fe0-4a6d-9c8f-1a1532b822b1
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(cmd.getName().equalsIgnoreCase("kill")){ if(sender instanceof Player){ Player p = (Player) sender; if(p.isOp() || p.hasPermission("scmds.kill")){ if(!(args.length < 1)){ Player t = Bukkit.get...
92ce94e8-e7e3-4960-80a9-d8bf7bd8a33a
6
@Override public void itemStateChanged(final ItemEvent e) { if (e.getSource() == bFlame) { if (bFlame.isSelected()) { client.setFlame(true); } else { client.setFlame(false); } } if (e.getSource() == bCyrillic) { if (bCyrillic.isSelected()) { client.setCyrillic(true); } else { clie...
f0c69a86-b0d5-44dc-9a5d-8900d15f5ec0
7
public HttpResponse(HttpRequest req) throws IOException { switch (req.method) { case HEAD: fillHeaders(Status._200); break; case GET: try { fillHeaders(Status._200); // TODO fix dir bug http://localhost:8080/src/test File file = new File("." + req.uri); if (file.isDirectory()) {...
5acb605d-bda0-4ac1-904b-b4b321a9b14d
0
public ExtendedProperty(String name,Property superType) { super(); this.name = name; this.superType = superType; }
05871488-975b-4afb-b648-13658484ddf7
4
private int xpa2Freq (CircularDataBuffer circBuf,WaveData waveData,int pos) { if (waveData.getSampleRate()==8000.0) { int freq=symbolFreq(circBuf,waveData,pos,samplesPerSymbol); if (theApp.isInvertSignal()==false) freq=freq+correctionFactor; else freq=PIVOT-freq+correctionFactor; return freq; } ...
e0aac9fa-e00b-4f4d-8333-19f728e085f1
8
public void tick(Input input, double delta) { time += delta; twinkTime += delta; if (input.buttons[Input.ESCAPE] && time < 5D) { time = 5D; } if (twinkTime >= nextTwink) { eyesOpen = !eyesOpen; if (!eyesOpen) { nextTwink = Math.random() * 0.4; } else { nextTwink = Math.random() * 2 + 1.33...
554336d1-702b-461a-9cbf-8e12b1e102af
7
public void setDirectory(File directory) { if (!directory.isDirectory()) { files = new File[] {directory}; } else { int i = 0; for (File e : directory.listFiles()) { if (e.getName().contains(".") && Utilities.getExtension(e) ...
08b87aad-5df7-4a60-a356-7e5ac25b22a5
7
public Set<Modifier> getOffensiveModifiers(FreeColGameObject attacker, FreeColGameObject defender) { Set<Modifier> result = new LinkedHashSet<Modifier>(); if (attacker == null) { throw new IllegalStateException("Null attacker"); } else i...
c2ec8982-0234-40bd-9b2f-3c3db265287b
5
private void MySQL2HTTP() { Connection conn = null; Statement s = null; PreparedStatement ps_select = null, ps_update = null; ResultSet rs_select = null; int MYSQL_PROXY_PACKETS_ID = 0, SERVER = 0, TARGET_PHP_FILES_RUNS_FUNCTION = 0, TARGET_PHP_FILES_RUNS_FUNCTION_OLD = 0; ...
a53cfd7a-8f18-4655-bc38-1f4356347fdf
4
public void meta(MetaMessage event) { if (event.getType() == END_OF_TRACK_MESSAGE) { if (sequencer != null && sequencer.isOpen() && loop) { sequencer.start(); } } }
7c2efaa6-2704-473a-9374-503999f09b51
4
private void UpdateFOV(LinkedList<Rectangle> walls) { ps.clear(); fov = new Polygon(); float tX = (float) (getPos().X - 50 * old_sign.X); float tY = (float) (getPos().Y - 50 * old_sign.Y); fov.addPoint(tX, tY); fov.addPoint((float) (tX - fovW), (float) (tY + fovH)); fov.addPoint((float) (tX + fovW), (flo...
84029913-1b03-40fd-9bb3-7ce78fa37ae8
3
public boolean collidesWith(CollidableObject co) { //Logic of two rectangles colliding with one another return ! ( co.left > right || co.right < left || co.top > bottom || co.bottom < top); }
8140d57e-181b-4fd6-ab7c-7dd5e9e8f64c
7
public static int findEmptyRegionHash(int widthChunks, int heightChunks) { int regionsDistanceX = 1; while(widthChunks > 8) { regionsDistanceX += 1; widthChunks -= 8; } int regionsDistanceY = 1; while(heightChunks > 8) { regionsDistanceY += 1; heightChunks -= 8; } synchronized (ALGORITHM_LOCK)...
06f111ea-0489-4cc1-85cd-61d54b20939a
8
private BufferedImage getImage() { if(colorMap != null) { color = new Color[K]; float[] numbers = new float[K]; float[] R = new float[K]; float[] G = new float[K]; float[] B = new float[K]; for(int i = 0; i < K; ++i) { numbers[i] = 0; R[i] = 0; G[i] = 0; B[i] = 0; } for(int i =...
9ebdad4a-cb6e-47fc-9fd6-c1c28424491c
2
public static BufferedImage shrink(BufferedImage image, int n) { int w = image.getWidth() / n; int h = image.getHeight() / n; BufferedImage shrunkImage = new BufferedImage(w, h, image.getType()); for (int y=0; y < h; ++y) for (int x=0; x < w; ++x) ...
5396101f-e464-4201-bb94-d6f9c6a9f374
7
double getAvgBaseP(String s){ Annotation document = new Annotation(s); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); Tree t =sentences.get(0).get(TreeAnnotation.class); List<Tree> list = t.postOrderNodeList(); double avg = 0; int count =0...
9e5c71be-cf0f-4954-b7ff-d6cf7c7823a9
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
6c94d3a8-4412-4bc5-9dfc-2a6b0ef01e2b
3
public boolean deplacementValide(int pointDeplacement) { int distance = 0; if (this.posDep.getLigne() < this.newPos.getLigne()) distance += this.newPos.getLigne()-this.posDep.getLigne(); else distance += this.posDep.getLigne() - this.newPos.getLigne(); if (this.posDep.getColonne() < this.newPos.getColonn...
3409e9fd-0b89-4143-92cf-59c5b3e91112
0
@Column(name = "NOV_CEDULA") @Id public Integer getNovCedula() { return novCedula; }
db845610-8c83-48b6-9350-39f84bcda9f9
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=profi...
08771682-ab86-4deb-8ff0-5e6051f5b591
8
public void setLink(TWPoint startPoint, TWPoint endPoint, int direction, int owner) { // Not if it already exists, tho. if (linkArray_[startPoint.x][startPoint.y][direction]) return; linkArray_[startPoint.x][startPoint.y][direction] = true; Link newLink = new Link(owner, startPoint, endPoint); linkList_.add(new...
34d0b124-7d3e-4006-a904-befcdb15e10f
5
private byte[] getClassFromAddedClassPaths(String className) { try { String fsep = System.getProperty("file.separator"); for (String path : paths) { File pathFile = new File(path); if (pathFile.isDirectory()) { File f = new File(path + ...
34245b10-f2f4-4e86-9c9c-089e302198a7
2
public void saveConfiguration() { PrintWriter pw = null; try { pw = new PrintWriter(new FileWriter("./config/configuration.txt")); } catch (IOException ex) { System.err.println("Unable to update settings!"); System.err.println(ex.getMessage()); ret...
3738873a-34da-4c2f-8da0-e236e127904d
7
public void paint(Graphics graphics) { // create an offscreen buffer to render the map if (buffer == null) { buffer = new BufferedImage(600, 600, BufferedImage.TYPE_INT_ARGB); } Graphics g = buffer.getGraphics(); g.clearRect(0, 0, 600, 600); g.translate(50, 50); // cycle through the tiles in the map...
81190ab9-5c13-44bd-9678-e666ee2832b3
3
@WebMethod(operationName = "ReadProdBra") public ArrayList<ProdBra> ReadProdBra(@WebParam(name = "pb_bra_id") String pb_bra_id) { ProdBra pb_in = new ProdBra(); ArrayList<ProdBra> pb_ins = new ArrayList<ProdBra>(); ArrayList<Product> product = new ArrayList<Product>(); ...
3b066086-b721-49cb-b417-fe9ed250acd8
6
public static void main(String[] args) throws InterruptedException { Main main = new Main(); while(true) { for(Unit unit : main.getUnits()) { unit.updateAction(); unit.updateGraphics(); } for(Building building : main.getBuildings()) { building.updateGraphics(); } for(AnimatedObject animOb...
06c45be7-a82d-43c1-837d-32c19b8f43f4
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof LoginInfo)) { return false; } LoginInfo other = (LoginInfo) object; if ((this.logID == null && other.logID != n...
1c87c7a2-3e92-496c-b5eb-8cef5bb954a2
6
public final void method482(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) { int i = 0; int l1 = Rasterizer.centerX; int i2 = Rasterizer.centerY; int j2 = Model.modelIntArray1[i]; int k2 = Model.modelIntArray2[i]; int l2 = Model.modelIntArray1[arg0]; int i3 = Model.modelIntArray2[arg0]; int...
67d8e5ea-6437-471a-9a50-b6186a69a7a9
6
private static double grad(int unknown0, double unknown1, double unknown2, double unknown3) { double unknown4 = (unknown0 &= 15) < 8 ? unknown1 : unknown2; double unknown5 = unknown0 < 4 ? unknown2 : (unknown0 != 12 && unknown0 != 14 ? unknown3 : unknown1); return ((unknown0 & 1) == 0 ? unknown4 : -unknown4) + ...