method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a11cde47-4fd4-48dc-927b-0163d7e387c9
9
public static Position getValidShiftPos(int index, int side) { if (index < 0 || index > 6 || index % 2 == 0) throw new IllegalArgumentException("Invalid index to insert."); if (side < 0 || side >= 4) throw new IllegalArgumentException("Invalid side of board"); int col = -1; int row = -1; switch (side...
8044a38c-fbea-4f04-9b6e-afffb7a5a0c5
8
@Override public Runnable getRunnable() { return new Runnable() { public void run() { long balance = dicer.getBalance(); if (balance < startingBet) { stop("Starting bet is higher than the current balance."); return; } BetResult result = dicer.bet(startingBet, 0.916f); while (running)...
3325e0d2-484f-496e-96b2-c56b84ffaafc
6
public void addString(String words) {// **Left == Less** if (root==null) root = new StringNode(words); else { StringNode temp = root; boolean notSet = true;//there is probably a cleaner way to implement this while (notSet) { //but I don't know it. ...
70fba4e4-8f5e-4402-af77-7916a4c8abb9
0
static boolean adjacent(Point from,Point to,int k){ return Math.abs(from.x-to.x)+Math.abs(from.y-to.y) <= k; }
7eb58478-92d5-4dfb-850d-92ba7d2f7222
4
public void writeEndElement() { try { level--; if (lastElement == Elements.OPEN_TAG || lastElement == Elements.ATTRIBUTE) { xmlWriter.write(" />"); elementStack.pop(); } else { if ...
3c5ac87e-1651-489c-b80e-ea1a8e15affe
0
@Override public void mouseExited(MouseEvent e) { }
0b7e3cba-b50f-4348-9408-e4e78f445a07
7
public String fetchSslRss(String urlToFetch) throws SslRssFetcherException, BadPaddingException, SocketTimeoutException, IOException { /* if (args.length != 3) { System.err.println("Syntax: x ca-cert.jks yourcert.p12 yourpassword"); System.exit(1); } ; String cacerts = args[0]; String mycert = args...
89e21dc3-8641-4a4b-a90f-97dbe18207b3
2
public void ImageSetNormalColor() { for (int y = 0; y < this.height; y++) { for (int x = 0; x < this.width; x++) { byte r = this.bytes[y][x]; byte g = this.bytes[y + this.height][x]; byte b = this.bytes[y + this.height * 2][x]; int pi...
c1c32b0f-e912-4e3d-aba7-a077035e99c5
2
@Override public void send(String message, Colleague colleague) { if (colleague == mColleagueA) { mColleagueB.update(message); } else if (colleague == mColleagueB) { mColleagueA.update(message); } }
d5888df8-4336-4790-8bc4-900ab359e92e
2
public void visitCallExpr(final CallExpr expr) { if (expr instanceof CallMethodExpr) { visitCallMethodExpr((CallMethodExpr) expr); } if (expr instanceof CallStaticExpr) { visitCallStaticExpr((CallStaticExpr) expr); } }
7ea0676b-fcbe-4fe5-a382-4d5d34259448
3
public double getTipForBaggeHandler() { double tip = 0.00; // always initialize local variables switch(serviceQuality) { case GOOD: tip = baseTipPerBag * bagCount * (1 + GOOD_RATE); break; case FAIR: tip = baseTipPerBag * bagCount ...
6b8c4a39-8251-4c69-83fb-ec053853c05c
3
public void drawPowerups(Graphics2D g2d, Powerup powerups[], int[] screen) { for(int i = 0; i < powerups.length; i++) { try{ if(powerups[i].living) { powerups[i].draw(g2d, screen, this); powerups[i].draw(g2d, screen, this); } } catch (NullPointerException e) { ...
9d1c50e6-e29e-43cc-9c5b-91f3aab1aa9b
5
public Address readAddress(JsonReader reader) throws IOException { String city = null; Number latitude = null; String street = null; Number longitude = null; reader.beginObject(); while (reader.hasNext()) { String key = reader.nextName(); if (key.equals("city")) { city =...
206937f5-aa58-43af-bd00-207a73de9d56
1
@Override public void addRecordToDB() { try { String statement = new String("INSERT INTO " + DBTable + " (userid, aid)" + " VALUES (?, ?)"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {"id"}); stmt.setInt(1, user.userID); stmt.setInt(2, achievement.id);...
a3d25b09-1d1d-4f26-8558-46a53b821773
3
public static void disableEvent(Cuboid c, CuboidEvent event) { if (c == null || event == null) return; if (!c.getEvents().contains(event)) return; c.getEvents().remove(event); }
b832ee75-b5cf-42d7-9c77-76c71b6345a4
4
public static void load() { String path = FilesUtil.settingsFilePath(); File f = new File(path); if (f.exists()) { try { Document doc = XMLBuilder.loadDoc(f); settings_.load(doc.getDocumentElement()); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStack...
170b0a87-cb3d-4b12-9a69-4ff88afaa5e9
8
@Override public void performButton(GameModel g) { if (!g.getSelectedUnit().hasAttribute("Attack")) { return; } AttributeAttack attack = (AttributeAttack) g.getSelectedUnit() .getAttribute("Attack"); if (attack.getAttacksLeft() < 1) { return; ...
03505760-9952-4d57-86dd-c588400a37cb
1
private void buildCityHall() { CityHall cityHall = new CityHall(); Point2D loc = new Point2D.Double((getSideLength()-1)/2, (getSideLength()-1)/2); try { addBuilding(cityHall, loc); } catch (InvalidLocationException e) { e.printStackTrace(); } }
181fa5e4-283a-4681-9a44-26e411ce5dc7
2
public void checkConsistent() { super.checkConsistent(); StructuredBlock sb = outer; while (sb != breaksBlock) { if (sb == null) throw new RuntimeException("Inconsistency"); sb = sb.outer; } }
b9b8fd0d-efeb-48f1-adfd-eef068da6083
6
public void processEvent(Event event) { if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); _itemHandles.remove(event.getHandle()); // update the handle list return; } ...
daf6ff24-5f85-4fe3-99cd-b2eb6deb6685
7
private int getContinueFlag(Row row, Map<String, Integer> posMap) { if (row == null) { return Constants.CONTINUE_BREAK; } Cell cell = row.getCell(0); if (cell == null) { return Constants.CONTINUE_BREAK; } String startFlag = cell.getStringCellValue(...
1b150918-6e32-45e0-8147-52e5b15133c8
2
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if(label.equalsIgnoreCase("spellcraft")){ if(sender instanceof Player){ Player p = (Player) sender; ItemStack i = new ItemStack(Material.STICK, 1); ItemMeta met = i.getItemMeta(); met.setDisplayName...
d1b2d9a8-f361-41ae-be1b-b425b631b852
7
public Color getColor(){ if (pos.equals("MISC")){ return Color.GRAY; } else if (pos.equals("PREP")){ return Color.PINK; } else if (pos.equals("DET")){ return Color.LIGHT_GRAY; } else if (pos.equals("ADJECT")){ return Color.BLUE; } else if (pos.e...
77abb197-97ca-4ef1-afdc-51adc2e8f81d
0
public boolean angreifen() { return false; }
8b09d9cf-e0ff-46e1-ba84-383d62552b57
2
private static Type[] convertTypes(final Class[] classes) { if (classes == null) { return (null); } final Type[] types = new Type[classes.length]; for (int i = 0; i < types.length; i++) { types[i] = Type.getType(classes[i]); } return (types); }
4a332873-43cd-4d5d-994c-733195aa426e
5
private void updateSong() { clear(); System.out.println("Update Song:"); System.out.println(""); try { ArrayList<Song> songs = smgr.ListAll(); printSongHeader(); for (Song s : songs) { System.out.println(s); ...
a6776545-b7c1-402f-af38-9fb5952e1357
5
public static void main(String[] args) { EdgeWeightedDigraph G = new EdgeWeightedDigraph(new In(args[0])); int s = Integer.parseInt(args[1]); BellmanFordSP sp = new BellmanFordSP(G, s); if (!sp.hasNegativeCycle()) { for (int t = 0; t < G.V(); t++) { System.out.print(s + " to " + t + " (" + S...
e8eae8c5-4a50-40df-a465-6ff897cecb38
0
public void setSide(int s) { side = s; }
6097e7a3-d754-4c46-8788-7238c0abbbbf
7
public void mouseClicked(MouseEvent mouseEvent) { Node selectedNode = treePane.getNodeAt((Graphics2D) treePane.getGraphics(), mouseEvent.getPoint()); if (!mouseEvent.isShiftDown()) { treePane.clearSelection(); } SelectionMode mode = selectionMode; if (mouseEvent.isAl...
220208b2-a762-4fd5-83b7-f7f606564370
3
protected Response authCramMD5(String user, String password) { Response response = doCommand("AUTH", "CRAM-MD5"); if (response.code == 503) return response; Mac mac; try { mac = Mac.getInstance("HmacMD5"); mac.init(new SecretKeySpec(password.getBytes(C...
986d81cd-1d06-4f33-8c45-ea09aee68767
2
public void setAgroFraction(double agroFraction) { if (agroFraction < 0.00 || agroFraction > 1) { return; } this.agroFraction = agroFraction; }
830e98cc-656b-416e-bfdd-d166098d9ae4
8
private void createListeners() { StringConverter<? extends Number> converter = new DoubleStringConverter(); resetValues(); /* initialize mediators */ ToolsSizeMediator tsMediator = new ToolsSizeMediator(); tsMediator.getCurTool().bindBidirectional(cbTools.valueProperty()); sSize.disableProperty().b...
076b2123-60ce-458c-bdba-a91b4b8f613a
3
private void execTetris( int dir ) { if ( dir == Block.TURN ) { _block.turn(); } else { boolean isFixed = _block.move( dir, this ); if ( isFixed ) { // ブロック固定SE再生 _fixSe.play(); // 次のブロックへ _block = new Block( this ); } // そろった行があれば削除 deleteLine(); //...
b8ab48a1-740d-4af6-897f-7d8b482b081c
7
private void permuteHelper(int[] num, int left) { if (left == num.length - 1) { ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < num.length; i++) { list.add(num[i]); } result.add(list); return; } ...
d3beff4f-baab-4207-9a8d-b879c54adc43
1
private static void copyTail(Object[] from, int fromStart, Object[] to, int toStart) { for (int i = fromStart; i < from.length; i++, toStart++) { to[toStart] = from[i]; } }
bcdad956-5bb2-4678-a311-486417ea6913
1
public RowMapper<?> getRowMapper() { return rowMapper; }
8026cc54-bd51-418f-83c8-4ddcdfb3e38f
5
public void removeSubject(DataRow row) { for(AbstractOpinion op : opinions) { if(op.getName().equals(row.getName())) { removeOpinion(op.row); } } boolean result = DataVector.getInstance().dbManager.remove(row); if(!result) ...
5e997902-1217-49d2-a59a-f4e05404241c
6
private void processDirectory(File current) { if (current.isDirectory()) { // process it recursively File[] subs = current.listFiles(new FileFilter() { Pattern pattern = Pattern.compile(".java|.xml|.png|.txt|.aidl|.mk"); public boolean accept(File file) { ...
c2081f1d-69ce-4ad5-9a40-ff1b7919e09d
1
public boolean isArray() { return clazz != null && clazz.isArray(); }
29d02d6c-1cb7-418d-9005-4f986ebf3000
2
public boolean isValidValue(Object potentialValue) { if (isAlternateValue(potentialValue)) { return true; } else if (potentialValue instanceof Boolean) { return true; } else { return false; } }
38522043-5ff1-4027-b5c6-a08cb7df0dba
5
public void updateAsScheduled(int numUpdates) { super.updateAsScheduled(numUpdates) ; if (! structure.intact()) return ; structure.setAmbienceVal(2) ; if (type == TYPE_NURSERY && numUpdates % 10 == 0) { final float decay = 10 * 0.1f / World.STANDARD_DAY_LENGTH, growth = ...
5affa4e8-5425-449f-bb32-2e082afef159
0
@RequestMapping(value = "/addTravelTripForm", method = RequestMethod.GET) public String addTravelTripForm(Model model){ model.addAttribute("newTravelTrip", new TravelTrip()); return "addTravelTrip"; }
07799382-8af1-421d-8f41-6bd3efe6385b
1
private static void db(final String s) { if (TypeComparator.DEBUG) { System.out.println(s); } }
e53adaae-33ec-4f4d-98b8-2c5a6eba0b26
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
e141bdfe-bd3c-4a3c-8e97-a25f0d5a941a
5
public void moveLeft() { if(!win && !m.getMap(p.getTileX() - 1, p.getTileY()).matches(pattern) && p.getTileX() != 0) { if(xOffset > 0 && p.getTileX() == xOffset + 10) { Board.xOffset--; p.move(-1, 0); } else { p.move(-1, 0); } } }
083eecf5-0d2e-4da1-90f7-c1da851764cf
8
protected void preservingSelection(Runnable updateCode) { if (!getPreserveSelection()) { return; } //If a check provider is present, it determines the state across input //changes. if(checkStateProvider != null) { //Try to preserve the selection, let the ICheckProvider manage //the ch...
e736029c-ac6d-4c60-b8f0-8b090d5ed818
7
public static CoordinateMatrix plane( Coordinate p, Coordinate d1, Double uStart, Double uEnd, Double uStep, Coordinate d2, Double vStart, Double vEnd, Double vStep) throws LengthException { assert uEnd > uStart; assert vEnd > vStart; assert uSt...
560e2106-c15d-4a70-96ce-0a2da0718d95
2
public double computeMaximumLikelihood(ArrayList<Integer> data) throws Exception { double heads = 0; double total = 0; for (Integer i : data) { heads += i; total += 1; } if (total == 0) { throw new Exception("data contains no points"); } return heads/total; }
8f1b514c-66e3-47f0-bc66-031b8e9d1bc2
3
public String get_balance() { String[] m = {}; m = _smsc_send_cmd("balance", ""); // (balance) или (0, -error) if (SMSC_DEBUG) { if (m.length == 1) System.out.println("Сумма на счете: " + m[0]); else System.out.println("Ошибка №" + Math.a...
d73967b2-d12d-4f18-975d-e7834e631e84
1
protected void calcDIR_FstClusHI() { byte[] bTemp = new byte[2]; for (int i = 20;i < 22; i++) { bTemp[i-20] = bytesOfFAT32Element[i]; } DIR_FstClusHI = byteArrayToInt(bTemp); }
e67520f5-0c8b-4c14-acd4-bd46ab8ba4d8
7
private synchronized void sendPacket() { if (flowList_ == null || flowList_.isEmpty() == true) { return; } // submits the first packet in the list Packet np = (Packet) flowList_.remove(0); boolean ping = false; // a flag to determine ping packet or not ...
88969f39-5621-43fa-90c7-738dada855a7
9
private static boolean cobasisJudgeIn(Term term, Vector vect) { boolean result = true; if (term.var != null) { return true; } else { boolean found = false; for (int i=0; i<vect.size(); i++) { Operation op = (Operation)vect.elementAt(i); if (op.equals(term.operation)) { found = true; } ...
14eb4f50-fe96-4851-8d3e-6966ffceafda
6
public void andamentoAtividade(Atividade atividade, String atividadeSelecionada) throws SQLException { Connection conexao = null; PreparedStatement comando = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement(SQL_UPDATE_ANDAMENTO_AT...
fb6e1130-d2ac-4696-ad46-1fc35e4d1a16
4
public void caretUpdate(CaretEvent e) { try { int testValue = Integer.valueOf(textField.getText()).intValue(); if ((testValue >= min) && (testValue <= max)) { textField.setForeground(darkGreen); setValue(testValue, false, true); } else { ...
c3d16478-9fe0-4fc0-b1d0-5eaccd6e379b
0
public int getY(){ return y; }
e43d1320-069c-4764-a00b-0f144e4c22f4
0
public int getAge() { return Age; }
43144c83-1fb0-4495-9aef-4f84b45d3d5a
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter(ACTION); List<MenuItem> updatedItems = null; MenuService ms = new MenuService(); if (action.equals("Delete"...
a4878553-6e48-49e1-bc23-6145cf9ddd22
2
public static Object zmq_getsockoptx(SocketBase s_, int option_) { if (s_ == null || !s_.check_tag ()) { throw new IllegalStateException(); } return s_.getsockoptx (option_); }
540f2546-89c5-4cba-b4db-c45658fc1363
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } else if (!(obj instanceof Time)) return false; else { Time rhs = (Time) obj; return ((this.hours == rhs.hours) && (this.minutes == rhs.minutes) && (this.seconds ==...
151ba3f7-102d-499b-8377-f9c60648e228
3
public void flush () { // The peer does not exist anymore at this point. if (state == State.terminating) return; if (outpipe != null && !outpipe.flush ()) { send_activate_read (peer); } }
645cd9fc-99b1-4a17-9640-e960fea2a759
0
public void setId(Integer id) { this.id = id; }
423ba7cd-c951-4626-a180-823ce0bacc3d
1
private void jTextFieldCmdCliQte3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldCmdCliQte3FocusLost mondecimal = new DecimalFormat("#######.00"); if (!(jTextFieldCmdCliQte3.getText().equals(""))) { int qte = Integer.parseInt(jTextFieldCmdCliQte3.getText().trim...
dc13b613-faf4-4a66-9d96-6a60b56a5535
5
public boolean isDuck(Position position){ if (position.getX() >= 0 && position.getX() < field.getXLength() && position.getY() >= 0 && position.getY() < field.getYLength()) { if(field.getItemType(position)=='D')return true; } return false; }
a9b7a9b4-9e74-4b4e-a6af-3ff1e77dbfe6
1
public boolean SetGiftReceived(String player, Date newdate) { String datestr = ""; if (newdate != null) { datestr = new SimpleDateFormat("yyyy-MM-dd").format(newdate); } String query = "UPDATE birthdaygift SET lastGiftDate=? WHERE player=?"; dbcon.PreparedUpdate(query, new String[]{datestr, player.toLowerC...
c46ae3d7-8b52-403d-be75-505dd3346b55
6
@SuppressWarnings("deprecation") public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("dm")) { Player p = (Player) sender; if (args.length == 0){ p.sendMessage(Prefix + "Plugin by DragonSephHD(Peace1333)"); } if (ar...
b777387a-6536-4ef8-b69f-d649cb924db2
6
@Override public int hashCode() { int result = id; result = 31 * result + (profileDescription != null ? profileDescription.hashCode() : 0); result = 31 * result + (birthDate != null ? birthDate.hashCode() : 0); result = 31 * result + limitPerDay; result = 31 * result + (useDe...
173896c2-7c34-4fb4-a82c-c8821c8bcf77
7
@Override public final String toString() { final StringBuilder result = new StringBuilder(); final boolean hasDate = this.hasDate(); if (hasDate) { result.append(String.format("%04d-%02d-%02d", this._yearValue_(), this._monthValue_(), this._dateValue_())); } if (this.hasTime()) { if (hasDate) { res...
abea9712-eb5b-4575-891a-fdf5ad66155f
9
@Override public void validaTipos() { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. this.asignacion.validaTipos(); this.expresionLogica.validaTipos(); this.incremento.validaTipos(); this.b...
6187ff2f-10fb-4fa1-a851-a5440f35cf2a
7
public void print(String s,AST t) { // assume less than 1000 nodes; no problem for csc 413 int num = t.getNodeNum(); AST decoration = t.getDecoration(); int decNum = (decoration == null)? -1 : decoration.getNodeNum(); String spaces = ""; if (num < 100) spaces += " "; ...
f79e4471-01cb-4606-986f-215cd62af2db
3
public void setGrid(Grid<T> newGrid) { Grid<T> oldGrid = world.getGrid(); Map<Location, T> occupants = new HashMap<Location, T>(); for (Location loc : oldGrid.getOccupiedLocations()) occupants.put(loc, world.remove(loc)); world.setGrid(newGrid); for (Location loc : occupants.keySet()) {...
6e2a60fb-ee69-4364-bd91-89763ed4119f
9
private Object getXmlObjectFromXmlSubnet(String id, XmlSubnet xmlSubnet) { for (XmlPlace xmlPlace : xmlSubnet.places) { if (xmlPlace.id.equals(id)) { return xmlPlace; } } for (XmlTransition xmlTransition : xmlSubnet.transitions) { if (xmlTransi...
6b359edb-f5d4-45c0-a6b1-c0b2b322bf9f
7
private void addConditional(Vector addTo, Location loc, int x, int y) { int newX = loc.x + x, newY = loc.y + y; if (newX < 0 || newX >= grid.length) { return; } if (newY < 0 || newY >= grid[0].length) { return; } if (grid[newX][newY] == Constants.F...
d05a92d8-2a27-4c86-8b68-352175c9e19a
4
@Override public void onKeyDown(int key) { if (currentScreen == null) return; if (currentScreen instanceof IReceiveKeyDownEvent) ((IReceiveKeyDownEvent) currentScreen).onKeyDown(key); for (IRenderable renderable : currentScreen.getComponents()) if (renderable instanceof IReceiveKeyDownEvent) ((IR...
bfa11d59-55f6-4d66-88ee-3259beeae3bd
1
public void resume() { for (ConnectionProcessor pipe : pipes) { pipe.resume(); } }
0dd93870-f6c3-42ea-86ff-346a84942dbd
3
public static Collection<Tracker> forTorrent (TorrentMetaInfo torrent) { Collection<Tracker> trackers = new ArrayList<>(); Tracker announceTracker = getSingleTracker(torrent.getAnnounce()); if (announceTracker != null) { trackers.add(announceTracker); } for (Set<Stri...
21774740-93fd-4847-95ad-d38f7b484c4b
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...
5de3ed31-6774-41a2-bc2c-1a26631ca2dd
8
public DriveEquation(Object id, Collection<Dimension> InputSpace, AbstractOutputChunkCollection<? extends AbstractOutputChunk> Outputs) throws InvalidFormatException{ super(InputSpace, Outputs); ID = id; if(!InputAsCollection.containsKey(ID)) throw new InvalidFormatException ("The input space MUST contain a ...
48b02192-f6ea-4882-88d6-3e912a8b2f27
0
public static MessageDialog getInstance() { return instance; }
cd4376f5-080e-4dc5-9b56-367eedb5ef1a
9
public CommandLine(String[] anArgArray) { args = anArgArray; boolean isSuccessful = true; //parsing the credentials from the args first try { cre1 = fetchCredentials(1); cre2 = fetchCredentials(2); System.out.println("Credentials parsed successfully"...
b5748d7f-20d7-4887-9867-886000040a29
5
private void start() { if (script == null) { return; } script.tree.clear(); script.status = ""; List<Node<LogBankOrganiser>> nodes = new ArrayList<Node<LogBankOrganiser>>(); nodes.add(new OpenBank(script)); final IBank.BankTab[] bankTabs = IBank.BankTab.values(); List<LinkedHashSet<Integer>> re...
0a0ff246-63d6-43b1-9620-01ca0802a6ef
1
public static void createDirectory(Path directory) throws IOException { if (directory == null) { IllegalArgumentException iae = new IllegalArgumentException("The directorypath is null or points to an invalid location!"); Main.handleUnhandableProblem(iae); } Files.createD...
46aace18-08d3-4cc1-b0e3-adafd826ced0
3
public synchronized int gridletStatus(int gridletId,int userId) { ResGridlet rgl = null; // Find in EXEC List first int found = gridletInExecList_.indexOf(gridletId, userId); if (found >= 0) { // Get the Gridlet from the execution list rgl = (ResGridl...
7e8aeabb-cfe7-46ab-83d6-f3667dc1b720
9
private static <T extends Element<U>, U> int getNextLocation(State<T, U> state, int classification) { int location = state.currInsertIndex[classification]; int classLowerBound = getLowerBound(state, classification); if (location < classLowerBound) { /* If the current class is full, we should re-classify in th...
bc6e714f-cd86-4c03-b2f0-4365deb603e1
6
public static void startupLogicMacros() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((...
06f48916-9d2a-4a4f-8156-847dd0d7593d
8
public static void main(String[] args) { @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); Integer d = Integer.parseInt(scan.nextLine()); ArrayList<Integer> numbers = new ArrayList<Integer>(); while (true) { String input = scan.nextLine(); if (input.equals("End")) { break; ...
76c220c1-83fe-4a19-96e3-fdc3ec5a9a7b
8
public static Direction decodeDirection(String dir) { dir = dir.toLowerCase(); Direction direction; switch(dir) { case "north": direction = Direction.NORTH; break; case "south": direction = Direction.SOUTH; break; case "west": direction = Direction.WEST; break; case "east": direction ...
e8276ce0-6f0c-4c65-9e65-c88464afb804
8
public void setPosicionJugador1(int x,int y){ if(x>=0&&x<8&&y<8&&y>0){ switch (pd.mapa_jugador1[x][y]) { case "SM": case "PA": case "AZ": System.out.print("POSICION OCUPADA"); System.out.println("OTRA CORDENADA"); ...
a240842b-a7a3-43ac-9287-566f85712e15
8
private List<ProcessNode> getNextActivitiesInAndBlock(ActivityNode lastMatchedNode) { List<ProcessNode> nextNodes = new ArrayList<ProcessNode>(); AndSplit matchingAndSplit = model.getContainingAndBlock(lastMatchedNode); if (matchingAndSplit == null) { return nextNodes; } for (ProcessEdge edge : model...
4731feb4-5e6b-4755-b07c-5d9655e08103
7
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(sender instanceof ConsoleCommandSender) { sender.sendMessage("§cYou're silly! Thinking that the console can join a game..."); return true; } Player p = (Player) sender; if(args.length>= 2) { ...
e02f9b4b-1511-4397-9925-baa7fae17316
6
public SumaManager() { try { connection = DriverManager.getConnection(url); statement = connection.createStatement(); ResultSet rs = connection.getMetaData().getTables(null, null, null, null); // sprawdzenie czy tabela istnieje while (rs.next()) { if ("Trumna".equalsIgnoreCase(rs.getString(...
9882829d-4ec3-4afe-9f3d-a7144644cd2d
9
private void autoload() { Thread t = new Thread(new Runnable() { public void run() { // Autostart from disk/prg autoText = getParameter("autostartCode"); autostartDisk = getParameter("autostartDisk"); if (autostartDisk != null) { autostartProgram = getParameter("autostartPGM"); if (autostartP...
11e3d097-eb61-4997-97d5-b20dfbf995e0
3
public void openFile( File file ) { try { Data.setInventoryFile( file ); Data.getView().setupTitle( file.getName() ); InventoryObjectDAO.setInventoryObject( Model.loadInventory( file ) ); Data.setInventoryLoading( true ); // prevents "Inventory Changed" from events during load Data.ge...
4b688110-d48d-4f86-b534-a704737335f7
2
public static boolean kingCheckedAfterMove(){ boolean retBool; if (retBool = isChecked(userColor, getXOfKing(userColor), getYOfKing(userColor), false)) { // Check if the resulting position leads to a check on the user's king if (kingPreviouslyChecked){ // Case when the user's king is checked in the turn before t...
6b4824d1-a51d-4bbf-8747-bacf2c280290
3
public void addController(SxController controller) { for (Class<?> c = controller.getClass(); c != SxController.class; c = c .getSuperclass()) { Method[] methods = c.getDeclaredMethods(); AccessibleObject.setAccessible(methods, true); for (Method m : methods) { genSetter(m, controller); } } }
d0bf899a-a602-47f0-9484-1b6ac74b1169
9
public void finalizeCellProcessing(){ // Unary Role Traverse. for (String state : parser.grammar.getStates()) { if (!cell.CKYTable.hasState(state, cell.i, cell.j)) continue; // state is the state that current span could be ScoreState previouScoreState = cell.CKYTable...
b7f99787-4226-4c02-b435-afb99ee82126
7
protected int[] getWrongAttr(int num){ int[] arr=new int[num]; for(int i=0;i<num;i++){ arr[i]=-1; } for(int i=0;i<num;i++){ do{ arr[i]=(int)(Math.random()*this.numEventAttributes); if(arr[i]==numEventAttributes){ ...
2bfc4d4c-63f9-4e41-acc7-2c44bd75f7db
0
public static void main(String[] args) throws ParseException { String dateString = "2010/01/01 00:00:00 000"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss SSS"); // Calendarに日時を設定し、getTimeでDateを生成すると設定した日時と1ヶ月ずれる Calendar calendar = Calendar.getInstance(); calendar.set(2010, 3, 1...
bde29548-3774-44cb-b4f0-477b767afbf2
0
public void setFoo2(T2 foo2) { this.foo2 = foo2; }
0a475c48-f16d-46d8-9423-aaf876d3c84b
2
public void exec() { try { ArrayList<HDD> hdds = util.getHarddisks(); for (int i = 0; i < hdds.size(); i++) { ArrayList<String> erg = util.networkCommand("df -h " + hdds.get(i).getDescription()); String [] foo = erg.get(1).split("\\s+ "); hdds.get(i).setSize(foo[1]); hdds.get(i).setFree(foo[2]);...
f7a547f1-88bb-45a0-bafe-2ff89836f009
7
public void flushImageCache() { Enumeration localEnumeration = this.images.elements(); while (localEnumeration.hasMoreElements()) { ImageTrack localImageTrack = (ImageTrack)localEnumeration.nextElement(); int i = checkImage(localImageTrack.image, this); int j = (i & 0x20) != 0 ? 1 : 0; ...