method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3693be5e-6f08-4e0a-b5a0-a4a6e16ef1f9
9
public Result astar() { long startTime = System.currentTimeMillis(); HashSet<HeuristicNode> seen = new HashSet<HeuristicNode>(); Queue<HeuristicNode> toConsider = new PriorityQueue<HeuristicNode>(); //Map<Node, Node> routesTaken = new HashMap<Node, Node>(); int nodesProcessed = 0; toConsider.add(new Heur...
44103556-ac57-4634-93a2-550ba837079c
3
@RequestMapping(value = "/{videoId}", method = RequestMethod.DELETE, produces = "application/json") public ResponseEntity<?> delete(@PathVariable("videoId") int videoId, @RequestParam(required=false) String searchFor, @RequestParam(required=false, defaultValue=DEFAULT_PAGE_DISPLAYED_TO_USER) int page...
6d6c2e5c-3328-49e0-b444-4cc1c58007b9
8
public void moveEntityWithHeading(float par1, float par2) { if (isInWater()) { moveFlying(par1, par2, 0.02F); moveEntity(motionX, motionY, motionZ); motionX *= 0.80000001192092896D; motionY *= 0.80000001192092896D; motionZ *= 0.800000011920...
cef6be36-371d-42a3-8c9b-248432872968
0
public void setCarSourceUrl(String carSourceUrl) { this.carSourceUrl = carSourceUrl; }
202dc0b0-39ff-43a7-9103-8c36fceccd4a
2
public Hunter(HuntField field) { boolean searchPosition = true; this.field = field; while (searchPosition) { position = new Position(new Random().nextInt(field.getXLength()), new Random().nextInt(field.getYLength())); if (field.setItem(this, position)) { s...
de4394c1-6006-4806-81e2-e17cd58caa9d
4
public static void saveWeapon(Weapon weapon) throws IOException { try { List<Weapon> weapons = new ArrayList<>(); weapons = getAllWeapon(); boolean found = false; for (int i = 0, end = weapons.size(); i < end; i++) { if (weapons.get(i).getName().e...
d1ad44e7-b933-42c6-b634-26d9b2e30b48
4
public void tick() { for (int i = 0; i < tiles.length; i++) { for (int j = 0; j < tiles[0].length; j++) { if (tiles[i][j].intersects(new Rectangle((int) (-c.getXOffset() - 64), (int) (-c.getYOffset() - 64), 448 * 2 + 128, 360 * 2 + 64))) { tiles[i][j].tick(); } } } if (t.Ring()) { spaw...
a4d3820d-77fa-4c4b-9df5-d6e3c457597b
5
private void normaliseStructure(String tag, Element htmlEl) { Elements elements = this.getElementsByTag(tag); Element master = elements.first(); // will always be available as created above if not existent if (elements.size() > 1) { // dupes, move contents to master List<Node> toMove...
11adafed-fea6-44e6-a71f-9a93a3c3ec94
8
public Doc(String text) { String line = null; BufferedReader br; try { // Creating Stream with BufferedReader to given Text.. br = new BufferedReader(new StringReader(text)); while ((line = br.readLine()) != null) { //line.split("(.*?[.!?](?:[\"')\\]}]|(?:<.*>))*[\\s])"); String[] res = line.s...
d3684520-85ea-4dca-addc-24d8ee4db76f
5
public static List MergeList(List x,List y){ if(x.size()>y.size()){ for(int i =0;i<x.size();i++) { if(!y.contains(x.get(i))){ y.add(x.get(i)); } } return y; }else{ for(int i =0;i<y.size();i++) { if(!x.contains(y.get(i))){ x.add(y.get(i)); ...
f8f24190-86da-4cf0-bd76-31032be3ebc5
9
public static void main(String[] args) { String filename = args[0]; String separator = args[1]; In in = new In(filename); ST<String, Queue<String>> st = new ST<String, Queue<String>>(); ST<String, Queue<String>> ts = new ST<String, Queue<String>>(); while (in.hasNextLi...
50d34734-bf04-4010-9115-438993ab2974
7
static void populateMap( List<String> taxaNames, HashMap<String, Holder> map, BufferedReader reader ) throws Exception { for( String s= reader.readLine(); s != null && s.trim().length() > 0; s= reader.readLine()) { TabReader sToken = new TabReader(s); sToken.nextToken(); sToken.nextToken(); String sampl...
5ef74567-1ca3-4e04-a337-0b780a2833eb
0
public void render(Graphics g) { Graphics2D g2 = (Graphics2D) g; //System.out.println("" + dValue + " " + value); int length = (int)((w - 2 * bW) * dValue); g.setColor(Color.BLACK); g.fillRect(x, y, w, h); g.setColor(barColorB); g.fillRect(x + bW, y + bW, w - ...
71c86916-49ca-4a58-ad30-79ce2c9a5d88
9
public DependencyGraph<CoffeeIdentifier> generateGraph(CoffeeTree tree) { DependencyGraph<CoffeeIdentifier> graph = new DependencyGraph<CoffeeIdentifier>(); List<OutgoingReferences<CoffeeIdentifier>> outgoing = new ArrayList<OutgoingReferences<CoffeeIdentifier>>(); Set<File> files = tree.getFil...
f354c50f-eb39-4379-a1de-011b4f4572ee
7
private void handle(Object input) { if (input instanceof Datagram) { TransitionEvent event = getTransitionEventFromDatagram((Datagram) input); try { this.fsm.handleEvent(event); if(this.fsm.getCurrentState() != null && "acked".equals(this.fsm.getCurrentState().getIdentifier())) { if(Statics.RX...
a4264305-de5a-4d71-afd2-7cb3dda70406
1
private int skipWhite(int c) throws IOException { while (isWhitespace(c)) { c = getChar(); } return c; }
89379689-5f3a-492b-9c42-66041454e992
3
public WrongLoginWindow(int problem) { this.setSize(200, 100); this.setResizable(false); if(problem == USERNAME) { wrongUser(); centerWindow(); } else if(problem == CODE) { wrongCode(); centerWindow(); } else if (problem == TIME) { wrongTime(); centerWindow(); } }
5685f71b-7f9f-4f61-9c55-f295e512d1c5
6
public Precision getPrecision() { if(year<0) return Precision.NONE; if(month<0) return Precision.YEAR; if(day<0) return Precision.MONTH; if(hour<0 || minute<0) return Precision.DAY; if(second<0) return Precision.MINUTE; return Precision.SECOND; }
a750efba-62fb-4a24-9668-74459e014a09
0
public void setTexte(String texte) { texteRech = texte; notifyObservers(); }
2d95025e-d950-4fe7-96cb-362f856833cc
5
public int numDecodings(String s) { if(s.length()==0) return 0; int[] ways = new int[s.length()+1]; ways[0] = 1; if(checkValid(s.substring(0,1))) ways[1] = 1; else ways[1] = 0; for(int i=2;i<=s.length();i++){ ways[i] = 0; if...
9286a859-2b14-4635-8c0d-e27a23aec4a2
3
public boolean exist(char[][] board, String word) { this.board = board; this.m = board.length; this.n = board[0].length; this.visited = new boolean[m][n]; this.word = word.toCharArray(); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { ...
2f35db74-ea92-4f56-940e-dd9c7b78d031
5
public static void main(String[] args) { ExecutorService executorService = Executors.newCachedThreadPool(); Future<?> future = executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { Random random = new Random(); int duration = random.nextInt(4000); if( dur...
9ee74930-e0a2-4e8e-9315-ab8d1d6fde34
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Move other = (Move) obj; if (fromx != other.fromx) return false; if (fromy != other.fromy) return false; if (tox != other.tox) retur...
585a2e1e-eb1d-4e49-8e72-dc2c53abb767
4
*/ public String toString() { String output = " "; for ( V letter : alphabet ) { if ( !letter.equals("-1") ) { output += (" " + letter); } } output += "\n"; for (int i = 1; i < transitions.length; i++) { output += " " + i; for (int j = 1; j < transitions...
6fc57d48-742d-4112-8ab5-37b1252aeba8
4
public void run() { try { byte[] buf = new byte[1024]; int r; try { while ((r = input.read(buf)) >= 0) { output.write(buf, 0, r); } } finally { if (ownedInput != null) ownedInput.close(); if (ownedOutput != null) ownedOutput.close(); } } catch (IOException...
f780beab-1cf3-4450-be55-7e6d32d296a0
9
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case ID: return String.class; case NOME: return String.class; case APELIDO: return String.class; case DATANASCIMENTO: return String.class; case TELEFONERES: return String...
c682312b-be34-47de-8a84-871f5fabe3bb
4
public Point getPointingDirection(){ double px, py; if(x < 0){ px = -1; }else if (x > 0){ px = 1; }else{ px = 0; } if(y < 0){ py = -1; }else if (y > 0){ py = 1; }else{ py = 0; } return new Point((int)px,(int)py); }
51d0a0dc-b411-4326-b2f5-ccc1f9697092
6
public void render(int xOffset, int yOffset) { for (int y = 0; y < height; y++) { int yp = y+yOffset; if(yp < 0 ||yp >=height)continue; for (int x = 0; x < width; x++) { int xp= x + xOffset; if(xp < 0 ||xp >=width)continue; pixels[xp + yp * width] = Sprite.grass.pixels[(x&15)+(y&15)*Sprit...
fc11e565-6eae-4461-8081-27b72bda77a3
3
public int extractA(String figure) { if (Objects.nonNull(figure) && Objects.nonNull(getFigureQuantityMap()) && getFigureQuantityMap().containsKey(figure)) { return getFigureQuantityMap().get(figure); } return 0; }
0aba7051-1a95-4c8a-9aa8-f8b505203f53
9
private int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 38: if ((active0 & 0x400L) != 0L) return jjStopAtPos(1, 10); ...
8da548ef-2c98-4023-8e7c-5fb0c285ec3d
9
public Itemsets runAlgorithm(String output, TransactionDatabase database, double minsupp) throws IOException { // if the user want to keep the result into memory if (output == null) { writer = null; frequentItemsets = new Itemsets("FREQUENT ITEMSETS"); } else { // if the...
d4967c13-1722-4917-a02c-fd3026757720
2
public String getString(String key, String def) { if(fconfig.contains(key)) { return fconfig.getString(key); } else { fconfig.set(key, def); try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); } return def; } }
12f9e3a9-3ae7-4aa2-bcfd-8f9ded647fe6
9
public Object getValueAt(int row, int col) { Statement m = getAllStatements().get(row); if (col == 0) { return m.getName(); } else if (col == 1) { return Utils.toString(m.getDate()); } else if (col == 2) { return (m.isDebit()) ? "D" : "C"; } else if (col == 3) { return m.getAmount(); } els...
f3f47959-b669-4ae1-92f4-5215ab81ea85
3
@Override public List<Integer> next() { while (true) { while (c - a > 1) { a++; List<Integer> triplet = createTriplet(); if (triplet != null) { return triplet; } } a = 1; c++; ...
d707778b-94d7-4729-bc22-6dbd8b07d233
5
public Writer write(Writer writer) throws JSONException { try { boolean commanate = false; Iterator keys = keys(); writer.write('{'); while (keys.hasNext()) { if (commanate) { writer.write(','); } ...
a4b8eace-555c-4780-9bc5-c59f6988e509
1
public Resistance(String resist) { if(resist != null) { String[] temp = resist.split(":"); this.crush = Float.parseFloat(temp[0]); this.slash = Float.parseFloat(temp[1]); this.thrust = Float.parseFloat(temp[2]); this.magic = Float.parseFloat(temp[3]); this.head = Float.parseFloat(temp[4]); this.b...
e93a714a-1d97-4981-8975-8876a71125a5
0
@Basic @Column(name = "phone_number") public String getPhoneNumber() { return phoneNumber; }
63f67fca-9d74-4c79-9043-628ee4094f54
2
public static ArrayList<Announcement> getAllAnnouncements() { ArrayList<Announcement> announcements = new ArrayList<Announcement>(); String statement = new String("SELECT * FROM " + DBTable); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(statement); ResultSet rs = stmt.executeQuer...
12c508c7-5e5e-4a93-a0ab-35f86ebc5de5
5
public ArrayList<ArrayList<Integer>> threeSum(int[] num) { // Start typing your Java solution below // DO NOT write main() function int n = num.length; Arrays.sort(num); Map<String, Boolean> map = new HashMap<String, Boolean>(); for (int i = 0; i < n - 2; i++) { int expect = 0 - num[i]; int l = i + 1,...
78a3b6f1-2b5e-48ed-ac91-58896ed1c2ac
7
@SuppressWarnings ("unchecked" ) public ReflectObject( Class<?> type ) { Constructor<?> calculatedConstructor = null; Field[] calculateFields = null; Reflect<Object>[] calculatedReflects = null; int calculatedMaxSize = 0; try { calculatedConst...
4cd53302-555d-4c40-827d-d18c52f934b9
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...
24d304f8-3408-403c-8d3e-c9741c933686
0
public void addEdge(Object vertex1, Object vertex2) { adjacent(vertex1).add(vertex2); adjacent(vertex2).add(vertex1); }
ee4f05b1-e1e3-4118-8b77-615a59faf1d9
4
public LayerPanel() { layerCount = 0; initComponents(); selected = -1; displayed = new ArrayList<>(); setFocusable(true); addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { } ...
da5159b7-b999-4d24-aa5f-39242d6695b6
9
public void getLabel(StringBuffer s) throws Exception { //for now just return identity //StringBuffer s = new StringBuffer(); FastVector tmp = (FastVector)m_ranges.elementAt(0); if (m_classObject != null && m_training.classAttribute().isNominal()) { s.append("Classified by\...
9bd2a894-6819-462d-aa36-77dd07dc1c28
2
@EventHandler public void onKeyPressed(KeyPressedEvent event) { if (event.getScreenType() != ScreenType.GAME_SCREEN) { return; } final Keyboard key = event.getKey(); final UUID ident = event.getPlayer().getUniqueId(); switch (key) { case KEY_LSHIFT: SHIFT_HELD.put(ident, true); } }
4a337085-d114-4b15-8b0c-873c095b92fe
8
public static void mouseEntered(MouseEvent mouseEvent) { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldHandleMouse) { if (comp.shouldHandleMouse(...
c97f8ba7-621f-4fb9-9340-460588ea4a51
2
public static void main(String[] args) { Comparable<Integer>[] a = new Integer[20]; Random r = new Random(); System.out.println("Before Sort: "); for (int i = 0; i < a.length; i++) { a[i] = r.nextInt(50); System.out.print(a[i] + " "); } new...
5a7afe2d-9686-4ebb-b483-901a9457574d
9
public final NiklausParser.multiplicationexpression_return multiplicationexpression() throws RecognitionException { NiklausParser.multiplicationexpression_return retval = new NiklausParser.multiplicationexpression_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token M...
206528cc-82bb-4bc3-9593-48e221065d06
0
public void reset() { // do nothing }
6b22ef77-bcd4-497e-8fb7-7f43f57233d8
1
protected void initView() { initTreePanel(); // Sets up the displays. JComponent pt = initParseTable(); JScrollPane parseTable = pt == null ? null : new JScrollPane(pt); GrammarTable g = initGrammarTable(grammar); JScrollPane grammarTable = new JScrollPane(g); myJListModel=new DefaultListModel(); my...
fa6555ce-1190-4735-8b22-f314f0887a7d
7
private void paintPitches(Graphics g) { // graph pitches FontMetrics fm = g.getFontMetrics(f); int ascent = fm.getAscent() / 2; for (int i = 0; i < 127; i++) { if (i % 12 == 0) { g.setColor(Color.red); } else if (i % 12 == 4) { g.s...
12bafdf7-4ed6-46f3-a98b-31d1712de725
6
public static boolean indexIthDomainP(NamedDescription description, int i) { { boolean testValue000 = false; testValue000 = false; if (testValue000) { testValue000 = NamedDescription.functionDescriptionP(description); if (testValue000) { testValue000 = !NamedDescription.comput...
1b1c3371-8c66-4e87-bc35-75a0f241f5f5
4
private void getBounce (Dimension bounds) { if (getBottom() >= bounds.height || getTop() <= 0) { getVelocity().setDirection(-getVelocity().getDirection()); } else if (getRight() >= bounds.width || getRight() <= 0) { getVelocity().setDirection(Sprite.LEFT_DIRECTION - getVe...
aa63cb2d-1c2d-4fdd-b651-4f9d4ee90ca6
3
public void loadPatientData(){ PatientLogic myLogicLayer=new PatientLogic(); List<Patient> patientList=new ArrayList(); DefaultTableModel patientDataTable=new DefaultTableModel(); Object[ ] columnNames=new Object[6]; Object[ ] fieldValues=new Object[6]; Patient myPatient=n...
80a157f1-1741-4cc5-b7a0-520a6627693d
0
public double getLeftDistance() { return _leftEncoder.get(); }
99ef3b91-5259-4d16-8c76-4266ca6f987d
9
public Tree extractSelectedTree() { DrawableNode ancestor = null; if (selectedNodes.size()==1) { DrawableNode node = selectedNodes.get(0); ancestor = node; } else { ancestor = findCommonAncestor(selectedNodes); } if (ancestor==null) { ErrorWindow.showErrorWindow(new NullPointerException("Could n...
e8502420-6f46-42de-b353-017d5b3c4bbd
5
public static void main( String args[] ){ MiniDB_Util.canWait = false; MiniDB_grade grader = new MiniDB_grade(); double totalPoints = 0; double pointsByTest[] = new double[NUM_TESTS+1]; System.err.println( "Test starting up" ); if( args[0].equals( "-all" ) ){ boolean skipTest[] =...
224922bf-e6d2-4389-b208-91d12024bacf
9
private boolean r_t_plural() { int among_var; int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; // (, line 160 // setlimit, line 161 v_1 = limit - cursor; // tomark, line 161 ...
2bd0e527-6c40-44e4-b784-309d666746c3
0
public void evenIncrement() { i.addAndGet(2); }
f7cdfe65-0028-4084-8748-07b47ff65edb
0
public static void setSide(int side) { s = side; t = (int) (s / 2); //t = s sin(30) = (int) CalculateH(s); r = (int) (s * 0.8660254037844); //r = s cos(30) = (int) CalculateR(s); h = 2 * r; }
29cf7419-83e2-4b69-a4ee-e62ddfe20bc6
7
private void update() { int tryNumber = 0; this.parser.setBasePath(updateDir); while (!pendingQueue.isEmpty()) { try { try { tm.suspended(); } catch (InterruptedException ex) { Logger.getLogger(UrlHandler.class.g...
8c024f98-3d12-4ad7-bc92-a0d0d4892eef
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...
61084a27-0a77-4d2d-9d77-72f0c9c95435
9
private SimpleStmt simple_stmt() { ArrayList<SmallStmt> small_stmt_list = new ArrayList<SmallStmt>(); while (lexer.token == Symbol.ID || lexer.token == Symbol.PRINT || lexer.token == Symbol.CONTINUE || lexer.token == Symbol.BREAK || lexer.token == Symbol.RETURN && lexer.token != Symbol....
4e857149-107b-478e-9425-c87345d1fc3f
8
public CompareShippingReport(Map<String, Object> parameters) { try(Connection connection = ServiceDB.getConnection(Application.getContext().getUserDB().getLogin(), Application.getContext().getUserDB().getPassword())){ connection.setAutoCommit(false); try(Statement s...
c593dba8-e430-400f-8a12-b1f5ebf93ae5
3
public void addHost(Host host) { if (hosts.get(host.getName()) == null) { hosts.put(host.getName(), host); } for (DeviceModelChangeListener listener : listeners) { listener.hostAdded(host); } for (Device device : host.getDevices()) { addDevice(device, false); } }
44b5d651-5d5e-44bf-84d8-bd4c19d02de0
3
@Override public String toTex() { // auto-add header boilerplate StringBuilder sb = new StringBuilder(); while (!stack.isEmpty()) { Story curr = stack.pop().getStory(); if (curr != null) { // useTex = TRUE, authors cannot be shown in Tex (per story, an...
865785e5-a54c-45df-a0db-6759a6ed489e
3
protected void func_31026_E() { boolean var1 = false; int var2 = -1; int var3 = -1; int var4 = -1; float var5 = -99999.0F; for(int var6 = 0; var6 < 10; ++var6) { int var7 = MathHelper.floor_double(this.posX + (double)this.rand.nextInt(13) - 6.0D); int var8 = MathHe...
a80e9dd7-2f02-493d-926f-e5a0ea79ce00
4
private Symbol getSymbolByAlter(String alter){ if(alter != null && !alter.isEmpty()) for(Symbol symbol : this.alphabet){ if(symbol.mathByAlter(alter)) return symbol; } return null; }
39c5408c-351b-4199-8a6e-0044460f3df6
8
public QRDecomposition (Matrix A) { // Initialize. QR = A.getArrayCopy(); m = A.getRowDimension(); n = A.getColumnDimension(); Rdiag = new double[n]; // Main loop. for (int k = 0; k < n; k++) { // Compute 2-norm of k-th column without under/overflow. double n...
33e8991b-e136-481b-9c46-bff75d5d57b7
3
public void writeChar (String ct,Color col,Font font) { if (ct!=null) { if (pauseDisplay==false) display_view.addChar(ct,col,font); if (logging==true) fileWriteChar(ct); } }
636b9af2-a856-497c-bf57-bdf40c114d08
8
public String Convertir(String numero, boolean mayusculas) { String literal = ""; String parte_decimal; //si el numero utiliza (.) en lugar de (,) -> se reemplaza numero = numero.replace(".", ","); //si el numero no tiene parte decimal, se le agrega ,00 if(numero.inde...
b6929a97-33c8-4768-9e75-287d54de12ea
4
@Override public void run() { ImageSegFrame frame = null; BufferedImage screenshot = null; while (true) { // capture an image screenshot = ActionRobot.doScreenShot(); // analyse and show image //int[][] meta = computeMetaInformation(screenshot); if(!useRealshape) scree...
dc805a4a-7b6f-4463-8e07-03588cff7318
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data =...
8731f359-0f8a-4b34-ba1b-16b6eacdec37
3
public void inint(int n) { distancias = new int[n][n]; padres = new int[n][n]; for (int i = 0; i < n; i++) for (int k = 0; k < n; k++) if (i != k) distancias[i][k] = INF; }
f8f05d38-6b2a-4e16-9340-b22333d46f1f
4
private TetravexPiece getIdeal( int x, int y ) { TetravexPiece ideal = new TetravexPiece( EMPTY, EMPTY, EMPTY, EMPTY ); if (isPiece( x - 1, y )) { ideal.s[LEFT] = pieces[board[y][x - 1]].s[RIGHT]; } if (isPiece( x + 1, y )) { ideal.s[RIGHT] = pieces[board[y][x + 1]].s[LEFT]; } if (isPiece( x, ...
f50037f8-2568-4a59-b76e-3eb01a878e8f
7
public double getMode(double[] pitches){//method for calculating the mode of the pitch array generated double t = 0; for(int i=0; i<pitches.length; i++){ for(int j=1; j<pitches.length-i; j++){ if(pitches[j-1] > pitches[j]){ t = pitches[j-1]; pi...
d93196ec-e2f5-4093-8a93-f0dda573df2e
7
private float accelerate() { if (this.velocity <= 10 && this.velocity >= 2) { if (((this.velocity - 2f) / 8f) < this.throttle) { return 4f * TIMESTEP_SCALE; } if (((this.velocity - 2f) / 8f) > this.throttle) { return -4f * TIMESTEP_SCALE; } } if (this.velocity >= 1.5 && this.velocity <= 10) ...
1104ef9b-dbf5-4fdc-b99a-26c9d5bc9c99
7
@Override public String getBodyString() { synchronized (this) { ByteArrayOutputStream temp = new ByteArrayOutputStream(); try { if (body == null && inStream != null) { byte[] buf = new byte[4096]; int len; wh...
34f83c8d-b87b-4c68-9490-1bf900342df2
5
@Override public boolean equals(Object o) { if (o == null || !(o.getClass() == Mock.class)) { return false; } Mock m = (Mock)o; if (this.i != m.i || this.j != m.j || !(this.date.equals(m.date))) { return false; } return true; }
dbae4d33-e4a6-4a23-bbd0-2bd4fa22801b
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IconIndex other = (IconIndex) obj; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.p...
80dae08b-b75b-4076-b9e7-d59ed9df2a10
5
public static boolean isProperPlayer(UUID eUUID, UUID pUUID){ try { String t = PetBukkit.pb.t; PreparedStatement p = PetBukkit.pb.c.prepareStatement("SELECT * FROM `" + t + "` WHERE pUUID = ?;"); p.setString(1, pUUID.toString()); ResultSet rs = p.executeQuery(); while(rs.next()){ if(rs.getString("p...
0b8cc442-ca6b-4a3a-892f-afd958d6de74
6
public void setEditValue(int n, EditInfo ei) { if (n == 0) { if (ei.checkbox.getState()) { flags |= FLAG_FLIP_X; } else { flags &= ~FLAG_FLIP_X; } setPoints(); } if (n == 1) { if (ei.checkbox.getState()) ...
e4538235-7522-42bc-a174-edbaa3cf6b94
2
public void popularCbProjeto() { ArrayList<String> Projetos = new ArrayList<>(); ProjetoBO projetoBO = new ProjetoBO(); try { Projetos = projetoBO.ComboBoxEscolhaProjeto(usuarioLogado.getDepartamento().getCodigo()); } catch (SQLException ex) { JOptionPane.showMes...
7d6d1186-014c-409b-a969-f9b888ee5f43
1
public void setPeriodRange(String periodRange) { System.out.println("*****Setting Period Range to " + periodRange); parseRange pr = new parseRange(); boolean[] range_tmp = pr.getArray(periodRange, 13); this.periodMask = new boolean[12]; for (int i = 0; i < 12; i++) { ...
7eeedc90-8159-400e-91d8-020ca1325b04
7
public static void exportGrafoAsImage(GrafoComponent cmp, File f) throws IOException { Grafo g = cmp.grafo; HashMap<Vertice, Point> posizioniOriginali = new HashMap<>(); int xMin = Integer.MAX_VALUE; int xMax = Integer.MIN_VALUE; int yMin = Integer.MAX_VALUE; ...
dd20f44b-4892-4c05-aee4-8cf47129c83a
8
public void input(int delta) { if (Keyboard.isKeyDown(Keyboard.KEY_Z)) { int dy = (int) this.position.y; float oldY = this.position.y; dy -= 0.1f * delta; this.aabb.center.y = dy; if (!checkCollisions(this)) { this.position.y -= 0.1f * delta; this.aabb.center.y = this.position.y; } else { ...
ffdab807-89af-4c73-8399-d07a46b0f9d1
9
@Override public void sort() { // Divide Vector<T> arr1; Vector<T> arr2; // If there are zero or one elements if (this.arr.size()<=1) { this.steps=1; return; } // If there are two elements if (this.arr.size()==2) { // compare them and swap if necessary if (this.arr.getValue(0).compare...
3b7ef721-b7a9-45da-89ab-cbb490e22034
0
public Village(ArrayList<Villager> population, int x, int y) { this.x = x; this.y = y; this.population = new ArrayList<Villager>(); this.addPopulation(population); constructCity(); }
d448edbc-42e2-443c-b450-0ea47b6bd0f6
4
protected void handleControlPropertyChanged(final String PROPERTY) { if ("RESIZE".equals(PROPERTY)) { resize(); } else if ("PREF_SIZE".equals(PROPERTY)) { aspectRatio = getSkinnable().getPrefHeight() / getSkinnable().getPrefWidth(); } else if ("SELECTED".equals(PROPERTY))...
90f6ffe1-aec3-41b1-8897-ac9e6033b817
3
public void resetSelectd(){ if(shift == false){ for(MyDrawing d : drawings){ d.isSelected = false; } if(selectedDrawings.size() != 0){ selectedDrawings.clear(); } } }
390a5bf8-33a2-4b15-93cd-3373c0be6974
4
private void sendFile(File file, BufferedOutputStream out) { // Prepare InputStream try (InputStream reader = new BufferedInputStream(new FileInputStream(file))) { // No ContentType found? Start a simple download String contentType = FileManager.getContentType(file); if (contentType == null) { contentT...
77fcf7b1-bcec-4361-8671-62805d93d227
7
public static ArrayList<SearchResult> searchItem(String name) { ArrayList<SearchResult> output = new ArrayList<>(); String input = null; int id = -1; String label = null; try { input = Untils.readPage(new URL(SEARCH_ITEM + URLEncoder.encode(name, "UTF-8"))); } catch (Exception e) { e.printStackTrace...
db206fff-b189-48d7-88fc-fc32c26ad520
0
public static void main(String[] args) { new TheWorld(); }
39eff7e0-d0d9-4283-bed9-bdf21b6fd2d8
7
private static Set<Class<?>> collectHierarchyClasses(Collection<Class<?>> classes) { Set<Class<?>> resultSet = new HashSet<>(); for (Class<?> cls : classes) { Class<?> curCls = cls; while (curCls != null) { resultSet.add(curCls); curCls = curCls.ge...
3a5617c9-f66f-4f4f-a2d6-39c2f02cc7ce
4
private int executeNativeGit(final String... cmd) throws IOException, InterruptedException { final Process p = Runtime.getRuntime().exec(cmd, null, this.repoRoot.toFile()); final BufferedReader rOut = new BufferedReader(new InputStreamReader( p.getInputStream())); final BufferedReader rErr = new Buffer...
80863603-ea2d-4f04-8c1e-34a918652380
1
protected void processActionEvent(ActionEvent e) { if(actionListener != null) { actionListener.actionPerformed(e); } }
d36f05e3-495a-432a-9068-c4606a6088de
7
protected void setPanelPerson(P p, boolean newPerson) { if (getFieldsChanged()) { System.out.println("Player panel changing, fields modified."); try { savePerson(); } catch (InvalidFieldException e) { setExceptionError(e); return; } } isNewPerson = newPerson; if (isNewPerson) { load...
2c375781-6da9-4110-b0aa-9547851599bd
8
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been ...
365d32c3-d38e-4dd6-abed-8907bbe25e52
4
public int getTime(){ boolean test = false; if (test || m_test) { System.out.println("OthelloAI :: getTime() BEGIN"); } if (test || m_test) { System.out.println("OthelloAI :: getTime() END"); } return m_time; }
6488eee9-6d08-479d-9784-cf05d3f3de25
9
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirection / HALF_RIGHT) * HALF_RIGHT; int...