method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
be4fe4a9-415e-4f17-8a03-5fa99d6ebc62
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; if(affected==invoker) return true; final MOB mob=(MOB)affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to d...
d8a77c91-cc11-4ebf-af45-6e91d0ab9424
4
public static Dictionary getDictionary(String dictionaryName, int type) { Dictionary dictionary = null; switch (type) { case CHAR_DICTIONARY: dictionary = new CharDictionary(dictionaryName); break; case WORD_DICTIONARY: dictionary = new WordDictionary(dictionaryName); break; case WORD_LIST_DIC...
7b9995df-54ae-45e9-95ec-d7805a6b2c1e
8
public Server(int numOfPlayers, String filename, int portIn, int portOut) { try { game = new Game(numOfPlayers, filename); } catch (NullBoardException nbe) { System.out.println("Creating the game failed."); return; } System.out.println("Starting server..."); server = new com.esotericsoftware.kry...
3339eb43-26c4-4d36-9b9b-534d0b131164
2
public BlockType[][] getIntegers2D() { BlockType[][] newBoard = new BlockType[HEIGHT][WIDTH]; for (int row = 0; row < board.length; row++) { for (int col = 0; col < board[row].length; col++) { newBoard[row][col] = board[row][col]; } } return newBoard; }
642f9331-8c4a-49c2-8a86-59e420ec32e1
8
public boolean getvar(String stat) { String first = "", second = "", relation = ""; boolean check = false; for (int i = 0; i < stat.length(); i++) { if (stat.charAt(i) == '=' || stat.charAt(i) == '>' || stat.charAt(i) == '<') { check = true; relation += stat.charAt(i); continue; } if (ch...
7ea0e559-0ca3-4850-a179-0c492a09eb48
2
public static void main(String[] args) { @SuppressWarnings("resource") Scanner input = new Scanner(System.in); double x = input.nextDouble(); double y = input.nextDouble(); Path2D path = new Path2D.Double(); Double corX[] = { 17.51 ,12.51, 12.51, 17.51, 17.51, 20.01, 20.01, 22.53, 22.53 }; Double ...
eb13bf36-1dfd-497d-96d9-f9d6adab57b5
0
public int compare(Object o1, Object o2) { Person pa1 = (Person) o1; Person pa2 = (Person) o2; return pa1.score - pa2.score; }
a2031f8d-cd25-435b-a0b4-f73cd28fffa9
5
public void tick() { super.tick(); if(!remove) { if(!level.blockFree(this, true ,0) || !level.blockFree(this, true ,1) || !level.blockFree(this, true ,2) || !level.blockFree(this, true ,3)) { remove = true; } else { ...
e3552443-bdd1-489f-8474-a19a5f700a11
1
public void generarEquipos(PriorityQueue<Inscripcion> primeros10Ordenados){ if(this.cantidadTotalInscriptos()<10) throw new NoHay10InscriptosParaGenerarEquiposException("No se puede generarEquipos pq no hay 10 jugadores "); criterioParaDividirEquipos.dividirEquipos(equipo1,equipo2,primeros10Ordenados); ...
e49e8549-646f-4fe0-978c-ef2417632317
7
private void calculateRanges() { roomsMin = 1000000; roomsMax = 0; areaMin = 1000000; areaMax = 0; int a = 1, r = 0; for (int i = 0; i < dwellings.size(); i++) { if (dwellings.get(a).getArea() < areaMin) { areaMin = dwellings.get(a).getArea(); ...
649fe5d9-d6bc-4da9-b9ea-ce6032e08309
5
public void buyClicked() { if (amount.value() == 0) { return; } boolean found = false; for (core.GroupOfUnits u: hero.getUnits()) { if (u.type == unit) { u.setNumber(u.getNumber()+amount.value()); found = true; pay(); break; } } if (!found) { if (hero.getUnits().size() == 6) { ...
bd2458d1-9ec6-4cf4-8e4f-1ad984f2f106
4
private static byte[] getUnicodeBytesFromOp( Ptg op ) { byte[] strbytes = null; if( op instanceof PtgRef ) { BiffRec rec = ((PtgRef) op).getRefCells()[0]; if( rec instanceof Labelsst ) { strbytes = ((Labelsst) rec).getUnsharedString().readStr(); } else if( rec instanceof Formula ) { str...
5c8d30e4-f0dc-4ad1-8f53-5bb2d539539b
5
private Session(boolean b) { if (b) { debug = true; } else { debug = false; } debugMode("=== CREATION OF GLOBAL KEYS ===", true); // ==Q== debugMode("Creating global key Q .......... ", false); globalKeyQ = new BigInteger(160, 20, new SecureRandom()); debugMode("[OK]", true); // ==P== debug...
eed99b17-7cc7-4a6e-af86-6f5125432d0e
0
public CheckResultMessage checkSum5(int i,int j){ return checkReport1.checkSum5(i,j); }
d33e95cd-d264-4e12-ae06-91d013ea5f8f
3
private void setupFonts() { UIManager.put("ToolTip.font", new FontUIResource(currentFont)); UIManager.put("Table.font", currentFont); input.setFont(currentFont); comboBox.setFont(currentFont); btnCompile.setFont(currentFont); btnRun.setFont(currentFont); btnStepThrough.setFont(currentFont); fileMenu....
9787be45-1665-4f63-86a8-2a9127137de0
2
private static boolean isEqual(Object o1, Object o2) { if (o1 == o2) { return true; } else if (o1 != null) { return o1.equals(o2); } return false; }
44e4169c-46a0-4f66-bff0-a27a69244693
6
public StringTemplate getLocationName() { if (settlement == null) { Settlement nearSettlement = null; for (Tile tile: getSurroundingTiles(NEAR_RADIUS)) { nearSettlement = tile.getSettlement(); if (nearSettlement != null) { int x = getX(...
e21a09d9-60d0-4600-a017-19f38eea38ce
7
private void merge(int left, int middle1, int middle2, int right) { int leftIndex = left; int rightIndex = middle2; int combinedIndex = left; int[] combined = new int[data.length]; System.out.println("merge: "+subarray(left, middle1)); ...
17f77a1a-e0fb-487a-80a7-303da98364a5
5
public void addBookType(BookType bt) { Connection conn = null; PreparedStatement ps = null; //Do nothing if book type is not properly instantiated if(bt == null) return; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); //Insert attribute...
c75a6b8b-a24a-4c48-a393-0bb43b538d73
8
@Override public boolean start(Player player) { if (player == null || node == null) { return false; } if ((ingredients == null && rawIngredient == null) || otherItem == null) { return false; } if (ingredients != null) { this.slot = ingredients.getSlot(otherItem.getId()); if (slot == -1) this....
31a145c0-055d-4f9b-b571-4a457f433ee8
5
public static void createAppData() { File f = new File(System.getenv("APPDATA") + "\\OneFlower"); if (!f.exists() || !f.isDirectory()) { f.mkdirs(); } String[] filenames = new String[] { "HardModeLock.data" }; for (String i : filenames) { File j = new File(f, i); if (!j.exists())...
6d91520d-1aca-4f41-926f-02251b56a93d
5
public void process(int number) throws ParseException, SQLException { switch (choice) { case 1: enterModel.add(); break; case 2: enterModel.delete(); break; case 3: enterModel.search(); break; case 4: ...
6b4f4944-2840-4ed1-8e56-ed045e4483e6
5
public String toString() { String retStr = "-----------------\n"; for (int i = 0; i < _board.length; i++ ) { if (i != 0) { retStr += "\n"; } for ( int n = 0; n < _board[i].length; n ++ ) { retStr += "|"; if (_board[i][n] == 1) { retStr += "x"; } else if (_board[i][n] == 2) { ...
829e6931-e4a0-47fd-ada2-2af33244d320
5
private static BigFraction fromByteArray(byte[] b){ int numeratorSign = 0; int denominatorSign = 0; byte[] numeratorArray; byte[] denominatorArray; BigInteger numerator = BigInteger.valueOf(0); BigInteger denominator = BigInteger.valueOf(0); int i = 0; int j = b.length; if(b[0] == -1){ nu...
bcc67317-323e-4328-8238-c8d09f8fed61
8
public boolean isOuter() { if (classType instanceof ClassInterfacesType) { ClassInfo clazz = ((ClassInterfacesType) classType).getClassInfo(); ClassAnalyzer ana = methodAnalyzer.getClassAnalyzer(); while (true) { if (clazz == ana.getClazz()) return true; if (ana.getParent() == null) break; ...
4d395305-e817-43e2-a0ac-2927ee725251
1
private void txt_codigo_laFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txt_codigo_laFocusLost if (txt_codigo_la.getText().length() > 3) { JOptionPane.showMessageDialog(null, "El codigo de linea aerea no es válido", "Mensaje", JOptionPane.WARNING_MESSAGE); txt_codi...
0f2d36fe-fbbb-4119-a6fe-714f2fdfd11a
2
public List<?> listAll(Class<?> clazz) { String simpleName = clazz.getSimpleName(); String hql = "from " + clazz.getName() + " " + simpleName; return getSession().createQuery(hql).list(); }
c50ae81e-adea-4816-b9a6-97f50e92a3b0
9
public void readNumber() { boolean hex = false; int start = column - 1; /* special case for hex numbers */ if (line.charAt(start) == '0' && line.charAt(column) == 'x') { column++; hex = true; } while (column < line.length()) { char c = line.charAt(column); if (!Character.isDigit(c)) { ...
31cdc7cd-a0ef-423b-a7be-da659789cb8c
7
protected Map<String, String> getVariables(Element element) { Map<String, String> map = new HashMap<String, String>(); String attributeName = element.getAttribute("name"); String attributeValue = element.getAttribute("value"); if (attributeName.length() != 0 || attributeValue.length() != 0) { if (attributeN...
1e1d1338-043d-4b5e-9d50-24d32d9381e4
9
public static ArrayList<Trip> parseDeparturesXML(String xml) { ArrayList<Trip> departures = new ArrayList<Trip>(); try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = db.parse(new InputSource(new StringReader(xml))); ...
06d8f01a-8603-4a81-a029-c65201eec7f4
5
public static String[][] run(String train, String[]test2) { int k = 3; // read the train file //String inputtrainf="IrisTrain.csv"; //String inputtestf="IrisTest.csv"; String inputtrainf=train; //String inputtestf=test; ArrayList<String> trainLis...
39d76dcd-643c-484c-9e64-57a2eb43fa04
2
public boolean checkEnoughStock() { ProductDAO dao = DAOFactory.getInstance().getProductDAO(); int id; for (ProductInBasket product : basket.values()) { id = product.getProduct().getId(); if (product.getQuantity() > dao.findProductStock(id)) { return false; } } return true; }
ec2f0a29-424e-410e-b26a-dbf13dfd7cd5
8
@Override public boolean mouseUp(Event e, int x, int y) { if (x >= 120 && x <= 285 && y >= 170 && y <= 245) Main.getInstance().resume(); if (x >= 420 && x <= 520 && y >= 170 && y <= 245) Main.getInstance().endGame(); return true; }
223dd940-a41e-45c4-8b79-55501104f679
1
public boolean Apagar(FormasPagamento obj) { try{ PreparedStatement comando = banco.getConexao() .prepareStatement("UPDATE tipos_pagamento SET ativo = 0 " + "WHERE id = ?"); comando.setInt(1, obj.getId()); comando.executeUpdate(); ...
d7a144c2-0d9b-4a8d-9a32-c193547e2279
6
public static boolean checkFeedback(String s_id, String i_id, int o_id) { try { Connection conn = global.getConnection(); PreparedStatement pStmt = conn.prepareStatement("select student_id from takes where offering_id = ? and student_id = ?"); pStmt....
e6ffa251-f9b0-4637-940f-aef5dcaef815
2
private void pauseGameThread(boolean pause){ synchronized(gthread){ try { if (pause) gthread.wait(); else gthread.notify(); } catch (InterruptedException ex) { System.out.println("Failed to pause/start gthread!!!"); } } }
dc603812-71e0-4267-8d8f-52659138b054
3
public int[] sort(int[] rawArray){ if(rawArray.length == 1){ return rawArray; }else{ int center = rawArray.length/2; int[] LArray = new int[center]; int[] RArray = new int[rawArray.length - center]; for(int i=0; i<center; i++){ LArray[i] = rawArray[i]; } for(int i=center; i < rawArray.lengt...
1c031f4b-b0b3-4a3d-ba82-7314084ecfc4
3
private ArrayList<Chunk> getGrownVillageChunks() { ArrayList<Chunk> grownVillageChunks = new ArrayList<Chunk>(); chunksLock.readLock().lock(); try { for (Chunk c : chunks) { if (c.hasVillage() && c.getVillage().getGrowth() != 0) { grownVillageChunks.add(c); } } } finally { chunksL...
e4570554-3e05-4cf2-b3f9-11f8924176a2
0
public int[] getSortedTarget(){ return target; }
e5b4ffad-ab1f-4547-b178-ff8f14254bc1
3
public static void move(int column) { switch(column){ case 0: cell0 = MainClass.currentXorO + "|"; break; case 1: cell1 = MainClass.currentXorO; break; case 2: cell2 = "|" + MainClass.currentXorO...
b008b6d9-87bf-4012-b14a-359b8173cd61
5
public static void fetchCategory(final String categoryName) { Thread thread = new Thread() { @Override public void run() { super.run(); Category category = categories.get(categoryName.toLowerCase()); String updateString = ""; ...
472ba83d-722e-4767-b6c0-b5e64bda831e
9
public static void main(String[] args) { Zoo aZoo = new Zoo(); ZooInterface aZooInterface = new ZooInterface(); Scanner userInput = new Scanner(System.in); String user_input; do { aZooInterface.displayOptions(); user_input = userInput.nextLine(); ...
af3aa74c-5c67-4b85-a69b-c2765c8dd40e
3
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Seed:"); String seed = scanner.nextLine(); System.out.println("SizeX: (Max: 24)"); sizeX = scanner.nextInt(); System.out.println("SizeY: (Max: 80)"); sizeY = ...
56fdc5a9-77ce-4906-b996-f08024697ff7
3
private void acao170() throws SemanticError{ if(idAtual instanceof IdentificadorMetodo){ if(tipoMetodo != null){ if(leVar){ leVar = false; throw new SemanticError("Só variáveis/parâmetros podem ser lidos"); } } else { throw new SemanticError("Esperava-se método com tipo"); } } else { ...
8a584ef5-4610-4da5-9d8d-c08e73628cf5
1
public void testGetLastAttempt() { Board board = new Board(); board.setGridLine(DefaultValues.DEFAULTATTEMPTCOMBINATION1, DefaultValues.DEFAULTANSWERCOMBINATION); board.setGridLine(DefaultValues.DEFAULTATTEMPTCOMBINATION2, DefaultValues.DEFAULTANSWERCOMBINATION); board.setGridLine(DefaultValues.DEF...
3064a7d8-0b63-42ea-9577-f1ceec927e47
7
@Override public void ParseIn(Connection Main, Server Environment) { if (!Main.Data.IsStaff()) { return; } int RoomId = Main.DecodeInt(); Room Room = Environment.RoomManager.GetRoom(RoomId); if (Room == null) return; Environment.InitPacket(5...
94a99a06-1e5e-4b3d-93e5-4658a6af27bf
3
@SuppressWarnings("static-access") @EventHandler(priority = EventPriority.HIGH) public void onPlayerDamage (EntityDamageByEntityEvent event) { Entity entity = event.getEntity(); Entity damager = event.getDamager(); if (entity instanceof Player) { if (damager instanceof Skelet...
4d72b194-a4b3-4291-908c-6cfc6a09fa6b
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
df3e9e42-acd4-4ab1-a052-5d31cda7386e
7
private void closeConnection(ArrayList<Connection> cons, ArrayList<PreparedStatement> pstatements, ArrayList<ResultSet> resultsets) { //This is where all the "tidy'd" up Connections, preparedStatements and ResultSets go to die (and get closed). try { //Not all methods produce ResulSets, so c...
f8995d9e-70e5-4a99-b17a-a5be3d2229a2
3
private static String toString(String paramName, Object o, boolean required) throws BadConfig { if (o == null) { if (required) throw new BadConfig("Parameter \"" + paramName + "\" is required"); return null; } if (!(o instanceof String)) throw new BadConfig("In parameter \"" + paramName + "\", value ...
842ae69b-bc0c-461b-a16c-1a2471792c4a
6
public int compare(Object o1, Object o2) { int r; if ( o1 == null && o2 == null) { r = 0; } else if ( o1 == null ) { r = -1; } else if ( o2 == null ) { r = 1; } else if ( o1 == o2) { r = 0; } else if ( o1 instanceof Comparab...
76824862-7c52-44c6-8a46-d7e18a2d44fb
7
boolean isAttributeSetDifferent(AttributeProperties[] configurationAttributes, AttributeSet attributeSet) { final ObjectSet objectSet = attributeSet.getObjectSet("Attribute"); // Ist die Menge vorhanden? Sie muss vorhanden sein! if(objectSet == null) { _debug.finer("Die Menge ist nicht vorhanden, muss aber vo...
791a5f2f-f1d1-4935-90c6-b10c5625265d
7
public void testCreationWithFilter2() { List<Message> msgs=new ArrayList<>(20); for(int i=1; i <= 20; i++) { Message msg=new Message(null, i); if(i <= 10) { msg.setFlag(Message.Flag.OOB); if(i % 2 == 0) msg.setTransientFlag(Mess...
76d1062b-389d-424c-8cf9-bb759b93c2e2
8
public String toString() { switch (this) { case SENSE: return "Sense"; case MARK: return "Mark"; case UNMARK: return "Unmark"; case PICKUP: return "PickUp"; case DROP: return "Drop"; case TURN: return "Turn"; case MOVE: return "Move"; case FLIP: return "Flip"; default: // ...
060b7f81-9838-45a4-b552-4a1f007d061e
5
@SuppressWarnings("boxing") @Override public LinkedList<Character> search(Node problem) { frontier.clear(); //clear previous nodes from previous puzzles etc Map<String, Integer> map = new HashMap<>(); addToFrontier(problem); //start pq with first node while (!frontier.isEmpty()) { Node node = removeFromFro...
8e6f6406-ba0c-41f2-97f9-e5ab3c3ce277
7
public static CharacterMatcher newCharacterMatcher(BitSet characterSet) { if (characterSet.isEmpty()) return new CharacterMatcher() { @Override public boolean match(int c) { return false; } @Override ...
a384390e-fa14-44de-96a2-f8d9d19a0d40
6
private void generateGrid(int width, int height){ for(int y=0; y<height; y++){ for(int x=0; x<width; x++){ Vertex v = this.grid.get(new Coordinate(x,y)); if(x>0){ this.graph.connect(v,this.grid.get(new Coordinate(x-1,y)),1); } ...
1ac9d818-f3b2-4664-8af5-d767f54730b6
6
public ArrayList<Node> readPajek(String file){ ArrayList<Node> nodes = new ArrayList<Node>(); String line; String[] parts; int s; int d; int n; try { BufferedReader in = new BufferedReader(new FileReader(file)); line = in.readLine()...
45de99d9-5b32-4a8b-8069-4def5d1aa251
6
@Override public UBLEntry build() throws UBLParseException { UBLEntry entry = new UBLEntry(); Object uuidNode = m_entryNode.get("uuid"); if(!(uuidNode instanceof String)) { throw new UBLParseException("Entry node has an incorrect UUID node: " + m_entryNode); } St...
2f5d34e8-48ab-4135-a58e-0b91a5a7d354
4
public void update() { lock.lock(); for(Object eObj : networkTreeMap.entrySet().toArray()) { Entry<Byte,TreeSet<Byte>> e = (Entry<Byte,TreeSet<Byte>>)eObj; Byte n = e.getKey(); if(e.getValue().isEmpty()) { this.removeNode(n); } } HashMap<Byte,LinkedList<Vertex>> paths = findAllPaths(); nextHop...
df855232-3f9a-4b0c-91d5-89cdc0a049f7
1
public void decliner() { this.enDeclin = true; joueur.declinerPeuple(this); if (this.territoiresOccupes.size() == 0) { joueur.pertePeupleEnDeclin(); Partie.getInstance().remettreBoite(this); } }
a22cd2bd-7dda-47da-9b53-39d9dc219fb5
9
public int totalCards(ArrayList<String> cards, int total, String who){ total = 0; if (who.equalsIgnoreCase("player")){ for (String card: cards){ total += getCardValue(card, total); if (player.acesReduced == 0 && hasAce(cards) && total > 21){ total -= 10; player.acesReduced++; } } }e...
9da0843c-0dc8-4e7d-9624-f049be8b7cd3
1
public void resendAll() { setKills(kills); setDeaths(deaths); setKit(kit); setMoney(money); setKillstreak(killstreak); for (The5zigModTimer timer : timers) { timer.sendRequest(getPlayer()); } }
523e1881-d661-4f1e-ab81-601f9da64cc9
2
public static AstronomicalObject findById(int id, StarSystem stm) { List<AstronomicalObject> elements = stm.getElementsAsList(); for (AstronomicalObject element : elements) { if (id == element.getId()) { log.info("Object found by ID:{}", id); log.info("{}", e...
5bbe9995-b0ac-4574-86d1-570c9fb0cfca
6
public boolean match (Position p) { try { String s=R.getBracket(P); if (s==null) return false; char a[]=s.toCharArray(); for (int i=0; i<a.length; i++) { if (p.end() || a[i]!=p.get()) return false; p.advance(); } return true; } catch (Exception e) { return false; } }
465c7ad4-25f8-442d-bdb0-54fc56d124ed
8
void printLink(PrintWriter pw) { final String ent1h; final String ent2h; if (chiral) { ent1h = htmlLink(link.getEntity1()); ent2h = "<i>" + StringUtils.unicodeForHtml(link.getEntity2().getCode()) + "</i>"; } else { ent1h = "<i>" + StringUtils.unicodeForHtml(link.getEntity1().getCode()) + "</i>"; ent...
63bc6f38-295f-47d2-bac3-77a250d90d51
2
public boolean setdia(int dia) { if(dia>0&&dia<32) { _dia=dia; return true; } else return false; }
af3c739d-6efd-4d46-b864-8e4dd23bab87
8
public void calculateExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime = 0; ...
f51281a9-011f-4390-8e85-41faa8707707
4
@Override public void recieveEvent(Event event) { if (event.getEventType() == EventType.INPUT && !event.isHandled()) { String input = (String) event.getData(); for(String trigger : triggers) { if(input.contains(trigger)) { emit(ne...
181d22e9-fdf4-45b9-8bf9-4b83e64fb28e
7
@Test public void test() { MarineControlJProxy proxy = new MarineControlJProxy(); proxy.initialize(); MProxyInterface echoInterface; echoInterface = new EchoInterface(); proxy.attachInterface(echoInterface); try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch b...
61282651-d92d-4d62-99b8-8835de019c77
2
private void getResult() { DecimalFormat df = new DecimalFormat("0", DecimalFormatSymbols.getInstance(Locale.ENGLISH)); df.setMaximumFractionDigits(340); String s = this.expression.getText(); if(!this.answer.getText().isEmpty()) { s = s.replace("Ans...
2351a315-2917-4259-b5ce-795365c1c7b1
9
private boolean updateFile(StringTokenizer st) throws IOException { if (isRegistered() == false) { os.write("ERR: You are not registered yet.".getBytes()); return false; } if (st.hasMoreTokens() == false) { os.write("ERR: Empty filename.".getBytes()); return false; } String fileName = st.nextToken...
92181ca8-7d05-457e-a03f-629f3726b836
5
* @param shift the number of rows by which to shift the cell */ private static void shiftCellRow( BiffRec cell, int shift ) { int newrow = cell.getRowNumber() + shift; cell.setRowNumber( newrow ); // handle per-record special cases switch( cell.getOpcode() ) { case RK: ((Rk) cell).setMulrkRow( new...
6d886c4a-2bd3-49aa-8c6b-6fcbb77d39f0
8
@Override public void setStat(String code, String val) { if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0) CMLib.coffeeMaker().setGenItemStat(this,code,val); else switch(getCodeNum(code)) { case 0: setPowerCapacity(CMath.s_parseLongExpression(val)); break; case 1: setPowerCapacity(CMath.s_par...
c78ecd3d-0edb-4c5f-8c8f-bd24e719f941
2
public ArrayList<Drop> generateDrops() { Drop drop = null; DropChance dropChance = null; ArrayList<Drop> drops = new ArrayList<Drop>(); for (int i = 0; i < dropChances.size(); i++) { dropChance = dropChances.get(i); drop = dropChance.generateDrop(); i...
c23b2ed8-3ee1-4ab6-964b-fb4b4b35640b
6
public boolean insert(T[] values) { synchronized(lock) { if(values==null || values.length==0) { System.out.println("Insert item is empty..."); return false; } TrieNode<T> currNode = root; for(int i=0;i<values.length;i++) { T current = values[i]; if(current == null) { System.out.pr...
21d3066c-f752-44c8-a252-b3ca6a38f272
1
private void saveResults() { Boolean saved = DbAccess.saveResults(quiz.quizDBId, selectedAnswers, user.dbId); if (saved) { QuestionPanel.setBackground(Color.green); } }
00c2ae87-006a-4745-b553-d496decec8a4
1
public void recalculate() { this.color = Color.avgColor(colorSet); if ( getSize() > maxSize ) maxSize = getSize(); }
228a8f86-d263-498d-920b-613ab8e7a52b
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; CharacterComponent other = (CharacterComponent) obj; if (c != other.c) return false; return true; }
e1ce7d2d-c266-40b5-843d-9c8f1c5a36f2
5
public static void main(String args[]) throws Exception { WordFreq solution = new WordFreq(); solution.table = new Hashtable<String, Integer>(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //System.out.println("Input the number of terms to add."); solution.n = Integer.parseIn...
80088b63-c134-4368-9997-9b2112c4d19a
2
public static void addElement(ElementField element, Sprite sprite) { if (element != null && sprite != null) { _elements_sprite.put(element, sprite); } }
cc3ed673-cddb-4211-9a49-46599aea5630
6
public void Solve() { int[] triangles = new int[_length + 1]; for (int i = 1; i < Math.sqrt(_length); i += 2) { for (int j = 2; i + j < Math.sqrt(_length); j += 2) { if (Euler.Gcd(j, i) == 1) { int sum = Math.abs(j * j - i * i) + 2 * i * j + i * i + j * j...
662d1e81-9d75-4951-a669-49c67a588bac
3
protected void fireTreeNodesRemoved(Object source, TreePath treePath, int[] indexes, Object[] objects) { // Guaranteed to return a non-null array Object[] listeners = this.listenerList.getListenerList(); TreeModelEvent e = null; // Process the listeners last to first, notifying // those that are interested in...
bcd2d5d1-8b3b-40cd-a1e6-1834cdc54d49
9
private void printAttrs(Out fout, int indent, Node node, AttVal attr) { if (attr != null) { if (attr.next != null) printAttrs(fout, indent, node, attr.next); if (attr.attribute != null) printAttribute(fout, indent, ...
79daf920-4b1a-4879-b4e5-841db0b37493
4
public void fillAndRemoveFromUserLists(JList uList, JList userOnTaskLlist, ArrayList<User> userOnTask) throws SQLException, IOException { DefaultListModel model = (DefaultListModel) uList.getModel(); DefaultListModel modelOnTask = (DefaultListModel) userOnTaskLlist.getModel(); model.clear(); ...
45db8d41-5c87-4580-ad5e-40f350c41962
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Fridge other = (Fridge) obj; if (temperature != other.temperature) { retu...
2a58847e-15d1-455f-9a4e-87988c1189eb
1
private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { JSONObject jsonResponse = new JSONObject(); try { jsonResponse.put("path",getServletContext().getRealPath(getInitParameter("init-config"))); response.getWriter().write(jsonResponse.toString()); ...
53a4a3d2-2a3a-46ef-958c-67ae674db44f
0
public double getZ() { return z; }
acf838b9-557c-49a5-a1fd-6705922b4d07
7
public int findKthLargest(int k){ if(k==1){ return arr[0][0]; } int length=arr.length; if(k>(length*length)){ return -1; } int temp=k; for(int i=0,j=0; temp>0 ; ){ System.out.println("i :"+i +" and j :"+j); if(arr[i][j+1] > arr[i+1][j]){ i++; if(i>=length){...
45a73ac8-88dd-42ee-bd55-de04828b7e73
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
196bdc38-f4eb-4467-941d-791df0c5676e
3
public boolean isBasicValid(String s) { boolean valid = true; System.out.println("String is:" + s); System.out.println("Length of said String is:" + s.length()); for(int i = 1; i <= s.length(); i++) { if(!isNumber(s.substring(i - 1, i))) { ...
f4423154-54c5-4f88-84cc-f5889545c014
8
private void initializeDebuffSpinners() { // Set to use the debuffSpinnerModel debuffTopLeftSpinner = new JSpinner(DEBUFF_SPINNER_MODEL); debuffTopCenterSpinner = new JSpinner(DEBUFF_SPINNER_MODEL); debuffTopRightSpinner = new JSpinner(DEBUFF_SPINNER_MODEL); debuffBottomLeftSpinner = new JSpinner(DEBUFF_SPINN...
c2577f1b-81a4-484a-9a58-6994d7be3ce4
8
static void indexDocs(IndexWriter writer, File file) throws IOException { // do not try to index files that cannot be read if (file.canRead()) { if (file.isDirectory()) { String[] files = file.list(); // an IO error could occur if (files != null) { for (int i = 0; i < files.length; i++) { ...
b91da165-3128-4a89-b402-e81a923fe156
9
@Override public void update(int tick) { target = getTargetVector(); if (onFire && tick % 3 == 0) frame = (frame + 1) % 4; Vector dif = target.clone().sub(pos); if (dif.getLength() > speed) dif.setLength(speed); angle = (float) Math.atan2(dif.y, dif.x); pos.add(dif); if (canSetOnFire && !o...
376551ab-75f9-47d9-9ec8-6770d1ddb478
2
public void doA02(MsgParse mp) throws SQLException { if (!mp.visit.getPatient_class().isEmpty()) try { //get the current location from the visit table for patient //update table -- prior location gets value of current location //update table -- cu...
1871f56d-d583-478e-8656-539e710fb55a
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Room target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("The waters here are already bloody.")); return false; } if(!CMLib...
b1d67aea-82d2-460b-a7cd-cade495c9348
0
public String getName() { return Name; }
e6454789-9724-43f9-9b9c-40b28ee1284f
0
public boolean validate(double balance){ return balance >= this.money ; }
200b983d-af8e-4c44-a6fc-a273f6aab24d
6
@Override public void run() { while (!isInterrupted()) { if (Movement.queueHasElements() && Movement.queueHasNextElements()) { currentJob = Movement.getNextElementInQueue(); deamon.setJob(currentJob); while (!currentJob.isComplete()) { if (currentJob.getMovementType() == Type.DRIVE) { //...
e3e2c9b2-c695-492c-918e-0fd2f9d3978b
3
public Color calculateColour(double progress) { if (colours.size() < 2) { throw new IllegalStateException("There are not enough colours in this colour scheme!"); } // Return single colours for minimum and maximum divergence if (progress <= colours.firstKey()) { ...