method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f601eb03-1981-469e-961e-48bc9bf8b8c7
4
public static TerminalPosition getCursorPosition(List<Character> currentMatching) { if(currentMatching.isEmpty()) return null; if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE) return null; String asString = ""; for(int i = 1; i < currentMatching.size...
0047db48-9b90-4a6d-a8c3-763977cecdc2
7
public void blur(int xPos, int yPos, int w, int h) { for(int y = 0; y < h; y++){ int yPix = y+yPos; if(yPix < 0 || yPix >= height-1)continue; if(y% 3 == 0)continue; for(int x = 0; x < w; x++){ int xPix = x+xPos; if(xPix < 0 || xPix >= width-3)continue; int merged = merge(pixels[xPix + 1 + yPix...
35416a8e-3a27-4c3c-babb-55d1cb31b73f
2
@Override public Shift findById(String uuid) { List<Shift> listOfShifts = this.jdbcTemplate.query(SQL_GET_BY_ID, new Object[]{UUID.fromString(uuid)}, new ShiftMapper()); if (listOfShifts.isEmpty()) { return null; } else if (listOfShifts.size() == 1) { return listOfSh...
d25ac8df-df2e-42bf-bd6b-6e9a131a986d
8
public static int getDirFromDelta(int x, int y) { if(x < 0) { if(y < 0) { return UP_LEFT; } else if(y == 0) { return LEFT; } else { return DOWN_LEFT; } } else if(x == 0) { if(y < 0) { return UP; } else if(y == 0) { return NONE; } else { ...
df5a60b5-3c7c-4b7a-a87c-a009557ee9c8
7
public List<AlumnoTresSemestresDTO> getActivosTresSemestres() { List<AlumnoTresSemestresDTO> alumnostressemestres = new ArrayList<AlumnoTresSemestresDTO>(); Connection con = null; PreparedStatement pst = null; ResultSet rs = null; String sql = null; try { con = EscolarConnectionFactory.getInstance(...
a8c74e8e-b7cf-4fab-9b1a-505e5dcdc1b8
7
public double computeSimilarity(int user1, int user2) { double sim = 0; // HACK! if (data.getItemsByUser().get(user1) == null || data.getItemsByUser().get(user2) == null) { return sim; } // Create list with all items rated by both user1 and user2 ArrayList<Integer> sharedItems = new ArrayList<Integer>...
19aa4285-39df-47f9-b544-9808e1cbbe86
8
public void tick() { currentTime += frameRate; subtractCountdownToNextWave(frameRate); if (!gameover) { notifyListeners(); if (countdownToNextWave <= DELTA) { // asume all enemies are dead and if this is not the case it is set to false below. ...
3d13f85a-fbbb-491b-80de-b6f0f480cb24
9
public void validate() throws IllegalArgumentException { // Message checks if (isNullOrEmpty(message)) throw new GeneralException(MESSAGE_EMPTY); if (message.length() > MESSAGE_MAX_LENGTH) throw new GeneralException(MESSAGE_TOO_LONG); // Author name checks if (isNullOrEmpty(aut...
9d29cc2f-1d1f-40e2-a614-6b11f646f357
8
public boolean collectCooks() { //. = class //# = id String baseURL = "http://allrecipes.com/cook/"; int len = baseURL.length(); Document doc = null; System.out.println("Starting user crawl"); int userCounter = 0; StringBuffer userIDs = new StringBuffer()...
131a08bf-b69e-4a29-a971-9fe2fb20ed8c
9
private int nextNBits(int bitsToGet) { byte b; byte next; byte next2next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = data[bp + 1]; next2next = 0x00; } e...
36be3014-1dbf-44b8-97b2-2cfd4f4a523e
8
@Override public void unInvoke() { // undo the affects of this spell final boolean canBeUninvoked=canBeUninvoked(); final MOB invoker=invoker(); final Room room=CMLib.map().roomLocation(affected); if(canBeUninvoked&&(room!=null)&&(affected instanceof MOB)) room.show((MOB)affected,null,CMMsg.MSG_OK_VISUAL...
2423c37d-6f7a-4fb3-ae7a-a7e473436403
1
public boolean isZero() { return (this.X == 0 && this.Y == 0); }
0172a9fe-20f8-4c46-a144-695cd9402c9d
6
private Class<?> createRelated(Class<?> type, Class<?> relatedType) { if (relatedType == null && type.isArray()) { relatedType = Array.newInstance(type, 0).getClass(); } if (!type.equals(relatedType)) { return type.getSuperclass(); } return null; }
488d466c-0334-477a-a73b-2948de0ef85d
7
public static HashMap<Field, ArrayList<Object>> isConflict(TaskDispenser td) { ArrayList<Agent> agents = td.agents; HashMap<Field, ArrayList<Object>> objectHashMap = new HashMap<Field, ArrayList<Object>>(); ArrayList<Box> handledBoxes = new ArrayList<Box>(); for (Agent a : agents) { Field agentAt = a.a...
17a7ba9c-e021-4bc1-910d-481b563fbe56
9
@Override public int getCurrentBall() { assert !isGameOver(); int currentBall = 10; if (getCurrentFrame() == 10) { currentBall = 0; } for (int i = 0; i < rollCount; i++) { int pinsKnockedDown = pinsKnockedDownArray[i]; if (getCurrentFrame() == 10) { currentBall += 11; } else ...
a3a9e4df-1867-4650-b426-0f2eef41e344
7
public List<Pessoa> buscar(Pessoa filtro) { try { String sql = "select * from pessoa "; String where = ""; if (filtro.getNome().length() > 0) { where = "nome like '%" + filtro.getNome() + "%'"; } if (filtro.getCodigo() > 0) { ...
862b5a76-d984-4a1a-affd-f805c6936b1d
4
@Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null || (object instanceof String && ((String) object).length() == 0)) { return null; } if (object instanceof Producto) { Producto o = ...
b3fb9c1c-1c73-4ab3-a786-64fe760af9fc
0
public CtrlMenu(CtrlPrincipal ctrlPrincipal) { super(ctrlPrincipal); vue = new VueMenu(this); }
4a55f75f-c7c9-4976-92a3-55c2d6e1e484
4
public JPanel createBalancePanel(){ balancePanel = new JPanel(); balanceInput = new JTextField(); balanceInput.setText("0.00 €"); balanceInput.setToolTipText("The amount of money the wallet already has."); balanceInput.addFocusListener(new FocusListener() { @Override...
746eadd7-68cc-4063-ae71-19dbb979eae8
0
public CtrlAbstrait getControleur() { return controleur; }
daf8b6d8-78c7-4c50-a159-dad3346b6c85
9
public static void main(String [] args) throws Throwable { if (args.length < 2) { usage(); return; } Class stemClass = Class.forName("org.tartarus.snowball.ext." + args[0] + "Stemmer"); SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance(); Reader reader; ...
0bb21b46-dfca-4975-900b-e4c50c2c6aa5
4
public static ArrayList<String> getMatchbitHTML(String url) throws MalformedURLException, IOException { BufferedReader r = new BufferedReader(new InputStreamReader( new URL(url).openConnection().getInputStream())); ArrayList<String> re = new ArrayList<String>(); String l = null; boolean found = false; ...
b6f1dd34-455d-434b-ace7-933590b47732
0
public int getDataTypeLineIndex() { return dataTypeLineIndex; }
086a39e7-f641-446d-bd76-3ab1acb29ac7
1
public Object mapValue(Object value) { return value instanceof Type ? mapType((Type) value) : value; }
a68cae50-4167-4549-bc5f-edf8c34c44f8
1
public Integer mapRow(ResultSet rs, int rowNum) throws SQLException { // Validate column count. ResultSetMetaData metaData = rs.getMetaData(); int nrOfColumns = metaData.getColumnCount(); if (nrOfColumns != 1) { throw new CountRowNumberException("返回记录数过多:期望1条, 实际" + nrOfColumns + "条"); } return rs.getInt...
b5adfe2c-cea5-4590-aca2-323b950b75f7
0
public JComboBox<Angle> getAngleComboBox() { return angleComboBox; }
15216648-4157-4901-82ab-530c32633250
2
public void encode(Packet obj, Callback callback) { logger.fine(String.format("encoding packet %s", obj)); if (BINARY_EVENT == obj.type || BINARY_ACK == obj.type) { encodeAsBinary(obj, callback); } else { String encoding = encodeAsString(obj); ...
080f4ec8-288a-41a8-9ba7-33cb26cca784
0
public ClusterNode getRoot() { return this.root; }
e0e8bc26-aa21-4ab1-8ef6-35440ce2b18d
5
private void handleCommitReservation(Sim_event ev) { int src = -1; // the sender id boolean success = false; int tag = -1; try { // [0]=reservID, [1]=gridlet(s), [2]=transID, [3]=senderID Object[] obj = ( Object[] ) ev.get_data(); // ge...
236a182c-bce2-4b7a-9f9c-af7feb846f75
9
public boolean isMatch(String s, String p) { int i=0; int j=0; int star=-1; int mark=-1; while(i<s.length()){ if(j<p.length()&&(p.charAt(j)=='?' || s.charAt(i)==p.charAt(j))){ i++; j++; }else if(j<p.length()&&p.charAt(j)=='*'){ star=j++; mark=i; }else if(star!=-1){ j=star+1; i...
d1aec16c-c8db-41fd-9e69-a8a72a5af7ff
6
void steady_state_reached(double trans_time) { if (data == null) { return; } Set keyset = data.keySet(); Collection valueset = data.values(); Iterator keys = keyset.iterator(); Iterator values = valueset.iterator(); while (keys.hasNext()) { String measure = (String)keys.next(); ...
611ba0bc-1884-4648-b8b7-cedef93af7fd
4
public int getDimension() { if (opcode == Opcode.NEWARRAY) return 1; else if (opcode == Opcode.ANEWARRAY || opcode == Opcode.MULTIANEWARRAY) { int index = iterator.u16bitAt(currentPos + 1); String desc = getConstPool().getClassInfo(index); ...
df86c6c1-7766-46a4-a616-b84ac5096aa1
3
private void saveStats() { PoolConnection pcon = ConnectionPool.getConnection(); PreparedStatement ps = null; try { Connection con = pcon.connect(); ps = con.prepareStatement("UPDATE `accounts` SET `kisses` = ?, `knuddels` = ?, `onlineTime` = ?, `ipAddress` = ? WHERE `name` = ?"); ps.setInt(1, kisses); ...
38712049-f058-4738-ac03-b3cda5b16612
6
private static void encode( String value, Appendable out ) throws IOException{ for( int i = 0, n = value.length(); i<n; i++ ){ char c = value.charAt( i ); switch( c ){ case '<': out.append( "&lt;" ); break; case '>':...
7565e731-1261-4483-90de-532e9d2687d9
0
private void addChartPanel(JPanel chartPanel){ removecurrentChartPanel(); this.currentChartPanel = chartPanel; chartPanel.setPreferredSize(new Dimension(frameWidth, frameHeight - controlPanelHeight)); chartPanel.setMinimumSize(new Dimension(frameWidth, 200)); chartPanel.setMaximumSize(new Dimension(Short.MAX...
1715def4-bbce-47fb-8c5b-9dd1380e5063
0
public void setUrl(String url) { this.url = url; }
0c01c475-a69d-4050-b715-a195297404ff
0
public void setCompanyLab(String companyLab) { this.companyLab = companyLab; }
8077001a-58f4-4f86-b28e-3ffec7ad5c0c
9
public void mouseClicked(MouseEvent e) { if (exitButton.onButton(getMouse())) System.exit(0); if (play.onButton(getMouse())) started = true; if (grid.getUI().onBox(getMouse())) grid.getUI().alter(); if (grid.getUI().open()) { if (grid.getUI().on(getMouse())) { if (grid.getUI().getTowerOn(getMous...
387b605a-21be-49d1-87a3-532805cd8c46
9
@Override public String getColumnName(int column){ String name = "??"; switch (column){ case 0: name ="Bestillings Nr"; break; case 1: name ="KundeID"; break; case 2: name ="FirmaNavn"; break; case 3: name ="ProduktID"; break; case 4: name ="Prod...
84a48281-5c4f-4bae-8aee-73b69c19ac0b
2
public static int getIndexOfStu(String IDnum) { // String ID = new String(IDnum); int counter = 0; Student thisStudent = new Student(); while ((counter < Students.size())) { thisStudent = (Student) Students.get(counter); if (thisStudent.getID().equals(IDnum)) return counter; counter++; } ret...
d0d700cd-938e-41cd-8d80-3ff618fd3f64
9
protected Node<T> getReplacementNode(Node<T> nodeToRemoved) { Node<T> replacement = null; if (nodeToRemoved.lesser != null && nodeToRemoved.greater == null) { // Using the less subtree replacement = nodeToRemoved.lesser; } else if (nodeToRemoved.greater != null && nodeToR...
e5f7bd50-2917-43ae-a658-61c50420e1e1
8
public void setSubSpaceParametersForBrushing(int dim1, int dim2, int minThreshold) { int brushAxis; HashMap<Point2D, ArrayList<Integer>> clumpingMap = data.getAxisPair(dim1, dim2, parallelDisplay).getClumpingMap(numBins, minThreshold); //chosen Axis 1- first axis, 2 - second axis ArrayList<Integer> bru...
c57d354f-1521-4d5d-ae90-b806e586c5cd
5
@Override @SuppressWarnings("SleepWhileInLoop") public void run() { while (!game.isOver()) { if (!game.isPaused() && !game.isStarting()) { game.update(); } panel.repaint(); try { Thread.sleep(game.getDelay()); }...
86b96563-c00c-4fdd-983f-ccebd298d6f6
0
public void actionPerformed(ActionEvent arg0) { Component apane = environment.tabbed.getSelectedComponent(); JComponent c=(JComponent)environment.getActive(); SaveGraphUtility.saveGraph(apane, c,"JPEG files", "jpg,jpeg"); }
d1c5fd2b-e981-423b-b98f-f6cd998def37
7
public void connect(String threadName, String host, int port, MessageHandler messageHandler) throws ConnectException, IOException { int tries; if (port < 0) { port = FreeCol.getDefaultPort(); tries = 10; } else { tries = 1; ...
d8e2f922-403e-403b-af01-01039ddead0c
0
private void setCellAt(int x, int y, boolean isAlive) { currentCells[x * width + y] = isAlive; }
668c047f-c5bf-4963-b58d-3ccdad098235
0
public void setAddress(int address) { this.address = address; }
13a843af-6053-41e9-ae91-71d24c2180d2
5
private boolean incrementSequence() { synchronized (sequenceQueueLock) { // Is there a queue, and if so, is there anything in it: if (sequenceQueue != null && sequenceQueue.size() > 0) { // grab the next filename/URL from the queue: filenameURL(SET, sequenceQueue.remove(0)); // Let everyone know we...
086ff2f9-2162-42ee-b1dd-b521cdf2736c
0
public static void main(String[] args) { new WrongCar().start(); }
dd287e6d-58cd-49ab-b33e-1c00e74524fd
1
@Override public byte[] getHTTPMessageBody() { try { return Files.readAllBytes(getPath()); } catch (IOException e) { return "File Could Not Be Read".getBytes(); } }
fbd475f5-04a4-4692-bb22-61bd89ea254a
3
private DataPoint isUnique(ArrayList<DataPoint> points, int x, int y){ for(DataPoint temp:points){ if(temp.x == x && temp.y == y){ return temp; } } return null; }
4e6960f3-ecc0-4a79-9628-2867962ede0b
2
@Override public void orderRows(final OrderBy ob) { if (ob != null && rows != null) { ob.setMetaData(getMetaData()); ob.setParser(parser); Collections.sort(rows, ob); goTop(); } }
e495e4c3-bae6-4bfe-a963-605b1e61fc34
6
public boolean equals(Object obj) { // Vérification de l'égalité des références if (obj == this) { return true; } // On vérifie si le Object est une instance de plateau if (obj instanceof Plateau) { Plateau p = (Plateau) obj; // si la taille est differente (ne devrai jamais arriver) if (this.tai...
d654d3bf-7628-47b9-b516-5b051ddbde2d
0
private void setQuestAnswer(QuestPoint quest, String goTo, int points, String date, String wrong, int timestop) { String gt[] = new String[1]; gt[0]=goTo; quest.setGoTo(gt); quest.setPoints(points); quest.setDate(date); quest.setWrong(wrong); quest.setQuestTimeout(timestop); }
78de8fdc-1509-4e21-a2b0-5ebc2a5d9950
0
@FXML private void handleBtnCreateAction(ActionEvent event) { userAction = UserAction.SUBMIT; hide(); }
90993425-efb0-4139-85de-4701c8477fd9
3
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } put(key, value); } return this; }
9bac078c-ec51-47fa-81d7-b90baa8a9c8d
4
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/mensaje.jsp"); EntradaBean oEntradaBean = new EntradaBean(); EntradaDao oEntradaDao =...
c24b8b0c-929d-44d8-97f3-6dfde3d445a5
7
public boolean canJump(int[] A) { if(A.length <=1) return true; for(int i =0 ;i < A.length;i++){ if(A[i] == 0){ int j =i; if(i == A.length -1) return true; for(; j >=0 ;j--){ if(j+A[j] >i) ...
1ba1c6bf-48ed-47dd-8878-3d6e3b6c53cc
8
private boolean checkHorizontal(int j, int i, ConnectFourPiece[][] m_Pieces) { boolean gameWon = false; int secondPieceForwardRow = j+1; int thirdPieceForwardRow = j+2; int fourthPieceForwardRow = j+3; if (j<ROW_EIGHT && m_Pieces[j][i].getPieceColour() == m_Pieces[secondPieceForwardRow][i].getPieceColou...
7ed65572-6bc1-4c26-ba14-eceb633394ff
5
public void addUser(String Nick,String Nombre, String Apellidos, String pass) { //ok try { String queryString = "INSERT INTO Usuarios( nick, nombre, apellidos, password) VALUES(?,?,?,?)"; connection = getConnection(); ptmt = connection.prepareStatement(queryString); ...
80de5527-1992-4b71-80a9-6e669a6f134d
5
private static void loadFile() { File f = new File(CentralCore.getInstance().getDataFolder(), "sqlite.jar"); if(!f.exists()) { Util.copyFileFromJar(f, "sqlite.jar", true); } try { URL[] jarURL = {new URL("jar:file:" + f.getAbsolutePath() + "!/")}; URLClassLoader classloader = URLClassLoader.newInstance...
d3a03369-e056-4cf3-9d65-ce8df9073303
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...
b7cb8c40-09f0-4fda-ad5b-4ad1181e4f42
0
protected Distance _getDistance() { return _distance; }
3ac2901e-4ca5-4b60-8cbd-637c623c274c
5
private static float pointIntersectsMovingPointDetection( float p1X, float p1Y, float p1SpeedX, float p1SpeedY, float p1Radius, float p2X, float p2Y, float p2SpeedX, float p2SpeedY, float p2Radius) { // Rearrange the parameters to set up the quadratic equation. double centerX = p1X...
0a1a9dc3-58f5-43c7-9eb0-d31fbcbc0f6b
8
public static void setSystemLaF(boolean s){ //if(true) return ; s=true; try { if(s){ boolean find=false; for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (LaF.equals(info.getName())) { U...
466b8bb8-d1ba-4ae2-ae9c-facd30e663b4
9
*/ protected boolean removeImage(Icon image) { if (getDocument() == null) return false; if (getDocument().getLength() <= 0) return false; AbstractDocument.BranchElement section = (AbstractDocument.BranchElement) getDocument().getDefaultRootElement(); AbstractDocument.BranchElement paragraph = null; Abs...
8531553e-352b-44fd-8797-f3f1e9a9bb99
4
public static String getRemoteManifestFromFile(URL url) { String str = ""; InputStream is = null; try { URLConnection con = url.openConnection(); is = con.getInputStream(); byte[] buf = new byte[128]; while(is.read(buf) > 0) str += new String(buf); } catch(Exception e) { str = ""; } if...
64f6d5b6-de23-40b9-bdbe-cee13f7755be
3
@Model private void setActiveWorm(Worm worm) throws IllegalArgumentException { if (worm == null) throw new IllegalArgumentException("The worm isn't allowed to be a null reference."); if (!worm.isAlive() || worm.getWorld() != this) throw new IllegalArgumentException("The worm provided as active worm must be a...
4913d3cb-c84e-42aa-9c65-afe66ad0a8f1
6
private final boolean getChildLoaded(String string, int i, String string_56_) { try { anInt626++; if (!isInitialized()) return false; string = string.toLowerCase(); string_56_ = string_56_.toLowerCase(); int i_57_ = (indexTable.archiveHashTable.get (Class281.getArchiveHash(string))); ...
d513351b-e40f-49d3-8323-0db8ceac30a0
8
public void checkMessages(){ if(debug){ System.out.println("Running"); } //Run in a continues loop while(running){ //Don't check for new messages if connectedTo is not set yet if(connectedTo!=null&&!connectedTo.equals("")){ String recei...
b999f6ee-224b-4b60-b7c4-b5626cdb6083
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Row)) return false; Row row = (Row) o; if (employeeID != row.employeeID) return false; if (department != null ? !department.equals(row.department) : row.depart...
7632a45b-e389-439f-b156-47b536847200
7
void format() { page.createNewPage(); String[] snapshot = SnapshotGallery.sharedInstance().getImageNames(); if (snapshot == null || snapshot.length <= 0) return; StyledDocument doc = page.getStyledDocument(); try { doc.insertString(doc.getLength(), "My snapshot images\n\n", titleStyle); } catch (Bad...
0ca61dfa-eb72-46d4-a880-427e48145e13
6
public void insert( BKnoop<E> newChild, int childIndex ) { if( isAncestor( newChild ) ) throw new IllegalArgumentException( "Nieuw kind is voorouder" ); // als de nieuwe child al eerder is gevormd een error gooien. if( childIndex != LEFT && childIndex != R...
f981054b-4092-4bd6-8993-8e2e9b5692bb
9
public static void main(String[] args) { // double i = 13195 / 29.; // System.out.println(i); // i = 13195 / 7.; // System.out.println(i); // i = 13195 / 13.; // System.out.println(i); // i = 13195 / 5.; // System.out.println(i); // System.out.println((5 *...
5ae43d7a-c06a-453f-892f-eb81303deaa0
5
public static void meow(){ if(o.getDisplayName().equals(ChatColor.DARK_GRAY + "[" + ChatColor.AQUA + "SkyblockTip" + ChatColor.DARK_GRAY + "]")){ clear(); o.setDisplayName(ChatColor.DARK_GRAY + "[" + ChatColor.AQUA + "SurvivalTip" + ChatColor.DARK_GRAY + "]"); message("&8You can claim", 6); message("&8and...
19454d06-0ad1-4767-b895-7c18205fb772
9
public ArrayList<TileCell> getNonZombiedCells(boolean filterPlayers) { ArrayList<TileCell> cells = new ArrayList<TileCell>(); for (int ty = 0; ty < this.SIZE; ty++) { for (int tx = 0; tx < this.SIZE; tx++) { for (int cy = 0; cy < 3; cy++) { for (int cx = 0; cx < 3; cx++) { TileCe...
e2b85f0f-cdb8-4cd9-bbca-ec32362e1803
5
private void convertCSV() throws IOException { String thisLine; // variable to read a line BufferedReader myInput = null; try { // Objects to read the file FileInputStream fin = new FileInputStream(new File(input)); myInput = new BufferedReader(new InputStreamReader(fin)); int count = 0; // to cou...
a21ad86b-10f1-4aeb-bda4-02268b017160
0
public static void main(String[] args) throws IOException { // outOfMemory(); // try { // npe(); // } catch (MyException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } // checkedException(); badExample(); System.out.println(badExample2()); }
f207634c-8733-4e2e-9a37-74363a9071d4
0
@Override public void actionPerformed(ActionEvent e) { this.dispose(); }
9b8bcb71-aa9e-4ddb-8f74-710a0cdee7ca
8
private List<Package> getPackages() { List<Package> packages = new LinkedList<Package>(); for ( int i = 0; i < toolsTableModel.getRowCount(); i++ ) { Boolean isSelected = (Boolean)toolsTableModel.getValueAt(i, ToolsTableModel.COLUMN_SELECTED); String name = (String)to...
22a3a030-e52f-4da8-a866-95c7befd026f
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
5b7bcd1c-366d-4c4f-98a2-2a8b5ca5ae18
8
public RPCEnvelope invoke(RPCEnvelope req) throws Exception { RPCStreamEnvelope request = (RPCStreamEnvelope)req; if(request.getRpcType()==RPCEnvelope.RPC_TYPE_REQUEST){ File f = new File(request.getSource()); if(f.exists() && f.isFile() && f.canRead() ) { if(log.isDebugEnabled()) log.debug("Sendin...
f186c325-f7fa-4345-855f-527ecae3a7d8
9
public static boolean isAllowedInXml(final int c) { boolean ok = false; if (c >= 0x10000 && c <= 0x10FFFF) { ok = true; } else if (c >= 0xE000 && c <= 0xFFFD) { ok = true; } else if (c >= 0x20 && c <= 0xD7FF) { ok = true; } else if (c == 0x9 ||...
0e5c2660-d41e-405c-8fee-f74f8c55b272
6
public static void removeVarObject(int objectType, int objectX, int objectY, int objectHeight) { for (int index = 0; index < varObjects.size(); index++) { VariableObject vo = varObjects.get(index); if(vo == null) continue; if(vo.getType() == objectType && vo.getX() == objectX && vo.getY() == objectY &...
61769a49-0a38-459c-9121-5adc4d75eddf
2
private void testValidIndex( int idx ) throws Exception { if ( idx <0 && idx >= size ) { throw new InvalidItemIdException("Check Item Id!"); } }
5e18cd15-6aee-4a2c-b32e-696f424cb3ca
3
@Override public void ParseIn(Connection Main, Server Environment) { Player pClient = Environment.ClientManager.GetClient(Main.DecodeInt()); if(pClient == null) return; if((pClient.Flags & Server.plrOnline) == Server.plrOnline) // Is Online? { Environment.InitPacket(...
46cd5b3b-8ddd-4cbf-a931-983721b5cd21
3
public void destroy() { ListIterator<Socket> itr = sockets.listIterator(); while (itr.hasNext()) { destroySocket(itr.next()); } sockets.clear(); // Only terminate context if we are on the main thread if (isMain() && context != null) contex...
b29a6d9e-9fbe-4216-a598-acb4a9913c8c
5
public Class resolveClass(String className) { Class clazz; try { clazz = classLoader.loadClass(className); return clazz; } catch (ClassNotFoundException ex) { if (!className.contains(".") && Character.isUpperCase(className.charAt(0))) { Syste...
8262b342-27fc-44fe-94b8-4284115b3cf2
0
public kameraTest() { }
f5332723-91c4-45f1-9ed0-6b63eb34bbe9
7
public Ball(int xInitial, int yInitial, double thetaInitial) throws IllegalArgumentException { // Check to see if the x-axis position is within bounds. if (xInitial >= BALL_MIN_X + BALL_RADIUS && xInitial <= BALL_MAX_X - BALL_RADIUS) { xPosition = xInitial; } else { throw new IllegalArgumentException("In...
f87642bf-b4d8-440b-996f-887a28294f4c
6
private final void method1531(int i, int i_16_, int i_17_, int i_18_, float[] fs, int i_19_) { int i_20_ = i_18_ - i_16_; int i_21_ = i_17_ - i; int i_22_ = i_20_ < 0 ? -i_20_ : i_20_; int i_23_ = i_20_ / i_21_; int i_24_ = i_16_; int i_25_ = 0; int i_26_ = i_20_ < 0 ? i_23_ - 1 : i_23_ + 1; i_22_ = i_22_...
30e519d8-3dc3-4284-b7be-e962cee8e90d
4
private Map<Point, List<Point>> clusterPoints(List<Point> keys) { Map<Point, List<Point>> map = new TreeMap<Point, List<Point>>(); for (Point point : points) { double min = Double.MAX_VALUE; Point k = null; for (Point key : keys) { double distance = g...
0087394b-a149-4a1f-8b0c-85f340527e31
7
private void processChildren(URL codebaseURL, Element node) throws InvalidJNLPException { //Get the Children NodeList nodes = node.getChildNodes(); for(int i=0;i<nodes.getLength();i++) { Node cNode = nodes.item(i); String nodeName = cNode.getNodeName(); //sk...
a69e2dc0-34e7-48b7-bbbb-3aa0c42b3d2b
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Matrix other = (Matrix) obj; if (cols != other.cols) return false; if (rows != other.rows) return false; for(int i = 0; i < rows; i+...
bc703eaa-8ca8-4078-afe7-dad0d9111b90
7
public boolean isValid() { boolean okay = true; // System.out.println("Horizontal? : " + horizontal); int checkIter = shipSize; if (shipSize == 1) { checkIter = 3; } // System.out.println("checkIter: " + checkIter); if (horizontal == false) { int yCoor = ship.getY(); // System.out.println("Chec...
eaf35dce-0df4-4eb5-abfd-83f3eb71c13e
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 Entradas)) { return false; } Entradas other = (Entradas) object; if ((this.idEntrada == null && other.idEntrada...
cb083690-8564-4d9a-a37a-b7847f9cd740
8
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int PL = 500011; boolean[] p = new boolean[PL]; for (int i = 0; i < PL; i++) { p[i] = true; } for (int i = 2; i < PL; i++) { for (int j = 2 * i; j < PL; j...
7b1d3807-2ac7-4d43-bd39-575c36f1216e
8
public ArrayList<Integer> getFriendsKthLevel(int userID, int k) { ArrayList<Integer> friends = new ArrayList<Integer>(); // Initialize HashMap that stores a boolean (true if node is visited in // BFS, false otherwise). In the beginning, no nodes are visited yet. HashMap<Integer, Boolean> visited = new HashMap...
91f36a71-bfbb-44ff-aa48-f627777dc38b
7
Set<String> getPalindromes(String s){ Set<String> set = new HashSet<String>(); for (int i = 0; i < s.length(); i++) { int left = i; int right = i; while (left>=0 && right<s.length() && s.charAt(left)==s.charAt(right)){ set.add(s.substring(left,right+1)); left--; right++; } left = i; ...
aba61a43-5205-4fe2-a78c-c840c3d0a19b
4
private void startOneImageThread() { final Thread t = new Thread() { @Override public void run() { try { synchronized(ChunkPainter.this) { ++numberOfThreads; } while(!isInterrupted()) { for(;;) { if(hasPendingChunks()) { ...