method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b2665baa-5a08-4605-a2b7-f4ef8ca98fa1
6
public Matrix add(Matrix a) { if (a == null) { return null; } if ((!this.isJagged && !a.isJagged) && this.sameOrder(a)) { double[][] new_elements = new double[this.rowCount][this.columnCount]; for (int row = 0; row < this.rowCount; row++) { f...
18cecbd8-a60a-419a-a56a-fe6b9e2aba99
4
public void func_27425_c() { if(this.field_27427_l > 0) { --this.field_27427_l; } if(this.field_27426_m > 0) { --this.field_27426_m; } if(this.field_27436_c != null) { this.statFileWriter.func_27187_c(this.field_27436_c); this.field_27436_c = null; ...
dd7b3fee-d020-4267-a050-279721ea4001
3
public List<Session> getTop() { List<Session> map = new ArrayList<Session>(); for (Session session : HyperPVP.getGameSessions().values()) { map.add(session); } Comparator<Session> comparator = new Comparator<Session>() { public int compare(Session c1, Session c2) { if (c1.getKills() < c2.getKills...
f51e013e-ab1c-4814-a4b2-ea46404724dc
6
public boolean equals(Object object) { if (object == null) { return false; } if (object instanceof CycVariable) { CycVariable var = (CycVariable) object; return (isMetaVariable() == var.isMetaVariable()) && var.name.equals(name); } else if (object instanceof CycSymbol) { ...
4391efe3-478d-4b0c-8e7d-494f26566183
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
9dc911a5-61c8-49e5-bbbe-d705ccf4652b
5
private void printCentroids(Matrix features, List<Cluster> clusters) { for (Cluster cluster : clusters) { System.out.print("Centroid " + cluster._id + " = "); for (int i = 1; i < features.cols(); i++) { double val = cluster._centroid[i]; if (val == MISSING) System.out.print("?"); else { ...
aaed21eb-87db-45ae-a066-1b5492e44010
8
public static Ime_Velicina_Adresa OBRADI_izravni_deklarator(int trenutacnaLabela){ String linija = mParser.ParsirajNovuLiniju(); // ucitaj IDN UniformniZnak uz_idn = UniformniZnak.SigurnoStvaranje(linija); linija = mParser.DohvatiProviriVrijednost(); UniformniZnak uz_1 = UniformniZnak.SigurnoStvaranje(linija...
9893118e-76d4-4935-81db-68a551868279
4
public static CSTable asTable(CSProperties p, String dim) { List<String> arrays = DataIO.keysByMeta(p, "bound", dim); if (arrays.isEmpty()) { // nothing is bound to this return null; } int len = 0; List<String[]> m = new ArrayList<String[]>(); for ...
f9ba837b-482f-49f4-b6ba-8e41affa4ec9
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
1d8a81cf-dcc3-4ed5-b9c8-75e361e3c11e
2
@Override public Object invoke(Context context,List<Object> arguments) { if (!arguments.isEmpty()){ Object val = arguments.get(0); if (val instanceof Number){ return Math.tan(((Number)val).doubleValue()* Math.PI / 180); } } return 0; }
202ceac6-c8dd-4c80-aa32-17bb790ef453
6
protected void OnDataRangeChanged() { if (selectedIndex != null) { try { lastData = NetworkManager.showMore(selectedIndex.getSymbol(), selectedRange); lineChart.getData().clear(); if (pointerType != null && !pointerType.equals("hide")) { ...
55fa15ab-0999-4f4a-9c90-4c46cf369a8f
6
public void startListening() { if (isRunning) return; log_files.put("jmeter_log", JMeterUtils.getPropDefault(LoggingManager.LOG_FILE, "jmeter.log")); if (Utils.isJMeterServer()) { log_files.put("jmeter_server_log", Constants.JMETER_SERVER_LOG_FILENAME); } ...
36d88c16-de78-45a4-9053-fff876337a63
7
public UnconditionalFlowInfo discardNonFieldInitializations() { int limit = this.maxFieldCount; if (limit < BitCacheSize) { long mask = (1L << limit)-1; this.definiteInits &= mask; this.potentialInits &= mask; this.nullBit1 &= mask; this.nullBit2 &= mask; this.nullBit3 &= mask; this.nullBit4 &= mask; }...
b1f6e41f-a4f6-4857-83cf-6b4f0d380d76
0
public int getNumResults() { return results.size(); }
e1bd5067-9e7b-4e58-bfe6-8abc6386fd71
1
public long read6bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); long b4 = read(); long b5 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32) | (b5 << 40); else return b5 | (b4 << 8) | (b3 << 16) | (b2 << 24) | (b1 <...
7187d2f2-a828-4bf5-aec9-71a18bcbd42d
1
public void render(IRenderContext target) { if (isShowing()) { getCurrentMenu().render(target, font, offsetX, offsetY, scale, selectionColor, fontColor); } }
1c2fd312-3be5-4ed5-aae1-3206613d265e
8
public ArrayList<DnBData> getDnBDataFromXml(String xml) throws ParseException, XPathExpressionException { /* * D&B Failure Risk (Financial Stress) - FAIL_SCR * D&B Rating - DNB_RATG * D&B Failure Risk (Financial Stress) National percentile- NATL_PCTL or FAIL_SCR_NATL_PCTG ??? * Primary Name - PRIM_NME ...
30b15f86-1594-46b6-8740-8968c852754f
1
public void addSystemMessage(String message) { Document docs = textArea.getDocument(); SimpleAttributeSet attrSet = new SimpleAttributeSet(); StyleConstants.setForeground(attrSet, Color.BLUE); // StyleConstants.setUnderline(attrSet, true); // StyleConstants.setItalic(attrSet, true); // StyleConstants.setFo...
3645065c-ee4e-4660-8836-7d11f9687a6e
8
public static Slot slotFromExpressionTree(Cons tree) { if (Stella.SYM_STELLA_TYPED_SYS == tree.value) { tree = ((Cons)(tree.rest.value)); } { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree.value)); if ((testValue000 == Stella.SYM_STELLA_SYS_SLOT_VALUE) || ((testValue000 ==...
6326a871-489a-4424-84b0-50a4a99f63c7
0
protected boolean isFinished() { return false; }
17b25663-bd87-456c-b613-2127f5baaefb
7
public void run() { snake = new Snake(); food = new Food(); food.setFood(food); App.gui.setFood(food); App.gui.setSnake(snake); snake.getList().add(new Rectangle(snake.getSnakeX(), snake.getSnakeY(), 10, 10)); long startTime = System.currentTimeMillis(); long currentTime = 0; //game loop while(...
bc810ea1-2f64-4308-9a4c-59dcd3c90745
9
public Instances getDataSet() throws IOException { if (getDirectory() == null) throw new IOException("No directory/source has been specified"); String directoryPath = getDirectory().getAbsolutePath(); ArrayList<String> classes = new ArrayList<String>(); Enumeration enm = getStructure().classA...
e8c6dd8e-e54f-43f2-af8e-f1364b7de2b8
8
public static double getSimUserAverage(ItemNode a, ItemNode b, Map<String, AverageNode> map) { double d = 0, m1 = 0, m2 = 0; Iterator<RateNode> it1 = a.getVector().iterator(); Iterator<RateNode> it2 = b.getVector().iterator(); RateNode t1 = null, t2 = null; while(it1.hasNext() && it2.hasNext()) { if (t1 =...
b7150ffc-edd4-4eb0-a9bc-ee073cb07440
7
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(sender instanceof Player) { Player player = (Player) sender; if(args.length ==1) { @SuppressWarnings("unchecked") List<String> ranks = (List<String>) plugin.config.getList("Ranks");...
3d12a830-9a5c-4a1b-83e0-741df14c9155
2
public CommandParameter(String[] args, MFESetup setup) { if(args == null) throw new NullPointerException("CommandParameter has a null args"); if(setup == null) throw new NullPointerException("CommandParameter has a null mfe setup"); this.args= args; this.setup= setup; }
275425e5-1e95-44de-ae0f-58ab2c3da8f0
1
public void setRow(int j, String row_str) { int[] row_array = strToArray(row_str); if (row_array.length != width) return; array2d[j] = row_array; updateLengths(j); }
d0f05c8d-e68c-4449-b84e-b7b6bc242b2f
3
public void toggleRecord() { // Only want to execute this method if // we have a collection open and running if (parent.getCurrentCollection() == null) return; // Set the end time for this loop to stop if (recording) { recording = false; currentLoop.setEndTime(currentTime); loops.add(currentLoop...
00e92e61-36f0-4a80-a465-07bfc56d0a2f
6
private void initObjects(List<?> objects) { for (Object obj : objects) { if (obj instanceof ReferenceInitializer) { ((ReferenceInitializer) obj).initReferences(this); } else if (obj instanceof CompositeObject<?>) { initObjects(((CompositeObject<?>) obj).ge...
657141a9-558b-4676-a273-72de961c9ed5
6
public Double simula() { /* Simula fino al numero di job richiesti. */ while (this.getTempiUscita().size() < this.getJobTotali()) { Event next = this.getCalendar().get_next_double_cpu(); this.setClock(this.getCalendar().get_next_time_double_cpu(next)); System.out.pri...
4c896403-50f4-4ab2-995c-d7bf396cc7f1
8
@Override public Measurement parseResultRow(final ResultSet rs, int fromIndex) throws SQLException { Measurement m = new Measurement(); try { if (!rs.isAfterLast()) { int mId = rs.getInt(fromIndex); m.setId(mId); m.setTimestamp(rs.getLong(fromIndex + 1)); String readingClassName = rs.getSt...
4a877c78-8284-41a9-8ca3-aff94ee953d1
1
public void updateStock() { ProductDAO dao = DAOFactory.getInstance().getProductDAO(); int id; for (ProductInBasket product : basket.values()) { id = product.getProduct().getId(); product.getProduct().setStock(dao.findProductStock(id)); } }
74a368f6-3bb3-4941-916b-ebd454be9616
3
void combinationSumRec(int[] candidates, int target, int start, Deque<Integer> interList){ if(target == 0) { res.add(new ArrayList<Integer>(interList)); return; }else if(target < 0) return; for(int i = start; i < candidates.length; ++i){ interList.add(candidates[i]); combinationSumRec(candidates, targ...
09bcd0fb-3ccd-4976-b471-8cdeacbf8efe
1
@Override public int hashCode() { int hash = 0; hash += (idTelecom != null ? idTelecom.hashCode() : 0); return hash; }
766103a5-22cb-4afe-a6a1-e5a80304a79f
9
public void setFormat(String s) { if ("xmi".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_STANDARD); } if ("xmi:argo".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_ARGO); } if ("xmi:start".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_STAR); } if ("eps".equa...
bfcb097b-64b0-4c8a-8982-44d3522081c2
2
public TreeNode buildBST(ListNode[] node, int head, int tail) { if (head > tail) { return null; } else if (head == tail) { ListNode tmpNode = node[0]; node[0] = node[0].next; return new TreeNode(tmpNode.val); } int mid = head + ((tail - head) >> 1); TreeNode leftBST = buildBST(node, head, mid - 1)...
b262c515-ee86-41c2-9718-f43fa7b0faac
2
@Test public void testEventsOrderTransitionCollection() throws LogicViolationError { List<Transition> transitions = asList( new Transition(event_1, START, STATE_1), new Transition(event_2, STATE_1, STATE_2, true), new Transition(event_3, STATE_1, STATE_3), ...
e2b1a676-4a59-4308-aeac-1c6231982e8d
6
private boolean checkALError() { switch (AL10.alGetError()) { case AL10.AL_NO_ERROR: return false; case AL10.AL_INVALID_NAME: errorMessage("Invalid name parameter."); return true; case AL10.AL_INVALID_ENUM: error...
92e8fbcf-78e2-4a7b-87b4-f8193701699e
9
public static void align(SmithWatermanAlignment swa, Sequence ref, Read read, Sequence bwt, FmIndex fmIndex) { Sequence readSeq = read.getReadSeq(); int readlength = readSeq.length(); int lowerBound = 0; int upperBound = ref.length()-1; int savedLowerBound = lowerBound; ...
2104c47d-4cf8-46b8-8295-663bca44c337
4
public Engine() { addKeyListener(new Controller()); setBackground(Color.black); setPreferredSize(new Dimension(WIDTH, HEIGHT)); setFocusable(true); //init world final int defWidth = 150; final int defHeight = 15; final Random gen = new Ra...
c220dff8-72d2-4117-9cb2-48e59d7882b6
3
public void persistTransaction(Transaction transaction, int index, int size) { String sqlStatement; if(index == 0){ System.out.println("Connecting for the first transaction"); dao.connect(); } /*else if(index == (size-1)){ System.out.println("index: " + index + "vs. size-1: " + (size-1)); System....
1a8712c1-18fa-464a-9bf7-5de1d916d060
1
@RequestMapping(value = "/speciality-room-event-list/{specialityId}", method = RequestMethod.GET) @ResponseBody public RoomEventListResponse specialityRoomEventList( @PathVariable(value = "specialityId") final String specialityIdStr ) { Boolean success = true; String errorMessage...
b7d90dac-6a8b-4fe9-878f-1497167f6386
7
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { // if no channel specified if (plugin.SpyMap.containsKey(player)) { // if player already ...
2d50c08e-eeb5-40cd-87a1-903d5f8520bd
0
public void setPercent(double percent) { this.percent = percent; }
22f0e321-5f39-4853-893d-b479cf67ce0d
5
private void processDelete(Sim_event ev, boolean isMaster) { if (ev == null) { return; } Object[] data = (Object[]) ev.get_data(); if (data == null) { return; } String filename = (String) data[0]; int req_source = ((Integer) data[1]).intVa...
57434f1c-d35c-41da-9a95-41b283fee046
3
public void setRadii(double innerRadius, double outerRadius){ if(innerRadius<=0.0D)throw new IllegalArgumentException("The inner radius, " + innerRadius + ", must be greater than zero"); if(outerRadius<=0.0D)throw new IllegalArgumentException("The outer radius, " + outerRadius + ", must be greater than ...
9333b9d8-ab4a-4da5-acbd-b1660d836d89
5
private static boolean canGetPushedOutOfSuperRegion(BotState state, SuperRegion superRegion) { boolean out = true; List<Region> subRegions = superRegion.getSubRegions(); for (Region subRegion : subRegions) { if (subRegion.getPlayerName().equals(state.getMyPlayerName()) && subRegion.getEnemyNeighbors(state...
785dedd4-66a2-4603-b14b-dcf918ed4e22
3
static Object convertIfPromising(Object obj) { if (obj instanceof CycSymbol) { final String symbolName = ((CycSymbol) obj).getSymbolName(); if (symbolName.startsWith(CycVariable.META_VARIABLE_PREFIX) || symbolName.startsWith(CycVariable.NORMAL_VARIABLE_PREFIX)) { return new CycVari...
16ea483c-2bd6-40ae-afbd-4374a3e41b2e
3
public void tick() { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { Tile t = getTile(x, y); t.tick(this, x, y); } } for (Entity e : entities) { e.tick(); } }
6ece6f32-36d9-4325-bf02-3bf6c95cff9e
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 fe...
d03d41ed-708f-4201-a415-b867f8d6b8c2
8
private void readFrameBufferUpdate() throws IOException { readPadding(1); int n = readCard16(); // _console.writeline("reading " + n + " rectangles"); for (int i = 0; i < n; ++i) { int x = readCard16(); int y = readCard16(); ...
47d899ca-1df8-4dc9-b2a3-0008a41a7b5f
8
private JsonObject execute () { ProcessBuilder processBuilder; if ( execution.getStdin() != null ) processBuilder = new ProcessBuilder("/home/pod/app/"+execution.getActivityName()+"/main.sh", execution.getStdin()); else processBuilder = new ProcessBuilder("/home/pod/app/"+execution.getActivityName()+"/ma...
7045f758-bfc3-47e2-91b9-12848cd71519
2
public void setDefaultValues(String[] defaultValues) { if(defaultValues == null) { return; } if(this.defaultValues.length != defaultValues.length) { Out.err("Invalid amount of values for CLineArg(While setting the defaultValues): " + this.key); return; } System.arraycopy(defaultValues, 0, this.defaul...
c19ca533-9cf5-4053-97e2-66d394cb42ea
9
@SuppressWarnings("resource") public static void writer() throws InterruptedException, IOException { FileWriter logWriter = new FileWriter(new File(("log" + System.currentTimeMillis() + ".txt"))); MyArrayList cur = null; int reopenCnt = 0; while (true) { try { if (!graphQueue.isEmpty()) { synch...
5c099c47-c5cd-4133-ad06-a3035e35dcc9
6
@Override protected Msg xrecv (int flags_) { Msg msg_ = null; if (prefetched) { if (!identity_sent) { msg_ = prefetched_id; prefetched_id = null; identity_sent = true; } else { msg_ = prefetched_m...
b5e0a695-b2bf-4ecf-b101-4851a5b84f2a
1
public void readLines() { while (scan.hasNext()) { count++; processLine(scan.nextLine()); } scan.close(); System.out.println("winner:" + maxWord + " score" + maxScore + " Line number:" + maxLineCount); }
216c93ca-5560-4d13-b8dc-8225341cac55
8
Expr factor() throws IOException { Expr x = null; switch(look.tag) { case '(': move(); x = bool(); match(')'); return x; case Tag.NUM: x = new Constant(look, Type.Int); move(); return x; case Tag.REAL: x = new Constant(look, Type.Float); move(); return x; case Tag.TRUE: x = ...
97a1666b-e719-4527-b9d1-5fe28edcf6f2
0
public static void transferDataToResultView(ListDataOut obj, int[] selResultRows){ frames.getResultView().setData(obj, selResultRows); }
c0818f3c-f7dc-46e5-8949-623a7530b457
7
public static void method2() throws Exception { PronounDisambiguationDataReader pr = new PronounDisambiguationDataReader(); pr.deserializeData2(); NarrativeSchemaReader nsreader=new NarrativeSchemaReader(); ArrayList<NarrativeSchemaInstance> allInstances = nsreader.readSchema(6); // 6,8,10,12 // f...
a39fbb83-1120-4896-a09a-61532e11b85e
7
public Entity(int x, int y, int id){ NecroBotVariables = new VariablesAtTime(sysTime); this.x = x ; this.y = y; this.id=id; if(id==1 || id ==2){ // if the entity is a player this.default_FireRate = InformationExpert.PLAYER_DEFAULT_FIRE_RATE; this.fireRate = this.default_FireRate; this.default_Speed ...
11793fba-73c6-414a-a2fc-59f3c44c3952
1
private boolean register(Network handler, Handshake hs) throws IOException { String name = hs.name; if (clients.containsKey(name)) { // already contains a client with this name handler.send(new Message("", "A user with that name already exists. Try again with ...
005e0c33-dd9b-4233-9e6a-ac90322dcdff
0
@Override public String describeNode() { return "Frame:"+this.frameIdentifier; }
e8cee786-2c8e-41c5-b712-186631a200da
2
private static double rotate( double angle, double delta ){ angle += delta; if( angle > Math.PI ){ angle -= 2*Math.PI; } else if( angle < -Math.PI ){ angle += 2*Math.PI; } return angle; }
05a820e0-122e-4216-bfa3-e9154409f88f
3
public static ReflectObject addObject( Class<?> c ) { ReflectObject ro = objectMap.get( c ); if (ro == null) { ro = new ReflectObject( c ); if (listener != null) { listener.onReflectObjectCreate( ro ); } ReflectRe...
afeba685-52c4-4bd1-b239-60d489d9b8f0
3
public LifeStatus shouldALive(LifePosition lifePosition) { if(calculateLifeAround(lifePosition) == 3 || calculateLifeAround(lifePosition) == 2 && alive(lifePosition)) return LifeStatus.alive; return LifeStatus.dead; }
29f9eca0-6130-4bed-9a67-0ebc55f50ec1
0
public Ability getAdditionalAbility() { return additionalAbility; }
aa4b6a86-2809-4161-92ff-f46f42a4bb06
7
@Override public void keyPressed(KeyEvent arg0) { if (activo) { switch (arg0.getKeyCode()) { case KeyEvent.VK_UP: //Asrriba Snake.Arriba(); break; case KeyEvent.VK_DOWN: //Abajo Snake.Abajo(); break; case KeyEvent.VK_LEFT: //Izquierda Snake.Izquierda(); break; cas...
e22946a9-561c-43af-9b59-a3d203407972
6
public boolean testEnPassant(int oldX, int oldY, int newX, int newY) { if (((Chess.enPassantCapturer1X == oldX) && (Chess.enPassantCapturer1Y == oldY)) || ((Chess.enPassantCapturer2X == oldX) && (Chess.enPassantCapturer2Y == oldY))) { if (newX == Chess.enPassantX && newY == Chess.enPassantY) { board[Ches...
102c74f3-a71c-4cf2-8530-6583160e83c7
4
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof FilmModel) { FilmModel otherBook = (FilmModel) other; boolean isSameClass = this.getClass().equals(otherBook.getClass()); return (this.getTitle().equals(otherBook.getTitle())) && this.getDi...
885f4cb1-3502-48e4-867b-6cf8861b2a16
3
@WebMethod(operationName = "ReadInvoiceOut") public ArrayList<InvoiceOut> ReadInvoiceOut(@WebParam(name = "inv_out_id") String inv_out_id) { InvoiceOut inv_out = new InvoiceOut(); ArrayList<InvoiceOut> inv_outs = new ArrayList<InvoiceOut>(); ArrayList<QueryCriteria> qc = new Arr...
d80038b2-35bb-4a76-86dd-7a3a8759f419
8
public boolean execute() throws Exception { boolean result; Instances data; Instance filteredInstance; Instances filteredInstances; Instance filteredInstanceSource; Instances filteredInstancesSource; DataSource source; Filter filter; Filter filterSource; int i; r...
cd08e456-a2ee-4983-9b21-67a2b1a30969
1
public static boolean zip(String zip){ if(zip.matches("(\\d){5}(-(\\d){4})?")) return true; return false; }
0910a15d-d668-4252-9ab7-b56f7ac0bb9a
0
protected void initialize() {}
1887b00c-efd0-408e-9424-19011f5eaafa
6
public void addCarriage(RollingStock newCarriage) throws TrainException { if (train.size() == 0) { if (!newCarriage.getClass().getSimpleName().equals(LOCOMOTIVE)) throw new TrainException("First carriage must be a locomotive"); else train.push(newCarriage); } else if (newCarriage.getClass().getSimpleN...
c11e432d-ed1e-4bc8-bd58-1e1be598b33a
2
public byte[] getIconImageData() { if (Parameters.APP_ICON == null) return null; try { ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(Parameters.APP_ICON,"jpg",out); out.flush(); byte[] data = out.toByteArray(); out.close(); return data; } catch (IOException e) { Sy...
d6d0c092-100c-400a-920f-e7d823363f8d
1
private void initPopupMenu(){ popupMenu = new JPopupMenu(); ImageIcon itemDeleteIcon = new ImageIcon(Main.ICO_PATH + "table_row_delete.png"); JMenuItem itemDelete = new JMenuItem(" Delete ", itemDeleteIcon); itemDelete.addMouseListener(new MouseAdapter() { @Override ...
de6f2eb0-b0a3-4835-a374-f821dc8fb366
3
private int getLevel() { int level = 0; float y = 0; if(invader1.getEntityCount() > 0) {y = getLowestInvader(invader1);} else if(invader2.getEntityCount() > 0) {y = getLowestInvader(invader2);} else if(invader3.getEntityCount() > 0) {y = getLowestInvader(invader3);} else ...
0147d9fb-aa32-47e2-9d25-45aa7e2f690d
0
public LoginEvent(String login, String password){ this.login = login; this.password = password; }
e8a4bef6-bd45-4322-aca0-affff9d9298c
4
@Test //Test failed public void testOpenAccount() throws AccountExistsException, AccountDoesNotExistException { try{ setUp(); } catch (AccountExistsException e) { System.out.println("Account already exists"); } catch (AccountDoesNotExistException e){ System.out.println("Account does not exist"); ...
18ed1bdb-ae0a-4d26-a53d-4f18f0504a6c
3
public static Object copyObject(Object obj){ if(obj==null)return null; Object objCopy = null; try { // Write the object out to a byte array ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutp...
29b028fc-231d-49fe-91f3-f3b085ce1881
3
public void intControladorApaga(String nome) throws RemoteException, NenhumServidorDisponivelException, ObjetoNaoEncontradoException { //Delete object to the object list Integer id = objects.remove(nome); InterfaceReplicacao ir; boolean alive; //If there is not a object named nome, it throws exception ...
d3bee48c-5daf-4d9f-9c94-8697e054d40b
7
private List<TableColumn<Object, ?>> getLeaves(TableColumn<Object, ?> root) { List<TableColumn<Object, ?>> columns = new ArrayList<>(); if (root.getColumns().isEmpty()) { //We only want the leaves that are editable. if (root.isEditable()) { columns.add(root); ...
e37640ae-3c2d-4e5b-b05a-f6ab996927c5
0
@Override public int compareTo(Object o) { return 0; }
f833b4dd-e552-4c2f-9aeb-6a26845cc287
6
public boolean equals( Object other ) { if ( _set.equals( other ) ) { return true; // comparing two trove sets } else if ( other instanceof Set ) { Set that = ( Set ) other; if ( that.size() != _set.size() ) { return false; // different sizes, no need ...
0a05263c-57b3-4a2c-8388-95c2cf294dfb
2
public static boolean isBoolean(String line){ String upper = line.toUpperCase(); if(upper.equals("TRUE") || upper.equals("FALSE")){ return true; } return false; }
b164c911-8ba5-4c90-80cd-30f5778642d7
8
public void charger(Element partie) { videau = new Videau(Integer.valueOf(partie.getChildText("videau"))); switch(partie.getChildText("joueurEnCour")){ case "NOIR":joueurEnCour = CouleurCase.NOIR;break; case "BLANC":joueurEnCour = CouleurCase.BLANC;break; case "VIDE":joueurEnCour = CouleurCase.VIDE; ...
21bc0144-eb3e-4cd0-b6ef-365b89dbfdc7
5
public ArrayList<Integer> getNumberOfPagesInSelectedChapters(Term termRoot, ArrayList<Integer> selectedChapters) { PageRange range = termRoot.getExtendedRange(); ArrayList<Integer> ranges = new ArrayList<>(range.getRanges()); ArrayList<Integer> acceptablePages = new ArrayList<>(); for(int i = 0;i < selectedChap...
8703ea5d-0850-4926-b991-2f5cd62914ce
2
public void setCode(final byte[] bytes) { if (code != null) { code.setCode(bytes); if (Method.DEBUG) { System.out.println("Set code with " + bytes.length + " bytes"); // Thread.dumpStack(); } } }
cd1cec80-a2b8-438b-9015-1b91ea4e2daa
3
public void onMessage(Message msg){ System.out.println("Listined Message: " + msg.getSource() + " , " + msg.getContent()); String[] fields = parseMessage(msg); LockEventTypes eventTypes = LockEventTypes.valueOf(fields[0]); DistributedLock lock = manager.createLock(fields[1]); switch(eventTypes){ case A...
b18d554a-bf19-448d-a0be-a1bfea2a40d5
4
private void lowestSellPrice(){ if (Requests.isEmpty()) { highBuy = 0; } float lowest; lowest = meanSellPrice; for (Request RequestX : Requests) { if (RequestX instanceof SellRequest) { if (lowest < RequestX.getU...
8666839b-21c9-4d03-9f6d-4c44ee0b5c74
1
public boolean interlockCheck() { int confirm = JOptionPane.showOptionDialog(null, interlockCheckString, "Interlock Warning", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == 0) return true; else return false; }
811ea2d5-3a19-4fa6-9905-22a06a96e535
3
@Override protected Object decode (ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { input.setBuffer(buffer.array(), buffer.readerIndex(), buffer.readableBytes()); if (length == -1) { // Read length. if (buffer.readableBytes() < 4) return null; length = input.r...
f0683913-1a97-460c-9908-32974aa4fea1
8
public boolean sendAuthentication() throws IOException{ String str = new String("login"+ "," + usernameFld.getText()+ ","+ passwordFld.getText()); System.out.println(str); InetAddress serverAddr= null; try { serverAddr= InetAddress.getByName(GlobalV.serverIP); } catch (UnknownHostException e1) ...
95c79059-db56-46bb-bcc0-11e43ae74b01
8
public DefaultInventory(Trade instance, String otherPlayerName, int rows){ size = rows * 9; inventory = instance.getServer().createInventory(this, size, generateTitle(otherPlayerName)); acceptSlot = 3; refuseSlot = 4; statusSlot = 5; ownSlots = new ArrayList<Integer>(rows*4-1); otherSlots = ne...
87a0fc2e-9cb8-4de1-8736-507cd1792af0
3
private void btnAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirActionPerformed // Codigo de abrir archivo if (principal == null) { JFileChooser selector = new JFileChooser(); FileNameExtensionFilter filtro = new FileNameExtensionFilter("Archivos ...
f6c93b1c-30a8-40b9-9dd1-4c3f6fc5d68b
8
public static void clusteNouns(){ DBUtil db1 = new DBUtil(); Logger.getInstance().getElapseTime(true); String sql = "select * from extractions"; ResultSet rs1 = db1.executeQuerySQL(sql); try{ while(rs1.next()){ int sentIndex = rs1.getInt("sentindex"); String attr = rs1.getString("attr"); String...
ec41e11c-782c-4d42-b47f-a7b7368307cf
5
private void addAllAttributes( String shaderText ) { final String ATTRIBUTE_KEYWORD = "attribute"; int attributeStartLocation = shaderText.indexOf( ATTRIBUTE_KEYWORD ); int attribNumber = 0; while ( attributeStartLocation != -1 ) { if ( !( attributeStartLocation != 0 && ( Character.isWhitespace( shad...
a5feddd3-bdbc-4346-9d63-cfa7849a4a02
6
public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = ...
3cfe971c-403d-4134-ac71-99bf46ccd2d1
7
public AddTowerSprite(SceneView scene, GameInfoMenu info, Point position, boolean clickable, PlayerType playerType, int width, int height, TowerTypes towerType) { super(scene, -1, position,clickable,playerType,width,height); this.towerType = towerType; this.info = info; String fileName ="img/"; if(pl...
f783a96d-63d9-482c-95c4-816d608f9fcb
0
@Basic @Column(name = "LOG_TIPO") public String getTipo() { return tipo; }
a5ef9df5-460d-4101-a3d0-a3b31eeb581e
0
public void setPercent(double percent) { this.percent = percent; }