method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9c317b3a-a1ca-455d-8eef-829866d91e19
0
protected String testName() { //A little reminder to subclassers return "*** unknown ***"; }
8cadd946-087e-41e7-9886-84ff3208bce1
5
@Action public void run() { boolean flag = false; String strA = jTextArea1.getText().trim(); String strB = jTextArea2.getText().trim(); if(strA.charAt(0) == '-') { strA = strA.substring(1); flag = true; } if(strB.charAt(0) == '-') { ...
067c8039-0284-48c1-b1ae-e7cb884aab5f
2
@Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { int row = table.rowAtPoint(e.getPoint()); if (table.getSelectedRowCount() == 0) table.setRowSelectionInterval(row, row); MediaContextMenu menu = new MediaContextMenu(getSelected(), table);...
c15992b4-af11-4050-a4a5-0bf67303333d
6
@Override public void paint(final Graphics2D g) { final AffineTransform oldTransform = g.getTransform(); g.translate(getComponent().getX(), getComponent().getY()); g.setPaint(getComponent().getFgColor()); g.setStroke(getComponent().getFgStroke()); g.draw(getComponent().getS...
0d67fe1b-1924-4e5d-878f-df33bcfd8aca
8
public ArrayList<Integer> MergeSort (ArrayList<Integer> number, int start, int end){ if (start == end){ ArrayList<Integer> tmp = new ArrayList<Integer>(); tmp.add(number.get(start - 1)); return tmp; } // Set mid place int mid = (end - start + 1) / 2; ...
80f281d2-400a-4d17-87a5-cdeb25439714
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LinkedNode<?> other = (LinkedNode<?>) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.va...
16e97bc0-3689-4fc8-a853-10f132d7ad4b
1
private boolean jj_3_50() { if (jj_3R_69()) return true; return false; }
68b94ba7-fa21-42e5-a484-6bc8158b9bbc
7
public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); result.append("Recovered type:\n"); //$NON-NLS-1$ if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) { result.append(tabString(tab)); result.append(" "); //$NON-NLS-1$ } typeDeclaration.print(tab + 1, result); if...
10f16782-18be-4cdc-a99f-8e318da24ddc
6
@Override public void upDate() { if(bindBody != null) { if(grabbed) { bindBody.setX(x); bindBody.setY(y); } else if(bindBody.getX() != x || bindBody.getY() != y || bindBody.isRemoved() || bindBody.isDead()) { bindBody.setCantMove(false); bindBody.setPullAndPush(false); bindBody = null; ...
0d0d8d0d-9a92-43cb-b2f3-25cae9f40f1a
1
@Override public void close() { try { this.config.save(this.file); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
fe22619d-45d7-4c04-bca0-3f43e911e597
5
public boolean equals(Object o) { if(!(o instanceof Astronomy)) return(false); Astronomy a = (Astronomy)o; if(a.dt != dt) return(false); if(a.mp != mp) return(false); if(a.yt != yt) return(false); if(a.night != night) return(false); return(true); }
eba68c47-8f2b-40d7-b8aa-629b98580790
7
@SuppressWarnings("unchecked") private static JSONArray getJsonArray(List<Object> messageList) { JSONArray jsonArr = new JSONArray(); int index = 0; for (Object object : messageList) { if (object == null) { jsonArr.set(index++, JSONNull.getInstance()); } else if (object i...
340eb1f6-879e-407a-854a-fe62dc06dc52
0
@Test public void testCreatedEmptyContact() throws Exception { FiilContactFormParameter validForm = new FiilContactFormParameter("", "", "", "", "", "", "", "", "", "", "", ""); openMainPage(); initContactCreation(); fiilContactForm(validForm); submitContactForm(); returnToHomePage(); }
630ca215-05af-429c-9ff0-e9dbadbaed07
4
@Override public void draw(Graphics g) { if (trails) { g.setColor(new Color(0, 0, 0, 30)); g.fillRect(0, 0, width, height); g.setColor(new Color(20, 20, 20)); for (int i = 0; i < width; i += 50) { for (int j = 0; j < height; j += 50) { g.fillRect(i, j, 5, 5); } } } for (Particl...
0465b899-752e-4f1b-85ff-4312dddfe239
6
public void showField() { for (int i = 0; i < field.sizeField; i++) { System.out.print(" " + (i + 1) ); } System.out.println(); for (int i = 0; i < field.sizeField; i++) { System.out.print(i + 1); for (int j = 0; j < field.sizeField; j++) { ...
b05beef4-6d18-47b3-915c-b15f26edfc50
6
private float calcAgeMultiple() { if (metabolism == ARTILECT_METABOLISM) return 1 ; final float stage = agingStage() ; if (actor.species() != null) { //Make this more precise. Use Traits. return 0.5f + (stage * 0.25f) ; } if (stage == 0) return 0.70f ; if (stage == 1) return 1.00f ; ...
8cd59733-f756-457b-832b-2ad51af104c6
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Book other = (Book) obj; if (id != other.id) return false; if (name == null) { if (other.name != null) return false; } else if (!na...
db9cd3ec-53de-41e8-ae33-5562aeeb90ef
1
public void testWithPeriodBeforeEnd3() throws Throwable { Period per = new Period(0, 0, 0, 0, 0, 0, 0, -1); Interval base = new Interval(TEST_TIME_NOW, TEST_TIME_NOW); try { base.withPeriodBeforeEnd(per); fail(); } catch (IllegalArgumentException ex) {} }
d1c2a8c6-32b3-47d6-aaac-e0d1b918be69
6
public static void sed(InputStream inputStream, OutputStream outputStream, Map<Pattern, String> patternReplacements) throws IOException { if(patternReplacements == null || patternReplacements.isEmpty()) { return; } Scanner scanner = new Scanner(inputStream).useDelimiter(Pattern.compile("\n")); while(scanner...
fb60bd31-338a-47fb-9975-8c9eee0d8527
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...
af588657-7c65-4d2f-826a-ce0fe51378fe
7
* @Post: no changes * @Return: whether or not this point is under attack by an enemy knight */ private boolean knightsCanAttack(Point pointToCheck) { // TODO Auto-generated method stub ArrayList<Point> possibleKnightAttacks= new ArrayList<Point>(); //adds all L shaped shifts from the pointToCheck to the lis...
8660ab12-f954-425d-8987-3c69a03f18db
6
public static PathQuad load(BufferedReader reader, ArrayList<Entity> props) { String line; try { line = reader.readLine(); String[] temp = line.split(";"); BufferedImage hitmap = new BufferedImage(Integer.parseInt(temp[0]), Integer.parseInt(temp[1]), BufferedImage.TYPE_INT_RGB); PathQuad.size = new ...
7b6b6ab5-be4b-4fa7-bef1-49a43824c536
1
public final void setBill(double bill) { if(bill < minBill) { throw new IllegalArgumentException(billEntryError); } this.bill = bill; }
98286ce8-b2d4-449e-8b60-507e2d429e5b
6
@Override public ByHandleFileInformation onGetFileInformation(String arg0, DokanFileInfo arg1) throws DokanOperationException { EntityInfo inf; if (mapWinToUnixPath(arg0).equals(INITIALFILENAME)) { return new ByHandleFileInformation(net.decasdev.dokan.FileAttribute.FILE_ATTRIBUTE_NORMAL, 0, 0, 0, 0, 0, 1, ...
d99dfba2-df85-45b3-b1a6-99a34c7879e5
0
public CircleChain(Graph g, Dimension vDim, double vBuffer) { super(g); radius = 0; vertexDim = vDim; vertexBuffer = vBuffer; }
943ba7fc-1e2e-46fb-8844-42a45adad0e4
5
public static void main(String[] args) { System.out.println("Prueba de conexion con MS SQLServer"); String entrada="",salida="",opc=""; SQL= new AdaptadorSQL("localhost","1433","prueba","pekosog","sped1920"); System.out.println(SQL.getMeta()); do{ System.out.println("Opciones de Uso:\n1.-Ejecutar Query...
2458923b-bb7d-4ef4-a8fe-e6096046935c
3
private boolean jj_3R_43() { if (jj_scan_token(FOREACH)) return true; if (jj_3R_72()) return true; if (jj_scan_token(IN)) return true; return false; }
cc3bd4cb-1c0c-46f8-b59d-76ea1ee86dff
5
public static Complex[] fft(Complex[] x) { int N = x.length; // base case if (N == 1) return new Complex[] { x[0] }; // radix 2 Cooley-Tukey FFT if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); } // fft of even terms Complex[] even = new C...
405960df-4fed-4cd0-82af-9e52f85b49cb
6
public static String stringForResponseCode(int code) { switch ( code ) { case 200: return "OK"; case 401: return "Not Authorized"; case 403: return "Forbidden"; case 404: return "Not Found"; case 500: return "Internal Server Error"; case 501: return "Not implemented"; d...
6334f7f5-cf83-4944-a2c5-d1fbef896398
8
private void getEdgesInChildrenCells(S2Point a, S2Point b, List<S2CellId> cover, Set<Integer> candidateCrossings) { // Put all edge references of (covering cells + descendant cells) into // result. // This relies on the natural ordering of S2CellIds. S2Cell[] children = null; while (!cover.isE...
62513dd6-fefd-4f33-9125-f2a6446794c3
2
public static List<ScheduleTeamModel> getAllTeamSchedulesNotStarted(String order) { List<ScheduleTeamModel> res = new ArrayList<ScheduleTeamModel>(); for(ScheduleTeamModel stm : getAllTeamSchedulesByFinish(order,false)) { if(!stm.isSched_isStart()) res.add(stm); } return res; }
09a367be-66e8-4d94-ad2a-f48d080a09aa
2
private int compareType(int t1, int t2) { return (t1 < t2) ? 1 : (t1 == t2) ? 0 : -1; }
86afe760-419e-406d-a9c3-e38c65bf649f
4
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ request.setCharacterEncoding("UTF-8"); RequestData rd = getRequestData(request); Class clazz; try{ clazz = Class.forName(...
65b06f84-2fa4-4421-acfe-afc25a701833
8
public static void main(String[] args){ Scanner cin = new Scanner(System.in); str = cin.next(); for(int i = 0; i != str.length(); i ++) digits[intValue(i)] ++; boolean flag = true; int carry = 0; for(int i = str.length() - 1; i >= 0; i--){ result[i] = intValue(i)*2%10 + carry; digits[result[i]]...
222887de-9c05-4205-9697-a7264d19e0d6
4
private static void maxHeapify(Comparable[] arr, int i, int n){ //getting the left node of this node //while the j is less than the size of the array while(i*2+1<n) { int j = i*2+1; //checking if the right is less than the left node //if not then choose the r...
f88f421d-9518-4577-ab51-dbfd17d0b78c
2
public double getQuizRating() { String statement = new String("SELECT * FROM " + DBTable + " WHERE qid = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, quizID); ResultSet rs = stmt.executeQuery(); rs.next(); double averageRating; if(rs.getI...
ee39cdb7-06a2-4444-a412-73bd3f57e5a8
2
public static void tempMutePlayer( final BSPlayer t, int minutes ) throws SQLException { mutePlayer( t.getName() ); BungeeSuite.proxy.getScheduler().schedule( plugin, new Runnable() { @Override public void run() { if ( t.isMuted() ) { try { ...
83ee8469-3329-426d-a07a-5e02175d2c96
5
public JSONObject increment(String key) throws JSONException { Object value = opt(key); if (value == null) { put(key, 1); } else if (value instanceof Integer) { put(key, ((Integer) value).intValue() + 1); } else if (value instanceof Long) { put(key, ((...
32e80417-bbdd-4684-bfc2-7aab35e466dc
6
public Battleship() { setTitle("Battleship"); setDefaultCloseOperation(EXIT_ON_CLOSE); setJMenuBar(createMenuBar()); setResizable(false); //gets user to input name user=JOptionPane.showInputDialog("Enter your name."); int dummy=0; while (((user==null)||(user.equals("")))&&(dummy<3)) { ...
35e16b21-4014-48d8-bec1-2161fc485a4d
9
@SuppressWarnings("unchecked") // FIXME in Java7 public SelectDestinationDialog(FreeColClient freeColClient, GUI gui, Unit unit) { super(freeColClient, gui); // Collect the goods the unit is carrying. final List<GoodsType> goodsTypes = new ArrayList<GoodsType>(); for (Goods goods : ...
465f5830-5b14-4e02-947c-daf1544bcbc8
2
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Library library = new Library(); JSONObject result = new JSONObject(); try { library.checkOutBook( Integer.parseInt(request.getParameter("bookNumber")), ((Patron) request.getSessi...
11947e75-4487-46cf-bbb8-8a1b78fc3dd5
5
@Override public void deserialize(Buffer buf) { casterId = buf.readInt(); targetCellId = buf.readShort(); if (targetCellId < 0 || targetCellId > 559) throw new RuntimeException("Forbidden value on targetCellId = " + targetCellId + ", it doesn't respect the following condition : t...
617f4476-178c-4e93-b168-689bd514a547
2
@SuppressWarnings("unchecked") public static <T> T[] addElemToArray(T[] array, T element, int index) { if (array == null) { array = (T[]) Array.newInstance(element.getClass(), (index + 1)); array[index] = element; return array; } if (index < array.length) { array[index] = element; return array; ...
38c77d2d-fa92-4ae9-89eb-d348f17d1d1f
8
public static int dfs(int num, int sumGreedy, int sum, int indexIzq, int indexDer, int turn, String cadSum, String cadgreedy) { if (indexIzq <= indexDer) { if (turn == 0) { if (arr[indexIzq] >= arr[indexDer]) { if (dp[indexIzq][indexDer] != Integer.MIN_VALUE) { value = (sum - (sumGreedy + arr[index...
21677008-77be-46d7-bfd5-b636b707f560
2
private void writePage() // writes page information { writeNumber(0,2,attrib,false); writeNumber(0,2,key_cnt,false); // count of keys in this block writeNumber(0,4,left_page,true); // left node or -1 writeNumber(0,4,right_page,true); // right node or -1 for(int i=0;i<key_cnt;i++) { // write keys t...
c7e4a56f-8060-4d41-abd8-fb647b3d7744
5
private void parseChar() throws CompilationException { char ch=0; switch(read()) { case '\\': ch=(char)parseEscape(); break; case -1: // EOF case '\n': case '\r': case '\'': // these can't be encountered inside char literal consume(-1); break; default: ...
d5a0a25d-f27d-419d-9cb0-dcee70c2e984
5
private void scan(MethodInsnNode methodInsnNode) { for (ThreatClass threatClass : threatClasses) { if (threatClass.getName().equals(methodInsnNode.owner)) { threatClass.setUsed(); if (methodInsnNode.name.equals("<init>")) addInteraction(threatClass, methodInsnNode); for (ThreatMethod threatMethod ...
c7387356-b6d6-4fe1-a9d8-1f2c8163239c
9
double isNotEqual(MembershipFunction mf, InnerOperatorset op) { if(mf instanceof FuzzySingleton) { return op.not(isEqual( ((FuzzySingleton) mf).getValue())); } if((mf instanceof OutputMembershipFunction) && ((OutputMembershipFunction) mf).isDiscrete() ) { double[][] val = ((OutputMembershipFunction)...
2290c189-1f55-441a-b800-520af670cd24
8
static int solve(int a, int b) { if (a >= n) return 0; if (dp[a][b] != 0) return dp[a][b]; if (a == b) return dp[a][b] = 1; int r = b - a + 1; for (int i = a; i <= b; i++) for (int l = 1; l <= i - a + 1; l++) if (check(a, i, l)) { if (i == b && l == (b - a + 1)) continue; r = ...
b645fc37-f11e-42f6-825a-304c3a8a2409
5
public boolean isLand(String cardName){ if(cardName.equalsIgnoreCase("mountain")) return true; if(cardName.equalsIgnoreCase("island")) return true; if(cardName.equalsIgnoreCase("forest")) return true; if(cardName.equalsIgnoreCase("plains")) return true; if(cardName.equalsIgnoreCase("sw...
96f75e90-d610-4bcb-9874-bca86d83ddc1
2
private static void recordChanges(String str) { int changes = 0; char []ch = str.toCharArray(); int i=0,j=ch.length-1; while(i<j){ if(!(ch[i]==ch[j])){ //System.out.println(ch[i] + "->"+ ch[j]); changes+= Math.abs(ch[i] - ch[j]); } i++; j--; } System.out.println(changes); ...
7d9d4cd5-e149-4903-be5a-396c42e84605
4
private Box LoadPhoto(String number) { File f=null; ImagePanel ImagePanel = new ImagePanel(); ImagePanel.setLayout(new BorderLayout()); if(Phone.numbers.get(number)!=null) f=new File(Phone.PhotoFolder + Phone.numbers.get(number).get(1)); if(f==null||f.equals(null)) f=new F...
7351b4ae-3b34-483b-84b0-1c2fd235d1a1
8
@Override public final void setInitialState() { for (int i = 0; i < contents.length; i++) { Cell[] tempArray = new Cell[8]; for (int j = 0; j < tempArray.length; j++) { if ((i + j) % 2 == 0) { tempArray[j] = new Cell(i, j); } ...
4abcee9f-6687-4820-acec-e06109863932
5
public static void killMetaInf() { File inputFile = new File(System.getenv("APPDATA") + "/.MinebookLauncher/packs/" + downloadPack.packID + "/minecraft/bin", "minecraft.jar"); File outputTmpFile = new File(System.getenv("APPDATA") + "/.MinebookLauncher/packs/" + downloadPack.packID + "/minecraft/bin", "...
6ab2019c-9895-4f0e-a216-074e90744a3a
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1]))); String lineString; while((lineString = in.readLine()) != n...
c8ec5038-7db4-468e-8386-4a511013a576
5
private void computeRootNodeStatistics() { // Compute mean per dimension from all objects. double[] mean = new double[numberOfDimensions]; for (int i = 0; i < numberOfDimensions; i++) { mean[i] = 0; for (int j = 0; j < numberOfObjects; j++) { mean[i] += data[j][i]; } } double divFactor = 1.0 / nu...
d1337bca-f583-400a-9099-a3d69485fdd5
6
private static int distance(Person a, Person b) { HashSet<Person> visited = new HashSet<Person>(); HashMap<Person, Person> previous = new HashMap<Person, Person>(); LinkedList<Person> queue = new LinkedList<Person>(); queue.add(a); visited.add(a); Person p = a; while (!queue.isEmpty()) { p = queue.remo...
8f2582b1-0b50-4552-8a97-95781f6a371b
6
private void generateCircle(int index) { //This method generates a new circle. //TODO: rewrite this more gracefully. outer: while (foci[index] == null) { //let's look for a new coordinate. double randx = r.nextDouble() * DWIDTH; double randy = r.nextDo...
0fbc61dc-b02b-4855-9cb3-71ec91aec9f1
1
public List<Bin> getGenesByDivision(Pair div) { List<Bin> genes = new ArrayList<Bin>(); for(int i = div.x; i < div.y; i++){ genes.add(this.bins.get(i)); } return genes; }
5fa68622-ad0c-477a-9644-895e7696b158
3
private void colisionesNaves() { for (Nave n : naves) { if(n.isVivo()){ int colisionesMortales = n.colisionesMisDisparosConList(invasores); if(colisionesMortales>0){ juego.setPuntos(juego.getPuntos() + colisionesMortales); } ...
8677e523-6653-4a4f-ba46-d3a2b4379520
3
@Test public void RandomSet() { //Make two identical models but one parallel and one sequential AbstractModel paraModel=DataSetLoader.getRandomSet(100, 800, 40, new ModelParallel()); AbstractModel seqModel=DataSetLoader.getRandomSet(100, 800, 40, new Model()); //Step through each model stepNumber stepModel(...
79c5b4da-4b81-40b9-b9c2-54aa1ec20e88
6
private static void editarTienda() { boolean salir; String nombre, cif, codigo; Integer idTienda; Tienda tienda; do { try { System.out.print( "Introduce el Id de la tienda: "); idTienda = Integer.parseInt( scanner.nextLine()); if ((tienda = Tienda.buscar( idTienda)) == null) ...
39374fa9-3000-4df7-bf6d-83205c654e1d
0
@Override public final void testStarted(Description description) throws Exception { super.testStarted(description); selectListener(description).testStarted(description); }
a6c731e6-198f-4e96-a13e-23342d2c2eec
6
public void testNoInterveningTiles() { // Place a tree in the middle board.addTile(tree, CENTRE, CENTRE); try { // Check illegal arguments aren't accepted board.validateNoInterveningTiles(CENTRE - 1, CENTRE - 1, CENTRE + 1, CENTRE); fail("Method shouldn't accept diagonal moves"); ...
79ea1f7c-3a1e-4c66-b64f-9f9e55a9eb4d
4
public void merge(int[] arrayA, int[] arrayB, int tailA, int tailB) { int lastA = tailA + tailB + 1; while (tailA > -1 && tailB > -1) { if (arrayA[tailA] > arrayB[tailB]) { arrayA[lastA] = arrayA[tailA]; lastA--; tailA--; } else { ...
b854e374-8fd0-4cc2-80eb-c17507933c0d
4
private void consumeMaterials() { // // Decrement stocks and update demands- final float wear = Structure.WEAR_PER_DAY / World.STANDARD_DAY_LENGTH ; final int maxPop = HoldingUpgrades.OCCUPANCIES[upgradeLevel] ; float count = 0 ; for (Actor r : personnel.residents()) if (r.aboard() == this) cou...
3d6da4d6-c529-4d8b-a002-8fb83d9fdffa
3
public static void main(String [] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText(getResourceString("window.title")); InputStream stream = BrowserExample.class.getResourceAsStream(iconLocation); Image icon = new Image(display, strea...
f856cfb9-34d3-4452-a7ec-85f3252ef4d5
6
public String toString() { boolean test = false; if (test || m_test) { System.out.println("Grid :: toString() BEGIN"); } String gridString = ""; for (int y = 0; y < getGridHeight(); ++y) { for (int x = 0; x < getGridWidth(); ++x) { gridString += m_Grid[x][y] + "...
245d26e1-7844-49ab-9ba1-3a9a164f9503
9
public static boolean bingo(int[][] board, int[] drawn) { // the size of the board. int size = board.length; // This array keeps track of filled array. boolean filled[][] = new boolean[size][size]; // Mark the center of the board as filled. if (size % 2 != 0) { ...
75fe16da-998e-480c-98cb-b645fea4e5f5
5
public static List<Enhancement> getEnhancements(String prestige, List<Integer> requiredList){ List<Enhancement> el = new ArrayList<Enhancement>(); for(ClassTree ct : takenPrestigeTrees){ if(ct.getPrestige().equalsIgnoreCase(prestige)){ for (int i : requiredList){ el.add(ct.getEnhancement(i)); ...
68061297-b9c3-48ff-9607-bacb0adca0df
8
@Override public GameMap generateMap(boolean visual, int x, int y) { this.visual = visual; numFloor = (int) (x * y * percentFill); GameMap retMap = new GameMap(x, y); retMap.fillMap(MapCellWall.getInstance()); for (int i = 0; i < initFloors; i++) { retMap.setCell...
00dfdce9-8ee7-40f5-b94d-8a9a15e39f7f
2
public ListaContaCorrente contasComSaldoLista(double valor) { ListaContaCorrente l = new ListaContaCorrente(this.quantasContas); for(int i=0; i < this.quantasContas; i++) { if (this.aContas[i].getSaldo() > valor) { l.incluirNoFim(this.aContas[i]); ...
34aaaf2b-7081-42fa-b302-af782925964f
9
@Override public void actionPerformed(ActionEvent e){ view.getDisplayArea().setText(null); try{ if (e.getSource() == view.btnAddFile) this.addDiseaseFile(); if (e.getSource() == view.btnAddPatient) this.addPatient(); if (e.getSource() == view.btnRemovePatient) this.removePatient(); if (e.getSource() =...
3cb17b9c-1ae9-4d6b-92e7-63b821ea67a7
3
public static void displayHighScore() throws ClassNotFoundException, IOException { Player[] hsList = HighScore.getHSList(); for (int i=0; i < hsList.length; i++){ if (hsList[i]!=null){ SimoneUI.HighScoreUI.append(hsList[i].toString()+ "\n"); } if (hsList[i]...
da84bce0-0a23-4c1d-bbcc-87dd8bd4a7fb
2
private void jTextFieldUtilisateurRechercheKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldUtilisateurRechercheKeyReleased try { List<projetrf.model.Ville> vv1 = RequetesVille.rechercheVilleByCp(jTextFieldUtilisateurRecherche.getText()); ...
b9c55221-14dc-4492-a0f6-d3d0aca34ab6
1
public void parse() { try { program(); } catch (QuitParseException e) { error.reportSyntaxError(); } }
a08539d6-15b8-49da-94f1-8c4e84d3d0ad
4
public void plusEquals(Matrix bmat){ if((this.numberOfRows!=bmat.numberOfRows)||(this.numberOfColumns!=bmat.numberOfColumns)){ throw new IllegalArgumentException("Array dimensions do not agree"); } int nr=bmat.numberOfRows; int nc=bmat.numberOfColumns; for(int...
5caab630-ed4d-4881-8bef-c9a7a9b1b83c
7
public Candlestick(double abertura, double fechamento, double minimo, double maximo, double volume, Calendar data) { if (minimo >= maximo) { throw new IllegalArgumentException( "Preço mínimo não pode ser maior que o preço máximo."); } if (data == null) { throw new IllegalArgumentException("Data nã...
5108dd88-81ae-4d20-bb72-9a30d515c341
6
public static float doFrictionX(float xv, float yv, float FRICTION) { float angle = (float) Math.atan(yv / xv); if (xv == 0) { if (yv == 0) { angle = 0; } angle = (float) Math.PI / 2; } // apply friction float fx = Math.abs(FRI...
8838ddc5-0197-4b51-8faf-23c5d08cff54
6
public static void main(String[] args) { Scanner scan = new Scanner(System.in); ArrayList<Integer> ints = new ArrayList<Integer>(4); try { while (true) { try { System.out.print("Input at least 3 numbers seperated by spaces: "); ...
8bdae21f-cbf6-4f36-aee2-bec48f9b37b6
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...
a2f655d5-dee1-4e3a-9a48-f637670d7440
3
private static byte[] readEntry(final InputStream zis, final ZipEntry ze) throws IOException { long size = ze.getSize(); if (size > -1) { byte[] buff = new byte[(int) size]; int k = 0; int n; while ((n = zis.read(buff, k, buff.length - k)) > 0) { k += n; } return buff; } ByteArrayOutpu...
1392b2b3-6099-491c-9162-26f917c66f95
9
private ArrayList<ASTatom> fetchExpressions(SimpleNode n, boolean ignoreLocals) { // ignore choice rules and aggregates in case ignore locals was set to // true ArrayList<ASTatom> result = new ArrayList<ASTatom>(); if (ignoreLocals && (n.getId() == ElpsTranslatorTreeConstants.JJTAGGREGATE || n .g...
ee37ac2d-6844-4959-b35f-e8c0c5236fdd
9
private void setIconPositionAndVisibility(String labelName, ImageIcon imgicon, boolean isVisible) { //"woman" 80,50, "smallDragon" 240,250, "genie" 280,150, "onyxia" 0,0 if (labelName.equals("woman")) { womanLabel.setIcon(imgicon); mainpanel.add(womanLabel); ...
a7bf9ab0-3682-43a2-9a2a-30291a07aac2
6
public static boolean cloneTaskTree() { Data data=new Data("SomeData"); IDGenerator generator = new IDGenerator(); TaskTree tree1 = new TaskTree(generator, data); TaskTree child1 = new TaskTree(generator, data); tree1.add(child1); TaskTree child2 = new TaskTree(generator,...
ac106749-9702-4771-bb14-572b4adb7baf
8
public void CaptureWhitePiece(int r1, int c1, int r2, int c2) { // Check Valid Capture assert(Math.abs(r2-r1)==2 && Math.abs(c2-c1)==2); // Obtain the capture direction MoveDir dir = r2<r1?(c2<c1?MoveDir.forwardRight:MoveDir.forwardLeft) :(c2<c1?MoveDir.ba...
b8625c33-25ca-4cdb-ba35-25dce81b6c7f
6
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ClientInfo other = (ClientInfo) obj; if (socket == null) { if (other.socket != null) { return fa...
cbc63b21-5c69-4fe5-bea2-030b380e0f3f
9
private double RoundUp(double val) { int exponent; int i; exponent = (int) (Math.floor(SpecialFunction.log10(val))); if (exponent < 0) { for (i = exponent; i < 0; i++) { val *= 10.0; } } else { for (i = 0; i < exponent; i++) { val /= 10.0; } } if (val > 5.0) val = 10.0; else ...
6fd9ee48-0713-49cc-8ff4-ad5e923db6e9
2
public String toString() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; i++) { sb.append("Vector[" + i + "] = " + array[i]); if (i < array.length - 1) { sb.append("\n"); } } return sb.toString(); }
9f57314a-fe5e-4093-93dd-e23305d23a23
5
@Override public void recycle(Object t) { if (!(t instanceof HugeElement)) return; switch (((HugeElement) t).hugeElementType()) { case Element: if (elements.size() < allocationSize) elements.add((TE) t); break; case BeanImpl: if (impls.size() < allocationSize) ...
052d7cf9-0ee6-4665-b585-2c34f87652f6
9
private HashSet<AbstractTile> getTilesToHighlightHelper(AbstractTile tile, HashSet<AbstractTile> tileSet, int radius) { if(radius == 0) { return tileSet; } //if(!(tile.getX()/Main.TILE_SIZE < Main.BOARD_DIMENSION_BY_TILE.width) || !(tile.getY()/Main.TILE_SIZE < Main.BOARD_DIMENSION_BY_TILE.height)) { /...
aa5b8e52-8418-4f7c-821d-b53acb6354ae
1
public void testConstructor_RI_RD5() throws Throwable { DateTime dt = new DateTime(TEST_TIME_NOW); Duration dur = new Duration(-1); try { new Interval(dt, dur); fail(); } catch (IllegalArgumentException ex) {} }
48dd4e4e-6fd9-4ffe-a51b-35c10f6ffcf6
9
private void setSourceBuffer(int i) { if (disabled) return; SoundObject obj = soundObjects.get(i); OggDecoder oggDecoder = new OggDecoder(); ByteBuffer databuffer = ByteBufferBuffer.alloc(2048 * 2048); try { InputStream f = Loader.getRequiredResourceAsStr...
ec72fc1c-a59c-4595-8fdb-7a8c2bd6a5a5
9
public void setZeros(int[][] matrix){ Boolean[] rows = new Boolean[matrix.length]; Boolean[] cols = new Boolean[matrix[0].length]; for(int i = 0; i < rows.length; i++){ rows[i] = false; } for(int i = 0; i < cols.length; i++){ cols[i] = false; } for(int i = 0; i < matrix.length; i++){ for...
4039b264-bc0f-4d7f-b499-4ad907ce2794
6
public static void main(String[] args) { try { System.out.println("If args are given: FILEPATH REPETITION ITERATION TEMPERATURE"); String filepath = "/home/mik/Documenti/univr/Ragionamento Automatico/stage/report/200/0.29/2.pg"; if (args.length >=1){ filepath...
35fe91b8-c376-4447-a26d-09fa4e38e403
5
public static void testStrings(){ // Learn to use conditional operator instead of if... else statement int a , b; a = 10; b = (a == 1) ? 20: 30; System.out.println( "Value of b is : " + b ); b = (a == 10) ? 20: 30; System.out.println( "Value of b is : " + b ); ...
41efbe5d-6d4d-4866-a9c2-057d1fcc32bc
2
@Override public void toString(String indent, StringBuilder buffer) { final int size = this.tags.size(); if (size == 0) { buffer.append("[]"); return; } buffer.append("[ "); this.tags.get(0).toString(indent, buffer); for (int i = 1; i < size; i++) { buffer.append(", "); this.tags.get(i)....
de0484c6-56b5-4d03-8abd-b8fd54f591fc
5
public static void main(String[] args) { try { initBase(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(1); } // Warm up the nanoTime function for(int i = 0; i < 10000; i++) { System.nanoTime(); } ...
a98a2f04-866c-4fb7-a960-6cb1ae92dc93
9
public void init() { if (!runOnCanvas) { final BufferedImage bi = new BufferedImage(2, 2, BufferedImage.TYPE_INT_ARGB); cs.handleResize(); cs.needAnalyze(); cs.updateCircuit(bi.getGraphics()); // cs.analyzeCircuit(); updateThread = new Threa...
1b67f1c0-d158-41ee-9ea3-07ac9e5a5690
7
public void move() { // if (target == null) { int dist = 1000; for (Organism g : Ecosystem.getYellow()) { if (getDist(g) < dist) { target = g; dist = getDist(g); } } for (Organism g : Ecosystem.getRed()) { if (getDist(g) < dist) { target = g; dist = ...