method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d7550ecb-b3b6-4906-9f9d-e7cd1084f3a6
1
private void startOutput(String fileName){ leavesContentFile = new java.io.File(fileName + ".leavesContent.txt"); try { leavesContentFileWriter = new FileWriter(leavesContentFile); leavesContentFileWriter.write("FileBasedThreadSpider Start: " + getRightNowTimeStr("/", ":", " ") + "\r\n"); } catch (IOExcepti...
a7027db6-c01c-4744-9b4d-dbab9642a366
2
public void start() { if (driving) return; (new Thread() { public void run() { driving = true; while (driving) { move(); yield(); // prevent consuming all CPU resources } } }).start(); }
2d586799-bcc4-4fe0-9649-25e933c9da25
7
public static void performEvents(ArrayList<HasKeyEvent> objects){ for (Integer code : keysPressed) for (HasKeyEvent obj : objects) obj.keyPressed(code); for (Integer code : keysDown) for (HasKeyEvent obj : objects) obj.keyDown(code); for (Integer code : keysReleased) for (HasKeyEvent obj : object...
25f681d4-2809-4428-a330-afb46d4843ad
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 fe...
c8c3ea54-4db0-40e8-96d6-71235dc63d85
4
private void setFire (Location loc, int depth) { Block block = loc.getBlock(); Block blockDown = loc.getBlock().getRelative(BlockFace.DOWN); if (block.getType() != Material.AIR || blockDown.getType() == Material.AIR) { Block highest = loc.getWorld().getHig...
bbb5b022-6816-4d41-9f72-15c6192b0aa2
9
public void testOneTask() { System.out.println("\nStarting testOneTask"); tasks = tasksAccess.getTasks(); assertNotNull(tasksAccess); date1.set(2013, 7, 7); task1.setDueDate(date1); tasksAccess.sort(0, false); for(int i = 0; i < tasks.size()-1; i++) { assertTrue(tasks.get(i).getTaskID(...
79a4302e-32e1-4ff3-a6c2-e3753ec041d7
4
public void mapRead(int fileNumber) throws IOException { String nextLineData[]; int hashValue; int lineNumber = 1; WordData next; try { Scanner scan = new Scanner(Index.fileArray[fileNumber]); //Read all words in document while(scan.hasNext()) { //Get next line of data split by...
29c935b5-964a-4db5-99c8-cacca6247278
3
private String getDynamiteLabelText() { if(model.isInfiniteDynamite()) { return "You have INFINITE packs of dynamite!"; } else if(model.getRobot().getDynamite() == 0) { return "You don't have any packs of dynamite!"; } else if(model.getRobot().getDynamite() == 1) { return "You have 1 pack of dynamite."; ...
8b481351-8e5f-4e5c-9ecd-8b5a0ff0bfb3
8
private static void bigClosestDepotRouteWithGreedyCut(Individual individual) { ProblemInstance problemInstance = individual.problemInstance; //Assign customer to route boolean[] clientMap = new boolean[problemInstance.customerCount]; int assigned=0; individual.bigRoutes = new ArrayList<ArrayList<ArrayL...
4fbf7901-8aa1-415d-9da5-300327ee4577
9
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); PrintWriter webPageOutput=null; try { webPageOutput=response.getWriter(); } catch(IOException error) { Routines.w...
30549eb6-4a8a-4022-b2f8-24edd8db188f
6
public void setState(int state) { this.state=state; if (state==1) theApp.setStatusLabel("Sync Hunt"); else if (state==2) theApp.setStatusLabel("Validating Sync"); else if ((state==3)&&(syncState==1)) theApp.setStatusLabel("50 Baud Sync Found"); else if ((state==3)&&(syncState==2)) theApp.setStatusLabel("Decod...
bc162a05-a486-4784-87af-d5758ca50a54
5
public void repair(String key, LinkedList<Tuple> correctTable, HashMap<String, ErrorData> errorTable, Tuple correctLine) { if( torepair.contains(key)) { int correctTax = cuid_tax_map.get(key); correctLine.setValue(rawAttrs.TAX, Integer.toString(correctTax)); for(Tuple t: correctTable) { int tax = -1; ...
067c202b-5b99-45a6-badf-5706bfb51ff1
4
public boolean setRates(double[] rates) { // error checking if (rates == null || rates.length != numClasses_) { return false; } // the value of each rate must be a positive number for (int i = 0; i < rates.length; i++) { if (rates[i] <= 0) ...
570abc2a-d3b3-450d-84db-6d6c6959c802
9
@Test public void test() { String[] args = { "java.lang.String" }; if (args.length < 1) { Prt.outln("usage"); System.exit(0); } try { Class c = Class.forName(args[0]); Method[] m = c.getMethods(); Constructor[] ctor = c.getConstructors(); if (args.length == 1) { for (Method element : m) ...
905d479d-5751-45ac-aa4c-eb6959349844
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
3c7e7e59-a28b-4060-99a4-4280ea2d9076
9
public int checkAPEtagFooter(byte[] b, int off) { if (b.length - off < 32) return 0; if (b[off] == 'A' && b[off + 1] == 'P' && b[off + 2] == 'E' && b[off + 3] == 'T' && b[off + 4] == 'A' && b[off + 5] == 'G' && b[off + 6] == 'E' && b[off + 7] == 'X') { apeVer = apeInt32(b, off + 8); return apeInt32...
34ad4147-338f-465d-a849-8811a4c4045d
9
public Expression<?> consume(final ConsumableBuffer<Token<PrologTokenType, ?>> buffer) { final Token<PrologTokenType, ?> first = buffer.peek(); Expression<?> expr = null; switch (first.getType()) { case ATOM: buffer.next(); expr = new AtomExpression(first); break; case VARIABLE: buffer.next(); ...
8f0f360d-5ae2-4984-923b-6e0f1bb36c2c
5
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: String str; Integer id=0,Año=0; List Plata = new ArrayList(); j = new Juego(); j.setNombre(this.jTextField1.getText().toUp...
4c9fb0a6-82a5-442d-a70a-ab3cc1e50196
0
public ConvertController(GrammarViewer grammarView, SelectionDrawer drawer, Map productionsToTransitions, Component parent) { this.grammarView = grammarView; this.drawer = drawer; this.parent = parent; grammar = grammarView.getGrammar(); automaton = drawer.getAutomaton(); initListeners(); pToT = produ...
1aaba710-d93f-42ba-baa5-db130a9a2a19
3
private boolean containsNullValue() { Entry[] tab = this.table; for (int i = 0; i < tab.length; i++) for (Entry e = tab[i]; e != null; e = e.next) if (e.value == null) return true; return false; }
a56c9ec5-be95-488d-a56a-575cd70a64ba
9
private <T> T convertReference(String value, Class<T> clazz) { if (clazz.isAssignableFrom(String.class)) return clazz.cast(value); if (clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(short.class)) return clazz.cast(Short.parseShort(value)); if (clazz.i...
4941eabf-7b40-41fe-ad19-32b56a9e237e
1
public void toggleSolenoid(Solenoid solenoid){ if (ledSolenoid[solenoid.GetChannel() -1].getBackground() == Color.GRAY){ solenoid.State(true); ledSolenoid[solenoid.GetChannel() - 1].setBackground(Color.RED); }else{ solenoid.State(false); ledSolenoid[solenoid.GetChannel() - 1].setBackground(Color.GRAY...
d4224db1-e16b-4e59-bbbc-ff34ec60b78a
2
public void alimentaTabelaVeiculo(String SQL){ ArrayList dados = new ArrayList(); String [] Colunas = new String[]{"Placa","Veículo","Ano","Chassis","Status"}; conecta.executaSQL(SQL); try { conecta.rs.first(); do{ ...
38226190-5b49-4217-a75a-8d73ccc90337
0
public static void main(String[] args) { new Client(); }
0de97d28-1e42-43b5-bb00-64724d897b1f
1
void commitTo(final OutputStream outStream) { try { final DataOutputStream out = new DataOutputStream(outStream); writeHeader(out); writeConstantPool(out); writeAccessFlags(out); writeClassInfo(out); writeFields(out, null); writeMethods(out, null); writeAttributes(out); out.close(); } ...
5f4078fb-6df9-40a8-a3fe-503441ff8e2a
6
public void createNavigationArrows() { JButton next = new JButton(">"); JButton back = new JButton("<"); add(back); add(next); setSize(551, 211); next.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) ...
a9642787-34ab-412c-b9e3-0baa49c2a7f7
8
public void BFS(TreeNode<Integer> root) { LinkedList<TreeNode<Integer>> queue = new LinkedList<TreeNode<Integer>>(); if (root == null) return; // System.out.println(root.data); root.isVisited = true; queue.add(root); LinkedList<LinkedList<TreeNode<Integer>>> lists = new LinkedList<LinkedList<TreeNode<In...
308753d3-4bf6-4862-8ccc-45fb0813cd03
5
@Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setFont(new Font("TimesRoman", Font.PLAIN, 20)); FontRenderContext frc = g2.getFontRenderContext(); Fo...
c3d82898-e8c9-402d-bb34-1e42829f3827
1
void acceptConnection() throws IOException { clientSocket = serverSocket.accept(); out = new PrintWriter(clientSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( clientSocket.getInputStream())); out.println("welcome"); // welcome client ...
64549d6b-58ae-4c95-a380-63cf16a742ba
4
private void enterRoom(ServerClient activeclient, Msg nextCMD) { Room leaving = new Room("null"); for (Room r : rooms) { if (r.getClientsInRoom().contains(activeclient)) // which room shell be left ? { leaving = r; } if (r.getName().equals(nextCMD.getContent())) // which room shell be entered ? ...
e16d5dcd-a809-4d53-826e-0947add1cbb3
1
@Override public int hashCode() { int result = pcaPosId != null ? pcaPosId.hashCode() : 0; result = 31 * result + pcaIdElemento; return result; }
07074f4e-7569-4245-a88a-b39b621ca53e
1
private void loadProperties() { try { controller.loadPropertiesFromFile(propertyFile); } catch (Exception e){ JOptionPane.showMessageDialog(this, "Can't load properties.", "Properties warning", JOptionPane.WARNING_MESSAG...
c7f9e4a6-96a2-426c-a22b-386509612a3b
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if((!mob.isInCombat())||(mob.rangeToTarget()<1)) { mob.tell(L("You really should be in ranged combat to cast this.")); return false; } for(int i=0;i<mob.location().numItems();i++) { fi...
e9d55da4-4042-40e5-8822-820186a970ef
2
public double[] columnMeans(){ double[] means = new double[this.numberOfColumns]; for(int i=0; i<this.numberOfColumns; i++){ means[i] = 0.0; for(int j=0; j<this.numberOfRows; j++){ means[i] += this.matrix[j][i]; } ...
e6032b25-7ab1-4545-96ec-931362ae57dd
8
public static int getLevenshteinDistance(String s, String t) { if (s == null || t == null) { throw new IllegalArgumentException("Strings must not be null"); } int n = s.length(), m = t.length(); if (n == 0) { return m; } else if (m == 0) { re...
16afe02d-0467-4739-86c7-e859f179205c
4
private static String toHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.length; i++) { int halfbyte = (data[i] >>> 4) & 0x0F; int two_halfs = 0; do { if ((0 <= halfbyte) && (halfbyte <= 9)) { buf.a...
c6027711-f258-4a12-b875-50a0b3b9e494
4
@Override public void maskedMergeOnto(MapLayer other, Area mask) { Rectangle boundBox = mask.getBounds(); for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) { for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) { Tile tile = ((TileLayer) other).ge...
edf3481d-f234-4e00-8615-ba215819381a
6
public String OutInitConfig() { StringBuilder str = new StringBuilder(); str.append("("); int col = 0; int row = 0; for (; col < ColNum; ++col) { // for our board configuration // output all the pieces that is on our side // in student consensus syntax f...
e9e079d1-483e-4101-8be9-d5f9a0c247f0
9
private int validateUpdate() { try { int receiptID; int upc; int quantity; if (piReceiptID.getText().trim().length() != 0 && isNumeric(piReceiptID.getText().trim())) { receiptID = Integer.valueOf(piReceiptID.getText().trim()).intValue(); } else { return VALIDATIONERROR; } if ...
60cf2f33-aec9-4727-9883-9b6aa8fbefc4
4
protected short parse_config_param(final String param_title, final String param_content) { short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS; boolean found = false; for (int index = 0 ; index < title_len ; index++) { if (param_title.indexOf(title[index]) == 0) { switch(index) { case 0: log_...
f8543ab9-fc36-4962-bed0-b8cadfe4e23b
1
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { calculateEnabledState(e.getDocument().getTree()); } }
74335507-aeae-4f98-8f86-845528578685
9
@Override public void doWork() { if(CurrentPattern == null) return; try { switch(CurrentPattern) { case TestThread: { TestThread(); break; } ...
47880645-08b4-4add-a7a5-8bb340af8624
6
@EventHandler public void MagmaCubeBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getMagmaCubeConfig().getDouble("MagmaC...
0aa30bcc-79d1-4531-ba7b-22e2c626e8af
4
public List<List<Object>> createLeaderboard() { List<List<Object>> leaderboard = new ArrayList(); List<List<Object>> leaderboardList; int globalScore = calculateGlobalScore(); calculateGlobalMass(); for (String s : this.stringPeptideList) { List<Object> scoreAndString...
2caab355-2b85-4382-971d-67fd4bf7797a
3
public void startServer (){ controller = new Controller(); try { sSoc = new ServerSocket(5666); } catch (IOException e) { System.err.println(e.getMessage()); System.exit(-1); } while(!sSoc.isClosed()) { try { Socket inSoc = sSoc.accept(); DatabaseThread newDatabaseThread = new Database...
cbfeeeaf-1f09-4820-b6b3-307660146d56
4
private static void colisionMonkeyLand ( Node rootNode, BulletAppState bulletApp, PhysicsCollisionEvent event, int score) { if (event.getNodeA().getName().equals("Bala de captura")) { // Eliminamos la malla de captura de la escena rootNode.detachChild(event.getNodeA()...
3c1417a2-477c-488a-9d1e-ea3d150c25af
4
private void setJoined(String a, String b) { // insert both the a->b and the b->a combination, as this makes queries // faster. // a->b combo ArrayList<String> aList = joinedTables.get(a); if (aList == null) { aList = new ArrayList<String>(); joinedTables.put(a, aList); } if (!aList.contains(b)) ...
c44c7627-8059-4ff2-bcef-4d5f34ca8f33
6
public Polygon hull() { Point[] points = getPoints(); Model model = getModel(); if (points == null || model == null || !model.isValid()) return null; /* * Generate a convex hull from the model vertices */ Point[] hull = ConvexHull.getConvexHull(points); if (hull == null || hull.length == 0) { retu...
c6baf925-27ae-4909-94b7-6f39b9b7d282
0
public static void setNomeUser(String nomeUser) { Funcionario.nomeUser = nomeUser; }
e592fdbd-c7aa-419d-8bc0-4e691705a84c
1
public Object clone() { // use reflection to create the correct subclass Constructor constructor = getClass().getConstructors()[0]; try { return constructor.newInstance(new Object[] { (Animation)left.clone(), (Animation)right.clone(), (...
ddbbaaa0-1c73-4466-b7ed-98e6021ded75
5
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Trend)) return false; Trend trend = (Trend) o; if (!name.equals(trend.name)) return false; if (query != null ? !query.equals(trend.query) : trend.query != null) return fal...
dca6f35f-9765-40db-af0f-a36e5d716939
5
void comp() { double[][] tempPoints = new double[totalNumOfPoints][numOfParams]; double[] tempObjFuncValues = new double[totalNumOfPoints]; // copy selected elements in pointsX and objFuncValueOfX to tempPoints and tempObjFuncValues for (int igs = 0; igs < currentNumOfComplexes; igs++) ...
12549073-c5cd-48b7-bdd4-45e7f0de44e9
3
public static int arrayMinimum(int ar[][]) { int min = ar[0][0]; System.out.print("Array Is :\n"); for (int[] element : ar) { System.out.print("\n"); for (int element2 : element) { System.out.print(element2 + " "); if (min > element2) { min = element2; } } } System.out.print("\n"); ...
d9c2dcf5-c480-4e26-8681-25e4d7635ad0
2
private void startProcess() throws IOException { Thread thread = new Thread(new Runnable() { public void run() { while (true) { try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); thread.start(); }
439bcfbd-4700-4b81-ba5b-aeae8541a804
0
public String toString() { return getTitle() + " " + getFirstName() + " " + getMiddleName() + " " + getLastName() + " " + getSuffix(); }
2bade260-09ae-494c-88c9-dac292e16a85
8
public static void main(String[] args) { //Create a command. StringBuffer command = new StringBuffer("nslookup"); if(args != null){ for(int i = 0; i < args.length; i++){ command.append(" "); command.append(args[i]); } } System.out.println(command.toString()); //Execute a child process. Proce...
4e42d36f-a38c-45dd-98d3-264516381ef6
3
public long getUndoMemoryUsed() { long total = 0; CPColorBmp lastBitmap = clipboard != null ? clipboard.bmp : null; for (int i = redoList.size() - 1; i >= 0; i--) { CPUndo undo = redoList.get(i); total += undo.getMemoryUsed(true, lastBitmap); } for (CPUndo undo : undoList) { total += undo.getMemo...
db6a3e0a-fce8-4c78-8fbc-de42a9cf927e
6
private static LinkedList<String> checkStringFields(Movie movie, LinkedList<String> errorList) { if (!movie.getName().isEmpty()) { Pattern pattern = Pattern.compile(TEXT_PATTERN); Matcher matcher = pattern.matcher(movie.getName()); if (!matcher.matches()) { e...
09c9e57b-5d7d-40f8-a8a7-de81f701d34d
9
public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = input.nextInt(); ArrayList<Integer> primes = new ArrayList<Integer>(); primes.add(2); for (int i = 3; i < x; i++) { boolean prime = true; for (int j = 2; j < i; j++) { if(i%j == 0) prime = false; } ...
d95a01fe-e2b7-4313-aae6-9a3547f73cb8
7
public Constraint getConstraint(Pushable p1, Pushable p2) { if (p1 == null || p2 == null || p1 == p2) { throw new IllegalArgumentException(); } final int i1 = participantList.indexOf(p1); final int i2 = participantList.indexOf(p2); if (i1 == -1 || i2 == -1) { throw new IllegalArgumentException(); } ...
19409cca-129e-4d8c-9b83-e119aa284b7f
6
private void playSinglePlayer(GameCanvas canvas, boolean loadGame) { BasicGameState state; if (loadGame) { state = BasicGameState.load(); if (state == null) { JOptionPane.showMessageDialog(gamePanel, "Could not load game!", "Error", JOptionPane.ERROR_MESSAGE); return; } } else { state =...
48c30675-e651-499a-bf54-d58d2f724fa6
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/state.gif"); return new ImageIcon(url); }
5fe91ee0-1610-422e-9998-b92734c0ba90
5
@Override public String toString() { String res = " QuestionEquation"; res = res + "\n Text: " + this.text; res = res + "\n Difficulty: " + this.difficulty; res = res + "\n Operands: " + this.operands; res = res + "\n Operators: " + this.operators; res = res ...
712ce688-9220-4800-be69-0201f1dbb9de
7
static Handler remove(Handler h, Label start, Label end) { if (h == null) { return null; } else { h.next = remove(h.next, start, end); } int hstart = h.start.position; int hend = h.end.position; int s = start.position; int e = end == null ?...
e04faa99-a635-4a86-8bd4-c7dd881cfeb5
4
void checkOutFieldAccess() { if (log.isLoggable(Level.WARNING)) { for (ComponentAccess w : oMap.values()) { for (Access out : w.outputs()) { if (!out.isValid()) { log.warning("Empty @Out connect for: " + out); } } } } }
22cdfe76-b229-4db1-81ca-21a5996384fa
5
protected final void createContents() { shell = new Shell(); shell.setMinimumSize(new Point(500, 390)); shell.setSize(826, 550); shell.setText("APVS async modeling project"); shell.setLayout(new FillLayout(SWT.HORIZONTAL)); shell.addControlListener(new ControlListener() ...
98dc64c2-0363-43b0-b81d-7eb6d327e78d
8
public void equiPartitionEnergy(MDModel model) { if (list == null) { list = new ArrayList<Particle>(); } else { list.clear(); } int n = model.getNumberOfParticles(); for (int i = 0; i < n; i++) { Particle p = model.getParticle(i); if (p.isCenterOfMassContained(scope)) list.add(p); } i...
ce26753d-4ea2-42b1-9598-e0dfa6d18ba5
5
public void positioning() { double distance = Math.sqrt(Math.pow(x - game.xPlayer, 2) + Math.pow(y - game.yPlayer, 2)); if(distance > 70); { if(game.xPlayer > x) xa++; if(game.xPlayer < x) xa--; if(game.yPlayer > y) ya++; if(game.yPlayer < y) ya--; } }
397de3e0-83d7-484a-b8e8-6938164cd7b1
7
@Override public void calculateInitDist() { /* calculate processing rate of each site */ double tmp = 0, rest = 0; double[] daProcRateByClass = new double[iClass]; for (int i = 0; i < iClass; i++) { print("ProcessRate[" + i + "]"); for (int j = 0; j < iSite; j++) { dmProcessRate[i][j] = iaCPU[j] / dm...
c4cdebc9-c9fe-42bb-b6e8-2ea544165468
6
private static StdImage createOptimizedImage(Image image) { Toolkit tk = Toolkit.getDefaultToolkit(); if (!tk.prepareImage(image, -1, -1, null)) { while (true) { int result = tk.checkImage(image, -1, -1, null); if ((result & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) { image = null; bre...
6ed6865c-b4c3-4827-9e5a-fc3b5bcd1995
5
public void takeDamage(int damage) { int damageTaken = damage; // Why do I do all of this? to simulate double or float arithmetic if (hasArmor()) { if (armor.isBroken()) { damageTaken = damageTaken * 10; damageTaken = damageTaken / armor.getArmorClass(); if (damageTaken < 10) {...
85517b89-8ae3-4212-9461-d31a14b5fc64
7
@SuppressWarnings("resource") public void listen(AddressBookManager addressBookManager, TestClass testClass) { while(true) { Scanner scanner = new Scanner(System.in); String userInput = scanner.next(); switch(userInput) { case "insert" : addressBookManager.inputForInsert(); break; case "search" ...
5f1f7155-9335-49bb-ab9b-bf4ab5788eb5
1
public <T extends AstronomicalObject> String stringObjectsOfType(Class<T> type) { List<T> obj = getObjectsOfType(type); String returnedString = ""; for (T t : obj) { returnedString += t.deepToString(); } return returnedString; }
85cd9d50-a7ef-4e55-90b2-db6cc7f03ffc
9
public void generateImage() { double divider = 256 / (Math.pow(2, ((double) targetDepth) / 3)); target = new BufferedImage(source.getWidth(), source.getHeight(), source.getType()); // Does this for every pixel: for (int i = source.getMinY(); i < source.getHeight(); i++) { f...
280b3b55-f898-4061-a654-b82d3b8a90b5
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
c9075165-0be0-4aa8-a8d4-78332ed7e4e7
1
public void renderControls(Graphics2D g2d) { for(Control control : Controls) { control.renderControl(g2d); } }
8d0fa909-3165-4306-ad06-2b1db68798a7
2
@RequestMapping(value = {"/MovimientoBancario/{idMovimientoBancario}"}, method = RequestMethod.DELETE) public void delete(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idMovimientoBancario") int idMovimientoBancario) { try { movimientoBancarioDAO.delete(...
e8f81aa1-1efc-4fb7-bed8-9f43997140be
4
public void run(){ int forAutoClose = 0; while(running){ if(autoClose){ forAutoClose++; } if(forAutoClose >= 250 && autoClose){ System.out.println("Nothing to do!\nAutoclosed the program!"); break; } render(); } System.exit(0); }
701a8c1f-1eef-4e79-9d2b-f9325068ac13
5
@Override public Product getProduct(String prodId) { Product product = null; boolean flag = true; if (prodId == null || prodId.isEmpty()) { System.out.println("Error at FakeDatabase.getProduct"); } else { for (Product prod : products) { if (pro...
87287c4c-2838-440e-892f-04b0f2f752c8
6
public boolean isSameTreeRec(TreeNode p, TreeNode q){ if(p == null && q == null) return true; if(p == null || q == null) return false; if(p.val == q.val) return isSameTreeRec(p.left, q.left) && isSameTree(p.right, q.right); else return false; }
8af9373c-ff28-4758-a474-0bb8388c0e0e
0
public DivideByZeroException(String message){ super(message); }
6e4f9fa4-12fc-4329-a856-0f9facc2ce10
2
public static void printuserlistConsole() { Connection c = null; Statement stmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:Restuarant.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); stmt = c.createStatement(); Re...
a60a2a4e-f4b0-4a46-9d62-1c6aaf67b8de
9
void detectEncoding() throws java.lang.Exception { byte signature[] = new byte[4]; // Read the first four bytes for // autodetection. is.mark(4); is.read(signature); is.reset(); // Look for a known signature. if (tryEncoding(signature, (byte) 0x00, (...
21da836a-976a-40d4-aa0b-96db227d9a7a
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
0eaca92e-3dff-403d-9f03-2bfe93c84c90
6
@Override public double[] computeValue(char refBase, FastaWindow window, AlignmentColumn col) { values[0] = 0; int count = 0; if (col.getDepth() > 0) { Iterator<MappedRead> it = col.getIterator(); while (it.hasNext()) { MappedRead read = it.next(); ...
d886a440-de81-417e-b67e-c21dc7a4c5cc
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FacilityCategory other = (FacilityCategory) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) ...
57eef183-752e-454f-9f9b-df62a1d0e668
4
@Override public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { // 1個でも注文があれば何もしない if (1 == engine.getOrders().size()) { return; } String label = "Buy" + System.currentTimeMillis(); IOrder orderByLabel = engine.getOrder(label); if (null != orderByLabe...
cf15582f-85b8-4851-801c-2cce30e18223
9
public List<Map> getRecords(String tableName, List<String> columnNames) throws SQLException, Exception { List<Map> Records = new ArrayList(); Statement stmt = null; ResultSet rs = null; ResultSetMetaData metaData = null; Map record = null; String sql...
70808d6c-db8d-44bc-a32d-95939cc70b71
6
public boolean dropLink(String name) throws GlobalException, NoDataException{ try { conectar(user, pass,ip,port,db); } catch(ClassNotFoundException ex) { throw new GlobalException("No se ha localizado el Driver"); } catch (SQL...
66eb8668-b370-442b-a169-f402b804ba36
1
public static void main( String[] args ) { try { showGUI(); //DescriptorsTest.run(); //CaptureScreenToFile.run(args); //CaptureVideoFrame.run(); //TestAudio.run(args); } catch (Exception ex) { System...
aabf8bb9-4987-42b0-aafb-76a75295aa0f
2
public void run(){ while(true){ byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); try { socket.receive(packet); } catch (IOException e) { e.printStackTrace(); } this.parsePacket(packet.getData(),packet.getAddress(),packet.getPort()); //String mes...
86918122-a913-49bc-a2fc-b5bf505abe75
1
public void addEvent(Event e){ if(e.getType()==0) this.listCustAr.add(e); else this.listOrderArrival.add(e); }
dd46e205-3018-491b-a201-e79551a1c3b0
6
public boolean isPalindrome(ListNode head) throws IllegalArgumentException { if (head == null) { throw new IllegalArgumentException(); } if (head.next == null) { return true; } /* Get middle point of the list */ ListNode ptr1 = head; ListNode ptr2 = head; while (ptr2 != null && ptr2.next != ...
db72cfd9-0774-4d42-85df-4865c77894e9
7
public Purchase makePurchase(int id_user, int cost, String type, int id) throws DataBaseConnectorException { Purchase purchase = new Purchase(); try { if(type == null){ throw new DataBaseConnectorException("Shopping error ^_^ (type == null): "); }else if(type.equa...
e74ff841-cc4f-4c2f-ab9a-55797db3b5fb
3
private static void player2DoSwapPieces(OthelloPiece piecesToSwap[][]) { for (int i = 0; i < TOTALWIDTH; i++) { for (int j = 0; j < TOTALHEIGHT; j++) { if (piecesToSwap[i][j] == null) { // do nothing } else { player2SwapPieces(i, j); } } } }
49120727-50c0-4e30-a804-9ee92549d528
9
public void createconfig(){ File file = new File(getDataFolder(), "config.yml"); if(file.exists()){ return; } if(!getDataFolder().exists()){ if(!getDataFolder().mkdirs()){ getLogger().severe("Datafolder could not be created!"); getLogger().severe("Disabling"); setEnabled(false); return; ...
be14f0ed-1516-4d9f-b416-83760990c345
8
protected void range(int stride) { int i; if (length >= stride) { dxmax = data[0]; dymax = data[1]; dxmin = dxmax; dymin = dymax; } else { dxmin = 0.0; dxmax = 0.0; dymin = 0.0; dymax = 0.0; } for (i = stride; i < length; i += stride) { if (dxmax < data[i]) { dxmax = data[i];...
6988859f-9690-4cc5-8217-cc8fd13e9066
6
private EMSA_PKCS1_V1_5(final IMessageDigest hash) { super(); this.hash = hash; hLen = hash.hashSize(); final String name = hash.name(); if (name.equals(Registry.MD2_HASH)) { prefix = MD2_PREFIX; } else if (name.equals(Registry.MD5_HASH)) { prefix = MD5_PREFIX; ...
fdb7bc03-1ecc-4eb4-a799-bad369af1819
0
public String getHelloWorld() { return helloWorld; }
dba0738f-a844-4008-b30f-b784018e537b
2
private boolean setupEconomy() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { return false; } econ = rsp.getProvider(); return econ != null...