method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
96059023-bc21-4ec1-987d-55bdf8932ff5
3
public static void createUser(int totalUser, int totalGridlet, int[] glLength, double[] baudRate, int testNum) { try { double bandwidth = 0; double delay = 0.0; for (int i = 0; i < totalUser; i++) { String ...
83d98953-5f9b-4fc3-b4a3-16bc38c3eea6
4
public void keyPressed(KeyEvent e) { int i = targetList.getSelectedIndex(); switch (e.getKeyCode()) { case KeyEvent.VK_UP: i = targetList.getSelectedIndex() - 1; if (i < 0) { i...
07cfe283-0290-49d2-bf91-e9c678b35e8b
6
public void removeCourse(Course course) { if (DEBUG) log("Find the courseWidget that contains the desired course"); CourseWidget target = null; for (CourseWidget cw : courseWidgets) { if (cw.getCourse() == course) { target = cw; } } if (target == null) { if ...
5336295b-bfa1-4a76-8d54-2ae77c863417
0
public static byte[] sha(byte[] data) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(SHA); digest.update(data); return digest.digest(); }
922a599d-a6f5-4024-a105-968120340fc7
6
public static float detectCollision(Collidable a,Collidable b) { if (a == b) return -1F; float velMag1 = Vector.mag(a.getVelocity()); float velMag2 = Vector.mag(b.getVelocity()); float sampleFreq1 = velMag1 / a.getLargestDim(); float sampleFreq2 = velMag2 / b.getLargestDim(); float timeInterval = (...
663e839f-dbb6-4ad2-bd59-7313de59bf60
1
public static void declare(PrintStream w, Object... comps) { w.println("// Declarartions"); for (Object c : comps) { ComponentAccess cp = new ComponentAccess(c); w.println(" " + c.getClass().getName() + " " + objName(cp) + " = new " + c.getClass().getName() + "();"); }...
527a4018-1ad3-41b6-b534-d77f6128ceb2
6
int numConnected(Piece p, int x, int y, boolean[][] board){ if(x<0 || x>=board.length || y<0 || y>=board[0].length || !board[x][y]) return 0; board[x][y] = false; int[] nums = { numConnected(p,x+1,y,board), numConnected(p,x-1,y,board), numConnected(p,x,y+1,board), numConnected(p,x,y-1,board), ...
d05fcf18-bd4c-4c47-937a-2c552a0dc7fa
9
public boolean isCollideingWithBlock(Point pt1, Point pt2) { for (int x = (int) (this.x / Tile.tileSize); x < (int) (this.x / Tile.tileSize) + 3; x++) { for (int y = (int) (this.y / Tile.tileSize); y < (int) (this.y / Tile.tileSize) + 3; y++) { if (x >= 0 && y >= 0 && x < Component....
299f7764-e6ed-4c29-9f05-961a40448348
1
@Override public void printAnswer(Object answer) { if (!(answer instanceof Boolean)) return; System.out.print((Boolean) answer); }
1f66ec12-d885-4cd8-90b4-37260eaafe85
2
@Override public void mouseMoved(MouseEvent e) { if(!isMouseGrabbed) return; Controls.c.setMousePoition((Test3DMain.frame.getX()+Test3DCanvas.WIDTH/2 - e.getPoint().x-3),(Test3DMain.frame.getY()+Test3DCanvas.HEIGHT/2 - e.getPoint().y-25)); //Grabs mouse back to Center of Window try { Robot robot =...
e4d60fdc-7328-4041-92c2-0f774d69e4bc
0
public double getDexterity() { return dexterity; }
b7261663-8342-4c78-b404-1ede59eff87d
5
final void method3782(Interface11 interface11, int i) { try { anInt7640++; if (anInt7738 >= 3) throw new RuntimeException(); if (i != 327685) method3688(-94, -9, -90, -108, 41, -52, 70); if (anInt7738 >= 0) anInterface11Array7741[anInt7738].method45((byte) -47); anInterface11_7745 = anIn...
9215999d-e3eb-4f1b-baa5-1f4267e22f44
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jSplitPane1 = new javax.swing.JSplitPane(); jPanelTitre = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel...
76e4ab13-3b6c-400e-92fa-c935c38cb29e
8
public boolean checkWin(GameState g) { if(townAlive.check()) { if(!g.townAlive(townAlive.getRelational(), townAlive.getNum())) return false; } if(townDead.check()) { if(!g.townDead(townDead.getRelational(), townDead.getNum())) return false; } if(mafiaAlive.check()) { if(!g.mafiaAlive...
374f8a11-6cb7-4875-89fd-a3b8b1680f1f
1
public ParticleRenderer(String name, int number, int maxLife, Texture texture) { super("particleRenderer:"+name); this.particles = new ArrayList<Particle>(number); Random r = new Random(); for (int i = 0; i<number;i++){ particles.add(new Particle(new Vector2f(10,10),1 + r.n...
f4ac6c2f-723b-4e1a-8f66-e4c75adba5af
8
public Edge[] getEdges() { Edge[] ret = new Edge[(n*deg) / 2]; int t = 0; if(deg%2 == 0) { for (int i = 0; i < n; i++) { for (int j = i + 1; j < i+(deg / 2) + 1; j++) { if(i != j) { ret[t++] = new Edge(v[i], v[j % n]); ...
2eed22fb-7006-41f6-92f3-2418eb7838b7
9
private String useTriangleVariables(String s) { int n = view.getNumberOfInstances(TriangleComponent.class); if (n <= 0) return s; int lb = s.indexOf("%triangle["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; TriangleComponent triangle; while (lb != -1 && rb != -1) { v = s.substr...
9c4d5263-4790-4a09-9510-5a8ca4370ea4
9
public boolean buyItem(int itemID, int fromSlot, int amount) { if (amount > 0 && itemID == (server.shopHandler.ShopItems[MyShopID][fromSlot] - 1)) { if (amount > server.shopHandler.ShopItemsN[MyShopID][fromSlot]) { amount = server.shopHandler.ShopItemsN[MyShopID][fromSlot]; } double ShopValue; double ...
c015944d-b38f-4cb5-9ee6-4f9b11b2d839
1
public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = mv.visitAnnotation(remapper.mapDesc(desc), visible); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
8379dca1-ea98-4f3b-9499-9b383d844e45
1
public synchronized boolean addGameLawEnforcer( GameLawEnforcer gameLawEnforcer) { if (gameEnforcerCount < gameEnforcers.length) { gameEnforcers[gameEnforcerCount++] = gameLawEnforcer; gameLawEnforcer.setGameRoom(this); // gameLawEnforcer.start(); return true; } else return false; }
1d6cf03e-d4bd-4c79-ad5a-1d254c9efe69
8
private void dibujaPaint(Graphics2D g2){ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.clip(new Rectangle2D.Float(0, 0, getWidth(), getHeight())); switch (tipo){ case NONE:{ float x1=0,x2=...
4737eb47-68d3-4ec3-973d-d14c8008e785
6
public void update() { // update of the player. No, why so serious ? this.player.update(this); // test this.updateTime(); // update of the monsters // But, with a lot of monster, there will be too much operations ? oO // So, let's check only for nearest only for (int i=0; i<this.level.getMobs().lengt...
b5cafad2-a224-4249-a136-6a60dbd1ee33
3
public void call(String type, Object... params) { if (!methods.containsKey(type)) { throw new IllegalArgumentException("Not enough type"); } Map<Method, Object> methods = this.methods.get(type); for (Map.Entry<Method, Object> entry : methods.entrySet()) { try { ...
9d7d09c0-07fc-4b28-adb5-0167dfccaac9
7
@Override public void insertNames(UUID uuid, String... names) { if (names == null || names.length == 0) { throw new IllegalArgumentException("names must have at least one entry"); } Integer playerId = null; String query; if (names.length == 1) { quer...
ead1d5a0-2b9f-49a8-bb8e-a674a4c7bc37
3
public void execute() throws MojoExecutionException { appDb = new AppInitializer(); BdbTerminologyStore store = appDb.getDB(); ViewCoordinate vc = appDb.getVC(); ConceptVersionBI con = appDb.getBloodPressureConcept(); ConceptVersionBI newCon = null; try { createNewDescription(con); ConceptChronic...
71b4ccd9-4203-4907-906c-485393b6ec41
9
protected void clearWordsBySpot(char[] guesses) { ArrayList<Integer> letSpots = new ArrayList<Integer>(14); for (int i = 0; i < guesses.length; i += 1) { if (guesses[i] != '_') { letSpots.add(i); } } ArrayList<String> wordsToRemove = new ArrayList<...
a00f6d72-2a9f-421d-b08e-1e30e021f824
0
public void showProgress( int current ) { jLabel2.setText("已完成 " + current + " bytes / " + filesize + " bytes"); progress.setValue( current*100/filesize ); }
3c406500-ebf8-4645-88b6-79bfdd67033f
4
@SuppressWarnings("deprecation") public void leaveGame(Player player, boolean normalLeave) { player.setGameMode(GameMode.CREATIVE); //player.setAllowFlight(true); player.setHealth(20.0); player.setFoodLevel(20); player.setLevel(0); for (PotionEffect effect : player.getActivePotionEffects()) { player....
b214428d-aab9-4c31-a356-46b21239d759
6
protected Response getReply() { try { if (read == null) { read = new BufferedReader(new InputStreamReader(socket.getInputStream())); } String line; int code = -1; ArrayList<String> responses = new ArrayList<String>(); while ...
6e4d8e21-0f0d-4280-9fcd-40334cf028cb
5
@Override public void keyReleased(KeyEvent e) { int keyCode = e.getKeyCode(); if(keyCode == KeyEvent.VK_LEFT){ mainPlayer.setLeft(false); } if(keyCode == KeyEvent.VK_RIGHT){ mainPlayer.setRight(false); } if(keyCode == KeyEvent.VK_UP){ mainPlayer.setUp(false); } if(keyCode == KeyEvent.VK_DOWN){...
3759d9c9-e618-44b7-9008-417d33039d26
9
@SuppressWarnings("unchecked") public boolean equals(Object otherViewObject) { if (otherViewObject != null && otherViewObject instanceof View) { View<T> otherView = (View<T>) otherViewObject; if (size() == otherView.size()) { for (int i = 0; i < size(); i++) { if ((get(i) != null || ...
02b5c14e-ac83-4d92-936e-9ae433fa710c
4
private SignFilter(final String text1, final String text2, final String text3, final String text4) throws PatternSyntaxException { this.text[0] = (text1 != null ? Pattern.compile(text1) : null); this.text[1] = (text2 != null ? Pattern.compile(text2) : null); this.text[2] = (text3 != ...
806ee1d9-bef7-4979-ad71-3c1f2e0bfcf8
7
public Set<Map.Entry<Double,V>> entrySet() { return new AbstractSet<Map.Entry<Double,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TDoubleObjectMapDecorator.this.isEmpty(); } publi...
3640faf4-926e-4044-9eac-1033852829d7
0
public static Font getFont() throws FontFormatException, IOException{ URL urlFont = ResourceManager.class.getResource("/fonts/8bit.ttf"); Font font = Font.createFont(Font.TRUETYPE_FONT, urlFont.openStream()); return font; }
cc1af325-9602-43f0-bc1d-f1353be32131
5
private void goDirection(MouseEvent e) { // handle direction Direction direction = view.directionContaining(e.getPoint()); if(direction != null) { switch (direction) { case NORTH: { kdtCC.execGo(Direction.NORTH); break; } case SOUTH: { kdtCC.execGo(Direction....
a438dfaf-8da5-42f4-b3ef-843e8efd1e5c
7
public int Run(RenderWindow App) { boolean Running = true; Text numberChickenKillLabel = new Text(); Text scoreLabel = new Text(); Text numberChickenKill = new Text(); Text score = new Text(); Text scoreLoseLabel = new Text(); Text scoreLose = new Text(); ...
82b2ca30-9c53-4d9d-af9e-db53f787a580
8
public Node findItem(int key) { if (isEmpty()) return null; else { Node current = this.root; while (true) if (current.getKey() > key && current.getLeft() != null) current = current.getLeft(); else if (current.getKey() < key && current.getRight() != null) current = current.getRight(); ...
a619d198-48ce-48c2-98d8-1476e1648b31
9
@Override public Session findPlayerSessionOnline(String srchStr, boolean exactOnly) { // then look for players for(final Session S : localOnlineIterable()) { if(S.mob().Name().equalsIgnoreCase(srchStr)) return S; } for(final Session S : localOnlineIterable()) { if(S.mob().name().equalsIgnoreCase...
dd86a5ac-c1e4-4dd2-9909-902cd9798eb1
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ArraySelectorNode other = (ArraySelectorNode) obj; if (selector == null) { ...
7afedf3d-8377-468f-a41f-4bc44894bdbf
4
private boolean osuukoKarkiVarteen(double karkix, double karkiy, double[] juuriKarkiXYXY){ double varsijuurix = juuriKarkiXYXY[0]; double varsijuuriy = juuriKarkiXYXY[1]; double varsikarkix = juuriKarkiXYXY[2]; double varsikarkiy = juuriKarkiXYXY[3]; ...
ddd90ca7-b108-4572-a843-be9e0d1dc2ff
6
private synchronized void savePasswd() throws IOException { if (passwdFile != null) { FileOutputStream fos = new FileOutputStream(passwdFile); PrintWriter pw = null; try { pw = new PrintWriter(fos); String key; String[] fields; StringBuffe...
3c945c2f-0455-447c-82f5-5829916cdf77
5
private ArrayList<Time_Sheet> getAllConflicts(Time_Sheet ts) throws SQLException{ ArrayList<Time_Sheet> conflicts = new ArrayList(); int oldConflictsSize = 0; conflicts.add(ts); for(int i = 0; i < conflicts.size(); i++){ for(Time_Sheet tempTs : timeSheetAccess.getConflicting...
577589fb-df97-4bf2-ad2f-f8dd9efd26e8
4
public void setComplete() { double temp = 0.0; // Check the IBU if (ibuHigh < ibuLow) { temp = ibuHigh; ibuHigh = ibuLow; ibuLow = temp; } // check the SRM if (srmHigh < srmLow) { temp = srmHigh; srmHigh = srmLow; srmLow = temp; } // check the OG if (ogHigh < ogLow) { tem...
bb767e41-7364-4732-a8a8-cdf01224c48b
7
public int compare(TradeOrder order1, TradeOrder order2) { if (order1.isMarket() && order2.isMarket()) { return 0; } if (order1.isMarket() && order2.isLimit()) { return -1; } if (order1.isLimit() && order2.isMarket()) { return 1; } double cents1 = 100 * order1.getPrice(); double cents2 ...
0962d866-2d5b-4952-b0cf-faf145cd2212
6
Class310_Sub3(DirectxToolkit class378, Class304 class304, int i, int i_0_, int i_1_, byte[] is) { super(class378, class304, Class68.aClass68_1183, false, i_1_ * i_0_ * i); anInt6338 = i; anInt6337 = i_1_; anInt6339 = i_0_; anIDirect3DVolumeTexture6336 = (((DirectxToolkit) ((Class310_Sub3) this).aCl...
971b331c-2d1b-4d9f-ae54-d77a0426f3db
0
public void method2() { System.out.println("执行方法!"); }
1e7aa7c8-773c-4620-b7ce-ee45a03a1028
6
static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextCol...
989b4de9-25d2-4982-bfdd-c970baffab70
2
public static Pays selectPaysById(int id) throws SQLException { String query = null; Pays pays1 = new Pays(); ResultSet resultat; try { query = "SELECT * from PAYS where ID_PAYS=? "; PreparedStatement pStatement = ConnectionBDD.getIns...
51cb7afa-bc21-464d-b500-a10d1da0c421
7
public boolean handleEvent(Event e) { switch (e.id) { case Event.KEY_PRESS: case Event.KEY_ACTION: // key pressed break; case Event.KEY_RELEASE: // key released break; case Event.MOUSE_DOWN: // mouse button pressed break; case Event.MOUSE_UP: // mouse button released controller.onCli...
902b5d45-d455-4802-ac53-0451b10988b4
8
public Iterator<SecFlag> flags() { return new Iterator<SecFlag>() { Iterator<SecFlag> p=null; Iterator<SecGroup> g=null; private boolean doNext() { if(p==null) p=flags.iterator(); if(p.hasNext()) return true; if(g==null) g=groups.iterator(); while(!p.hasNex...
10c1890c-46cf-4f1b-b2e2-479f1f9d7498
7
private void putResize (int key, V value) { if (key == 0) { zeroValue = value; hasZeroValue = true; return; } // Check for empty buckets. int index1 = key & mask; int key1 = keyTable[index1]; if (key1 == EMPTY) { keyTable[index1] = key; valueTable[index1] = value; if (size++ >= threshold)...
5d505491-8f71-4fe9-b661-76e940d5e1ad
6
public static void test() { Gson gson = new Gson(); String json; try { json = getJSON("http://dev.mhsnews.org/json_db/updates.php"); char[] cson = json.toCharArray(); System.out.println(json.toCharArray().length); System.out.println(); //LOOP: //While there is a line in JSON up to a certain...
b2943794-52c2-4446-952a-2be59ab454a0
4
static boolean containsOrigin(List<Vector3f> simplex) { // If we don't have 4 points, then we can't enclose the origin in R3 if(simplex.size() < 4) return false; Vector3f a = simplex.get(3); Vector3f b = simplex.get(2); Vector3f c = simplex.get(1); ...
4fa3791c-a9cc-45ed-a805-26f2979d735f
3
@Test public void getterTest() { for (int i = 0; i < TESTS; i++) { double value = rand.nextDouble() * rand.nextInt(); Angle angle = new Angle(value); double truevalue = value % 360; if (truevalue < 0) truevalue += 360; assertEquals(truevalue, angle.getAngle(), 0.00001); assertTrue(angle.getAngle() ...
96c839e5-b25e-48ef-98a5-e9cfcac76a38
3
private void AddComponentsToGamePanel() { ArtAssets art = ArtAssets.getInstance(); this.setLayout(null); switch (gameState.getDifficultyLevel()) { case GameState.DIFFICULTY_EASY: this.loadTargetPins(new Dimension(4, 3), 60, new Dimension(70, 70), 60,...
0c0e7aea-9d2f-447c-a054-e86c1021f468
5
public static void createSolution() { try { switch (solution) { case 1: s = new FkSolution(depth); break; case 2: s = new F2kSolution(depth); break; case 3: s = new F3kSolution(depth);...
5baac544-276f-4ff3-80fe-51c2f70d87ed
5
public void algoritmi(int iAlku, int jAlku){ int[] sij; Verkkosolmu vuorossa; initialiseSingleSource(iAlku, jAlku); int kaydytsolmut = 0; keko.heapInsert(kaytavaverkko[iAlku][jAlku]); while(!keko.empty()){ kaydytsolmut++; vuorossa = keko.heapDelMin...
f651cb86-c82f-4bf9-b9c9-b558d1493cc8
0
public static String getValidationString() { String random = RandomStringUtils.randomAlphanumeric(20); return random; }
f4a67613-524e-445c-a9d9-a7f573cb66d6
8
final public void EqualityExpression() throws ParseException { Token t = null; InstanceOfExpression(); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQ: case NE: ; break; default: break label_12; } switch ((jj_ntk==-1)?jj_...
413f9ec8-65e5-4ab8-be67-537936cb248a
1
* The expression whose value we are storing. */ private void addStore(final MemExpr target, final Expr expr) { if (saveValue) { stack.push(new StoreExpr(target, expr, expr.type())); } else { addStmt(new ExprStmt(new StoreExpr(target, expr, expr.type()))); } }
e7e1952c-1856-4c6e-9141-10524c40a516
1
public static boolean isWindows() { String osName = System.getProperty("os.name"); if (osName.toLowerCase().startsWith("win")) { return true; } else { return false; } }
8536876a-a187-411f-a7f8-255db6a4d329
3
@Override public float calculateCost() { float cost = getPrice(); cost = (float) (cost + (0.125 * cost) + (.1 * cost)); if (cost > 0) { if (cost <= 100) { cost += 5; } else if (cost <= 200) { cost += 10; } else { cost = (float) (cost + (0.05 * cost)); } } return cost; }
3b01a9b1-cc2c-447d-b2b3-3ba27b71475f
1
public void fillObject(Users user, ResultSet result) { //Заполняем информацией из базы try { user.setId(result.getInt("ID")); user.setUserName(result.getString("USERNAME")); user.setUserPsw(result.getString("USERPSW")); user.setUserState(result.getInt("USE...
7548fd46-a08a-44eb-952d-6ef0f97efd24
4
int bestScore() { alignmentScore = Integer.MIN_VALUE; int maxj = b.length, maxi = a.length; for (int i = 1; i <= a.length; i++) { if (alignmentScore < score[i][maxj]) { alignmentScore = score[i][maxj]; besti = i; bestj = maxj; } } for (int j = 1; j <= b.length; j++) { if (alignmentScore ...
5340d1e1-87f7-4df5-8dd2-6d30745f0299
8
@Override public void tick() { if (fuelSlider.isActive()) { fuelSlider.tick(); } if (massSlider.isActive()) { massSlider.tick(); if (rocket.getY() < 0.001) { mass = massSlider.getValue(); rocket = new Rectangle(210, 0, (int) (m...
036c3555-cd47-4ed3-892a-c2739cc64d09
5
@Override public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { this.conf = context.getConfiguration(); sequenceFileRecordReader.initialize(split, context); // get dimensionLengths from hadoop conf try { ...
0c8d6c11-09b5-4f1f-b6d5-6fc715ff899a
2
private void initComponents() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); selectFileLbl = new JLabel(); backBtn = new JButton(); statusLbl = new JLabel(); sectionScrollPane = new JScrollPane(); sectionListTable = new JTable(); addFileBtn = new JButt...
9dbd231a-32ac-4c31-bd6a-b95c8f2c883b
2
private Connection getConn() { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); try { conn = (Connection) DriverManager.getConnection(this.url, this.usuario, this.senha); } catch (SQLException ex) { Lo...
63c3abde-166e-41e4-a19d-9ea7dfea795a
1
public static boolean isFloat(String string) { try { Float.parseFloat(string); return true; } catch (Exception ex) { return false; } }
7b090b21-68a2-4dd1-9359-7b73e9aba46f
9
@Override public void keyReleased(KeyEvent e) { if (isWaitingForKeyPress() || consoleInputField != null) { return; } /* Movement controls */ if (e.getKeyCode() == KeyEvent.VK_LEFT) { leftPressed = false; leftPresse...
007ff092-1a17-4fea-8d3b-82761c507652
9
private void updateGrid() { // Draw the shadow (previous should already have been removed) if (displayShadow) { shadowDistance = 0; boolean canMoveDown = true; // Drop the shadow to calculate new distance while (true) { for (int[] relLoc ...
ccf658f4-d0a2-4c8d-8d53-7b3f17a5552b
9
private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header) { try { // Read the request line String inLine = in.readLine(); if (inLine == null) return; inLine = URLDecoder.decode(inLine, "UTF-8"); StringTokenizer st = new StringTokenizer( inLine ); if ( !st.has...
403671bd-51d6-4ec3-815d-9cbed7136d75
6
static public Vector3f findTriangleSimplex(List<Vector3f> simplex){ Vector3f newDirection; //A is the point added last to the simplex Vector3f a = simplex.get(2); Vector3f b = simplex.get(1); Vector3f c = simplex.get(0); Vector3f ao = Vector3f.ORIGIN.minus(a); ...
17d6ac84-d993-4253-a651-bec36de09c25
2
@Override public void sorted(OutlineModel model, boolean restoring) { if (!restoring && isFocusOwner()) { scrollSelectionIntoView(); } repaintView(); }
2e10b055-8af7-41e4-abed-1dfba64b208c
9
public boolean create(String username, String albumname){ PreparedStatement stmt = null; Connection conn = null; ResultSet rs = null; try { conn = DbConnection.getConnection(); stmt = conn.prepareStatement(GET_UID_OWNER); stmt.setString(1, username); rs = stmt.executeQuery(); ...
858bade7-aa47-4f81-aadc-87a103f4febb
5
public void displaySet() { System.out.println(""); String disSet = ""; int i = 0; for (Case c : this.set.getCases()) { disSet += "["; for (Player p : this.players) { if (p.getPosition() == c.getPosition()) disSet += "(" + p.getTurn() + ")"; } disSet += c.getDisplay() + "]"; if ( i%20 == 17 ) ...
ab567775-6ae1-4ebb-a2b3-6d28accddaf6
5
public static void putData(int data, int port) { ENABLE_BIT.high(); switch (port) { case 1: GPIO_PORT_PINS.get(0).low(); GPIO_PORT_PINS.get(1).low(); break; case 2: GPIO_PORT_PINS.get(0).low(); GPIO_PORT_PINS.get(1).high(); break; case 3: GPIO_PORT_PINS.get(0).high(); GPIO_PORT_PINS.g...
79799125-5407-4355-93b3-c4488f32e687
5
Rectangle getHitBounds () { int[] columnOrder = parent.getColumnOrder (); int contentX = 0; if ((parent.getStyle () & SWT.FULL_SELECTION) != 0) { int col0index = columnOrder.length == 0 ? 0 : columnOrder [0]; if (col0index == 0) { contentX = getContentX (0); } else { contentX = 0; } } else { content...
a2634a1b-1ea6-4fff-b34d-8453903242ef
6
public ListNode reverseBetween(ListNode head, int m, int n) { if(m == n) return head; Stack<ListNode> stack = new Stack<ListNode>(); ListNode headNew = new ListNode(-1); ListNode step = headNew; ListNode index = head; ListNode left = null; for(int i=1...
4516a03f-d0b5-48c7-a24f-1a36d4db7170
5
public static boolean cobreTodasTwoFlip(Coluna col1, Coluna col2, Solucao sol){ ArrayList<Integer> cobertura1 = col1.getCobertura(); ArrayList<Integer> cobertura2 = col2.getCobertura(); for(Integer entradateste1 : cobertura1){ if(!(sol.getLinhasCobertas().contains(entradateste1))){ ...
7bad6520-76a9-4141-9334-a1d15957bc65
8
public static void processLines(ArrayList<String> listaFiles, String folder) { String[] XMLS=new String[listaFiles.size()]; int counter=1; int iterador = 0; for (String linea2 : listaFiles) { System.out.println("Record "+counter+"..."+listaFiles.size()); counter++; try { URL url = new URL("htt...
d4ed6919-80f3-4bad-8e09-3f82a09bdb4b
3
@Override public void mousePressed(MouseEvent evt) { int mouseX = evt.getX(); int mouseY = evt.getY(); lastTilePressed = CheckTiles(mouseX, mouseY, evt.getButton()); if(lastTilePressed.x != -1 && lastTilePressed.y != -1) { if(evt.getButton() == MouseEvent.BUTTON3) { System.out.println("got in th...
be38708f-769b-47a1-bec7-fdffa2f82358
7
public Map<String, List<Entry<String, List<?>>>> getValue() { Map<String, List<Entry<String, List<?>>>> ret = new HashMap<>(); for(ICommandParser<Entry<String, List<?>>> t : parserList) { List<Entry<String, List<?>>> valList = new ArrayList<>(); for(Entry<String,List<?>> entry : t.getValue()) { valList.ad...
ade04def-c97e-479a-86ad-f828156e74ef
3
public double[] subtractMean_as_double() { double[] arrayminus = new double[length]; switch (type) { case 1: double meand = this.mean_as_double(); ArrayMaths amd = this.minus(meand); arrayminus = amd.getArray_as_double(); break; case 12: BigDecimal meanb = this.mean_as_BigDecimal(); ArrayMaths...
0a7b8586-bc84-4c88-915a-1168f5d340bc
7
public void paintComponent (Graphics g) { super.paintComponent (g); // Background. Dimension D = this.getSize (); g.setColor (Color.white); g.fillRect (0,0, D.width, D.height); g.setColor (Color.black); // Axes, bounding box. g.drawLine (inset,D.hei...
8b3c53c7-52f5-460a-ba99-3ca3d95d19a1
0
public void setSourceText(String sourceText) { _sourceText = sourceText.trim(); }
5abf91f2-d8b2-42bb-a728-8246ede926e9
3
private static void bubbleSort(int[] аrray) { for (int i = 0; i < аrray.length; i++) { for (int j = 1; j < аrray.length - i; j++) { if (аrray[j - 1] > аrray[j]) { int help = аrray[j - 1]; аrray[j - 1] = аrray[j]; аrray[j] = ...
8198daa2-9ee3-4981-ac85-b923d7e7e799
5
private void imprimirCheques() { try{ Scanner lea = new Scanner(System.in); System.out.print("Numero de Cuenta: "); int nc = lea.nextInt(); if( buscarCuenta(nc) ){ if( rCuentas.readUTF().equals("CHEQUE")){ String ar...
f0ca1290-f2eb-4975-baab-4e8c20bcf672
7
private void updateComponents() { int selectedCount = 0; for (int i = 0; i < goodsList.getModel().getSize(); i++) { GoodsItem gi = (GoodsItem) goodsList.getModel().getElementAt(i); if (gi.isSelected()) selectedCount++; } if (selectedCount >= maxCargo) { ...
86e00527-0801-4e89-8d1f-ef83d7809102
8
private void destroyToolBar() { getToolBar().removeAll(); Object o; AbstractButton b; for (Enumeration e = toolBarButtonGroup.getElements(); e.hasMoreElements();) { o = e.nextElement(); if (o instanceof AbstractButton) { b = (AbstractButton) o; b.setAction(null); ActionListener[] al = b.getAct...
011e979b-aea0-441f-b8b1-396618c08242
8
public void initFrame() { GridBagLayout frame_layout = new GridBagLayout(); drawing = new DrawingPanel(640, 480, WORLD_WIDTH, WORLD_HEIGHT, this); addKeyListener(this); getContentPane().add(drawing); side_panel = new JPanel(); side_hud_panel = new JPanel(); score_label = new JLabel("Score: " + score); ...
30889d26-06cd-400f-996c-a8a08738ca14
7
private double calcStepTemp(String stepType) { float stepTempF = 0; if (stepType == ACID) stepTempF = (ACIDTMPF + GLUCANTMPF) / 2; else if (stepType == GLUCAN) stepTempF = (GLUCANTMPF + PROTEINTMPF) / 2; else if (stepType == PROTEIN) stepTempF = (PROTEINTMPF + BETATMPF) / 2; else if (stepType == BETA...
6517ecbc-d47d-4743-b0fc-f535569a6ab6
8
public String readLine () throws IOException { StringBuffer buf = new StringBuffer(80); boolean endOfLine = false; boolean lastWasCr = false; int bytesRead = 0; do { int c = read(); switch (c) { case -1: endOfLine = true; break; case '\r': lastWasCr = true; bytesRead++...
cdb4f6d3-1124-4a19-b1a5-ad3466fcb6a4
9
void readProteinFileGenBank() { FeaturesFile featuresFile = new GenBankFile(proteinFile); for (Features features : featuresFile) { String trIdPrev = null; for (Feature f : features.getFeatures()) { // Find all CDS if (f.getType() == Type.GENE) { // Clean up trId trIdPrev = null; } else if (...
97d1ca6b-dbea-474e-bf30-899f7b18fa1a
0
public List<PhpposSalesEntity> getMovimientosPos(){ return getHibernateTemplate().find("from PhpposSalesEntity where estadoMovimiento = 'N' "); }
c2b5c33b-09b0-4db3-98e5-900b28406264
2
public boolean acquireLock(){ boolean success = false; if(!isLOcked){ synchronized (this) { if(!isLOcked){ isLOcked = true; lockedBy = "localhost"; success = true; String msg = "Acquire_Lock" + ":" + lockName; manager.notifyAllRemoteListeners(new Message(msg, localhost)); } } ...
2b607389-7ab4-4de0-85f9-5581ea1c608a
2
@Test public void testConcurrent() { final int SENDERS = 6; final int SENDS_PER_SENDER = 100; final int TOTAL_SENDS = SENDERS * SENDS_PER_SENDER; final AtomicInteger sends = new AtomicInteger(); final AtomicInteger receives = new AtomicInteger(); final Signal signal = new Signal(); GroupTask.initi...
7c400721-d43c-4e28-ac0a-fbd2d4468936
1
public synchronized boolean isComplete() { return this.pieces.length > 0 && this.completedPieces.cardinality() == this.pieces.length; }
88f360ad-4cbf-4fc5-92c8-ac4e60de58b8
4
private void rebalance() { // Fictitious names for now int leftIndex = 0; int rightIndex = 0; int parentIndex = getParentIndex(getParentIndex(array.getLastPosition())); while (needRebalance()) { leftIndex = getLeftChildIndex(parentIndex); rightIndex = ge...
47e06a18-7e52-4541-b053-5383471fdb9b
8
public static OfflinePlayer requestFilePlayer(String namepart) { OfflinePlayer requested = null; boolean found = false; File dir = new File("plugins/" + AdminEye.pdfFile.getName() + "/players/"); for (File file : dir.listFiles()) { PlayerFile playerFile = new PlayerFile(file.getName().replaceAll( "....