method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
235ea82e-a73b-412d-b485-b73e9df7ab1f
6
@Override public Joueur find(int id) { Joueur found = null; PreparedStatement pst = null; ResultSet rs = null; try { pst=this.connect().prepareStatement("select * from Joueur where id= ?"); pst.setInt(1, id); rs=pst.executeQue...
f39a5f4e-1865-44bb-8431-18042d48d86e
7
private long[] countVotes(JavaService js) { // Gets all non-overwritten votes from authority CommMessage request = CommMessage.createRequest("getAllVotesAuthority", Model.getaCommunicationPath(), Model.getNewValidator()); try { // Receives the collection of votes CommMessage response = js.sendMessage(reques...
16edd455-9011-42e4-90d0-e09d2256421e
7
public CoreMetaData getMetaData() throws NoSuchMethodException, IllegalArgumentException { if (this.calc!=null) return this.calc; this.calc = CoreMetaData.getInstance(func); FuncInfo finfo = calc.getFuncInfo(); if (args.length>finfo.nbOptInput()) throw new IllegalArgumentException(); //T...
91119dea-48d0-48ed-a87c-b5fb20a19bde
0
@Override public String getCur() {return "" + cur;}
031f4e84-1ba0-4240-92cb-d436f293c3cb
9
public MediaFile load(File f) throws IOException { Registry.FileType fType=Registry.getFileType(f); if(fType!=null) { this.changeProperty(fType.fileProperty); } dropChildren(); if(!f.isDirectory() && f.exists()) { this.actu...
f7de165e-c96f-4b79-a34b-c945cc0802a7
4
private Agrupamento criarAgrupamentoPorLinhaDePesquisa() { Agrupamento agrupamento = new Agrupamento("Alunos por linha de pesquisa"); for(Object o : alunos){ if(o instanceof Aluno){ Aluno aluno = (Aluno)o; if(aluno.getLinhaDePesquisa() != null && alun...
e8b776fe-bcc1-40b1-ae87-45879e7f1511
6
public char nextRequest(int timeout) throws Exception { String requestPath = request(timeout); if (requestPath == null) return 'X'; if (isFileRequest(requestPath)) { replyFile(requestPath); return 'I'; } if (requestPath.equals("play")) return 'P'; if (requestPath.equals("step")) return 'N'; ...
aec3f9b6-8a1a-4b0c-baec-a10270e0597e
2
@Override public SqlSession getRequestSession() { SqlSession session = thSession.get(); if (session == null) { try { session = MyBatisManager.getProjectSessionFactory().openSession(); } catch (Exception ex) { Logger.getLogger(ThreadLocalRequest...
736004fb-89c8-4195-884e-d70f5e0cbc78
4
public boolean compareMessage(byte[] message) { if(pendingMessage == null) { throw new IllegalStateException("There is no pending message to compare the given message with"); } if(message.length != pendingMessage.length) { return false; } else { for(int i = 0; i < pendingMessage.length; i++) { ...
436f0c86-d66a-4346-8f5a-55e52db0cb1e
6
public void clear() { if (ava != null) ui.destroy(ava); ava = null; if (rmb != null) ui.destroy(rmb); if (invb != null) ui.destroy(invb); if (chatb != null) ui.destroy(chatb); if (name != null) ui.destroy(name); if (grp != null) ui.destroy(grp); name = null; grp = null...
18035cbe-2258-4fb1-8b02-84d5a3745a8b
6
private static void parseTransitionEndPoint(Transition.EndPoint endPoint, String expr) { String label = encryptStereotypeDelimiters(expr); Styles.Decoration decoration = Styles.Decoration.None; if(expr.contains("<>")) { decoration = Styles.Decoration.Aggregation; label ...
3975dc49-d3dc-4963-a9c6-46f1805c10aa
9
public final void argument() throws RecognitionException { try { // Python.g:416:10: ( test ( ( ASSIGN test ) | gen_for )? ) // Python.g:416:12: test ( ( ASSIGN test ) | gen_for )? { pushFollow(FOLLOW_test_in_argument3710); test(); state._fsp--; if (state.failed) return; // Python.g:416:17: ( ...
1cfbf62f-e5a7-487d-97f9-fbf200fe8cfe
0
public static boolean isApplicable(Object object) { return object instanceof TuringMachine; }
386f5e8b-d3a8-4afe-9b33-549c9658101b
4
public void deleteRoom(String temp) { int rm = Integer.parseInt(temp); TypeEntity tempTE = null; Query g = em.createQuery("SELECT t from TypeEntity t"); for (Object o : g.getResultList()) { TypeEntity p = (TypeEntity) o; if (p.getName().equals("null")) { ...
17d49b0f-7d7a-4f79-8bc8-f12f3aafcdec
5
private boolean allUnselected() { return !chckbxArea.isSelected() && !chckbxArtist.isSelected() && !chckbxGenre.isSelected() && !chckbxMedium.isSelected() && !chckbxRecording.isSelected() && !chckbxRelease.isSelected(); }
6a642546-5914-48c7-9b06-c923b469eb38
9
private String getTag(byte[] data, String name) { try { // get the start position of the tag we searched for int pos = ByteHelper.indexOf(data, name); // tag not set? => return empty string if (pos == -1) {return "";} int charset, pos2, pos3, size; // ID3v2.2 if (name.length() == 3) ...
10247b0d-7e12-4763-9ba6-1980da2cfe35
5
public void setToolTipText (String string) { checkWidget (); if (toolTipText == string) return; if (toolTipText != null && toolTipText.equals (string)) return; toolTipText = string; if (parent.toolTipShell == null) return; /* tooltip not currently showing */ if (((Integer) parent.toolTipShell.getData ()).intValue...
4580f9ef-0dbf-4c36-8359-52e49410c486
5
private static int findNextChar(InputStreamReader br) throws IOException { int character = br.read(); while((character>=0)&&(character!=' ')&&(character!='\n')) { character=br.read(); } character=br.read(); while(character==' '||character=='\n') { characte...
1a73763a-a543-41a1-a2d7-0fba0a162ea1
8
private boolean pathTowards(World world, NetworkConnection network, boolean goAround) { if (targetLocation.equals(pathingTarget)) return false; Orientation orientation = orientationToward(world, goAround); if (orientation == Orientation.NONE) return false; tempP...
0851bf47-507e-4812-b870-d86baa058f02
9
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { final UEllipse shape = (UEllipse) ushape; g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); visible.ensureVisible(x, y); visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight...
9aa5ccf9-d723-423d-a1c1-7408e44ed0a5
4
public static ResponseCodes parse(String value) { ResponseCodes output = ResponseCodes.Unknown; if(!Utilities.isNullOrWhitespace(value)) { for(ResponseCodes code : ResponseCodes.values()) { if(value.equals(code.toString())) { output = code; } if(output != ResponseCodes.Unknown) { br...
645a12ad-e636-47dd-bd0a-1b22f67c2736
0
public void setId(String id) { this.id = id; setDirty(); }
8e3cd1b6-a6dd-42ce-9a0a-4503cdb78e18
0
@Override protected void setColoredExes() { // TODO Auto-generated method stub coloredEx = CircleGenerator.circle(begin, R); }
5ff6a9c6-c2c0-4c1c-8bcb-34a0c1a774f1
4
public static boolean deleteFile(String fileName) { // A File object to represent the filename if (fileName == null) return false; File f = new File(fileName); // Make sure the file or directory exists and isn't write protected if (!f.exists()) return false; if (!f.canWrite()) return false; // If it is...
9054b1c4-ae11-43fc-b541-9357caf98a79
7
public static boolean demoSkipToCommand(InputStream stream) { { char ch = Stella.NULL_CHARACTER; boolean eofP = false; boolean echoP = false; OutputStream echostream = stream.echoStream; loop000 : for (;;) { stream.echoStream = null; { Object [] caller_MV_returnarray = new O...
43c9c272-78c2-4c11-83e8-34f53db5a28c
6
@Override public Set<DataEntry> getRemovals(List<DataEntry> input) { HashSet<DataEntry> toRemove = new HashSet<DataEntry>(); //First, check to see if there are even enough neighbours to perform filtering if(input.size() < this.neighbours) throw new IllegalArgumentException(); for(DataEntry tse : input)...
ad54a2ef-d8b7-4c65-88fc-19c025585a38
5
private void read(DataInputStream in) throws IOException { int n = in.readUnsignedShort(); items = new LongVector(n); numOfItems = 0; addItem(null); // index 0 is reserved by the JVM. while (--n > 0) { // index 0 is reserved by JVM int tag = readOne(i...
3a5f4197-fe5d-440e-9b8b-7216c46e0eed
4
public void run() { Thread.currentThread().setPriority(priority); while (true) { for (int i = 1; i < 100000; i++) { d += (Math.PI + Math.E) / (double)i; if (i % 1000 == 0) Thread.yield(); } System.out.println(this); ...
8a90d309-7eb0-4fa8-abcd-6722c0be829c
6
@Override public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) { values[0] = 0.0; if (col.getDepth() > 0) { Iterator<MappedRead> it = col.getIterator(); while(it.hasNext()) { MappedRead read = it.next(); if (read.hasBaseAtReferencePos(col.getCurrentPosition())) {...
cbe98dd7-ded3-461e-a83e-479eb5cb0292
4
private static void performLogin(final JFrame frame, final JTextField user, final JPasswordField pass, final JCheckBox rememberMe) { final VBLogin login = new VBLogin(user.getText().replaceAll(" ", "%20"), new String(pass.getPassword())); if (login.login()) { if (rememberMe.isSelected()) { ...
649fb7e6-291a-4564-af0f-0e74aeee9ccf
2
@Override public void execute(Game game) { if (cooldown <= 0) { if (game.getHealth() <= 100) { game.setHealth(Math.min(100, game.getHealth() + 30)); } cooldown = E_COOLDOWN; onCooldown = true; } }
00eb2eca-295f-4e77-a086-7b9f51761f2b
2
private Card[][] getRandomTableCards(ArrayList<Card> cardStack) { final int[] NON_NULL_CARDS_IN_EACH_ROW = { 4, 8, 9, 8, 4 }; Card card; int randomArraylistPosition; Card[][] displayCards = new Card[NUMBER_OF_ROWS][NUMBER_OF_COLS]; // need // to // create ...
25ca487e-a531-4e04-a407-b18face66c22
2
public void addEdge(Vertex v, Vertex w) { if (!adjMap.containsKey(v)) { adjMap.put(v, new HashBag<Vertex>()); } if (!adjMap.containsKey(w)) { adjMap.put(w, new HashBag<Vertex>()); } adjMap.get(v).add(w); }
abf07c09-079b-4a25-99e3-a0ad4135f352
6
private Point avoidNear(Point aim) { Collection<Flockable> tooClose = new ArrayList<Flockable>(); for (Flockable f : Map.INSTANCE.flock) { if(f == this) continue; final long distance = getDistance(this.getLocation(), f.getLocation()); if(distance < DISTANCE * DISTANCE) { tooClose.add(f); } }...
e0e93dc5-e6ef-447f-99b0-c88d38480d5d
5
public void findmoney(String[] split) { if (split.length != 2) { PrintMessage("Syntax:!findmoney [player]"); return; } String name = split[1]; int total = 0; for (Player p : everyone.values()) { int temp = 0; for (Moneys m : p.money) { if (m.owner.equalsIgnoreCase(name)) temp += m...
a12e7217-65f2-4d5a-ac3b-4cc4b648fc92
1
public void detectLinesAndCols() { for (int i = 5; i > 2; i--) { detectLine(i); detectCol(i); } }
75592ddf-f9f9-47f6-ac76-c4d6e746c30a
2
public double standardizedAllResponsesMinimum(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedAllResponsesMinimum; }
6c74fcf0-464b-4586-a827-bab8ff6dfafc
2
public void addCorporationContacts(int corporationID, ArrayList<Integer> users) throws SQLException { if (conn != null) { for(int userID : users) { PreparedStatement stmt = conn.prepareStatement("INSERT INTO crmcorporationuserconnection VALUES (?, ?)"); stmt.setInt(1, userID); stmt.setInt(2, corpo...
03a31a46-8400-49e9-8f02-7e5ffeee911b
2
@Override public void disconnect() { try { if (connection != null) { connection.close(); } } catch (SQLException e) { } }
db3b5b6f-4adc-42ec-ac80-8576bfbe0f8b
2
public Berechtigung getBerechtigungzuLeitername(String Benutzername) { ResultSet resultSet; Berechtigung rueckgabe = null; try { resultSet = db .executeQueryStatement("SELECT b.* FROM OrgaEinheiten a, Berechtigungen b WHERE" + " a.idLeiterBerechtigung = b.idBerechtigung AND a.Leitername = '" ...
41fbd3c5-7478-4cf3-aba9-1c1e53a3fecf
2
public static boolean isValidStreet(String street) { if (street == null) return false; return street.matches("[a-zA-Z ]+") && street.length() <= 32; }
5d193205-d919-419b-8d6f-7fe727d977dc
5
public static boolean isReservedMultiplyOp(String candidate) { int START_STATE = 0; int TERMINAL_STATE = 1; char next; if (candidate.length()!=1){ return false; } int state = START_STATE; for (int i = 0; i < candidate.length(); i+...
e2ee7946-e3f5-40e6-9f1c-ebed4d659255
7
protected MOB getCharmer() { if(charmer!=null) return charmer; if((invoker!=null)&&(invoker!=affected)) charmer=invoker; else if((text().length()>0)&&(affected instanceof MOB)) { final Room R=((MOB)affected).location(); if(R!=null) charmer=R.fetchInhabitant(text()); } if(charmer==null) ...
06a62fb4-2e8d-43ce-b1cf-2ada48914158
4
public static void insertBook(BookCopy b){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedState...
a3cf7ee9-35e7-4d7d-a766-c65a3951d9f4
5
public static Date parseDate(String str) { if (str == null || isSelfPaced(str)) return null; str = str.replace(",", ""); str = str.replace("Sept ", "Sep "); // More of these? for (SimpleDateFormat format : dformats) { try { return format.parse(str); } catch (Exception e) { } } try { re...
9bef99c3-f8f4-4087-9c03-319ea28ef5b4
6
public EightPuzzleLoader() { file = new File(System.getProperty("user.home") + File.separator + ".EightPuzzle"); try { if (file.mkdir()) { makeImageFile(); makeFormatFile(); makeMetaFile(); makeHighScoreFile(); } else { // Read metaData. If it doesn't exist make it metaDataURL ...
7f905714-ff36-4bc6-bd22-d40088232c6a
1
public List<Monitor.Stats.Stat> getStat() { if (stat == null) { stat = new ArrayList<Monitor.Stats.Stat>(); } return this.stat; }
33b09e5b-0e80-46d4-82be-ddeca10564b6
1
public static String collectionToCommaDelimitedString(Collection<?> coll) { return collectionToDelimitedString(coll, ","); }
1238300a-6b92-43e3-85f3-5b1bd1410105
9
public static void propagateInfluence(float[][] bufferMap){ float up, down, left, right, tempMax; for(int i = 1; i < 30; i++){ for(int j = 1; j < bufferMap[i].length-2; j++){ if (bufferMap[i][j] != 0){ /*up = influenceMap[i-1][j]; down = influenceMap[i+1][j]; left = influenceMap[i][j-...
7d17be60-2791-4d30-9c56-082fad04fd1d
8
static void prep(){ colUp = new int[n][m]; colDown = new int[n][m]; rowLeft = new int[n][m]; rowRight = new int[n][m]; for(int i=1; i<n; i++){ for(int j=0; j<m; j++){ colDown[i][j] = colDown[i-1][j] + value(a[i-1][j], a[i][j]); } }...
9364939e-91e5-4969-bed2-0017d334525d
2
protected static void TestArrayList(int N) { for (int i = 0; i < N; ++i) { num.add(i); } for (int n: num) { System.out.println(n); } }
fcfe36f5-bb54-4f4c-90c6-10675a86425c
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Predicate other = (Predicate) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) ...
f7011416-2298-4166-bede-f6e7ebcb3f35
7
void importIntoCurrentTable() throws IOException, SQLException { if (env.getCurrentConnection() == null) { showMessageDialog(this, res.get("w.not-connect")); return; } TableModel tm = resultSetTable.getModel(); final boolean importable; if (tm instanceof R...
052498db-c0b9-466d-b1fc-f991590c3671
1
public synchronized List<Long> getWaysIds(int pos) { if (nodes.size() > pos) return ways.get(pos); else return new ArrayList<Long>(); }
2d3ebdff-e76a-47db-b6ad-f9d4c6f61243
4
@Override public void action() { if(agente.getPasso() == 1){ DFAgentDescription template = new DFAgentDescription(); ServiceDescription sd = new ServiceDescription(); sd.setType("Reputacao-Agentes"); sd.setName("Reputacao-Agentes"); template.addServices(sd); try { ...
8c3668fe-fa46-4c85-a673-62f4f2996bc0
0
@Override public void undo() { this.to.removePiece(this.piece); this.from.addPiece(this.piece); this.capturedPawnField.addPiece(this.capturedPawn); this.piece.decreaseMoveCount(); }
c6928ee7-5c6a-4da6-a27f-d152884f003a
3
public void setCol(int a, String b){ if(a < y){ String[] tokens = b.split(","); if(tokens.length == x){ for(int i = 0; i < x; i++){ mat[i][a-1] = Integer.parseInt(tokens[i]); } } } }
e9cb3df6-09dd-42be-9d1c-14e7eae0175b
5
* @return The column index, or <code>-1</code> if none is found. */ public int overColumnDividerIndex(int x) { int pos = getInsets().left; int count = mModel.getColumnCount(); for (int i = 0; i < count; i++) { Column col = mModel.getColumnAtIndex(i); if (col.isVisible()) { pos += col.getWidth() + (mD...
f8d08a55-4658-42c0-a9f7-d62e6af5f59b
9
private double find(int A[], int B[], int l, int r) { int m = A.length, n = B.length, len = m + n; if (l > r) { return find(B, A, Math.max(0, (n - m) / 2), Math.min(n - 1, (m + n) / 2)); } int i = (l + r) / 2; int j = len / 2 - i - 1; int Bj = j <= -1 ? Integer.MIN_VALUE : B[j]; int Bj...
4a4abc9c-7218-495b-b769-0dd5dda5b5db
2
public void runFileSystem(ConfigurationForFS configuration) { configuration.setProperties(properties); if (configuration.isInvalid()) exitStatus = 1; if (configuration.showHelp()) { System.out.println(configuration.getHelpText()); } else { fileSystemIn...
b8be3dc4-5b9e-400a-af49-2f1d39f732c0
8
@Override public boolean equals( Object obj ) { if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } @SuppressWarnings( "unchecked" ) final Couple<L, R> other = ( Couple<L, R> ) obj; if ( this.l...
b18c9e6b-b2a4-4dcb-923e-a1163d901d2b
8
public static String toJSONString(final String value) { final StringBuilder strBldr=new StringBuilder(""); for(final char c : value.toCharArray()) { switch(c) { case '\"': case '\\': strBldr.append('\\').append(c); break; case '\b': strBldr.append('\\').append('b'); break; cas...
8987766d-f505-459f-befe-565f86675b25
7
private void updateBlack(Getal g) { int x = g.getX(); int y = g.getY(); Boolean [][] omg = g.getOmgeving(); for (int i=(x>0 ? -1 : 0); i<(x<width-1 ? 2 : 1); i++) { for (int j=(y>0 ? -1 : 0); j<(y<height-1 ? 2 : 1); j++) { if (black[x+i][y+j] == null) black[x+i][y+j] = omg[i+1][j+1]; } } }
22f1f619-e2f1-4afa-aeae-c76a5449f3c1
0
public Category(String naam) { this.naam = naam; this.subcategories = new ArrayList<SubCategory>(); }
2fbad115-442b-41ae-8deb-1f79b4e68372
2
private void makeJButton(JButton jb, int player) { File imageCheck; if (player == 1) { imageCheck = new File("resources/cross_150_150.png"); } else { imageCheck = new File("resources/circle_150_150.png"); } try { Image img = ImageIO.read(imageCheck); jb.setIcon(new ImageIcon(img)); } catch (IOEx...
708f021f-ee56-4580-bea4-c08fb33a47e5
3
public String load(String address) { String data = null; String[] parsedAddress = breakAddress(address); Set theSet = null; if (!fullyAssociative) theSet = this.getSet(parsedAddress[1]); else theSet = this.getSet(parsedAddress[0]); if (theSet != null) { Record record = theSet.getRecord(parsedAddres...
fe164450-0ffe-428e-bfc0-1ffff377a8df
5
private boolean canHaveAsWall(List<Position> positions, boolean recursive) { if (positions == null) return false; for (Position pos : positions) { if (!grid.getElementsOnPosition(pos).isEmpty()) return false; if (recursive && !canHaveAsWall(grid.getPositionsAround(pos), false)) return false; } ...
87f77e7f-60ce-4e9d-b137-3e4596da8ac7
1
public static BufferedImage getImage(String str){ File source = new File("res/" + str + ".png"); BufferedImage in = null; try { in = ImageIO.read(source); } catch (IOException e) { e.printStackTrace(); } return in; }
beb21890-88ff-4ccf-8556-ed6f675bb7b6
5
public void run() { if (list.isEmpty()) { return; } if (server.getPlayers().isEmpty()) { return; } for(ProxiedPlayer player: server.getPlayers()){ for ( String line : list.get(count).split( "\n" ) ) { player.sendMessage(line); } } count++; if((count+1)>list.siz...
be6da344-4cce-486b-b942-82f80b158377
3
public int minPatches(int[] nums, int n) { long curN=1; int curIndex=0; int result=0; while (curN<=n){ if(curIndex<nums.length && nums[curIndex]<=curN){ curN=curN+nums[curIndex]; curIndex++; }else{ result++; ...
a8dd16b0-8257-4e79-8f64-75e18e4c0233
3
private void UpdateProductQuantity(List<Product> p_list, String p_productName, float p_quantityToAdd) { for(Product product : p_list) { if(product != null && product.GetTypeProduct().GetName().equals(p_productName)) { product.SetQuantity(product.GetQuantity...
6b709058-2fb0-4db8-9232-05377d48b8bd
4
public Position getVisibleMapOffsetPosition(Player player) { int offsetXObject = player.x - (int) Math.ceil(Realm.MAP_WIDTH / 2); int offsetYObject = player.y - (int) Math.ceil(Realm.MAP_HEIGHT / 2); if (offsetXObject < 0) offsetXObject = 0; if (offsetYObject < 0) offsetYObject = 0; if (offsetXObject...
aef77283-4b4c-4027-b124-5e34194a7d02
3
private void attemptLogin() { if (username.length() < 2 || password.length() < 6) { errorMessage = "Your username must be at least 2 characters and less than 12 characters,"; errorMessage2 = "and your password must be at least 6 characters, but less than 16 characters."; retu...
558daefe-e92e-4d71-83a5-6100f91d273b
1
private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } }
b86ce1c0-cc32-4e10-9121-18b2b523f5bd
4
@Override public void actionPerformed(ActionEvent ae) { int row = view.getFindFoodTable().getSelectedRow(); Food temp = frame.getMainFrameCntl().getAuthenticationCntl().getFoodList().getFoodByCode(Integer.parseInt((String)view.getFindFoodTable().getValueAt(row, 0))); ArrayLis...
d6c510db-8381-44e5-a251-08df7f1d6a08
1
public static String getLangueMessage ( String key ) { ResourceBundle resourceBundle = Utilities.getResourceBundle () ; String str = key ; try { str = resourceBundle.getString ( key ) ; } catch ( Exception e ){ str = "? - " + key ; System.err.println(e) ; } ...
c2a67feb-a609-4060-90f8-16651d96b419
2
private double average(int[] record){ int sum=0; int i; double avg; int ct = 0; for (i=0;i<record.length;i++){ sum = sum+record[i]; System.out.printf("\n the %d th record is %d\n",i, record[i]); if (record[i]!=0) ct=i; } avg = sum/(ct+1); System.out.printf("\n the avg score is %f\n", avg); ...
3d1e4801-8d05-49a4-a377-b983fc7acf97
0
@Basic @Column(name = "FUN_APELLIDOS") public String getFunApellidos() { return funApellidos; }
8f0a4c68-9ef1-48d0-899e-1c87a14b2726
0
public ConcreteFlyweight(String data) { this.data = data; }
57fb2a80-295c-4a16-95fa-26711d5addec
0
@Override public int compareTo(Name name) { return new Character(_firstName.charAt(0)).compareTo(name.getFirstName().charAt(0)); }
5d2dd0d1-f6a1-4e88-a7cc-308ec6a6ba8f
5
public void readRTSItems(String fileName) { try { this.fileName = fileName; if (!new File(fileName).exists()) { new File(fileName).createNewFile(); return; } else { ObjectInputStream input = new ObjectInputStream(new FileInputStream(fileName)); points = (Ha...
5d9646a2-566a-4691-98d6-e879d59cdccf
9
@Override public void run() { while (true) { for (int i = 0; i < tilearray.size(); i++) { Tile t = tilearray.get(i); t.update(); } robot.update(); if (robot.isJumping() == false && robot.isDucking() == false) currentSprite = anim.getImage(); else if (robot.isJumping()) currentSprite...
c0579f1e-f78a-4df9-901d-a02c831d03b6
7
public void run() { while(true){ try { sleep(delayFromStart * War.TIME_INTERVAL); synchronized (destructor) { if (target.getStatus() == Missile.Status.Launched){ for (WarEventListener l : allListeners) { l.addedMissileToDestroy(destructor.getDestructorId(),target.getMissileId(),super.g...
5aaeb1a1-9b09-41c0-b4a9-c2a2838ad82f
8
public String unzip(String archiveFilePath, String destDirectory, String extension, Boolean isUnzipRecursively) { logger.debug(extension + " archive path requested for unzipping: " + archiveFilePath); File archiveFile = new File(archiveFilePath); String unzippedName = ...
2b3f686b-4b99-4835-864b-2a944a2fb6fe
0
public int getRatingId() { return ratingId; }
bc604b82-2c91-4683-afa6-345e3eddefac
5
private static void throwException(String body) throws GaraponException { if (body.contains("wrong password")) { throw new WrongPasswordException(substringAfterSemicolon(body)); } else if (body.contains("unknown user")) { throw new UnknownUserException(substringAfterSemicolon(body)); } else if (body.contain...
f392267e-b54d-4a43-926a-f7f130e9e14e
3
public void handle(HttpExchange exchange) throws IOException { String requestMethod = exchange.getRequestMethod(); if (!"POST".equals(requestMethod)) { exchange.sendResponseHeaders(HttpURLConnection.HTTP_BAD_METHOD, 0); exchange.close(); return; ...
63b51e34-9422-4966-89b3-e87d080a67cf
8
@Override public CMObject copyOf() { final WeakItemCollection c=(WeakItemCollection)newInstance(); for(int i=0;i<contents.size();i++) { final Item I=contents.get(i); if(I!=null) { final Item I2=(Item)I.copyOf(); I2.setOwner(I.owner()); c.innerContents.add(new WeakReference<Item>(I2)); } ...
91eff3e7-65dc-4943-970d-45d3904a01af
6
private void close() { try { if (sOutput != null) sOutput.close(); } catch (Exception e) { } try { if (sInput != null) sInput.close(); } catch (Exception e) { } ; try { if (soc...
65d3af81-5ec3-45e3-be07-f12f789a808f
1
public static boolean checkProcessEnd(Process process) { try { logger.info("Process ends with exit value: " + process.exitValue()); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
da16ec5f-9654-439b-8839-11e0413720cc
5
public void run(String[] args) throws Exception { if (args.length == 1) { if (PCSCManager.getTerminal() != null) { Logger.log("Terminal: " + PCSCManager.getTerminal().toString() + "\n"); Logger .log("Cartao inteligente: " + (PCSCManager.getTerminal().isCardPresent() ? "presente" ...
6f04a4ce-fbd8-4ba6-aab4-e8744779cfa3
8
public void writeStatement(Statement oldStm) { // System.out.println("XMLEncoder::writeStatement: " + oldStm); boolean internal = this.internal; this.internal = true; try { super.writeStatement(oldStm); /* Note we must do the mark first as we may ...
bae9c5e1-67dd-4d0d-8c72-3ca585c9cb4b
7
private Node getNextToExpand() { Integer bestCost = null; Node next = null; for (int i = 0; i < nodes.length; i++) for (int j = 0; j < nodes[i].length; j++) { Node nd = nodes[i][j]; if (nd != null && !nd.isVisited()) { if (nd.getCost() == null) continue; if (bestCost == null || bestCo...
45b1bf3a-f728-4e81-b8b3-12646bbb4211
9
@SuppressWarnings("rawtypes") @Override public Class getClass(int i_idColumn) { switch (i_idColumn) { case 0: return Integer.class; case 1: return String.class; case 2: return HTMLLink.class; case 3: return String.class; case 4: return HTMLLink.class; case 5: return HTMLLink.class; c...
1644494d-83de-447c-92ff-c1ab821c8f43
4
public boolean removeVertex(V v) { // zun�chst alle Kanten mit Knoten v als Startknoten entfernen Integer IIndex = vertexIndex.get(v.getId()); if (IIndex == null) { return false; } int index = IIndex; adjList.get(index).clear(); // dann alle Kanten mit Knoten v als Endknoten entfernen...
5cd597c1-1999-469d-9633-2644da0b7897
4
public void outerAttack(BsGs_Key key){ clearlog(); benchmark.init(); try{ x = this.attack(key); } catch (Error e) {e.printStackTrace(); System.exit(1);} if(x!=null){ log("x = "+this.x); BigInteger y2 = key.g.modPow(this.x, key.p); log("\nPrüfe:\ng^x mod p = "+key.g+"^"+this.x+" mod "+key.p+" = ...
aec45a9c-0e47-4172-ade8-cadccbb91ded
1
public synchronized List<RelayMessage> getRecent() throws SQLException { List<RelayMessage> messages = new ArrayList<RelayMessage>(); PreparedStatement stmt = connection.prepareStatement("SELECT nick, message, timeposted FROM messages ORDER BY timeposted DESC LIMIT 10"); try { ResultSet rs = stmt.executeQuery(...
e606e924-778d-4555-b989-a06a71f9b094
4
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { if(e.getMessage() instanceof HandshakeResponseEvent) { if(listener != null) { listener.handshakeResponseReceived((HandshakeResponseEvent) e.getMessage()); } if(((HandshakeResponseEvent) e.getMessage()).ge...
b29f38d0-3582-4f46-824c-90e026ff0ae8
2
public LobbyServerMessage lobbyServerMessageDecode(String mess) throws JSONException { JSONObject obj = new JSONObject(mess); LobbyServerMessage lsm = new LobbyServerMessage(); JSONArray JArr = obj.getJSONArray("UserList"); for (int i = 0; i < JArr.length(); i++) { JSONObject l = JArr.getJSONObject(i); ...
a3f06022-c4ef-4732-9657-9350c6d31fa5
0
public void setAlgorithm(String value) { this.algorithm = value; }