method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
581545eb-b89c-4047-a551-816332cf9225
0
public CheckResultMessage check20(int day) { return checkReport.check20(day); }
1666ceca-4e6d-461a-81c1-d62595eab297
6
private boolean isPerfectMatching() { // check that xy[] is a perfect matching boolean[] perm = new boolean[N]; for (int i = 0; i < N; i++) { if (perm[xy[i]]) { StdOut.println("Not a perfect matching"); return false; } perm[xy[...
703b612a-2dde-4892-8b40-1bc3bb5a36ed
8
public ArrayList<ArrayList<Integer>> levelOrderBottom(treeNode root) { ArrayList<ArrayList<treeNode>> listLevelNodes = new ArrayList<ArrayList<treeNode>>(); ArrayList<ArrayList<Integer>> listLevelValuesBottomUp = new ArrayList<ArrayList<Integer>>(); if (root == null) return listLevelValuesBottomUp; ArrayLi...
1583609b-dc2f-4128-b1ac-d57caeee992d
3
@Override public void run() { Runtime.getRuntime().addShutdownHook(new onShutdown(this)); try { bridge = new Bridge(true, false); server = new CommandServer(InetAddress.getLocalHost().getHostAddress(), 53789, this); } catch (UnknownHostException e) { Syste...
7b4e1402-6726-444f-9134-c79858dacbf2
5
public void mouseDragged(MouseEvent e) { if(clickable) { if(e.getX()>x && e.getX()<x+width) { if(e.getY()>y && e.getY()<y+height) { t1 = System.nanoTime(); clicked=true; } } } }
f087ab38-6840-4a93-a308-b65d1ebd38c6
6
public void produceUsers(){ users.removeAll(users); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); } PreparedStatement ps = null; ...
3667a93f-c58f-44a3-b416-15da688e918e
9
@Override public Query parse() { if(!this.prepared) { this.prepared = true; String P_KEY = null; StringBuilder sB = new StringBuilder(); sB.append("CREATE TABLE "); sB.append(this.t.replace("#__", this.db.getPrefix())); sB.append("\n"); sB.append(" (\n"); int i = 0; for(Col...
831038db-b95e-4b8f-8f35-e82a1aa9366e
6
private void initialize() { setUserPreferences(new UserPreferences()); try { UIManager.setLookAndFeel(getUserPreferences().getLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } setController(new Controller(this, getUserPreferences())); setFrame(new JFrame()); setMainPanel(new MainPanel(...
f1930ae5-630b-4968-8c14-9843c95bce7a
3
private boolean waitForPin(GpioPinDigitalInput pin, boolean waitforHigh, long timeout) { Timer timer = new Timer(timeout, true); while (waitforHigh ? !pin.isHigh() : !pin.isLow()) { Tools.waitForMs(10); if (timer.hasExpired()) { return false; } } return true; }
5cf400e2-1e22-4a33-8eae-26698b5082fd
6
private void run() { isRunning = true; int frames = 0; int frameCounter = 0; final double frameTime = 1.0 / FRAME_CAP; long lastTime = Time.getTime(); double unprocessedTime = 0; while (isRunning) { boolean render = false; long startT...
11852ac4-4df2-401b-936e-2d09ff648ff6
4
public static ActionArray createActionArray(int setType) { switch (setType) { case ActionArrayFactory.BLANKARRAY: return new BlankActionArray(); case ActionArrayFactory.DEFAULTARRAY: return new DefaultActionArray(); case ActionArrayFactory.DEFAULTALTARRAY: return new DefaultAltActionArray(); case Act...
ef4db949-bb66-4df8-b9fd-f1ad39e08351
6
private JPanel thumbnails(final String path) { final JPanel thumb = new JPanel(); thumb.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { for(int i=0;i<6;i++){ if(pnlIma...
137453d5-e5f3-47aa-afdc-a196bed94715
4
public void doAdd() { String item = JOptionPane.showInputDialog(this, "Please enter item to add to queue.", ""); boolean itemAdded = false; if(item == null || item.equals("")) { textArea.setText("Unable to add item to queue: Item must not be an empty String."); ...
3e99a367-bb67-4bce-9a98-10b2fb632a6e
7
DodsV findDodsV(String name, boolean useDone) { for (DodsV dodsV : children) { if (useDone && dodsV.isDone) continue; // LOOK useDone ?? if ((name == null) || (dodsV == null) || (dodsV.bt == null)) { logger.warn("Corrupted structure"); continue; } if (name.equals(dodsV.bt.get...
0c55c3c0-67ff-4cf3-af0f-dcd9242dd0e7
4
public boolean onLaudalla(Ruutu sijainti){ if (sijainti==null) { return false; } return sijainti.getX()>0&&sijainti.getX()<= koko && sijainti.getY() > 0 && sijainti.getY() <= koko; }
fdfeacb9-2cd5-4727-b8ea-c3cd5b40003d
3
public final void setDecimals(final int DECIMALS) { final int dec = DECIMALS > 5 ? 5 : (DECIMALS < 0 ? 0 : DECIMALS); if (null == decimals) { _decimals = dec; } else { decimals.set(dec); } }
613a7267-b94e-4d1a-915c-340d63a15f21
7
void updateScrollBar() { DNAScrollerModel dnamodel = getModel(); if (dnamodel == null) return; if (dnamodel.getDNA() == null) { scrollBar.setValue(0); return; } if (!scrollBar.isVisible()) { scrollBar.setVisible(true); } int index = dnamodel.getCurrIndex(); int startindex = dnamodel.getStart...
a6a54e8b-15ea-4a33-9065-997bda4ec296
2
private void writeSerializable(YamlFile yamlFile, String key, Class<?> value) { ConfigurationSerializable serializable = getSerializable(value); Map<String, Object> serialized = serializable.serialize(); Map<String, String> serializedTypes = new HashMap<>(); for(String s : serialize...
a2d6ef1a-9804-4af6-a134-4d3890ba8768
7
public String getAccessProperty(String type) { String path = this.getPath(); // /domain/ path = path.substring(8); String dpath = null; int pos = path.indexOf("/"); if (pos!=-1) { dpath = "/domain/"+path.substring(0,pos); path = path.substring(pos); } else { dpath = "/domain/"; } if...
ab2d2042-696a-4af4-99e5-5bd8bbe903f1
6
@EventHandler public void CaveSpiderFireResistance(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.getCaveSpiderConfig().getDouble(...
44889827-8266-4064-9141-ff33563f9ee2
8
private void runUpdater() { if (this.url != null && (this.read() && this.versionCheck())) { // Obtain the results of the project's file feed if ((this.versionLink != null) && (this.type != UpdateType.NO_DOWNLOAD)) { String name = this.file.getName(); // If it's a zip file, it shouldn't be downloaded as ...
07446c5b-8a11-49e3-8a79-40e8e5ab7d0e
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...
b5609304-8197-4a02-a85b-8ebf36ac52d4
8
public Point[] getAll(Texture tx) { //how much to increment the array by each time. final int increment = 20; //make array size 0 Point[] result = new Point[0]; Point[] temp; int row = 0; int col = 0; byte lightCount = 0; //while iteration...
7d6a8842-3cce-480c-9be4-e966e4892788
3
@Override public int hashCode() { int result = asOf != null ? asOf.hashCode() : 0; result = 31 * result + (trendAt != null ? trendAt.hashCode() : 0); result = 31 * result + (trends != null ? Arrays.hashCode(trends) : 0); return result; }
3e360029-326e-4fdf-9917-612a81bf5cde
4
public double value(StateObservationMulti a_gameState) { boolean gameOver = a_gameState.isGameOver(); Types.WINNER win = a_gameState.getMultiGameWinner()[id]; double rawScore = a_gameState.getGameScore(id); if(gameOver && win == Types.WINNER.PLAYER_LOSES) rawScore += HUGE_N...
ab0373f4-b938-4b80-921c-075326eb75da
8
public Scanning(int height, GC gc) { y = height; intersectionPoints = new ArrayList<Point2D>(); int i, j; Edge edge; for (i = 0; i < Main.shapes.size(); i++) { for (j = 0; j < Main.shapes.get(i).edges.size(); j++) { edge = Main.shapes.get(i).edges.g...
4e03d5f1-92d6-4c71-ae29-58967a96be9f
8
private void setDeathShape( int type, Shape [] array ) { Random rng = new Random(); int startX = 80; int inc = 96; if ( thePlayer.hasGun() && type == 1 && rng.nextInt() % 2 == 1 ) { // HANDLE IT! rockSound.playAsSoundEffect(1, 1, false); array[0] = new Death( startX , -16, 16, 16, 1, rock[0] );...
1f476194-13e9-4391-a954-4dc37d32edbb
2
private void nextLine() { // TODO Auto-generated method stub for(int i = 0; i < threads.length; i++){ threads[i].getLinha().getOsc().getEnvelope().addSegment((float) 0.0, 1.f); } for(int i = 0; i < 5; i++){ alpha[i] = (int) random(0, 11); System.out.println(alpha[i]); threads[(int) alpha[i...
b1c4bd2f-ea38-4949-baf6-8c594c5c2767
0
public String getKey() { return key; }
b55b6662-71e6-4c46-a0c6-78f22bafbf8f
2
public void busquedaRecursiva(Nodo<T> lista, T x){ if(lista != null){ if(lista.getInfo() == x){ System.out.println("El elemento se encuentra en la lista"); }else{ this.busquedaRecursiva(lista.getLiga(),x); } }else{ System.out.println("EL elemento no se encuentra en la lista"); } }
d1043adc-8b8e-498a-aabc-319daf3b1e7f
9
public Lru(int[] refList, int size, int frames) { int[] pages = new int[refList.length]; // Will hold the page reference list after converted to page numbers. int faults = 0; int[] frame = new int[frames]; int[] lastUsed = new int[frames]; // Will keep track of the last use for each page int hit = -1; in...
3212adad-3a2a-4963-915d-abbf1af8458c
0
public ExponentialDistribution(int NumberOfTimesPacketsAreDeliverd, long SEED) { super(NumberOfTimesPacketsAreDeliverd, SEED); //initialize the distribution array EDarray = new ArrayList(); //initialize the queue for output q=new LinkedList(); }
b42e2322-74ec-4c5f-9742-3b3d32deb7a5
7
private static boolean checkCommandLine(CommandLine cli) { boolean error = false; Mode mode = getMode(cli); if (mode == null) { System.err.println("Es wurde kein Modus angegeben"); error = true; } if ((mode == Mode.ZIPANDWRAP) || (mode == Mode...
1a32b45e-4e2b-431e-8c6b-3bad29276682
7
private void printlResult() { /*for(Entry<String, Category> entry : cateMap.entrySet()) { System.out.println(entry.getValue().toString()); } System.out.println();*/ List<Entry<String, Set<String>>> dinstinctKeywords = new ArrayList<Entry<String, Set...
ece1eaa1-3b1a-43fb-9cca-cc00b6dd2a22
1
@Override public void takeDamage(int damage) { if (Math.random() > getAvoidPercent()) { this.curHP -= damage - defense; } }
631f1766-6321-4f39-9abc-4a718163b604
3
public boolean canGoto(int x, int y, Entity entity){ for(int i=0; i < world.entities.size(); i++){ for(Tile tiles : world.tiles){ if(CollisionLibrary.testAABBAABB(entity.aabb, tiles.aabb)){ return false; } else { return true; } } } return false; }
b49f92ad-04f1-4759-92bc-f5c1f52188fe
5
@Test public void testSetListenThreadClient() { LOGGER.log(Level.INFO, "----- STARTING TEST testSetListenThreadClient -----"); boolean flag1 = false; boolean flag2 = false; if (server2.getState() == Server.CLIENT) { flag1 = true; } if (flag1) { ...
4f592c3f-4f7c-49aa-a2dd-c9fffb9bc5ac
2
public static final InkChromaticity get(Chromaticity chromaticity) { for (InkChromaticity one : values()) { if (one.getChromaticity() == chromaticity) { return one; } } return MONOCHROME; }
bb226617-80cf-4dc5-a58a-421c8210ce31
4
@Override public void handle() throws IOException { DataInputStream dis = new DataInputStream(player.getInputStream()); short size = dis.readShort(); List<Point> coords = new ArrayList<Point>(size); for (int i = 0; i < size; i++) { short x = dis.readShort(); short y = dis.readShort(); coords.add(new P...
0b338d07-dbbc-4c2d-8f6a-bcaf039f0a9d
6
private void initonce() { if(initedonce) return; initedonce = true; try { Resource.addurl(new URL("https", getCodeBase().getHost(), 443, "/res/")); } catch(java.net.MalformedURLException e) { throw(new RuntimeException(e)); } if(!Config.nopreload) { try { InputStream pls; pls = Resource.cl...
449d058d-9daf-4698-8449-953009227b7e
9
public void ComputeSmallWindowStatisticByToeflDataSet() throws IOException{ int correctAnswers = 0; File testFile = new File("toefl.tst"); BufferedReader testReader = new BufferedReader(new FileReader(testFile)); String rdline; int LineNo = 0; String[] question = new String[6]; while ((rdline = ...
fd395343-0b9b-457d-a117-f7f007f89b41
2
public int getBlockLength(int offset) { for(int i = 0; i < this.blockOffsets.length; i++){ if(offset == this.blockOffsets[i]) return this.blockLengths[i]; } return -1; }
43f8905a-52dc-40f3-8766-44943bbd3913
6
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "create graph" - Create the graph // "done" - All done // try { switch (ae.getActionCommand()) { case "create graph": Date startDa...
8b4c6497-ecd4-47c6-9ad7-d8077aeae2e5
1
public void testForOffsetHours_int() { assertEquals(DateTimeZone.UTC, DateTimeZone.forOffsetHours(0)); assertEquals(DateTimeZone.forID("+03:00"), DateTimeZone.forOffsetHours(3)); assertEquals(DateTimeZone.forID("-02:00"), DateTimeZone.forOffsetHours(-2)); try { DateTimeZone.f...
0f43008c-ccf9-4385-a8c7-0ef4ea86fc33
3
@Override public Object getValueAt(int rowIndex, int columnIndex) { if (params == null) return null; Parameter p = params.get(rowIndex); if (columnIndex == 0) return p.getName(); else if (columnIndex == 1) return p.getFormula(); else return p.getValue(); }
c7df3224-f81d-4f19-a233-51be5e1f225c
4
@Override public String toString() { // StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); // Intellij IDEA advised to use StringBuilder instead of StringBuffer sb.append("ComplexMatrix [\n"); for (int i = 0; i < getRowsNum(); i++) { sb.append("...
e6c60267-52ee-4e12-8283-cf8607468fcb
6
public String getMetaHeaders(HttpServletRequest request) { System.out.println("Euscreenxlitem.getMetaHeaders()"); String id =request.getParameter("id"); //System.out.println("ITEMID="+id); ipAddress=getClientIpAddress(request); String uri = "/domain/euscreenxl/user/*/*"; browserType = request.getH...
0810962f-2011-4c84-b195-99aa06c63433
0
public View(Model m) { _model=m; //setting sizes Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int screenWidth = (int) 700; int screenHeight = (int) 700; this.setSize(screenWidth,screenHeight); //setting elements c=getContentPane(); c.setLayout(new G...
b427a8e2-4f65-46ad-96d5-3b8f53930ddc
0
public void onModuleLoad() { Panel panel = new HorizontalPanel(); VerticalPanel consulterEventsPanel = new VerticalPanel(); Label title = new HTML("<h3>Consulter les événements</h3>"); consulterEventsPanel.add(title); consulterEventsPanel.add(searchWidget()); tableEvents = new TableWidget(); consulterEven...
261620a0-04b3-4430-96d9-40da10016aab
4
private int objectNextFree (int i, ArrayList<ObjetGraal> liste){ int result = -1; Boolean bExiste=false; for(ObjetGraal objet :liste){ if (objet.getType().equals(DefObjetGraal[i][0])){ if(i==(DefObjetGraal.length-1)) i=0; else i++; result = objectNextFree(i,liste); bExiste=true; break; ...
7c02f8e5-56a8-4f5d-9e15-6d267220cc1d
5
public treeNode getMinNode(treeNode root) { if (root == null) return null; treeNode leftMax = null; treeNode rightMax = null; treeNode minNode = root; if (root.leftLeaf != null) { leftMax = getMinNode(root.leftLeaf); if (leftMax.value < minNode.value) { minNode = leftMax; } } if (root.ri...
dd4605f9-b627-4cc9-8d33-8b7a07ef40c9
9
static private void gatherStatistics(String[] lineArray) { String token = ""; for(int j=0 ; j < numberLines ; j++) { StringTokenizer st = new StringTokenizer(lineArray[j], " \t", true); while(st.hasMoreTokens()) { token = st.nextToken(); boolean isWord = true; for(int i = 0; i<token.l...
33e60219-8c97-4e08-bf48-ce21606910f9
1
public final boolean more() throws JSONException { char nextChar = next(); if (nextChar == 0) { return false; } back(); return true; }
92711cef-2e04-411b-a748-c1d3623c26ec
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); user = (User) session.get("User"); Criteria ucri = myDao.getDbsession().createCriteria(User.class); ucri.add(Restrictions.not(Restrictions.eq("e...
ee5b7810-7014-43b6-ae5a-ecb29c011dea
7
public static List<MoleculeState> getIsomers(int carbons, Bond primaryBond) { List<MoleculeState> states = new ArrayList<>(); final HashSet<String> existing = new HashSet<String>(); Queue<MoleculeState> currentStates = new LinkedList<MoleculeState>() { @Override public boolean add(MoleculeState state) { ...
1a00d138-0e85-4b97-b537-0492626ad615
7
@Override public void unInvoke() { // undo the affects of this spell if(affected==null) return; if(!(affected instanceof Room)) return; if((shooter==null)||(parameters==null)) return; if(canBeUninvoked()) { shooter = (Ability)shooter.copyOf(); final MOB newCaster=CMClass.getMOB("StdMOB"); ...
70465d16-7834-49d2-abeb-b339e91a0310
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...
402d71bb-d3c1-484d-97bf-68f5c62fe56d
9
public void moveToTouch(OrthographicCamera camera) { // TODO Auto-generated method stub // The bloody camera and touch position is in a different orientation than the batch.draw orientation. It's a nightmare. if(currentForm!=4){ Vector3 touchPos = new Vector3(); touchPos.set(Gdx.input.getX(), Gdx.input.getY(), ...
cf2adf54-84a3-4d61-aa79-8ecb66bcf6a7
3
@Override public void keyPressed(KeyEvent event) { //Match hotkeys: switch (event.getKeyCode()) { case KeyEvent.VK_ESCAPE : match.cancelCurrentAction(); break; //Escape : cancel action/deselect unit. case KeyEvent.VK_E : if (event.isControlDown()) { //Ctrl-E : end turn. match.endTurn(); } break; //...
2396d933-10e0-41c6-b610-1b2385095f2e
4
public void run() { while (!threadTerminate) { // If we are not processing a request and we have a query, handle it if (!processingQuery && queryRequests.size() > 0) processQuery(); // This thread should only check requests every few seconds or so // The thread should not be demanding at all tr...
3cb204b6-5632-4909-9da2-319bfabb36c5
0
public Sound(String mp3Filename) { this.filename = mp3Filename; }
3017d594-b536-4086-babd-2a5e1fb97346
3
@Override protected Long getContentLength(String s, MediaType contentType) { if (contentType != null && contentType.getCharSet() != null) { Charset charset = contentType.getCharSet(); try { return (long) s.getBytes(charset.name()).length; } catch (Un...
fbc56a79-c276-4a15-83ae-baa17828fce4
2
public void paintComponent(Graphics g) { //BlackBG - VOID; should not be seen. g.setColor(Color.black); g.fillRect(0, 0, width, height); // // Map map.paint(g); // -- // Player Run.player.paint(g); // -- // MENUS //Start menu if (!Run.gameStarted) startMenu.paint(g); // //Pause m...
24fcefe4-0090-4f73-b109-29cf24ae019d
8
public static int fetchPersonId(String userid){ int personId=0; ResultSet rs = null; Connection con = null; PreparedStatement ps = null; boolean result = true; try { String sql = "SELECT ID FROM PERSON WHERE userid=?"; con = ConnectionPool.getConnectionFromPool(); ps = con.prepareStatement(sql);...
ae189ace-8d2f-4b15-b6fa-33280ef309b8
2
public void add(String word) { char[] wordChars = word.toCharArray(); for (int i = 0; i < wordChars.length; i++) { char before = wordChars[i]; wordChars[i] = (char) 0; String key = String.valueOf(wordChars); HashSet<String> valueSe...
9ff710a8-88c1-4e3e-89d9-cee8c30f2a66
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just cast a storm of meteorites!"); return random.nextInt((int) agility) * 2; } return 0; }
b08e875e-7f02-4a6b-b317-43216f62a715
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((myHost==null) ||(!(myHost instanceof MOB))) return super.okMessage(myHost,msg); final MOB mob=(MOB)myHost; if((msg.amISource(mob)) &&(mob.charStats().getClassLevel(this)>4)) { if(((msg.sourceMinor()==CMMsg.TYP_BUY...
8ac4d5dd-de3f-4358-ab71-3371b12629e7
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof MatchPairing)) { return false; } MatchPairing other = (MatchPairing) object; if ((this.id == null && other.id !...
8666c93b-793d-49bb-9f4b-e01fb07fcb8f
1
public void printArg(){ System.out.print("("); for(Argument e : arrayarg){ System.out.print(e.getId() + " : " + e.getType()); } System.out.print(")"); }
106eaec2-0054-4852-a3a1-f1726c36096b
9
private Element getOrCreateCollection(String collectionName) throws Exception { if(this.doc == null) { this.doc = Utilities.createDocument(); } Element docElem = this.doc.getDocumentElement(); if(docElem == null) { docElem = Utilities.createElement(this.doc, "c", "settings", this.namespaces); } else...
0cbc980f-d248-49e2-85f9-ff6a9dba32c1
1
public String getNoteContent(int noteId) throws SQLException { NoteDatabaseManager dm = new NoteDatabaseManager(); String s_noteId = Integer.toString(noteId); String sql = "select note_content from note where note_id = " + s_noteId + ";"; ResultSet rs = dm.sqlQuery(sql); String noteContent = null; while...
a7537c34-e3e9-4cf5-ba9c-3085b3df6a59
8
public void makeTable(ArrayList<String> fNames) throws IOException{ TextFile in = null; String line = ""; String[] splLine; int index = 0; //table with only counts table = new float[trSize][samplesSize]; readsPerSample = new float[samplesSize]; feature...
2e19f0c3-d74c-4aa9-83a4-75bdb18c96d6
7
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k - 1)) { k--; } } if (b[k] == 'l' && doublec(k) && m() > 1) { k--; } }
d1d12146-37c1-4a7b-9b94-358f906f6496
5
private static int maxSum(int[] a){ int max = Integer.MIN_VALUE; int temp=0; int m = Integer.MIN_VALUE; int linit = 0; for(int i=0;i<a.length;i++){ temp+=a[i]; m = Math.max(m, a[i]); if(temp<0){ temp=0; linit = i+1; } else if(temp>max){ max = temp; l = linit; r = i; } } ...
0b4521d7-b6ff-4154-a4d1-69fd7213d40f
1
@Test public void equals2_test() { try{ double []vec1= {1.0,2.0,3.0}; double []vec2= {1.0,2.0}; boolean result= Vector.equals(vec1, vec2); Assert.assertFalse(result); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } }
16de3e2f-6beb-45e8-bcfb-26e2fb5a6e4b
4
public static List<String> parseTexteVersMot(String pathInput) { List<String> result = new ArrayList<>(); try { Scanner scanner = new Scanner(new FileReader(pathInput)); String mot; while (scanner.hasNext()) { mot = scanner.next().replaceAll("[!,.;?\":...
86f91c5e-1308-4acf-b7e4-2cbc17ff147a
4
private void updateSaveIssueButtonState() { boolean disable = true; if (saveIssue != null && table != null) { final boolean nothingSelected = table.getSelectionModel().getSelectedItems().isEmpty(); disable = nothingSelected; } if (disable == false) { d...
24fc393f-7cef-461b-8422-d900e2b81938
1
public static Component getComponentForDialog(Object obj) { return obj instanceof Component ? (Component) obj : null; }
ee228fcd-6736-44d3-a790-b39d9611b5e5
6
public void run () { int W=job.getPageDimension().width,H=job.getPageDimension().height; int D=W*2/3/S,O=W/6; if (D%2!=0) D++; font=new Font("SansSerif",Font.BOLD,D/2); g.setFont(font); fontmetrics=g.getFontMetrics(font); g.setColor(Color.black); int i,j; // Draw lines int y=O; int h=...
9df37f20-ce4e-4e78-8e8e-d968c6f57305
1
public static boolean isGetter(String name){ if(name.contains("get")) return true; else return false; }
5b91dced-79a9-4e18-813b-67f5b403035a
3
public boolean isWeaponUnlocked(UnlockType type){ if(type == UnlockType.DEFAULT) return true; else if(type == UnlockType.DAMAGE_OVER_TIME) return unlockedDOT; else if(type == UnlockType.MAGIC) return unlockedMagic; else return false; }
fd5fbd69-de58-4895-9276-8febd9bea9ff
2
private void setupMenu() { setJMenuBar(menuBar); menuBar.add(connect); connect.add(connectNew); connectNew.setToolTipText("Create a new connection."); connectNew.addActionListener(this); connect.add(connectRecent); if(RecentConnections.hasRecentConnections()) { ArrayList<InetSocketAddress> recentConnec...
a7583a56-0478-4646-8efe-4925a0c55688
2
public static int getPriceOfAPlace(int zone) throws BDException{ String requete = "select prix from lescategories c, leszones z where c.nomc = z.nomc and numz=" + zone; Statement stmt = null; ResultSet rs = null; Connection conn = null; int res = 0 ; try { conn = BDConnexion.getConnexion(); stmt = co...
62b28d7b-cd8b-4748-899a-d3c4259009ec
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...
01f09363-c360-4631-817c-7afd09b4aff4
3
public BufferedImage toImage() { BufferedImage output = new BufferedImage(this.width, this.height, BufferedImage.TYPE_3BYTE_BGR); WritableRaster raster = output.getRaster(); DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer(); byte[] pixels = buffer.getData(); int...
71de6bdc-6f8e-4593-ac12-20bbda2bccbf
4
private static void displayStatistics(BufferedReader reader, VideoStore videoStore) { try { System.out.println("Please enter the start of a date range (YYYY-MM-DD):"); Date beginDate = Date.valueOf(reader.readLine()); System.out.println("Please enter the end of a date range (...
388b8a36-dd52-48a3-91ce-64c312113c92
9
protected void save() { // System.out.println("show the file picker"); JFileChooser filePicker = new JFileChooser(); // filePicker.setFileHidingEnabled(false); // filePicker.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); boolean exportData = false;...
e3d0ed50-8e5d-413f-bfca-6ac8f59b8903
1
public void testNegated() { Weeks test = Weeks.weeks(12); assertEquals(-12, test.negated().getWeeks()); assertEquals(12, test.getWeeks()); try { Weeks.MIN_VALUE.negated(); fail(); } catch (ArithmeticException ex) { // expected ...
3174e193-8720-4db1-94e7-fa4061ced7ee
6
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestState(qn); if (st == null) return htmltext; switch (st.getState()) { case Quest.STATE_CREATED: if (player.getLevel() < 76) { player.sendMessage("Low lvl, c...
9b78b47d-5158-47f1-87c0-3b6c310cdb9d
7
final void ZA(int i, float f, float f_15_, float f_16_, float f_17_, float f_18_) { anInt7912++; boolean bool = (anInt8172 ^ 0xffffffff) != (i ^ 0xffffffff); if (bool || f != ((NativeToolkit) this).aFloat8174 || f_15_ != ((NativeToolkit) this).aFloat8186) { anInt8172 = i; ((NativeToolkit) this).aF...
480ae262-2b82-4d63-b07b-02a05db66647
1
@Override public void onEnable() { try { Metrics metrics = new Metrics(this); this.getLogger().log(Level.INFO, "Enabling Metrics..."); metrics.start(); } catch (IOException ex) { this.getLogger().log(Level.SEVERE, "Error enabling metrics!", ex); ...
fdcc96fb-d7be-4bd5-9dd6-1559a6180204
3
void registerDeleteBooking(Booking b) { if (!newBooking.contains(b) && !modifiedBooking.contains(b) && !deleteBooking.contains(b)) { deleteBooking.add(b); } }
7151695d-5c4a-4749-88b2-8bb5caaf9b8f
2
public static void main(String[] args) { String userInput = ""; // input from the user String quitCode = "q"; // code for quitting program Scanner scanner = new Scanner(System.in); // scanner for user input ParkerPaulTime time; // time object for display while (!userInput.equalsI...
f5501546-9c34-4f54-a7bf-416f31e00941
7
public static char[][] build_block(String plain, int row,int period, int direction) { String plain_u=plain.toUpperCase(); if(row==-1) { row=plain_u.length()/period; } if(plain_u.length()%period!=0) { row++; } char[][] result=new char[row][period]; if(direction==1)//1 for vertical, 0 for horiz...
0ffac9b8-0b2d-46d3-91a0-2a003841aea7
5
@Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; if (!this.dead) { // Updates the x value of the pipe if (this.x1 < -151) { this.x1 = 930; this.score++; this.pipeA = new Pipes(this.x1,this.PIPEPATH); } if (this.x1 < -151) { this.score++; this.x1 = 9...
17dd9c74-88f7-41ad-ba67-96b5330b15b0
0
public Iterable<Integer> adj(int v) { validateVertex(v); return adj[v]; }
5debd6a9-412f-4183-94bd-2a252e915248
1
@Override public void setTitle(String title) { super.setTitle(title); if (isVisible()) { WindowMenuProvider.update(); } }
d7e76069-114f-417d-8e9f-6bb12f29ab7d
1
public void untap(){ for(Creature c : p1.getCritters()) c.setTapped(false); }
74dda484-73ba-4faf-b9c2-f446d13b3ec1
7
public static int countWaysOfChange(int[] S, int n) { if (n < 0) { return 0; } if (n == 0) { return 1; } int m = S.length; int[][] counts = new int[m + 1][n + 1]; for (int j = 0; j <= n; j++) { counts[0][j] = 0; } for (int i = 0; i <= m; i++) { counts[i][0] = 1; } for (i...
04941ec6-e8ae-46f6-b78a-c15a0e533e7d
3
public void setFalse(TFalse node) { if(this._false_ != null) { this._false_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...