method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e34d8543-5f29-4a3d-94e2-daa5db484b67
4
public void hitOnSplit(int deckNum) { // 1 - Left Deck -- 2 - Right Deck Card card9 = (Card)deck.pop(); Card card10 = (Card)deck.pop(); int temp1 = card9.getValue().getValue(); int temp2 = card10.getValue().getValue(); if(deckNum == 1){ splitDeck1.add(card9); splitTotal1 += temp1; split1CardIma...
7d609cb3-5d5d-4729-a28e-9979c72190e1
6
public ItemStack removeFromItem(ItemStack item) { ItemMeta meta = item.getItemMeta(); if (meta == null) return item; if (!meta.hasLore()) return item; List<String> metaLore = meta.getLore(); // Make sure the enchantment doesn't already exist on the item for (String lore ...
f1187258-a979-4673-bf55-9e5999a2042f
6
public static int lengthOfLastWord(String s) { int len = s.length(); if (0 == len) {return 0;} int i = 0, j = 0; for (i = len - 1; i >= 0; i--) { if (' ' != s.charAt(i)) break; } if (0 > i) return 0; for (j = i; j >= 0; j--) { if (' ' == s.charA...
7f337a16-3584-459d-9379-7b8bbeb51fa8
0
public long getId() { return Id; }
cbe2e13c-29e4-4c8f-a658-70666fdf1412
8
public void actionPerformed(ActionEvent e) { ArrayList ms = craft.getMissiles(); /*Block b = (Block)blocks.get(1); Block c = (Block)blocks.get(2); Block d = (Block)blocks.get(3); Block f = (Block)blocks.get(4); */ for(int i=0; i<ms.size();i++) { Miss...
7a71459d-3538-43f1-bf79-6809c0a414d4
1
public void setPos6(int val){ if (val == 1){p6 = true;} else { p6 = false; }}
d115e11d-49d7-42b0-8551-583d3e1f52ef
4
@Override public List<Player> selectPlayerofMatchByCourtByDayByHour(int terrain, int day, int heure) throws SQLException, IOException { connexionDB = ConnexionMysqlFactory.getInstance(); ResultSet rs = null; List<Player> lp = new ArrayList<>(); Statement st = connexionDB.createStatem...
ebfe09c2-b614-4384-b8d0-dbab69dcc039
8
protected void dataCheck() { // Check for NoPickup default if (DisguiseCraft.pluginSettings.nopickupDefault) { data.add("nopickup"); } // Check for player name if (type.isPlayer() && data.isEmpty()) { data.add("Glaciem"); } // Check for block data if (type == DisguiseType.FallingBlock) { ...
bb80c841-54e2-4eb0-aad0-069749663384
6
private void setGradient(DenseTensor M, int i, int r, double coeff, float[] M1, float[] M2) { if(KL) { setGradientKL(M, i, r, coeff, M1, M2); return; } //double newVal = M.get(i, r) - step_size * coeff * M1.get(r) * M2.get(r); float newVal = (float)(M.get(i, r) - step_size * coeff * M1[r] * M2[r]); ...
1a65c438-c322-4b09-abc5-e01b518b1910
8
void RadixSort(int array[]) { int digits, i, j, k, ind, max = 0; ArrayList<ArrayList<Integer>> buckets = new ArrayList<ArrayList<Integer>>(); //find number of max digits for(i=0; i<array.length; i++) { digits = FindDigits(array[i]); max = max<digits? digits:max ; } digits = max; System.out.pri...
999667f0-936f-4a87-a2ab-3031e24b4836
3
public ConsoleVisualizer(GameBoard gameBoard) { this.gameBoard = gameBoard; printBoard(); GameResult result = GameResult.UNDETERMINED; while (result == GameResult.UNDETERMINED) { MoveDirection direction = getPlayerMove(); if (gameBoard.canMove(direction)) { result = gameBoard.move(direction); } ...
2de66d46-a7c9-4a64-8e1d-97c70a17e53a
2
public void compress(int array[]) { char symbol; StringBuilder str = new StringBuilder(); for (int item : array) { item += 150; symbol = (char) item; str.append(item); if (mydata_str == null) { mydata_str = Character.toString(symbol...
9134d157-a664-4c15-86e9-8889ca5a2c49
5
@Override public void dragExit(DropTargetEvent dte) { if (mDragWasAcceptable) { if (mModel.getDragColumn() != null) { dragExitColumn(dte); } else { Row[] rows = mModel.getDragRows(); if (rows != null && rows.length > 0) { dragExitRow(dte); } } } else if (mAlternateDragDestination != ...
8eb3c616-57a2-4c23-af92-1bf8c4975de4
5
@Override public synchronized void drop(DropTargetDropEvent dtde){ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); Transferable t = dtde.getTransferable(); File f = null; Object data = null; try { data = t.getTransferData(DataFlavor.javaFileListFlavor); } catch (UnsupportedFla...
bfdfe8ec-e2d3-4eef-a4f5-31b736f25eae
0
public Method getRequestMethod() { return requestMethod; }
20d03f90-8277-4da0-abc7-0a2f3155b535
6
private Contact mapToContact(String csvContactStr) { String[] contactStrs = StringUtils .commaDelimitedListToStringArray(csvContactStr); if ((contactStrs.length != 3) || (contactStrs[0].isEmpty()) || (contactStrs[1].isEmpty()) || (contactStrs[2].isEmpty())) { LOGGER.debug("EMPTY entry: {}", csvContactSt...
f69d5c99-93d7-48d3-bc1e-4b5c09d3fcf1
1
private EncryptedCard encryptCard(Card card) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (e == null) { System.err .println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)"); return null; } String encCardData = String.valueOf(card.cardTy...
664ab49d-62fb-4557-89c6-a1e62611f7c9
8
protected double itemPriceFactor(Environmental E, Room R, String[] priceFactors, boolean pawnTo) { if(priceFactors.length==0) return 1.0; double factor=1.0; int x=0; String factorMask=null; ItemPossessor oldOwner=null; if(E instanceof Item) { oldOwner=((Item)E).owner(); if(R!=null) ((Item)E)...
58e29257-d09f-45e4-9860-7c96ea6c4898
3
private void initCouleur(){ switch(couleur){ case BLANC : setBackground(Color.WHITE); setForeground(new Color(200, 200, 200)); break; case NOIR : setBackground(Color.GRAY); setForeground(new Color(20, 20, 20)); break; } if(finale){ setBackground(Color.RED); setForeground(Colo...
8778ff9c-4130-41e5-9d28-dd0dd1484c91
2
protected Object decode( ChannelHandlerContext chc, Channel chnl, ChannelBuffer cb, DecoderState state ) throws Exception { switch ( state ) { case READ_LENGTH: length = cb.readInt(); checkpoint( DecoderState.READ_CONTENT ); ca...
a28ad8f8-5332-49a2-919f-1aa8b7037a12
9
public static void loadDbTableDataFromFile(DbSchema schema, DbTable table, Element etable) throws WaarpDatabaseSqlException, IOException { int read = 0; VitamReader reader = schema.identifier.getReader(); Element erows = DocumentFactory.getInstance().createElement("rows"); switch (table.type) { case CSVTYPE:...
8dfa16fd-dbcf-4ab1-b15b-3074bce2d107
6
@Override public void setStackInSlot(int slot, ItemStack stack) { if(stack != null) if(!stack.getItem().equals(Items.grease)) return; if(inventory[0] == null) inventory[0] = stack; else if (stack == null && inventory[0] != null) inventory[0] = null; else if(inventory[0].getItem().equals(stack.g...
de285cbe-729d-45ba-953d-48e6fd618651
2
public boolean handleRecord(Core root, GedcomRecord record, GedcomReader reader) { String tag = record.getTag(); if (tag.equalsIgnoreCase("CONC")) { ((Note) root).concatenateText(record.getContent()); return true; } else if (tag.equalsIgnoreCase("CONT")) { ((Note) root).continueText(record.getContent...
edde614d-ce2f-4c09-b23b-98cc8df5009f
8
public LabelStatement(SourceFile sourceFile, int lineNo, Token[] tokens) throws SyntaxError { // Super-class (Statement) constructor super(sourceFile, lineNo, tokens); // First token must be a label if(tokens[0].is(TokenType.LABEL)){ addressJump = false; }els...
0233c9a0-8433-4647-baac-fe557a06cf0f
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
db26fd94-c06d-44b7-917a-4026002ca0f2
9
public static boolean isConnected(List<Interval> list, Interval i1, Interval i2) { Vector<Vector<Integer>> adjList = new Vector<Vector<Integer>>(); Interval interval1, interval2; Vector<Integer> tempList; // Build adjacency list for (int i = 0; i < list.size(); i++) { interval1 = list.get(i); tempLi...
77e98d99-48b6-49ac-aabe-ac765afe4e66
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
f9edd013-4c97-4e30-a87c-2ffb19eb1972
4
public void stopTest(String userKey, String testId) { if (userKey == null || userKey.trim().isEmpty()) { BmLog.debug("Test cannot be stopped, userKey is empty"); return; } if (testId == null || testId.trim().isEmpty()) { BmLog.debug("Test cannot be stopped, t...
b3b12182-3304-4ebb-8037-f748ab749760
5
public void setEmail(String email) { List<Account> accounts = getAccounts(); Account newAccount = null; if (accounts!=null) for (Account account : accounts) { if (mailto.equals(account.getService())) { account.setAccountName(email); newAccount = account; break; } } else { newA...
3fdb7fea-e3e9-44c7-9d7f-4919e791f9d7
2
public static Connection getConnection(){ String DBDRIVER = "com.mysql.jdbc.Driver"; String DBURL = "jdbc:mysql://localhost:3306/bookdb"; Connection connectioncon = null; try{ Class.forName(DBDRIVER); connectioncon = DriverManager.getConnection(DBURL,S1,S2); }catch(ClassNotFoundException...
60dfe0e6-bfec-435b-9079-12d64e91755f
9
@Override public void acceptButtonActionPerformed() { String selectedNames[] = ds.getSelectedData(); String[] v = predLevel.getText().split(" "); double [] confidence = new double[v.length]; for(int i=0;i<v.length;i++) confidence[i] = Double.parseDouble(v[i]); if(selecte...
8f6eb306-ae18-41f8-8eda-9623d68bbde3
3
@Override public int getNumBounties() throws DataStorageException { Set<String> keys = this.config.getConfigurationSection("bounties").getKeys(false); int bounties = 0; for (String key : keys) { try { Integer.valueOf(key); ConfigurationSection sec...
f35e0305-c99b-4896-a343-dea7d40e0da7
6
public void setExits(Room north, Room east, Room south, Room west, Room top, Room bottom) { if (north != null) { exits.put("north", north); } if (east != null) { exits.put("east", east); } if (south != null) { exits.put("south", south); ...
729a5300-1be3-48aa-bd1b-965323c74ad3
9
private void world_test() { // ex. ansi, true // ex. prompt, "< %mode %h/%H %m/%M %state >" // ex. prompt_enabled, true /** * World/Game/Setting Test Cases * * Fallout Equestria (foe.txt) [Fallout] * Forgotten Realms (db.txt) [Dungeons and Dragons 3E?] * * NOTE: It is strongly advised to ...
e4014505-82b2-48bd-968c-705529f59b39
6
@Override public void update() { // to handle animation and other stuff super.update(); // AI stuff goes here double dist = Math.sqrt(Math.pow(Map.getPlayer().getX() - x, 2) + Math.pow(Map.getPlayer().getY() - y, 2)); if (dist < 64 && dist > attackRange) { ...
6062b9cc-b4e3-42a1-a573-8ad8cf1e7042
4
public void saveProducts(){ if(strat != null){ Iterator<Product> productIterator = this.iterator(); while(productIterator.hasNext()){ try { Product p = productIterator.next(); strat.writeObject(p); } catch (IOException e) { e.printStackTrace(); } } try{ strat.close(); ...
2b9bc5a7-2189-4fdf-a2c6-44627fe549e9
7
public void run() { boolean allBytesRead = false; while (!done) { int nBytesRead = 0; byte[] abData = new byte[2048]; while (nBytesRead != -1 && !done) { try { nBytesRead = ais.read(abData, 0, abData.leng...
ac90a2ba-e6fa-4b2e-9a54-4aa05e1a0f76
8
public String preReportByType() { List<ClassObj> lstClass = mdClass.getAll(); List<ObjectiveObj> lstObjective = mdObjective.getAll(); List<TopicObj> lstTopic = new LinkedList<TopicObj>(); if(lstObjective.size() > 0){ lstTopic = mdTopic.getByObjective(lstObjective.get(0).getOb...
3dd7bef6-cc60-45af-bff4-3ccc6c60ce1a
4
* @return an array of version ids */ public int[] getVersionsForGroup( short group ) { HashSet<Short> descendants = new HashSet<Short>(); if ( group != Group.TOP_LEVEL ) descendants.add( group ); getDescendantsOfGroup( group, descendants ); ArrayList<Integer> chosen = new ArrayList<Integer>(); for ( in...
9b0340ba-bade-4075-9b07-9ce3c9981c76
2
private void travelTree(TreeNode node, List<Integer> result) { TreeNode left = node.left; TreeNode right = node.right; //travel left if(null != left) travelTree(left, result); //travel right if(null != right) travelTree(right, result); //record result.add...
80aaec46-3566-48bf-b086-8fd0a6c8ef07
4
public boolean remove(int x, int y, Piece piece) { if (! pieceFits(x, y, piece)) return false; Pos center = piece.getCenter(); int cx = x - center.x; int cy = y - center.y; for (int px = 0; px < piece.getWidth(); px++) { for (int py = 0; py < piece.getHeight(); py++...
b9706c13-c9c8-4a2f-b12f-fb90feb9e654
1
@Override public JSONObject getValueForOutput() { try { return this.appt.toJson(0); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new JSONObject(); } }
83639146-1647-4cf4-b99f-526915ec2f97
1
public int Count(String statment){ ResultSet rs=null; Statement stat; try { stat = this.conn.createStatement(); rs=stat.executeQuery(statment); rs.next(); return rs.getInt(1); } catch (SQLException e) { e.printStackTrace(); return 0; } }
fb8c2571-fcb0-438c-be93-9c2b53bb4bd4
0
public void accept(OperationVisitor visitor){ visitor.visit(this); }
de42d07f-7236-4fa6-b3a7-49882bf71cbb
5
public void paintCursor(Graphics g) { if (cursorState && hasFocus()) { switch (cursorType) { case CURSOR_OVERSTRIKE: case CURSOR_INSERT: int x = cursorX * getCharWidth(); int y = cursorY * getCharHeight(); g...
267c9873-c1c9-44eb-8cc0-ef641c57c83b
6
private void loop() { Thread thTmp = Thread.currentThread(); Socket sckTmp = null; while(! thTmp.isInterrupted()) { try { sckTmp = this.ssck.accept(); sckTmp.setSoTimeout(EzimNetwork.dtxTimeout); EzimContact ecTmp = EzimContactList.getInstance().getContact ( ((InetSocketAddress) sc...
7ed0b95c-5248-4b5d-992d-5306556bd47a
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)) &&(msg.targetMinor()==CMMsg.TYP_GET) &&(msg.target() instanceof Item) &&(((msg.tool()==null)||(msg.tool() instanceof MOB)))) { final MOB m...
afe431f5-7dda-41d1-9e4f-a3e6de6242d1
3
@Override public CommandBase getCommand(String... alias) { if (alias.length == 0) { return this; } CommandBase cmd = this.commands.get(alias[0].toLowerCase()); if (alias.length == 1) { return cmd; } if (cmd instanceof Dispat...
fcda4046-f208-4185-ba1a-6ebe9955a31b
1
public static void main(String[] args) throws Exception { // InvokeTester test = new InvokeTester(); // System.out.println(test.add(1, 2)); // System.out.println(test.echo("tom")); //获取类的class对象 Class<?> classType = InvokeTester.class; //生产类的实例对象 Object invokeTester = classType.newInstance(); Sys...
38913e74-ed14-426a-b6b1-9c12a126ce27
9
public void method212(boolean flag, int j, int k, int l, int i1, int j1) { int k1 = 256; if(flag) k1 += 0x20000; l -= anInt290; i1 -= anInt291; if(j1 == 1 || j1 == 3) { int l1 = j; j = k; k = l1; } for(int i2 = l; i2 < l + j; i2++) if(i2 >= 0 && i2 < anInt292) { for(int j2 = i1; j...
6a29b10d-9f06-4dc5-9978-b0e988f6c5ee
2
private DatabaseConnection() { // Eigenschaften String password = "4xd3"; String user = "j81"; // String password = ""; // String user = "root"; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://loc...
07a1bc71-17df-480c-a299-1af60e5f221e
5
private void tbListaAdvogadosKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbListaAdvogadosKeyReleased System.out.println("Clicando"); if(evt.getKeyCode() == KeyEvent.VK_SPACE ){ try { concluido = true; this.dispose(); } cat...
668264ac-f1ae-473a-b594-f89d63c8c3ab
9
void draw(Graphics g) { int segments = 16; int i; int ox = 0; int hs = sim.euroResistorCheckItem.getState() ? 6 : 8; double v1 = volts[0]; double v2 = volts[1]; double v3 = volts[2]; setBbox(point1, point2, hs); draw2Leads(g); setPowerColor(g, true); double segf = 1./segments; int divide = (int) (segments*p...
ee510d7e-7123-45e7-8425-f93c5e9adc41
5
public Collection<DepartamentoDTO> buscarTodos(){ Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; try { con = UConnection.getConnection(); String sql = "SELECT * FROM departamento LIMIT 10"; pstm = con.p...
82c0fa2b-1be6-4f0b-ae4a-befa5ceb1a12
9
private void campoConstantes() { if (tipoDoToken[1].equals(" inteiro") || tipoDoToken[1].equals(" booleano") || tipoDoToken[1].equals(" real") || tipoDoToken[1].equals(" cadeia") || tipoDoToken[1].equals(" char")) { String tipoVar = tipoDoToken[1]; if (!acabouListaTokens()) { ...
b66d6639-c02f-45e0-8ef5-ce13a1784dab
7
public void insertStudentBooking(int studentId, int eventId, int seatRequested) { ResultSet rs=null; Connection con=null; PreparedStatement ps=null; try{ String sql="INSERT INTO STUDENT_EVENT_BOOKING(s_id, eventId, no_of_tickets) VALUES (?,?,?)"; con=ConnectionPool.getConnectionFromPool(); ps=con.pr...
1ac7d4c8-b272-46a7-b501-9ab411525378
6
public static void main(String[] args) throws Exception { //get the instance of the IClient interface final ITesterClient client = TesterFactory.getDefaultInstance(); //set the listener that will receive system events client.setSystemListener(new ISystemListener() { @Overri...
e3a49de9-1e4b-42a4-b487-ec77f677c987
0
protected void onSetChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) {}
d4682c04-9f3f-4063-91ae-556093b82ac1
7
*/ public void extendParent(Object cell) { if (cell != null) { Object parent = model.getParent(cell); mxGeometry p = model.getGeometry(parent); if (parent != null && p != null && !isCellCollapsed(parent)) { mxGeometry geo = model.getGeometry(cell); if (geo != null && (p.getWidth() < ge...
6a4b4079-d744-4c9f-845e-8448945efe75
1
private void generateHardwareSystemAlternatives() { int alternatives = 1; int possibilities[] = new int[project.getHardwareSets().size()]; int repetitions[] = new int[project.getHardwareSets().size()]; int i = 0; for (HardwareSet hws : project.getHardwareSets()) { alternatives *= hws.getHardwareSetAlternat...
ad655493-82d7-4f6e-afdc-c7ae45a0494c
2
public boolean isEmpty() { if (x == 0 && y == 0) return true; return false; }
7a9270d8-1073-4402-aaaf-7240bbac9ad9
0
public static int findSquareOfMaxOdd(List<Integer> numbers) { return numbers.stream() .filter(NumberTest::isOdd) //Predicate is functional interface and .filter(NumberTest::isGreaterThan3) // we are using lambdas to initialize it .filter(NumberTest::isLessTha...
cce5a000-807b-4a71-aedc-1566dff44b87
1
public void updateType() { if (type != Type.tVoid) updateParentType(subExpressions[0].getType()); }
f82ccf2d-49cb-43ee-a798-5329788fb5e4
0
@Test public void deleteWorksAtMiddle() { initializeWithABC(); l.delete(b); assertEquals(a, l.pred(c)); assertEquals(c, l.succ(a)); }
988dc2ef-dcb8-4295-a0ef-6c487c24db2a
8
public int checkWinner (char[][] board) { //board[0][0] == board[1][1] == board[2][2] == 'O' or 'X' if (board[0][0] == board[1][1] && board[1][1] == board[2][2]) { return board[1][1] == 'O' ? 1 : 2; } //board[2][0] == board[1][1] == board[0][2] == 'O' or 'X' if (board[2][0] == board[1][1] && board[1][1] ==...
ad57dc55-8ce0-4016-82f2-15744a8573d0
2
private static void readInConnection(Core output, Document xml, String updateId) { if (xml.getElementsByTagName(SOURCE).getLength() != 0) { long target = Long.parseLong(xml.getElementsByTagName(SOURCE).item(HEAD).getTextContent()); output.recibirConnectionPhase1(target, updateId); ...
decb4512-8243-41f7-9a19-d2a9b1f176be
5
protected void tickEntities() { for(int i = 0;i<entities.size();i++) { Entity e = entities.get(i); if(e != null) { // if(!(e instanceof EntityPlayer)) { e.world = this; e.tick(); ...
f3e9f209-4c36-4abc-a921-33636644ea6e
9
private String[] extractDispositionInfo(String aLine) throws IOException { String[] retval = new String[3]; String myline = aLine.toLowerCase(); // get content disposition -- should be "form-data" int start = myline.indexOf("content-disposition: "); int end = myline.indexOf(";"); ...
2c9198b9-ed1d-4563-a0e9-f454316d25c2
2
@Override public String readStatus(String str) throws Exception { BufferedReader reader = null; try { String urlString = "https://login.skype.com/json/validator?new_username=" + str; URL url = new URL(urlString); reader = new BufferedReader(new InputStreamReader(u...
bac9158f-31c7-4dd2-9b9a-20b54d70c3c9
6
public static void printTree(TreeNode root, int height){ if(root.isLeaf()) height--; else{ for(int i = 0; i<height; i++){ System.out.print("|"); System.out.print(" "); } } if(!root.isLeaf()){ if(root.getChildren()[0].isLeaf()) System.out.print(getLableName(root.getTestAttribute())+" = ...
d12a31fc-962e-4f1a-ba6d-2b914619bd37
6
private void gameRender() { // draw background g.setColor(new Color(255, 255, 255)); g.fillRect(0, 0, WIDTH, HEIGHT); // g.setColor(Color.BLACK); // g.drawString("FPS : " + averageFPS, 10, 10); // g.drawString("Bullets :" + bullets.size(), 10, 20); // draw bloodsplatter for (int i = 0; i < bloodsplatte...
4d0083c8-a1ce-4869-bcf5-8a8201b33147
8
public void setOptions(String[] options) throws Exception { String tmpStr; String[] spec; String classname; tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { spec = Utils.splitOptions(tmpStr); if (spec.length == 0) throw new IllegalArgumentException...
328cb584-6194-4c89-9b7a-505854e9ece3
0
public boolean hasArg() { return !peek().isEmpty(); }
f2ff00af-bafd-49e9-8723-d3927bd80864
4
public boolean isActive() { if (this.context == 0) { this.context = -1; try { if (getAppletContext() != null) this.context = 1; }catch (Exception localException) {} } if (this.context == -1) { return this.active; } return super.isActive(); }
c3ffab69-f2f0-43cf-951a-e0bb009349d9
0
public int getTargetIndex() { return this.targetIndex; }
5b6c109f-e4d2-456d-ab17-0cbe24089095
0
@Basic @Column(name = "CTR_FECHA") public int getCtrFecha() { return ctrFecha; }
b33168ff-d38d-4a32-afaf-e159cebcf13a
9
public boolean move(MoveType type, int numUnits) { Vec2D moveVector = new Vec2D(); switch (type) { case MOVE_LEFT: moveVector.set(0, -numUnits); break; case MOVE_RIGHT: moveVector.set(0, numUnits); break; case MOVE_DOWN: moveVector.set(numUnits, 0); break; } // //C...
cd0e7ffc-2cf0-4741-80e8-e09c0ea9ea67
1
public static Property constructPropertyByType(String name, String value){ Property property = constructBlankPropertyByType( name); if(property != null){ property.setValue(value); return property; } return null; }
d10529f3-026f-4b5f-a7b9-6b82e5fde74a
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("This place is already desecrated.")); return false; } if(!super...
0257b9cd-413e-4789-a093-3d888c96e333
3
@Override public String toString() { return "image "+(this.pictureType==null?"":"("+this.pictureType+ ")/") + (imgHeight>0 && imgWidth>0 ? (""+imgHeight+"x"+imgWidth):"?x?"); }
d7e69cc5-042c-4995-b4b1-428440539857
3
public static void expand() { Node root = readTrie(); // read in encoding trie int N = BinaryStdIn.readInt(); // read in # of chars for (int i = 0; i < N; i++) { Node x = root; while (!x.isLeaf()) { if (!BinaryStdIn.readBoolean()) x = x.left; // 0 else x...
fc735a83-222d-423a-91f7-060aa2afe5b7
5
private void update(DocumentEvent event) { String newValue = ""; try { Document doc = event.getDocument(); newValue = doc.getText(0, doc.getLength()); } catch (BadLocationException e) { e.prin...
2465ba3a-5db6-4a4d-815f-96a23cad4a7b
3
public static String stats(){ StringBuilder sb = new StringBuilder(); for (Node node : getElements()) { String prev = node.getPrevious()!=null ?node.getPrevious().getKey():"Null"; String next = node.getNext()!=null ?node.getNext().getKey() :"Null"; sb.append("\nKey: "+node.getKey()+", previo...
4f047653-ed7a-478c-8969-4798b32e3447
1
public static int PoissonRandomNumber(double lambda){ RandomGenerator rand = new RandomGenerator(); double l = Math.pow(Math.E, -lambda) , p = 1; int k = 0; do{ k++; p = rand.nextRand() * p; }while(p > l); return k-1; }
98f8b791-c4be-4afe-82a9-4f1b640fc6e0
2
public Weapon(int x, int y, int[] dir, Dimension space) { if(Weapon.weaponCounter == 0) { Image ii; try { ii = ImageIO.read(this.getClass().getResource("/resource/cat.png")); Weapon.weaponImage = ii.getScaledInstance(120, 120, 0); } catch (IOException e) { // TOD...
07bec026-1a10-4462-b5a4-16ce31f2305d
9
public boolean exist(char[][] board, String word) { if(word.length() == 0) return true; if((board.length ==0 || board[0].length ==0) && word.length() != 0) return false; m = board.length; n = board[0].length; use = new int[m][n]; for(int i = 0; i...
08c287b3-d3d9-4e23-be34-051b7985c25b
3
public static Card findCard(String cardName, CardArray cards) { for (Card i : cards) { if (i.shortdesc().toLowerCase().equals(cardName) || i.longdesc().toLowerCase().equals(cardName)) return i; } return null; }
1f03fbfa-09a7-4ce1-b558-bb73a886f034
2
public static ValidityStatusEnum fromValue(String v) { for (ValidityStatusEnum c: ValidityStatusEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
b9e2e169-be1f-43c7-87e1-a464b6072806
4
private void reportPlan(Player player, String[] args) { if (!player.hasPermission("buildingplanner.report")) { player.sendMessage("You do not have permission to use plan areas"); return; } PlanArea area = null; if (args.length > 1) { String areaName = null; areaName = args[1]; area = Bui...
857ca2d9-68e5-4b24-a53f-685961ac53a5
0
public int hashCode() { return super.hashCode() ^ myUnprocessedInput.hashCode(); }
7d95d379-8671-4824-8e3e-4ef745170754
2
public int min_number_of_frames(int streamsize) // E.B { if (h_vbr == true) return h_vbr_frames; else { if ((framesize + 5 - h_padding_bit) == 0) return 0; else return(streamsize / (framesize + 5 - h_padding_bit)); } }
1748bb9f-6e02-4167-9ff6-181991ea9230
2
public final void setProdID(String prodID) { if(prodID == null || prodID.isEmpty()) { throw new IllegalArgumentException(); } this.prodID = prodID; }
09be3466-60db-4918-bc5e-51ec7b8df3bf
1
public void init() { setSize(500,700); //inicio con tama;o 500 x 700 iScore = 0; //score de 0 iVidas = 4; //con 10 vidas iVelocidad = 4; //velocidad inicia con 4 iCada5 = 0; //empiezas con 0 iNivel = 1; iRandom = 0; iContador = 0; ...
85e81002-3321-4857-a81f-63e9e6dc13e9
1
public Type getSpecializedType(Type type) { if (type.typecode == TC_RANGE) type = ((RangeType) type).getBottom(); return type; }
5eb4c955-067b-42ce-9516-c302675e6a16
7
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt ) { boolean ok = false; // Get data flavors being dragged java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors(); // See if any of the flavors are a file list int...
161e5245-8466-495f-a3fe-324c372a5256
6
private int currentTokenGetValueCounstNumber(boolean NextToken) { int result = -1; if (!isNumber(parseTokenList.get(i))) { TokenParser token = tableVariable.get(currentNameSpase.concat(parseTokenList.get(i).getText())); if (token != null) { if (token.getType().equ...
7df6567b-a578-43d5-b96f-54b477705640
9
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerLoginEvent(PlayerLoginEvent event) { Player player = event.getPlayer(); PlayerFile playerFile = new PlayerFile(player.getName()); if (playerFile.banBanned) { String finalTime = (playerFile.banLength.equals(0) ? AdminEye.messages .getFile...
86bf3a41-5b6f-452e-bee7-eec47131ba69
8
private static void loot() throws Exception { int goldLooted = 0; switch(enemyNumber) { case 0: { goldLooted = generator.nextInt(10) + 5; } break; case 1: { goldLooted = generator.nextInt(10) + 20; } break; case 2: { goldLooted = generator.nextInt(5) + 3; } break...
fb9adfa2-f84d-4496-a863-55167cdd0299
2
public DefaultComboBoxModel<String> buildSwingBox() { DefaultComboBoxModel<String> swingBoxModel = new DefaultComboBoxModel<String>(); swingTimes = new float[maxFrame]; for(int x = 0; x<swingTimes.length; x++) { swingBoxModel.addElement("Frame " + x); swingTimes[x] = 1.0f / maxFrame; } float total...
81180554-751f-43b9-a282-69f368cdffd4
2
public static boolean isAssignableValue(Class<?> type, Object value) { Assert.notNull(type, "Type must not be null"); return (value != null ? isAssignable(type, value.getClass()) : !type .isPrimitive()); }