method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a488dee6-953e-4bf1-95ec-72f528e2eb8e
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
c88f2516-e166-40d5-a0c1-c34cc1905e95
4
public HashSet<BigInteger> getFamily3(BigInteger n, int[] positions) { char[] bi = n.toString().toCharArray(); HashSet<BigInteger> prs = new HashSet<BigInteger>(); if (positions.length == 3) { for (int i = 1; i <= 9; i++) { for (int k : positions) { ...
5dd51bfb-3c84-4996-a029-3d8948e0263c
9
public void drawElement(HudElement e, Point2D origin) { Texture tex; if(!e.isVisible()) return; switch(e.getType()) { case BUTTON: case PANEL: PanelElement p = (PanelElement)e; OpenGLDraw.fillPoly(p.getBackColour(), origin.x + e.getPos().x, origin.y + e.getPos().y, e.getShape(), 1); ...
ce90f603-c8cf-42e6-b6d4-f0c99a4ce6c9
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
856481fd-fc19-4b00-a44b-c6fc3ad86314
6
public static void sequenceCount(String s) { char c[] = s.toCharArray(); int count; int temp; for (int i = 0; i < c.length; i++) { if (c[i] != ' ') { temp = i; count = 0; for (int j = i; j < c.length; j++) { if ((c[i] == c[j]) && (j == (c.length - 1))) { count++; i = (i + count) ...
66fadb76-6b15-413d-8c7b-16f98041b413
6
public void downImage(final String imgUrl, final String folderPath, final String fileName) { System.out.println("开始下载图片:" + imgUrl); File destDir = new File(folderPath); if (!destDir.exists()) { destDir.mkdirs(); } pool.execute(new Runnable() { @Override public void run() { HttpClient client ...
517dd372-c6db-40f6-a5b4-bbe7298d3835
6
public static void handleEvent(int eventId) throws IOException { // Changes focus to Main Ship Shop Menu if(eventId == 1) { Main.Save_Confirmation_PopUp.setVisible(false); Main.Save_Confirmation_PopUp.setEnabled(false); Main.Save_Confirmation_PopUp.setFocusable(false); Main.mainFrame.remove(Main.Save...
177db98d-25bd-4d2a-bcaa-03469168e3b3
7
public LinkedList<DataPacket> getPackets(Byte source) { byte rStack = source; LinkedList<DataPacket> res = new LinkedList<DataPacket>(); this.lock.lock(); HashMap<Byte, DataPacket> packets = new HashMap<Byte, DataPacket>(); if (this.packets.containsKey(rStack)) packets.putAll(this.packets.get(rSta...
5797c11a-3c47-4f23-9e3a-ab95d2a57285
7
public static boolean bindVariableToValueP(PatternVariable variable, Stella_Object value, boolean autocleanupP) { if ((value == null) || (!Logic.argumentBoundP(value))) { if (((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) && (((QueryIterator)(Logic.$QUERYITERATOR$.get())).partialM...
2c405e90-b7b5-4c14-914d-7fd2092deecb
9
private static boolean checkHwReqs(float wfHwCpu, float wfHwMem,float wfHwStorage, String archValue, QuerySolution qs) { //iapp HW specs (in MB) float iappHwCpu = 0; float iappHwMem = 0; float iappHwStorage = 0; String iappArch = ""; String hwcpu = qs.get("?hwcpu").toString(); String...
4aa2d9f2-4ebd-4339-abfa-c9d0df2d1c5f
6
public static ListNode reverseBetween(ListNode head, int m, int n) { ListNode qe = null; int i = 0; ListNode p = head; while (i < m - 2) { p = p.next; i++; } if (m > 1) { qe = p; } i = m; ListNode q = null; ListNode s = null; if (m > 1) s = p.next...
4ea5d112-634a-469e-94be-5160b52f9dc1
6
public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNext()) { String s = input.next(); String t = input.next(); int is = 0; int it = 0; while (is < s....
07732c83-b4a6-42d2-a524-b165ee44dd0b
2
public static OpenGLTexture getTexture(String name){ for(Texture ticket : textures){ if(ticket.getName().equals(name)){ return ticket.getTexture(); } } Debug.error("Texture '" + name + "' does not exist"); return null; }
5508c4d1-0954-4c64-b5ba-d78241fbb5ae
0
public RouterPacket GetRecentPacket() { return recentPacket; }
96f0a1f7-8221-4687-a756-495a032ecc64
6
@Override public int partition(Comparable[] a, int left, int right) { int x = left; int y = right + 1; int v = left; while (true) { while (less(a[++x], a[v])) { if (x >= right) { break; } } whil...
3f4684a4-53c2-4892-8a3a-a09c8c105575
4
private static CommandLine parseCommandLine(String[] args) { CommandLine cli = null; CommandLineParser parser = new PosixParser(); try { cli = parser.parse(options, args); } catch (ParseException e) { System.err.println("Konnte Kommando...
bfe5564c-d25d-4d22-9ebd-a60a565a96b9
1
@Override public void paintBorder(Component component, Graphics gc, int x, int y, int width, int height) { Color savedColor = gc.getColor(); gc.setColor(Color.lightGray); gc.drawLine(x + width - 2, y + 2, x + width - 2, y + height - 1); gc.drawLine(x + width - 1, y + 2, x + width - 1, y + height - 1); gc.dra...
c16107fd-211c-4be5-9a75-c2a8ba91f08d
3
public AnchorPane topLeft() { Rectangle rectangle = new Rectangle(); rectangle.autosize(); rectangle.setWidth(240); rectangle.setHeight(240); rectangle.setFill(Paint.valueOf(Color.WHITE.toString())); rectangle.setStroke(Paint.valueOf(Color.GRAY.toString())); recta...
aaec59e2-cb3d-4eda-b272-7646b04a18ff
7
@Override public Value run(CodeBlock i) throws InterpreterException { try { __return = false; if (body_ == null) { body_ = parseForRun(); } if (initalization_ != null) { initalization_.run(i); } while (!__end && !__return && condition_.run(i).getBoolean()) { runBlock(body_, this); i...
923031cc-95e2-4ca3-a557-3dce1b80b20a
7
public Cons consifyCurrentSolutions() { { QueryIterator self = this; { QuerySolutionTable solutions = self.solutions; Cons listifiedsolutions = Stella.NIL; int arity = self.queryDescription().arity(); boolean atomicsingletonsP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(self.dyn...
904806e8-7fb6-45f9-a380-6d4d5d4c39f2
5
public String getColumnName(int i) throws Exception { String colName = null; if (i == 0) colName = "fileID"; else if (i == 1) colName = "projID"; else if (i == 2) colName = "format"; else if (i == 3) colName = "fileName"; else if (i == 4) colName = "location"; else ...
962eae23-c41a-4e39-93b7-64efcc40aae0
4
public final YoutubeInformation getYoutubeInformation() throws IOException, DecoderException, MissingYoutubeUrlException { if (youtubeUrl == null) { throw new MissingYoutubeUrlException("Youtube url is missing."); } YoutubeInformation youtubeInformation = null; C...
2a7a045d-2be5-4e5d-9957-713885161923
7
private void enableJMX() { /* Enable the JMX Portion of the System */ //acquiring platform MBeanServer // Set the hostname if we need to if(null != this.hostname) { log.info("MineJMX: Using Minecraft Server hostname of: " + this.hostname) ; System.setProperty("java.rmi.server.hostname", this.hostname) ;...
b4c4561b-69ab-4527-b509-62a6afaec238
0
public String start_graph() { return "digraph G {"; }
6ee6e225-e6d1-42c2-8103-c4552ff941e7
7
public static boolean check(int a, int b, int c, int res) { if (a+b+c==res){ // equals a + c + b; b + a + c; b + c + a; c + a + b; c + b + a; return true; } if (a - b - c == res){ // equals a - c - b return true; } if (b - a - c == res){ // equals b - c - a return true; } if (c - a - b == res){ /...
affa44f0-bd7a-4e29-a924-55b1b8b6cc8e
5
private static void aesDecrypterFile(CryptobyConsole console) { // Input Path to File for decryption scanner = new Scanner(System.in); System.out.println("Enter Path to decrypt a File (Type '" + quit + "' to Escape):"); scanner.useDelimiter("\n"); if (scanner.hasNext(quit)) { ...
741d8fea-36b5-4388-bbfc-3707fb138744
4
private static void addImgToXmlData(String imgName, String galleryName) { NodeList nList = null; try { File fXmlFile = new File(path); DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.n...
26d67428-8555-49af-bb33-707e92cf6158
4
public Player getRealPlayer() throws RealPlayerException { Player playerFound = null; for (Player p:players) { if (p instanceof RealPlayer) { if(playerFound != null) { throw new RealPlayerException("there are several RealPlayers !"); } else { playerFound = p; } } } if (playerFoun...
279c7fb1-cce5-462a-9311-dcbb1054b233
4
public void removeItems(int[] rows) { Arrays.sort(rows); if (rows.length == 1) { removeItem(rows[0]); } else { int[] mutableRows = new int[rows.length]; System.arraycopy(rows, 0, mutableRows, 0, rows.length); int firstRow = rows[0]; int...
772ff1f4-2440-46d9-8588-2ebd4fd9f5ca
9
public boolean isSelected(int mousex, int mousey) { double a, b, c, h, g; a = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); b = Math.sqrt((x1 - mousex) * (x1 - mousex) + (y1 - mousey) * (y1 - mousey)); c = Math.sqrt((mousex - x2) * (mousex - x2) + (mousey...
e79b3c90-8979-4580-a6e1-eaf883b93366
4
public static void displayStudent(int mode) { if (FileReadService.sList.isEmpty()) { System.out.println("There is no Students !"); } else { System.out.println("Which student do you want to choose ?"); int i; for (i = 0; i < FileReadService.sList.size(); i++) { System.out.print(i + ":(" + FileR...
535abf16-17a5-4956-8000-6097cffe23eb
0
public Long getId() { return id; }
c521e412-cf2a-46cf-929b-d884a1985274
2
@Override protected State getNextState() { String[] line = getNextLine(); GrammarState state = new GrammarState(line[1], Integer.parseInt(line[3])); for (int i = 4; i < line.length; i++) if (!line[i].equals("")) state.addDestination(getHeaderEntry(i), Integer.parseInt(line[i])); return s...
fbd7848d-0b3b-4c1e-8c66-e4ad9c50daea
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
172b5770-417d-443e-ad9f-74b4b01bc74e
3
public static TagWapper constructTagWapper(Response res){ try { JSONArray tags = res.asJSONArray(); List<Tag> tagList = new ArrayList<Tag>(); for(int i=0;i<tags.getJSONObject(0).getJSONArray("tags").length();i++){ tagList.add(new Tag(tags.getJSONObject(0).getJSONArray("tags").getJSONObject(i))); } ...
178f85ed-307f-4fa3-b51a-8b298812d28f
7
private Element getVacantPlayers(Connection connection, Element element) { Game game = freeColServer.getGame(); if (freeColServer.getGameState() == FreeColServer.GameState.STARTING_GAME) { return null; } Element reply = DOMMessage.createMessage("vacantPlayers"); ...
805ee182-78b7-47ef-b23b-b7368d0fa3e5
9
public ImmuSet initExamples() { SetAccumulator sequences; SetAccumulator result; ImmuSet base; sequences = SetAccumulator.make(); sequences.step((Sequence.zero())); sequences.step((Sequence.one(1))); sequences.step((Sequence.two(1, 2))); sequences.step((Sequence.two(1, -2))); Stepper stomper = ((ImmuSet) seque...
fb5d843f-c0f3-4dab-a824-3ae06f3146b0
2
public List<Integer> getRow(int rowIndex) { List<Integer> list = new ArrayList<Integer>(); list.add(1); if(rowIndex == 0){ return list; } List<Integer> pre = getRow(rowIndex-1); ; for(int i =0 ; i < pre.size()-1;i++){ list.add(pre.get(i)+pre.get(i+...
5763cd66-85aa-4dcb-9a29-cc5697c8af6e
8
void animation() throws ScriptException { if (statementLength < 2) subcommandExpected(); int tok = statement[1].tok; boolean animate = false; switch (tok) { case Token.on: animate = true; case Token.off: viewer.setAnimationOn(animate); break; case Token.frame: frame(2, false); break; c...
671ab137-241f-431d-8d2e-d7a6063c237f
6
public BoolMsgResult canRemove(Plugin plugin) { if (plugin == null) return new BoolMsgResult(false, "The Plugin is null."); String name = "Plugin(" + plugin.getPluginName() + ")"; if (!plugins.containsKey(plugin.getPluginName())) return new BoolMsgResult(false, name + " d...
eec8f0af-3e7e-4202-b476-4224b9630e0c
7
public static void incrementallyLinkTaxonomyNodes(TaxonomyGraph graph, TaxonomyNode parent, TaxonomyNode child) { if (parent.children.membP(child)) { return; } TaxonomyGraph.createTaxonomyLink(graph, parent, child); { Interval interval = null; boolean parentexistsP = parent.initialInterval !...
82bd77be-7f78-46b3-a8b3-197d8adae143
9
protected final static Event createEvent(int type, int id){ switch (type) { case TYPE_KEY_PRESS: return new KeyEvent(id); case TYPE_KEY_RELEASE: return new KeyEvent(id); case TYPE_MOTION: return new MotionEvent(id); case TYPE_ENTER: return new CrossingEvent(id); case TYPE_LEAVE: return new Cr...
0c4670e4-184e-41ca-a6b3-5c2629ce86ee
3
private static Move BackwardRightForBlack(int r, int c, Board board){ Move backwardRight = null; assert(board.cell[r][c].equals(CellEntry.blackKing)); if(r<Board.rows-1 && c>=1 && board.cell[r+1][c-1].equals(CellEntry.empty) ) { backwar...
53e35ce0-a3c7-4eea-bd9d-f92f711af0b4
3
@EventHandler public void onClick(InventoryClickEvent e){ if(e.getWhoClicked() instanceof Player){ Player player = (Player) e.getWhoClicked(); if (player.getGameMode()== GameMode.CREATIVE){ return; } String name = player.getName(); if (plugin.onDuty.contains...
6f017f95-5dd1-4731-a9a4-ad457f9e6a29
3
public static void load(Plugin plugin, String fileName) { File file = new File(plugin.getDataFolder(), fileName); if (!file.exists()) { try { plugin.saveResource(fileName, false); } catch (Exception e) { e.printStackTrace(); } } if (!isFileLoaded(fileName)) { configs.put(fileName, YamlConfig...
b5d63ef0-4ce7-4020-9bdc-5a51b43f2d7a
3
public void testUndoRedo() throws Exception { us.add( e1 ).add( e2 ); assertFalse( us.hasRedoElement() ); assertTrue( us.hasUndoElement() ); try { us.getNextRedoElement(); fail(); } catch( final NoSuchElementException expected ) { } assertEquals( e2, us.getNextUndoElement() ); assertTrue( us...
8c510958-0c77-40a4-a2b6-152db84841f5
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...
b4dd87b4-5a17-411b-8afa-cf42f25dcc28
4
private boolean runEvolutionaryAlgorithm() throws HeadlessException, IllegalStateException { try { readSettingsParameters(); } catch (NumberFormatException numberFormatException) { JOptionPane.showMessageDialog(this, "Błąd wprowadzonych danych!"); return true; ...
d1c8c780-c798-4726-952a-76f86183d855
5
protected Vector<JButton> createCustomButtons() { Vector<JButton> buttons = new Vector<JButton>(); Method[] f = Global.customGlobal.getClass().getMethods(); for(int i = 0; i < f.length; i++){ AbstractCustomGlobal.CustomButton info = f[i].getAnnotation(AbstractCustomGlobal.CustomButton.class); if(info != nul...
a0c402ed-093b-4a9b-9e72-76d04390a596
7
protected void gatherData() { UnitType defaultType = getSpecification().getDefaultUnitType(); for (Unit unit : player.getUnits()) { if (unit.isOffensiveUnit() && !unit.isNaval()) { UnitType unitType = defaultType; if (unit.getType().getOffence() > 0 || ...
1ac7a6be-3f3d-4fe4-bfad-06ca005480e5
7
private int[] maxOneTimeProfit(int[] prices, int start, int end) { int bestBuy = -1, bestSell = -1, bestProfit = 0; int currentLow = start; for (int i = start; i < end; i++) { int price = prices[i]; if (i < end - 1 && price < prices[i + 1]) { if (price <...
8bd84970-63fa-40c0-afa2-8a858458aa28
3
@Override public void paintComponent(final Graphics g) { // Check if we have a running game super.paintComponent(g); g.setColor(this.getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); if (this.model != null) { // Draw all tiles by going over them x-wise and y-wise. for (int i = 0; i < this....
0600e38d-d27e-4516-9600-56a5393afd79
4
public String linksForLab() { testItems(); crimeLabEntrance.setLinks(null, stairsNorth, northenHallway, null); crimeLabEntrance.setRoomEast("To the East is the northen stairwell"); crimeLabEntrance.setRoomSouth("To the south is the northen hallway"); stairsNorth.setLinks(null...
f469df36-b213-4a40-ab93-1dbbc5371469
5
public void terminate() { tag = 0xdeadbeef; slot_sync.lock (); if (!starting) { // Check whether termination was already underway, but interrupted and now // restarted. boolean restarted = terminating; terminating = true; ...
8a5b72e9-c297-4900-9210-5ba1576ec6cf
7
public synchronized void startThreads() { QueuedPage qp; while (!q.isEmpty() && threadCount < maxThreads && !canceled) { qp = q.poll(); new CrawlerThread(qp, this); currentCrawls.add(qp); threadCount++; } // bereite Output vor, falls alle Threads fertig sind und keine weiteren // Seite zum Crawl...
18b615bf-6913-4d12-ab4e-c4a7cf3bd004
1
private static void installLnF() { try { String lnfClassname = PREFERRED_LOOK_AND_FEEL; UIManager.setLookAndFeel(lnfClassname); } catch (Exception e) { System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL + " on this platform:" + e.getMessage()); } }
89b4c10e-562f-4fe8-b65e-33881632f602
6
* @return <code>true</code> if the contents of the drag can be dropped into this outline. */ protected boolean isDragAcceptable(DropTargetDragEvent dtde) { boolean result = false; mAlternateDragDestination = null; try { if (dtde.isDataFlavorSupported(Column.DATA_FLAVOR)) { Column column = (Column) dtde....
d89a47ca-eb9c-410d-bdf7-cfa9a80a9fd5
9
@Override public void doFilter(ServletRequest sreq, ServletResponse sresp, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) sreq; HttpServletResponse resp = (HttpServletResponse) sresp; OAuthMessage m = new OAuthMessage(req); String fakescheme = req.get...
4b6773a9-b8f4-4f75-8e6d-aa9a334850a6
6
public Iterator<?> fieldIterator() { if (!isFieldListDataFormat()) throw new IllegalArgumentException("Data format is not compatible"); byte[] data = _event.getData(); if (data.length != 0) { try { if (_iterator == null) ...
830b9e61-602d-4387-8acf-78863e5cc590
9
public static void main(String[] args) throws IOException { String[] exis = {".jpg", ".jpeg", ".png", ".png", "", "", "", "", "", "", "", "", "",}; List<String> javaList = Arrays.asList(exis); int lastDir = 15; File newFilse = new File(newDir); if (!newFilse.exists()) { newFilse.mkdirs(); } File fil...
ed8b8ceb-d2a6-4a73-a876-41cc8fea11e4
0
@Override public void clear() { // TODO Auto-generated method stub }
071a674c-4f6a-49c0-b4cf-487aa30480ab
1
ByteVector put11(final int b1, final int b2) { int length = this.length; if (length + 2 > data.length) { enlarge(2); } byte[] data = this.data; data[length++] = (byte) b1; data[length++] = (byte) b2; this.length = length; return this; }
1af7238e-37f7-4cb7-8828-07fa077126a9
3
@Override public void update(Observable arg0, Object arg1) { if (!(arg0 instanceof logic.GekozenAntwoord)) return; logic.GekozenAntwoord updatedGk = (logic.GekozenAntwoord) arg0; Onderdeel updatedOnderdeel = updatedGk.getGekozenOnderdeel(); if (gk == updatedGk) setEnabled(true); if (updatedOnderdeel == onder...
9cc7ea7c-dce2-49f3-bf3b-9da221bfd0bd
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
f84ab383-e48d-49d8-b561-d50c43036473
2
private void initializeFrame() { if (fullscreen) { GraphicsEnvironment env=GraphicsEnvironment.getLocalGraphicsEnvironment(); device=env.getDefaultScreenDevice(); GraphicsConfiguration gc=device.getDefaultConfiguration(); frame=new Frame(gc); frame.setUndecorated(true)...
1d8173ef-0360-4b69-a622-0c7fde84b0f1
8
public void checkTypeOfBounds(Vector<Object> vo, int[] res, int i, String bound) { switch (bound) { case Bounds.Upper: if ((double) vo.get(0) >= (double) vo.get(i)) { res[i]++; } break; case Bounds.Lower: ...
0f42ade3-dd5e-47ff-9009-dcb5270fd154
2
public boolean isCommand(String id) { for (String each : commands) { if (id.equals(each)) { return true; } } return false; }
98542ab4-8235-46aa-ac8f-ea25a19ae352
6
@EventHandler public void ZombieWither(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.getZombieConfig().getDouble("Zombie.Wither.D...
c673de12-fc9f-4ebf-a5c4-3008176aeb00
2
private void Equipa1_RadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Equipa1_RadioButtonItemStateChanged if(Equipa1_RadioButton.isSelected()) Jogador_ComboBox.setEnabled(true); if(Equipa1_RadioButton.isSelected()== false) Jogador_ComboBox.setEnabled(f...
08a80600-036b-4f90-b7d2-aa380dffc1f6
5
private void putStoneAt(int column, char stone) throws AgainstRuleException { if (column < 0 || column >= COL) throw new AgainstRuleException("列は、0から6までの数字で指定してください。"); int row = ROW - 1; while (row >= 0 && board[row][column] != EMPTY) --row; if (row == -1) throw new AgainstRuleException(column +...
498e8d28-92f9-4d7d-b180-4b1b9171c0a3
3
public TileMap loadNextMap() { TileMap map = null; while (map == null) { currentMap++; try { map = loadMap( "maps/map" + currentMap + ".txt"); } catch (IOException ex) { if (currentMap == 1) { ...
d0ea29ad-9269-4fa2-b8ea-4d8bebfac4ca
7
public void addNewMsg(SensorMsg msg) { SensorMsg last_one; if (msgs.size() != 0) { last_one = msgs.get(msgs.size()-1); /* Szenszor tarts kimarads. */ long time_diff = msg.getTime() - last_one.getTime(); if (time_diff >= 900000) { loss.add(last_one.getTime()); loss.add(msg.getTime()); } /*...
3657d5ba-faa5-4da8-bc17-5d628a2cfa21
5
public void runDemo(String demoName) { Class demoClass = null; try { demoClass = Class.forName("markharder.physicsdemos.demo.demos." + demoName); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (demoClass == null) { System.out....
239d936c-8d5e-4984-9392-1380dcbad2d8
4
public void precedent(){ Visiteur leVisiteur = null; for(int i = 0; i<lesVisiteurs.size(); i++){ Visiteur unVisiteur = lesVisiteurs.get(i); if(unVisiteur.getNom().equals(this.vue.getjTextFieldNom().getText()) && unVisiteur.getPrenom().equals(this.vue.getjTextFieldPrenom().getText...
26c06830-8f9d-4976-942b-1232b96a7d1b
5
public static void merge(Integer[] nums, Integer[] helper, int start, int middle, int end){ for(int i = start; i < end; i++){ helper[i] = nums[i]; } //Now we merge. We will compare the left and right half, copying back the smaller //element from the two halves into the original array int helperLeft = star...
0674a52f-d411-4485-9118-c36a8fe24349
6
public int translateControlCharacter(int c) { switch (c) { case DEL: return TerminalIO.DELETE; case BS: return TerminalIO.BACKSPACE; case HT: return TerminalIO.TABULATOR; case ESC: return TerminalIO....
83a63b44-82c2-46b2-89c7-52f08f9aefd2
0
public void swapHunter() { field[swapper_y][swapper_x] = "hunter"; field[hunter_y][hunter_x] = "swapper"; int tmp = swapper_x; swapper_x = hunter_x; hunter_x = tmp; tmp = swapper_y; swapper_y = hunter_y; hunter_y = tmp; }
894705b0-5363-4df6-988a-01d5c7783ad0
7
static Category category(Object x){ Class xc = x.getClass(); if(xc == Integer.class) return Category.INTEGER; else if(xc == Double.class) return Category.FLOATING; else if(xc == Long.class) return Category.INTEGER; else if(xc == Float.class) return Category.FLOATING; else if(xc == BigInt.class) return ...
a59ff049-e9e3-4891-ab0b-2ae999abe48e
9
*/ public void fixBinWidths(double sensitivity) { double maxSlope = Math.abs(histogramData[1] - histogramData[0]); for (int i = 1; i < histogramData.length - 1; i++) { double slope = Math.abs(histogramData[i+1] - histogramData[i]); if (slope > maxSlope) { maxSlope = slope; } ...
fec01b19-655c-474e-a63d-4dae4cef936a
9
private void startAppLocal(JKWin winApp, String[] files) { File f; InputSource colorsStream = null; f = new File(DEFAULT_COLORS_FILE); if (f.canRead()) { try { colorsStream = new InputSource(new FileReader(f)); } catch (FileNotFoundException e1) { e1.printStackTrace(); } } Strin...
86d51878-c1b7-4ef1-8a51-55c9b075ece5
4
public void initServer() throws IOException{ System.out.println("Server started"); Server.packetHandels.add(new ServerPacketHandler(this)); server = new ServerSocket(7777); while(true) { socket = server.accept(); if(server.isClosed()) { break; } System.out.println("Connection"); for(int i = 0...
35ca8ab9-f31c-46ab-80ca-336319e63a56
4
private String convertedToHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.length; i++) { int halfOfByte = (data[i] >>> 4) & 0x0F; int twoHalfBytes = 0; do { if ((0 <...
af0ec694-47a8-4295-8e3f-6bcda5f2242a
1
private boolean contentChecker(String input) { boolean hasContent = false; if(input.contains(contentList)) { hasContent = true; } return hasContent; }
512780b2-ad2b-487d-b30f-c0338cc8f6a5
1
public String getSubDivideString() { if (sd == null) { return null; } else { return "File: " + sd.getFile() + ", Table: " + sd.getTable() + ", Column: " + sd.getColumn(); } }
a38e86db-c088-47a5-91f4-0309313e88a2
3
public void teach(double[][] data, double[][] results, int count){ for (int j = 0; j < count; j++){ for (int i = 0; i < data.length; i++){ for (int k = 0; k < neurons.size(); k++){ neurons.get(k).teach(data[i], results[i][k]); } } } }
fd232735-d475-4812-96db-23d0ef43c9e2
2
@Override public Class<?> getDataType(){ return data == null ? NepticalData.class : data.getClass(); }
8756a9ca-5ac5-4b4c-ad30-335b4c8aec20
2
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed JTextField[] gg = {this.jTextField1,this.jTextField2,this.jTextField3,this.jTextField4}; for(JTextField a : gg){ if(a.getText().isEmpty()){ proyecto.Error wp = new ...
ed50b697-ac35-45db-8b2c-2f612cba76e2
9
public void drawTrail(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(2)); while (!mousePath.isEmpty() && mousePath.peek().isUp()) { mousePath.remove(); } Point clientCursor = Mouse.getLocation(); mousePathPoint mpp = new mousePathPo...
adb536f8-0ff7-4064-97d3-50f6761a9645
2
public boolean isBookable() { return !getBusinessObjects().isEmpty() && debitTotal.compareTo(creditTotal) == 0 && debitTotal.compareTo(BigDecimal.ZERO) != 0; }
904d1aea-5ba1-4f6a-8a74-03cb9c576ec6
8
public ProjectInput getInput() throws Exception { TreeMap<Double, Double> map = new TreeMap<>(); ProjectInput input = new ProjectInput(); /** Get Polynomials **/ for (Component component : panPolynomials.getComponents()) { PolynomialField field = (PolynomialField) component; double exponent = 0; ...
d4cc83a1-6977-47d0-bef3-58fe0b002625
9
@Override public void run() { while(this.m_client.getConnectionState() != ConnectionState.DISCONNECTED) { int received = -1; try { received = this.m_inputStream.read(this.m_buffer); NetBlade.getServer().getLogger().finer("[" + this.getClient().getConnectionManager().getName() + "] Received " + re...
fe7ae71d-1f0c-47d9-a96c-b38c11972e48
0
@Test public void itShouldDeserializeMultiPoint() throws Exception { MultiPoint multiPoint = mapper.fromJson("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"MultiPoint\"}", MultiPoint.class); assertNotNull(multiPoint); List<LngLatAlt> coordinates = multiPoint.getCoordinates(); PointTest.assertLngLatAlt...
bf6ca15b-877a-468b-b0ef-4b7532cb1bd4
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...
8cca3219-369d-4775-8386-d9c7848a598e
6
public static boolean containsAll(final Collection<?> collection, final Iterator<?> iterator) throws NullPointerException { if (iterator == null) throw new NullPointerException("iterator = null"); if (collection == null) throw new NullPointerException("collection = null"); while (iterator.hasNext()) if (!colle...
eb131960-1877-472a-86ad-a2671c18d25e
6
public boolean jouerCase(Joueur joueurCourant, Joueur joueurAdverse, Case c) { if (c != null) { // Le joueur physique joueur if (joueurCourant.jouerCase(c)) { // Le joueur a touche un bateau this.afficherMessage("Vous avez touché votre adversaire !", tr...
55f5a743-a7e6-4601-b56d-edc5359ccb76
2
private Method getSetterMethod(Class boClass, String fieldName, Class fieldType) throws DataException { String setterName = "set" + fieldName.substring(0, 1).toUpperCase(); if (fieldName.length() > 1) { setterName += fieldName.substring(1); }//if try { return boClass.getDeclaredMethod(setter...
abe1232d-c409-4a62-8084-7ac7fe95b442
0
public DrawableItem(PersistentCanvas c, Color o, Color f) { canvas = c; fill = f; outline = o; shape = null; isSelected = false; }
d973f5e6-9320-4477-8b2b-ad0a749c9600
6
@Override public boolean decompose(DenseMatrix64F orig) { if( orig.numCols != orig.numRows ) throw new IllegalArgumentException("Matrix must be square."); int N = orig.numRows; // compute a similar tridiagonal matrix if( !decomp.decompose(orig) ) return fals...
6b4de328-7dc6-4f66-9aa8-d98a812fed54
4
public static void merge(int A[], int m, int B[], int n) { int i = 0, j = 0, index = 0; for (i = m - 1, j = n - 1, index = m + n - 1; i >= 0 && j >= 0; index--) { if (A[i] < B[j]) { A[index] = B[j]; j--; } else { A[index] = A[i]; i--; } } for (; j >= 0; ...
434560f1-0c86-4354-bb96-4d04f67f4a9e
7
@Override public ReturnStruct parse(String[] lines) throws InterpreterException { int i = 0; int c = 1; ArrayList<String> code = new ArrayList<String>(); while (i < lines.length) { String line = Parser.clean(lines[i]); if (line.startsWith("if ") || line.start...