method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
817cac5e-b07b-4d5d-b7ae-a3eba1c13067
0
public double getY(){ return y; }
66d69b3d-a58d-4e2a-a633-4d403120fd60
8
@Override public String buscarDocumentoPorFechaEmision(String fechaemi1, String fechaemi2) { ArrayList<Venta> geResult= new ArrayList<Venta>(); ArrayList<Venta> dbVentas = tablaVentas(); String result=""; Date xfechaemi1; Date xfechaemi2; Date f1; ...
118382a9-d904-46b5-9836-49e90145a796
7
public BitSet diversify(List<Subset> neighborhood){ if(neighborhood == null) return m_Sbest.subset; BitSet result = new BitSet(m_numAttribs); double [] counts = new double[m_numAttribs]; int numNeighborhood = neighborhood.size (); for (int i = 0; i < m_numAttribs; i++) { if(i == m_...
22640002-0bc7-4c7f-a4e4-3e181d6b9598
1
public static void testSingleFile() throws Exception { long stime; long ltime; stime = System.currentTimeMillis(); InputStream fstream; BufferedReader reader; // String fname = "/home/nlp/Documents/bnc/bnc/A/A0/A05"; // DJK F //HGBC // String fname = "/home/nlp/Documents/bnc/bnc/A/A0/A05"; // Strin...
935aa871-18dd-4341-91c6-53a6adef96a9
0
public void setNewspaper(Newspaper newspaper) { this.newspaper = newspaper; }
3a764d46-6c7a-45c2-a333-7c12d97f1e9c
9
private void doSave() { myFile = doRead(); if (myFile == null){ return; } String name = myFile.getName(); showMessage("compressing "+name); String newName = JOptionPane.showInputDialog(this, "Name of compressed file", name + HUFF_SUFFIX...
b2b3017a-7595-4ebb-94f6-4b1159dc42e7
0
public void notifyObserver(String str) { /* * if(str.matches("^0[0-9]+")) str = str.substring(1, str.length()); * * for(Observer obs : listObserver) obs.update(str); */ }
f19dd217-a988-402b-b623-f1be885fe863
9
private void send(OutputStream outputStream) { String mime = mimeType; SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); try { if (status == null) { ...
5c7265e0-501f-4e7c-9aae-6c48a7f23c98
9
@Override public final void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code > 0 && code < keys.length) keys[code] = true; if (TCode.DEBUG) // quick finding out of keycodes if (e.isAltDown() && e.getKeyCode() != KeyEvent.VK_ALT) System.out.println(e.getKeyChar() + " = " + e...
02880f1d-ded0-4b4b-9bbf-d71b936abeab
5
@Override public void setCell(int x, int y, boolean live) { if (y<0 || y>=getHeight()) return; if (x<0 || x>=getWidth()) return; if (live) world[y][x] = 0; }
2311a93d-0043-479e-b03c-9ff0117a8b1f
6
public void update() { // update position getNextPosition(); checkTileMapCollision(); setPosition(xtemp, ytemp); // check flinching if (flinching) { long elapsed = (System.nanoTime() - flinchTimer) / 100000; if (elapsed > 400) { flinching = false; } } // if we hit a wall, go the other way!...
ceef4860-6618-4063-aef0-958a03b803e4
8
@Test public void testPertenece1() { boolean expected = true; boolean actual = arbolito.pertenece(8) && arbolito.pertenece(3) && arbolito.pertenece(6) && arbolito.pertenece(1) && arbolito.pertenece(10) && arbolito.pertenece(4) && arbolito.pertenece(7) && arbolito.pertenece(14) && arbolito.pertenece...
04d82e6e-3906-4861-b9e2-e3e4bf50060d
0
public float getEXP() { return exp / 100.0f; }
194c2576-fe77-4e47-8ebe-fc1172bfa52a
0
protected DaoFactory(IUserDao userDao, IMessageDao messageDao) { super(); this.userDao = userDao; this.messageDao = messageDao; }
a3c54dee-c978-40ac-9635-b6c2a0c544bf
4
public static Node inorderPred(Node root,int val) { if(root==null) return null; if(root.data==val) { if(root.left!=null) return maxValue(root.left); else return predecessor; } if(root.data>val) return inorderPred(root.left, val); else { predecessor=root; return inorderPred(root....
88548ac3-2af5-4548-b2be-764c6cb73d3d
2
final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; }
b9d65586-6602-4994-b65d-9544c7c195b8
7
public static Mat findContours(Mat frame) { Mat contoursMat = preproc(frame); Mat result = new Mat(contoursMat.size(), CvType.CV_8U, new Scalar(255)); List<MatOfPoint> contours = new ArrayList<>(); List<MatOfPoint> contoursGeneral = new ArrayList<>(); Imgproc.findContours(conto...
f18689f5-c60f-4100-955a-be0a17ad989d
4
public Frame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 631, 366); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(pane...
ccb4dfd7-6feb-444a-9ed0-e6dac85baa13
1
@Override public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < Combination.SIZE; i++) { sb.append(tokens.get(i).getColor().name()); } return sb.toString(); }
dc474105-9b7e-469e-ba99-4877e340e506
7
public ChannelBuffer decode(ChannelBuffer channelBuffer) throws Exception { dataSink.writeBytes(channelBuffer); int actualLengthFieldOffset = dataSink.readerIndex(); long frameLength; switch (headLength) { case 1: frameLength = dataSink.getUnsignedByte(actualLengthFieldOf...
bfa07912-4955-4330-9c3c-57d79cdb90b6
7
public static boolean canMove(int x, int y) { for(Player p : players) { if(p.getX() == x && p.getY() == y) return false; } return !(x < 0 || y < 0 || x >= map.length || y >= map[0].length) && map[x][y] == 0; }
c8a0797b-3fed-4a11-bc1f-c2f366c621c6
1
public static void printList(ListNode list) { while (list != null) { System.out.print(list.val + " "); list = list.next; } }
66a3cdbe-d674-42a7-9bf5-bb6fa6d16d26
1
public void addUserPointsResult(int points) { if(points<0) this.user_point_lost -= points; else this.user_point_win += points; }
cc8c7a28-a8b6-4d01-959e-61b9bd354757
2
public double[] getRowCopy(int i){ if(i>=this.numberOfRows)throw new IllegalArgumentException("Row index, " + i + ", must be less than the number of rows, " + this.numberOfRows); if(i<0)throw new IllegalArgumentException("Row index, " + i + ", must be zero or positive"); return Conv.copy(this...
11472611-022a-4abe-ab3d-5cba3cadadd1
2
public T getItemById(final long id) { for (final T item : rows) { if (item.getId() == id) return item; } throw new NoSuchElementException(); }
f20724d2-0656-47c6-ad35-daccb664d43a
0
public void addFileChangeListener(FileChangeListener listener) { fileListeners.add(listener); }
365e484f-cf40-491a-9773-c720ee71b240
9
public static List<Unit> UnitParser (String filePath, String delimiter) { List<Unit> units = new ArrayList<Unit>(); try { FileReader fr = new FileReader(filePath); BufferedReader br = new BufferedReader(fr); String currentRecord; while((currentRecord = br.readLine()) != null) { String[]...
c60eace2-309b-46d3-9f1a-6f0ddcfa94ba
2
public void fill(File gdbFile) { int countNoFile = 0; String fileNofoundName = ""; String gdbFileName = gdbFile.getName(); String[] fields = {"RaceLaps", "TrackName", "GrandPrixName", "VenueName"}; gdbName = gdbFileName.substring(0, gdbFileName.length() - 4); String[] tr...
b9cfd9bf-2f92-4455-b745-b4e0997aa95e
0
public int getCliente() { return cliente; }
42579854-ebfb-4b17-a2e3-63ec8ca29fa1
0
public void patternText(){ this.text.insert(0, CrawlResultFormat.webPageHead(this)); this.text.append(CrawlResultFormat.webPageTail()); }
156aa85e-7648-45da-86b7-8942ac9421d8
2
public boolean isGameOver() throws Exception { if ((this.numEmptySquares == 0) || isWin()) { return true; } else { return false; } }
b98db290-2749-49c1-acf9-720eff1a0115
5
public RBNode search(int i) { if (isNil()) { return null; } else if (getKey() == i) { comparisonsDel++; return this; } else { if (i < getKey() && hasLeftChild()) { comparisonsDel++; ...
62d1a7b0-87ef-414d-b3bf-a3ae207b1e5c
7
private void generateProfileFromText() { if (arglist.size() != 1) { System.err.println("Need to specify text file path"); return; } File file = new File(arglist.get(0)); if (!file.exists()) { System.err.println("Need to specify existing text file path"...
5e2a639e-7183-4263-9d1a-47665c539fd1
0
public static String webPageHead(WebPage wp){ return "<page_html_code url=\"" + wp.getUrl() // + "\" depth=\"" + wp.getDepth() // + "\" father=\"" + wp.getFatherUrl() // + "\" charset=\"" + wp.getCharSet() // + "\">" + ln; }
1bc9c683-7fce-4c9a-84d5-ae7d0f660f1a
4
public static boolean isCartLockedDown(EntityMinecart cart) { int x = MathHelper.floor_double(cart.posX); int y = MathHelper.floor_double(cart.posY); int z = MathHelper.floor_double(cart.posZ); if (BlockRailBase.func_150049_b_(cart.worldObj, x, y - 1, z)) y--; TileE...
af9bc97f-c100-4a43-b60a-2448065099c8
4
private static void addBlocksToRootUsedInEditingScreen(RootUsedInEditingScreen rootUsedInEditingScreen, Root root) { List<BlockUsedInEditingScreen> blocksUsedInEditingScreen = new ArrayList<BlockUsedInEditingScreen>(); for ( Node node : root.getChildren()) { if ( node instanceof Block && !(...
4a0b4bb8-b390-4ca9-9acb-331e03b19677
7
public void terminate(Object[] arguments) throws MaltChainedException { // if (getAlgorithm() instanceof Trainer) { // ((Trainer)getAlgorithm()).terminate(); // } getAlgorithm().terminate(); if (getGuide() != null) { getGuide().terminate(); } if (mode == LEARN) { endTime = System.currentTimeMillis(); ...
4e161177-666d-4373-ab65-dee7f01ca33d
5
@Override public String getColumnName(int column) { String name = ""; switch (column) { case 0: name = "Name"; break; case 1: name = "Picture"; break; case 2: name = "ID"; br...
297ef997-79de-4c05-8528-edebc70215f4
9
public void loadStats(String name) { PoolConnection pcon = ConnectionPool.getConnection(); PreparedStatement ps = null; try { Connection con = pcon.connect(); ps = con.prepareStatement("SELECT * FROM `accounts` WHERE `name` = ?"); ps.setString(1, name); ResultSet rs = ps.executeQuery(); if (rs.ne...
56cfcb0c-88ae-4ab2-a61c-20a69fb77695
8
void floyd(int rows) { for (int i = 0; i < rows; i++) { for (int j = 0; j < rows; j++) { distancias[i][j] = grafo[i][j]; padres[i][j] = i; if (grafo[i][j] == INF || i == j) { padres[i][j] = -1; } } } // print(padres); for (int k = 0; k < rows; k++) { // print(distanci...
eef0629b-fccd-4b2f-9d4a-b39aab060cfd
6
@SuppressWarnings("resource") public void CrearBaseDeDatos() throws SQLException, FileNotFoundException, IOException { File dir = new File("/jpox.properties"); System.out.println("dire path " + dir.getAbsolutePath()); FileReader fr = new FileReader(dir.getAbsolutePath()); BufferedReader bf = new BufferedRea...
976c5f95-a18c-4502-82db-4035f1e3ba42
7
public int setVertical (int v) { if (TopLine == null) return 0; int NewTop = LineCount * v / 1000; if (NewTop > TopLineCount) { for (int i = TopLineCount; i < NewTop; i++) { if (TopLine.next() == null) break; TopLine = TopLine.next(); TopLineCount++; } repaint(); } else if (NewTop <...
720f5579-9f34-4efc-a7a4-76fb8691e8c0
4
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (obj.getClass() != getClass()) return false; ExtendedAttribute attr = (ExtendedAttribute)obj; return attr.getName().equal...
af400bdd-2912-4352-9c3c-9f73842f3c6f
0
public void setVenue(String venue) { this.venue = venue; }
3f241c34-bac4-4698-b105-a1d650e2b759
3
public static void main(String[] args) { int result = 0; for(int i = 3; i < 1000; i+=3) { result += i; } for(int i = 5; i < 1000; i+=5) { if(i % 3 != 0) result += i; } System.out.println(result); }
2c3b12fc-fc28-4a7f-92b5-4008bfbf0182
6
public boolean saveDialogBox () { if (theApp.getLogging()==true) return false; String file_name; // Bring up a dialog box that allows the user to select the name // of the saved file JFileChooser fc=new JFileChooser(); // The dialog box title // fc.setDialogTitle("Select the log file name"); // Start in...
69212bbc-ee2e-4714-bc96-494b48f58df3
4
public static ArrayList<Integer> inorderTraversalIterative(TreeNode root) { ArrayList<Integer> inorder = new ArrayList<Integer>(); Stack<TreeNode> stack = new Stack<TreeNode>(); if(root == null) { return inorder; } while(!stack.isEmpty() || root != null) {...
cf0fcbc4-6804-4d64-a8bc-89cfdf45dce7
4
public void changebonus(String[] split, String command) { if (split.length != 3) { PrintMessage("Syntax:!bonus [game] [#]"); return; } TournyGame m = (TournyGame) games.get(split[1]); if (m == null) { PrintMessage(split[1] + " is not an existing game"); return; } try { int b = new Inte...
c5a4583a-2c52-4f9f-a91f-c66dddf0adb7
7
public static double calculatePIdent(Hit h) { if(h==null){ return 0; } if(h.getHitHsps()==null){ return 0; } for(Hsp hsp:h.getHitHsps().getHsp()){ if(hsp.getHspIdentity()==null){ return 0; } if(hsp.getHsp...
4b8fb69b-a805-4718-990f-68137489bf88
4
public void move(long delta) { // if we're moving left and have reached the left hand side // of the screen, don't move if ((dx < 0) && (x < 10)) { return; } // if we're moving right and have reached the right hand side // of the screen, don't move if ((dx > 0) && (x > 750)) { return; } super...
c73f85a1-3dc1-47e3-ac32-18119791c983
4
private void endVideo(String to) { if (to.equals("slide")) slide.addEntity(video); else if (to.equals("quizslide")) quizSlide.addEntity(video); else if (to.equals("scrollpane")) scrollPane.addEntity(video); else if (to.equals("feedback")) quizSlide.addFeedback(video); }
c0bbbba6-e8bc-46bc-b0c2-a568b82b6bd2
1
public void setMap(Carte map) { this.map = map; if (map != null){ this.add(map.getCartePanel()); this.setVisible(true); } }
f3dda676-6b19-4726-938a-84d1f00963a2
7
public void actionPerformed(ActionEvent e) { if (e.getSource() == backButton) { this.f.getPanelJudgeMenu().setVisible(true); this.setVisible(false); this.remove(roundCombo); this.remove(typeCombo); /***************************************************/ // this.weightField.setText(""); // this.deadli...
9b9edf2e-b253-472f-83ef-35144b1f59ed
6
public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column) { setEnabled(table == null || table.isEnabled()); if(column==0 || column==1) { setHorizontalAlignment(SwingConstants.CENTER); ...
054b5ab9-eba7-4242-ac90-8d3a80d51677
7
public LinkedList<String> path() { LinkedList<String> out = new LinkedList<String>(); State s = prev; int oldOrientation = orientation; while (s != null) { if (oldOrientation != s.orientation) { if (oldOrientation == World.NORTH && s.orientation == World.WEST) { out.add("r"); } else if (...
a9c1dc83-b3d2-49ed-b5fd-d8b0db6a5d87
9
private boolean check() { if (!isBST()) StdOut.println("Not in symmetric order"); if (!isSizeConsistent()) StdOut.println("Subtree counts not consistent"); if (!isRankConsistent()) StdOut.println("Ranks not consistent"); if (!is23()) StdOut.println("Not a 2-3 tree"...
c7313083-4088-4785-86de-0af409e21543
3
public void addAttri(GeneratorAttri attri) { if (attri != null && this.attrislist != null) { if (Contains(attri) == -1) this.attrislist.add(attri); } }
d39a528e-c2a8-4de1-8179-9be76896172b
7
public boolean processCommand(Command command) { boolean wantToQuit = false; if(command.isUnknown()) { System.out.println("I don't know what you mean..."); return false; } // Given one of these commands, do the following String commandWord = command.getCom...
5ca43eeb-1b10-45dd-9480-54abc73b1bc8
6
private ArrayList<Task> getTodayTasks(ArrayList<Task> taskList) { String day = String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); String month = String.valueOf(Calendar.getInstance().get(Calendar.MONTH)+1); String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR)); ArrayList<Task> ...
530eb0b0-82d1-4838-9dcc-31433cace92f
2
private void getNewOffscreen() { log.logln(LogL.GUI_SEQ, "GraphPanel.getNewOffscreen: Allocating a new offscreen image."); imageSizeX = getWidth(); imageSizeY = getHeight(); offscreen = null; if(imageSizeX > 0 && imageSizeY > 0) { // update the transformation object pt.setWidth(imageSizeX); pt.setHe...
31783f4b-38d5-4be8-a2aa-c46405cc8189
9
public boolean dropon(Widget w, Coord c) { for (Widget wdg = w.lchild; wdg != null; wdg = wdg.prev) { if (wdg == this) continue; Coord cc = w.xlate(wdg.c, true); if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) { if (dropon(wdg, c.add(cc....
a9632c90-1af7-4aae-aadd-8b7810f7cf49
8
public void update() { for (int j = 22; j > 5; j--) { for (int i = 2; i < 12; i++) { if (!form.field[i][j]) { int l = -1; int type; sequence(); do { l++; if...
93c19b3f-c73a-438a-869f-0e936c94ab19
2
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); XMLTokener x = new XMLTokener(string); while (x.more() && x.skipPast("<")) { parse(x, jo, null); } return jo; }
4a3f61cd-7e10-4fd4-bc29-5a7e075316f7
2
public GridFrame(){ frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); JButton exp = new JButton("Export"); exp.setFocusable(false); exp.addActionListener(new ActionListener() { @Override public void actionP...
d21e857a-572b-419a-b8a7-5897fdb24f05
3
public void draw(Graphics g, PositionTransformation pt) { Position p1 = startNode.getPosition(); pt.translateToGUIPosition(p1); int fromX = pt.guiX, fromY = pt.guiY; // temporarily store Position p2 = endNode.getPosition(); pt.translateToGUIPosition(p2); if((this.numberOfMessagesOnThisEdge == 0)&& (t...
27d528ed-c286-47a9-823a-c5f1a1705139
4
@Override public void execute(CommandExecutor player, String[] args) { short w = 0; if (args.length == 1) { w = 64; } else if(args.length == 4) { LevelHandler handler = player.getServer().getLevelHandler(); handler.loadLevels(); if(handler.findLevel(args[0]) == null) { if (w != 0) handler...
25d0e54a-c5ee-4298-96d4-cc7b63216639
8
private static int findInternalSubsetStartCharWildcard( final char[] text, final int offset, final int maxi, final int[] locator) { boolean inQuotes = false; boolean inApos = false; for (int i = offset; i < maxi; i++) { final char c = text[i]; ...
e55ebd22-c6b0-4810-b0f7-3b20666d6c69
0
public static String constructString(StringBuilder sb) { String midStep = sb.toString(); Map<String,String> jsonData = parser.parseJson(midStep); return jsonData.get("amount"); }
d65d1b23-4243-492d-affa-b57ae2854987
7
public void successor(Integer[] T){ Integer[] S = new Integer[k+2]; S[0] = 0; // t_0 for(int i = 1; i < k+1; i++) { S[i] = T[i-1]; } S[k+1] = n+1; // t_{k+1} int j = 1; while(j <= k && S[j] == j) { j++; } if(k % 2 != j % 2)...
59d6b37f-d7ff-47a9-b2fc-f4625e848586
0
private ConfigurationManager() {}
6592ce04-2560-4a59-8ec3-f16f9c1b81bc
4
public double getNormalDistribution(double lowerLimit, double upperLimit, double standardDeviationSpread) { if (standardDeviationSpread < 1.0 || standardDeviationSpread > 5.0) // if standardDeviationSpread is < 1.0 there is a risk of excessive iterations of the range-checking do-while() loop throw new Illegal...
6f3e8c70-a5cf-4012-a109-048f3cba52ad
0
@RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formatt...
498409fa-f72e-499c-ac1a-89184b4560f2
9
public DiagramComponent connectLines(){ CompositeDiagramShape result = new CompositeDiagramShape(); //find all lines ArrayList<DiagramShape> lines = new ArrayList<DiagramShape>(); Iterator it = shapes.iterator(); while(it.hasNext()){ DiagramShape shape = (DiagramShape) it.next(); if(shape.getPoints().s...
dc0344dc-c678-44f9-96ae-a2a369e4c889
7
public static String[] verifyDateArguments(String[] args) throws Exception { if (null == args || args.length != 3) throw new IncorrectNoOfArgumentsException(3); int year = Integer.parseInt(args[0]); if (year < 0) throw new IllegalArgumentException("month value [" + year + "] exceed range"); int month = Integer....
abec318a-aec5-461c-a254-d9ef3d1c6169
7
protected Entity getEntityCollidingWithParticle() { if(!collidable) return null; if(game.localEntity.intersects(this)) return game.localEntity; for(int i = 0; i < game.globalEntity.length; i++){ if(game.globalEntity[i] != null) if(game.globalEntity[i].intersects(this)) return game.globalEntity[i...
799309ba-46f6-4958-a371-9b1891a80956
9
public boolean ingresoCorrecto(int a, int b, String v) { obtenerLimites(obtenerCuadrante(a, b)); int valor=Integer.parseInt(v); for(int x=pvCuadrante; x<=(pvCuadrante+2); x++) { for(int y=phCuadrante; y<=(phCuadrante+2); y++) { if(txtTablaHered...
7c434514-a1c1-4b15-819b-050a5ae47a5d
1
public static void main(String[] args){ WikiaXMLHandler xmlHandler = new WikiaXMLHandler(); SongFinder songFinder = new SongFinder(); try { String[] urlAndLyrics = xmlHandler.getUriAndLyricsSnippet("Adele", "Rolling in the deep"); String lyrics = songFinder.findAndExtractSong(urlAndLyrics[0]...
b9a9dbfc-698a-45cf-a1f9-9e8c4b4eba1c
5
public boolean onkoShakkiMatti(String vari) { for (int i = 0; i <= 7; i++) { for (int t = 0; t <= 7; t++) { if (getNappula(i, t) != null && getNappula(i, t).getVari().equals(vari) && !getNappula(i, t).mahdollisetSiirrot(i, t, ruudukko).isEmpty()) { ...
0f4d0238-badc-4df0-8cc2-6119254c1076
1
@FXML private void handleBtnBackAction(ActionEvent event) { btnBack.setDisable(true); final Region root; try { root = FXMLLoader.load(PosApplication.class.getResource("pos.fxml")); } catch (IOException e) { throw new RuntimeException(e); } Mai...
60d1ae46-5453-41f0-94b1-f58e54daced5
9
public void drawMap(Graphics g) { for (int r = 0; r < map.length; r++) { for (int k = 0; k < map[0].length; k++) { int x = k * GameObject.tileSize; int y = r * GameObject.tileSize; if (camera.intersects(x + GameObject.tileSize, y, 1, 1) || camera.inter...
93da0142-3891-4a39-97fd-621319ff6804
5
private static boolean[] primeBoolArray(int limit) { boolean[] nums = new boolean[limit]; for (int i = 2; i < nums.length; i++) nums[i] = true; int nextPrime = 2; while (nextPrime < nums.length / 2) { int i = nextPrime; for (; i < nums.length; i += nextPrime) nums[i] = false; nums[nextPrime] = t...
53b211ee-f4fc-4ef6-b112-6750c6dbb156
2
public Serializable decode(File file, Map parameters) { if (file.getName().endsWith(GRAMMAR_SUFFIX)) return readGrammar(file); if (file.getName().endsWith(REGULAR_EXPRESSION_SUFFIX)) return readRE(file); return readAutomaton(file); }
f9357088-b67a-4d10-91b3-b8791098be07
2
public int run(String[] args) throws Exception { // Parameter checking if (args.length < 2) { // Not enough parameters System.out.println("Error - Not enough parameters"); System.exit(0); } else if (args.length > 2) { // Too many parameters System.out.println("Error - Too many parameters"); Sys...
fe0c227d-e256-4379-876b-533fb40b34c0
4
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerJoin(PlayerJoinEvent event){ Player player = event.getPlayer(); //Keep track of all the players that have logged in if(!(plugin.getPlayersLoggedInSinceBoot().contains(player.getName()))) plugin.getPlayer...
5479841a-3bbc-4bf9-9241-f0f5da282895
5
private void heapifyDown(int index) { int leftChildIndex = index * 2 + 1; int rightChildIndex = index * 2 + 2; int swapIndex = index; // if left child exists and lesser than current node if (leftChildIndex < currentIndex) { if (heap.get(leftChildIndex).compareTo(heap.get(swapIndex)) < 0) swapIndex = l...
78928d3d-ea05-49b9-9a2a-f771d56ecc4a
4
public static void main(String[] args) throws FileNotFoundException, IOException, InvalidKeyException, IllegalBlockSizeException, InvalidAlgorithmParameterException, BadPaddingException, Exception { //1. Initialization int ctr = 1; int sizeBytes = 0; int l= 128; int k = ...
ba78b9ea-7de4-4fad-8ca6-59d01d322feb
0
public int getCurrentMap(){ return this.currentMap; }
83602560-be38-4ec1-bb1d-e09f7d01c8ad
4
public void paintComponent(Graphics g) { super.paintComponent(g); if(gameStage == GameStage.START_MENU){ g.drawImage(Dialogue.getStartMenu(), 0,0,null); } else if(gameStage == GameStage.IN_GAME){ Graphics2D g2 = (Graphics2D) g; for(int i = 0; i < 5; i++){ for(int j = 0; j < 5; j++){ g2.drawIma...
13577885-9682-4084-b952-5d8e2da94efe
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
de65eadc-259d-4b49-a98f-0594247037d3
4
private static String next(Queue<String> parts) { if (parts.isEmpty()) return null; String ret = parts.poll(); if (ret.equals("#")) { parts.clear(); return null; } if (ret.equals("-") || ret.equals(",")) return null; return ret; }
027fd06e-e9d4-493c-a7b3-f2dbbcfac04d
9
public String toStringSummary() { int resultsetLength; String result; String titles; int i; int j; if (m_NonSigWins == null) return "-summary data not set-"; resultsetLength = 1 + Math.max((int)(Math.log(getColCount())/Math.log(10)), ...
90ef0d69-7d49-4cc7-a76a-d240c7a5d17b
0
private URL getResourceURL() { return resource_url; }
4f58d76c-16e3-4efe-9dd3-560dc5e563de
4
public ArrayList<Rectangle2D> getFlatRects(Rectangle2D rectangle) { if(noChildren()) { ArrayList<Rectangle2D> tempRects = new ArrayList<Rectangle2D>(); for(int x = 0; x<flatRects.size(); x++) { tempRects.add(flatRects.get(x)); } return tempRects; } else { ArrayList<Rectangle2D> tempRects = new Ar...
a687d8e5-3f5e-4793-828d-b146651c432c
4
private void checkElements( int offset, int length ) { int end = offset + length; Document document = jText.getDocument(); Element element; do{ try { // We need to use a ParagraphElement because a CharacterElement produce problems with formating in a word ...
7b5c7d96-249c-4716-9076-461c40d9b0a1
0
public static Border getDefaultEmptyEtchedBorder() { return defaultEmptyEtchedBorder; }
04968def-04f2-4ddf-8a1f-8aa339266e71
9
public boolean overlaps(Interval<T> interval) { if (interval == null) throw new NullPointerException("interval is null"); return (this.contains(interval.min) && interval.contains(this.max)) || (this.contains(interval.max) && interval.contains(this.min)) || (interval.contains(this.min) && interval.contai...
6ba10ec8-1559-4930-8115-6c4573eda52b
4
public Object[][] getQueryResultAsObjectArray(String query){ List<List<Object>> queryResult = getQueryResult(query); if(queryResult==null||queryResult.size()<1) return null; Object[][] result = new Object[queryResult.size()][queryResult.get(0).size()]; for (int i = 0; i < result.length; i++) { for (int j = 0...
10b18bcf-212d-4762-8e55-6c12150527ef
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 =...
6b78ecac-48fe-4393-9636-8b3d387cb009
8
void updateUIText() { // borders br1.setTitle(UIText[0][curLang]); br2.setTitle(UIText[1][curLang]); br3.setTitle(UIText[2][curLang]); br4.setTitle(UIText[3][curLang]); // buttons addFileButton.setText(UIText[4][curLang]); changeFileButton.setText(UIText[...
e8bbf60e-2dd2-4e50-add4-c426890d59c0
7
@SuppressWarnings({ "unchecked", "rawtypes" }) public LevelCreator() { addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { Game.get().display.getFrame().setVisible(true); } }); setResizable(false); setTitle("Create Maze"); setDefaultCloseOperation(JFrame.D...