method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f65af63d-585f-4e71-9bc9-09c808a80e54
0
public String getName() { return name; }
c4f020ab-d701-400b-9d1e-aac7558fa120
2
public Key delMax() { if (isEmpty()) throw new java.util.NoSuchElementException(); Key max = pq[1]; exch(1, N--); sink(1); pq[N + 1] = null; if (N == pq.length / 4) resize(pq.length / 2); return max; }
cedf9947-80f2-4f9b-88b1-9957adada184
1
@Test public void testPointSize() { logger.info("nextGreaterPowerOf2"); int[] number = {0, 1,2, 3,4, 5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20}; int[] expResult = {1, 1,2, 2,2, 4,4,4,4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8}; int[] expResult2 = {1, 1,1, 2,2, 2,2,2,2, 4, 4, 4,...
a071a60f-b0a1-41a2-be0e-754d8b62bedb
4
public static Integer getLinePosition(Integer frameIdx, ScoreType scoreType) { Integer targetPos = IConstants.SCORE_TABLE_SPACE + 2; targetPos += frameIdx * (IConstants.SCORE_TABLE_SPACE + 2); switch (scoreType) { case FIRST: targetPos += 1; break; case SECOND: targetPos += 4; break; case THIRD...
aa0e08bb-5038-4c6e-b9fa-69f09aa11df9
4
public void update(long sysTime) { // Every in game tick, the bullet gets updated here // Let's calculate how long the bullet has been alive here (We can later use this in calculations) long lifeTime = sysTime - birth; if(life > lifeTime) { // Here we calculate the x and y coordinates of the bulle...
2372baf8-ca02-4ea1-b23e-2613cd093d7f
3
public void send(String line) { try { out.write(line +"\r\n"); out.flush(); if (level == 1) { // not registered IRCParser p = new IRCParser(line); if (p.getCommand().equalsIgnoreCase("NICK")) nick = p.getParameter(1).trim(); } } catch (Exception exc) { exc.printStackTrace(); } }
7cadad7e-f85d-4f0a-add2-acbe416a37fa
4
private void checkForWin(ArrayList<Player> players, Dealer dealer, int numPlayers) { for (int i=0;i<numPlayers;i++){ if ((players.get(i).getHandCount()>=players.get(i).getHold())&&(dealer.getHandCount()>=dealer.getHold())) { for (int j=0;j<numPlayers;j++) { Resolver resolve = new Resolver(...
85727a5e-6a84-4552-a154-0c6adad91424
3
@Override public boolean verifier() throws SemantiqueException { super.verifier(); if(gauche.isBoolean()) GestionnaireSemantique.getInstance().add(new SemantiqueException("Expression gauche de la division est booléenne, arithmétique attendue ligne:"+line+" colonne:"+col)); ...
d0fcd6aa-2b5d-437e-93a4-e468a587a0c2
2
@Override public boolean equals(Object obj) { return obj != null && (this.getClass().equals(obj.getClass())) && getId() == ((EntiteAvecId)obj).getId(); }
88992314-94c1-46bd-8123-0fe5ad9ef0b6
1
private List createParentBoundablesFromVerticalSlices(List[] verticalSlices, int newLevel) { Assert.isTrue(verticalSlices.length > 0); List parentBoundables = new ArrayList(); for (int i = 0; i < verticalSlices.length; i++) { parentBoundables.addAll( createParentBoundablesFromVerticalSlice...
d5dc140f-6d1c-4ced-b2e2-fc8c2ed1bfd6
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { this.stack[this.top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { ...
7339cf89-fb84-444c-a234-ac98320e9402
7
@Override public void init() { java.util.Random r = new java.util.Random(); int nbNeighbors = getArity(); while (true) { // Randomly select a neighbor int neighborDoor = r.nextInt() % nbNeighbors; // Send synchronization messages (0 and 1) for (int i = 0; i < nbNeighbors; ++i) sendTo(i, new...
ab4af913-ffa5-47c3-8164-2ac674c0bbb2
7
public static int insertMstxAdsImage(File fileName, int gid) { int result = 0; Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; FileInputStream fis = null; int id = getMaxNumber("mstx_ads_image"); updateMaxNumber(6);// 将该字段值加1 try { fis = new FileInputStream(fileName); pstmt ...
5fa187ac-786e-4538-9f81-7c0472c8aee0
2
public void removeBogusLegs() { Iterator<Leg> it = legs.iterator(); while (it.hasNext()) { Leg leg = it.next(); if (leg.isBogusNonTransitLeg()) { it.remove(); } } }
9ed678be-b7ad-48fc-82fd-9f9be1eae973
5
private void getBounds(Attributes attributes) { String minLat = attributes.getValue("minlat"); String maxLat = attributes.getValue("maxlat"); String minLon = attributes.getValue("minlon"); String maxLon = attributes.getValue("maxlon"); try { if (minLat != null) { ...
260f8489-648f-4400-a80b-a09d067cdcca
1
public static void maxSalaryEmployeeNoManager(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select e from Employee e where e not in (select m from Manager m) and e.manager = null order by e.salary desc", Employee.class); query.setMaxResults(1); List<Employee> ...
6ee87d39-5b4d-4aff-9fa8-549bf762923b
1
public Document buildBoard(Document document, Element root, ReversiBoard board) { Element boardElement = document.createElement("board"); for (int i = 0; i < board.getBoard().length; i++) { Element position = document.createElement("position_" + i); Text text = document.createTex...
54219915-90cc-49d5-8f8b-e38b2b8d6498
7
public static Cons yieldPrintTree(Cons tree) { { Stella_Object stream = tree.rest.value; Cons arguments = tree.rest.rest; Surrogate argumenttype = null; Symbol printoperator = null; String compoundedstring = null; Cons printforms = Stella.NIL; stream = Stella_Object.clTranslateA...
bb02107d-8915-47c5-a9ab-4644539b6055
5
public JMenu getFileMenu(){ JMenu temp = new JMenu("File"); JMenuItem menuLoadTiles = new JMenuItem("Load Tiles"); menuLoadTiles.addActionListener(new ActionListener(){ @Override public void actionPerformed (ActionEvent event) { fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int fcVal = ...
d1643f2c-62c3-4ace-abf0-594d29d6159b
0
private MeiyoVisitor() { // do nothing }
0b9f16a4-448b-4ae2-9da4-a1a0677f53a3
3
public static void main(String[] args) throws Exception { MatriceAddition worker[] = new MatriceAddition[4]; worker[0] = new MatriceAddition(new Point(0,0), new Point((A.length/2)-1,(A.length/2)-1)); worker[1] = new MatriceAddition(new Point(A.length/2,0), new Point(A.length-1,(A.length/2)-1)); worker[2] =...
3d7e676f-787f-4f91-9183-0425bd2ad083
1
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER...
75c08eed-d267-4472-aacb-641ef2e02a2c
8
public void RenderProjectile(int xp, int yp, Projectile p) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < p.GetSpriteSize(); y++) { int ya = y + yp; for (int x = 0; x < p.GetSpriteSize(); x++) { int xa = x + xp; if (xa < -p.GetSpriteSize() || xa >= width || ya < 0 || ya >= height) br...
4def8814-f9ff-4aba-9cae-914ab9d8e4f4
0
public void send(Packet packet){ client.getSession().send(packet); }
33195c0f-8e85-474f-891b-de9e50bd2549
0
public char getPion(int indice){ return ligne[indice]; }
cd02db16-119e-40a7-b506-c096e9adaf76
8
public ArrayList<Organism> getOthersWorldNPC(int x,int y,String wor) { ArrayList<Organism> end=new ArrayList<>(); for(int i=0;i<organisms.size();i++) { if((organisms.get(i).getX()<=x+8)&&(organisms.get(i).getX()>=x-8)) { if((organisms.get(i).getY()<=y+8)&&(organisms.get(i).getY()>=...
69240f9b-1763-4e7a-9bc5-99f21c557cb3
3
private void loadPanel() { Vector<String> generators = new Vector<>(); for (BaseGenerator g : Character.GENERATORS) { generators.add(g.getName()); } Vector<String> classes = new Vector<>(); for (BaseClass c : Character.CLASSES) { classes.add(c.getName()); ...
48b1d327-35c2-45f2-b421-23a37cdfc3ec
4
public static void main( String [ ] args ) { int NumElements = 128; int NumInSameSet = 16; DisjointSets ds = new DisjointSets( NumElements ); int set1, set2; for( int k = 1; k < NumInSameSet; k *= 2 ) { for( int j = 0; j + k < NumElements; j += 2 * k ) { s...
525b70b9-9fdd-47cb-9ca8-1caf3ce1609a
5
public static void main(String[] args) { long start = System.nanoTime(); int sum = 13; for (Integer i = 101; i <= 1000000; i += 2) { boolean isCircular = true; if (isPrime(i)) { String origNum = i.toString(); String newNumStr = null; circularLoop: for (int j = 1; j < origNum.length(); j++) { ...
fea1c8c1-2d9d-490f-9a41-815c13c1e4e7
7
public void move() { if (type) { if (x <= 1280) offScreen = false; x += MISSILE_SPEED; if (x > BOARD_WIDTH) visible = false; if (hit) visible = false; } else { if (x <= 1280) offScreen = false; x -= MISSILE_SPEED; if (x < 0) visible = false; if (hit) visible = false; ...
ec268705-214d-4d50-926c-33c79844ae46
2
@Override public boolean equals(Object obj) { if(obj instanceof MapData){ return ((MapData)obj).a_data == a_data && ((MapData)obj).b_data == b_data; }else return false; }
229133b3-7be9-4b09-b5d3-ca6c81679c63
4
public void update() { if (beginningAnimation) { AffineTransform transform = new AffineTransform(); transform.translate(WIDTH / 2 - scaleFirst * WIDTH / 2, HEIGHT / 2 - scaleFirst * HEIGHT / 2); transform.scale(scaleFirst, scaleFirst); Graphics2D g2d = (Graphics2D) beginningImage.getGraphics(); g2d.set...
c8ab2dea-8c0d-4894-ae7d-42e283895707
1
private void assertListEquals(List<LngLatAlt> expectedList, List<LngLatAlt> actualList) { for (int x = 0; x < actualList.size(); x++) { LngLatAlt expected = expectedList.get(x); LngLatAlt actual = actualList.get(x); PointTest.assertLngLatAlt(expected.getLongitude(), expected.getLatitude(), expected.getAlt...
4e510151-b202-4d9f-8dea-03d645ef672f
2
long fixedFromISO(int weekyear, int weekOfWeekyear, int dayOfWeek) { if (weekyear == 0) { throw new IllegalArgumentException("Illegal weekyear: " + weekyear); } if (weekyear == 1) { weekyear = -1; } else { weekyear--; } return nthWeekda...
34d0c641-786a-4513-b8de-837b216d5152
4
public ParametricContainerCommand(ContainerCommandDescriptor descriptor, Class owner) { super(descriptor); Command annotation = this.getClass().getAnnotation(Command.class); if (annotation == null) { throw new IllegalArgumentException("Missing Command annotation"); ...
63b34f8e-c1be-4198-9afc-671e3aa086d9
8
void tick() { if (x + xa < 0) { xa = 3; Sound.playScoreSound(); SinglePlayerState.compScore++; } if (x + xa > GamePanel.WIDTH - image.getWidth(null)){ xa = -3; Sound.playScoreSound(); SinglePlayerState.p1Score++; } if (y + ya < 0) ya = 2; if (y + ya > GamePanel.HEIGHT - image.getHeight...
4108e92f-2414-43d8-a291-0bf454e9b335
0
@Override public int read() throws IOException { dataSemaphore.acquireUninterruptibly(); synchronized(dataQueue) { // Debugger.println(2, "[DummyConnection] reading " + (char) (dataQueue.peek().intValue()) ); return dataQueue.poll(); } }
26214ad2-f10f-4cc3-9560-f0008d52ecad
6
protected void setKey(String type,String key){ if(type.equals("LEFT")){ mainWindow.config.setLeft(ActiveKeys.LEFT); editKey(tfLeft,key,borderBlack); } else if(type.equals("RIGHT")){ mainWindow.config.setRight(ActiveKeys.RIGHT); editKey(tfRight,key,borderBlack); } else if(type.equals("UP")){ mai...
627a64fb-12c7-4ff8-a9b7-aac03171add3
1
public synchronized void accept() throws IOException { if (_acceptable) { _acceptable = false; int[] ip = _bot.longToIp(_address); String ipStr = ip[0] + "." + ip[1] + "." + ip[2] + "." + ip[3]; _socket = new Socket(ipStr, _port); _reader = new Buffere...
6e4d8f77-16de-46e9-b0d4-50edcc4f07e9
1
public void visit_ishl(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
dc78091e-0f21-43f0-b9d4-d6b2f1f83e7e
4
protected void normaliseArgs() { if (capacity < 1) capacity = 1; if (allocationSize < MIN_ALLOCATION_SIZE) { allocationSize = MIN_ALLOCATION_SIZE; while (128 * allocationSize < capacity && allocationSize < 64 * 1024 * 1024) allocationSize <<= 1; } }
85b2e5e7-09c1-4d71-95ee-30f98066edb3
8
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; int v_4; // (, line 175 // setlimit, line 176 v_1 = limit - cursor; // tomark, line 176 ...
5c3a0267-d741-4f75-934c-2384c8bbc584
7
@Override public void returnObject(K key, V obj) throws Exception { try { addObjectToPool(key, obj, true); } catch (Exception e) { if (_factory != null) { try { _factory.destroyObject(key, obj); } catch (Exception e2) { ...
ef8c24d4-30b9-45ac-9499-f736bd9dfe51
2
private int despaceSet(String string, Set set) { set.clear(); StringTokenizer st = new StringTokenizer(string); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.equals("!")) s = ""; set.add(s); } return set.size(); }
44230c1b-6752-4b97-a612-7c3e9f8280a2
2
public static void main(String args[]) throws Exception { Flags.parse(args); if (Flags.isSet("--host")) { System.out.println("Starting server..."); Server s = Server.create(); } else if (Flags.isSet("--server")) { String host = Flags.getFlag("--server"); } WorldView wv = new WorldView(); wv.s...
3a454f9c-c77a-4b1e-8b0f-02e74aa76346
1
public void draw(GOut g) { super.draw(g); if(!folded) g.image(grip, sz.sub(gzsz)); }
01daf922-7bac-407f-b23e-4613aa5e015b
3
private boolean zufriedenheitVerringern() { boolean erfolg = false; int angreifererfolg = ermittleAngreiferErfolg(); if ( angreifererfolg == 0 ) { erfolg = false; } else if ( angreifererfolg > 0 ) { int verloreneSoldaten = this.opfer.getSoldaten() - this.getSoldateneinsatz() * 2; if (...
bd0e8585-efde-4559-a70f-9d485637bacc
0
@Override protected int processSortInfo (byte[] sortInfo) { // TBD // if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbBFReaderWriter:processSortInfo"); } return SUCCESS ; } // end protected method processSortInfo;
04981dc6-7771-46d6-9397-cd8919dc6e84
5
public static void init() { try { Properties p = new Properties(); if (!new File("auth_server.conf").exists()) { p.setProperty("mysql-host", "localhost"); p.setProperty("mysql-port", "3306"); p.setProperty("mysql-db", "user_services"); p.setProperty("mysql-password", ""); p.setProperty("mysq...
04ba251b-8d45-4858-afae-76f83b042e91
2
public Question getModel(int Question_ID) { Question question = new Question(); try { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Question_ID,QType_ID"); sql.append(" FROM `Question`"); sql.append(" where Question_ID=" + Question_ID); ...
85ad09a1-bfdc-4a34-a1c0-b1c1a1c650d6
4
public String Datos(String Radio) throws SQLException { String Recorrer = ""; ResultSet Rs = null; if (Radio.equals("Profesores")) { Recorrer += "<select name=\"identificacion\" id=\"ConProEsT\">"; Rs = Pres.traerProfesor(); while (Rs.next()) { ...
5a6575a7-826e-4f08-a11c-792ed16d2ce6
6
public Component getComponentFor(LodResource lodResource, TaskObserver taskObserver) throws InterruptedException { this.sourceLodResource = lodResource; taskObserver.taskProgress(lodResource.getName(), 1f / (float)taskObserver.getRange()); JPanel panel = new JPanel(new BorderLayout...
f9e277b3-0307-4f8f-86b3-e1e503489b8b
5
private static Integer[][] makePuzzleFromDifficultyHelper( Difficulty difficulty) throws PersonalisedDifficultyException { if (difficulty == Difficulty.VERY_EASY) { return makePuzzleHelper(3, 2); } else if (difficulty == Difficulty.EASY) { return makePuzzleHelper(5, 3); } else if (difficulty == Difficult...
c9259903-d90d-4307-9213-b4c230eece3b
9
private void saveInfo(String name) { FileWriter remoteSave = null; String eol = System.getProperty("line.separator"); try { remoteSave = new FileWriter(name +".rcf"); //Build the file header remoteSave.write("Remote Controller Info;" + eol); //The Base Controller Name remoteSave.write(">name:"...
cfc62061-211a-4364-bea3-c0c86fd7c5f8
8
public void addRequiredParameters(OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException { final Map<String, String> pMap = OAuth.newMap(parameters); if (pMap.get(OAuth.OAUTH_TOKEN) == null && accessor.accessToken != null) { addParameter(OAuth.OAUTH_TOKEN,...
bcc2cbfb-09ca-4977-ac94-2f20ac5bdee9
6
public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String url = value.toString().split("\\s+")[0].trim(); try { if (isValidLink(url)) { Document document = Jsoup.connect(url).userAgent("Mozilla").get(); ...
612e2b42-3cc3-4504-a923-d274546c956e
1
@Override public double arvo() throws IllegalStateException { if (!super.laskettavatAsetettu()) { throw new IllegalStateException(); } return super.getEtujasen().arvo() - super.getTakajasen().arvo(); }
56216b52-e807-41da-863a-b72b85a2412e
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Raiting that = (Raiting) o; if (idRaiting != that.idRaiting) return false; if (downloads != null ? !downloads.equals(that.downloads) : that.dow...
ad3dd6aa-096a-4c21-ad44-0ce03311dd8a
3
private static final Object[] decodeString(byte[] bencoded_bytes, int offset) throws BencodingException { StringBuffer digits = new StringBuffer(); while(bencoded_bytes[offset] > '/' && bencoded_bytes[offset] < ':') { digits.append((char)bencoded_bytes[offset++]); } ...
82a0342f-ddfd-4dd2-8a42-7583ca1569a0
2
public static int getUnreadCount(User user) { int unreadCount = 0; try { String statement = new String("SELECT COUNT(mid) FROM " + DBTable + " WHERE uid2 = ? and isRead = false"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, user.userID); ResultSet rs = stmt.exec...
6e41bcd8-8a1d-4e1e-8add-0840283c8c14
1
public HashMap<String, String>[] fav() throws Exception { List<HashMap<String, String>> a = JGroovex.getFavorites(query).result; @SuppressWarnings("unchecked") HashMap<String, String>[] ret = new HashMap[a.size()]; for (int i = 0;i<a.size();i++){ ret[i] = (a.get(i)); } return ret; }
141745e7-1392-4f7c-b8f4-f0951db77603
3
public static void main(String[] args) { // gen pop int popSize = 10; int indLength = 5; Population pop = new Population(popSize,indLength); System.out.println("Original population"); System.out.println(pop); // deep copy pop List<Individual> newPopList = new ArrayList<Individual>(); for (Indivi...
f4d5861f-6918-4506-984e-fe580f47907f
6
public static void main(String args[]) { Scanner sc = new Scanner(System.in); int T=sc.nextInt(); while(T>0) { T--; int N=sc.nextInt(); int diff=0; boolean fixed=true; for(int i=0;i<N;i++) { int a...
65337694-d589-43eb-99be-88603d6602f7
2
public UsuarioBean getFromLogin(UsuarioBean oUsuario) throws Exception { try { oMysql.conexion(enumTipoConexion); String strId = oMysql.getId("usuario", "login", oUsuario.getLogin()); if (strId == null) { oUsuario.setId(0); } else { ...
0fc0158a-db60-43df-9d26-f75114d653cd
8
private boolean[] attsTestedBelow() { boolean[] attsBelow = new boolean[m_numAttributes]; boolean[] attsBelowLeft = null; boolean[] attsBelowRight = null; if (m_right != null) { attsBelowRight = m_right.attsTestedBelow(); } if (m_left != null) { attsBelowLeft = m_left.attsTestedBe...
f7d8c74c-4780-4a69-82fe-e8323b472a6f
9
private void layoutContainerVertically(Container parent) { int components = parent.getComponentCount(); int visibleComponents = getVisibleComponents( parent ); if (components == 0) return; // Determine space available for components using relative sizing float relativeTotal = 0.0f; Insets insets = pare...
a2dc0f10-6af9-4a24-ac08-0e388507e9ad
9
private boolean time(CommandSender sender, String[] args) { if (args.length < 4) { sender.sendMessage(ChatColor.RED + "Usage: time <add/sub/set> <time> <sec/min/hour/day/week/month>"); return true; } long time = plugin.parseTimeSpec(args[2], args[3]); if (time ==...
2951e059-6671-47d5-ac6f-b509209743aa
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...
8d0963d6-0380-4494-bc73-30a250d5f2c7
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof UserDetails)) { return false; } UserDetails other = (UserDetails) object; if ((this.username == null && other.u...
a63d2fd6-44c3-4cc1-a649-eab92e9e1795
8
protected int partition(int attIndex, int l, int r) { double pivot = instance((l + r) / 2).value(attIndex); while (l < r) { while ((instance(l).value(attIndex) < pivot) && (l < r)) { l++; } while ((instance(r).value(attIndex) > pivot) && (l < r)) { r--; } if (...
fc7ff476-6ddc-4c08-a22a-c129375ddd88
1
public static void main(String[] args) { BusStop bstop = new BusStop(5); bstop.AddPerson(new Person(4,9)); bstop.AddPerson(new Person(1,12)); bstop.AddPerson(new Person(2,2)); bstop.AddPerson(new Person(3,1)); bstop.AddPerson(new ...
55bccb6e-8779-4b6e-8f6e-dbb4fe7ed32b
7
public Party battle() { //list the players and enemies and their current/max hp do{ //player characters go down the list taking a turn //foreach character c in the party for(Iterator<Character> party = players.getParty().iterator(); party.hasNext();) { Character c = party.next(); c.takeTurn(p...
435006b8-1222-46ae-bd24-d1e5e15ac3e4
7
public boolean addShopItem(int itemID, int amount) { boolean Added = false; if (amount <= 0) { return false; } if (Item.itemIsNote[itemID] == true) { itemID = c.getItems().getUnnotedItem(itemID); } for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if ((Server.shopHandler.ShopItems[c.m...
3747ccdc-2ece-48ef-bdcd-1b66197cea5e
4
private String getString(){ Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.out.println("Ошибка при подключении к порту: " + portNumber); System.exit(-1); } InputStream in = null; ...
76950bec-1768-4ce7-b904-601fe4e9750e
1
public void addFunction(String lispPackage, String name) { if (lispPackage.equals("")) arguments.add("#'" + name); else arguments.add("#'" + lispPackage + "::" + name); }
fdeec62b-f3da-4bf0-864b-046b0ae45c32
8
public int search(int[] A, int target) { if(A==null || A.length==0){ return -1; } if(A.length==1){ if(A[0]==target){ return 0; }else{ return -1; } } int pivot = findPivot(A); // System.out.println(pivot); if(pivot==-1){ //System.out.println("dd"); re...
2ccfed2a-d769-4692-9b46-5b7fc19d9c16
9
private String getPolePassed(final SatPos prevPos, final SatPos satPos) { String polePassed = DEADSPOT_NONE; final double az1 = prevPos.getAzimuth() / TWOPI * 360.0; final double az2 = satPos.getAzimuth() / TWOPI * 360.0; if (az1 > az2) { // we may be moving from 350 or greateer thru north if (az1 > 350...
f8dc3647-e70c-472a-839e-daf82f76655c
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.print("return"); if (instr != null) { writer.print(" "); instr.dumpExpression(writer.IMPL_PAREN, writer); } writer.println(";"); }
b1074475-221f-40b2-8b5b-cc5e24afab83
8
@Override public void run() { System.out.println("Listening on port " + this.serversocket.getLocalPort()); ArrayList<String> workerList = new ArrayList<>(); // Read list of workers from configuration file try(BufferedReader br = new BufferedReader(new FileReader( "./config/workers.c...
eb581c85-7c20-45c1-b2ff-e43e03dba777
7
@Override public Token parse() { Token test = first; exp1 = new Expression(test, scope); test = exp1.parse(); if (test.isOperator()){ Operator testOp = test.getOperator(); if (Operator.EQUALS.equals(testOp) || Operator.NOT_EQUALS.equals(testOp) || Operator.GREATER_THAN.equals(testOp) || Op...
34e53fe3-47a0-42f7-8ec8-2ba98aa2664a
7
public static void setHunger(Player player, String playerName, String hungerPlayerName, String amount) { ArrayList<Player> hungerPlayers = AdminEyeUtils .requestPlayers(hungerPlayerName); if (hungerPlayers == null && hungerPlayerName != null) { StefsAPI.MessageHandler.buildMessage().addSender(playerName)...
dece4e66-ca53-4cc4-b4b4-a62cfc91f8df
0
@Basic @Column(name = "CTR_ID_FUNCIONARIO") public int getCtrIdFuncionario() { return ctrIdFuncionario; }
ee57fd5b-7c2c-429d-a684-8a1b1bb30f71
5
/* */ public static void sendPacket(Player p, Object packet) /* */ { /* */ try /* */ { /* 103 */ Object nmsPlayer = getHandle(p); /* 104 */ Field con_field = nmsPlayer.getClass().getField("playerConnection"); /* 105 */ Object con = con_field.get(nmsPlayer); /* 106 */ ...
adfceb97-05a1-4743-bf7d-9da1ac1291ff
4
@Override public void notify(PositionedEntity e) { Environment environment = _simulation.environment(); double currentTime = (Math.round(e.getTimeNow() * 1000)) / 1000d; int numBees = environment.getNumberOfBees(); int numHives = environment.getNumberOfHives(); int numFlowers = environment.getNumberOfFlowers...
3cf9af40-2518-4f44-9205-56f74d81ecd4
7
private int get_prev_page(Page page) throws JOrbisException{ long begin=offset; //!!! int ret; int offst=-1; while(offst==-1){ begin-=CHUNKSIZE; if(begin<0) begin=0; seek_helper(begin); while(offset<begin+CHUNKSIZE){ ret=get_next_page(page, begin+CHUNKSIZE-offset)...
4d37a7d3-2898-437e-82f5-74b563bb37a1
9
public void run() { if (sccp.swPlayers.contains(player)) { if (!sendMessage) { sendMessage = true; count = -60; } count++; if (count < 0 && count % 10 == 0) { player.sendMessage(Methods.setColors("&a[&eStopwatch&a] Start in &e" + ((count / 10)) * -1)); } else if (count == 0) { pl...
efd6b4ba-7d1b-4f9f-b9d5-61405f7d9a8a
8
public List<Byte> getByteList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Byte>(0); } List<Byte> result = new ArrayList<Byte>(); for (Object object : list) { if (object instanceof Byte) { result....
20bb979e-1705-4de8-8704-83a3e2b1f01e
3
private boolean comparePlugins() { boolean ok = true; Plugin[] pluginList = pluginManager.getPlugins(); Configuration pluginListConfiguration = pluginListHandler.getConfig(); for (Plugin plugin : pluginList) { if (pluginListConfiguration.contains(plugin.getDescription().getName())) { if (!pluginListConf...
27ddd196-e01d-42d6-a5f1-85c530f3ddba
0
@Override public void initialize(URL arg0, ResourceBundle arg1) { DateFormat df = new SimpleDateFormat("yyyy/MM/dd(E)"); Date d = new Date(); currentDate = df.format(d); lblDate.setText(currentDate); }
79aa3828-7fe4-4fb9-ae69-1b6613bad36a
5
@Override public void start(final Stage primaryStage) throws Exception { final Group container = new Group(); final Scene scene = new Scene(container, Color.TRANSPARENT); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(final WindowEvent event) { System.ex...
9dffca96-61b1-47d8-987e-cdeb3333dffd
3
public boolean isInLine() { return (_row1 - _row0 == 0) || (_col1 - _col0 == 0) || (_row0 + _col1 == _col0 + _row1) || (_row0 + _col0 == _col1 + _row1); }
4334513a-42cb-4e4b-aea8-880eda072565
4
public String getRandomGeslacht() { Random rn = new Random(); switch (rn.nextInt(4)) { case 0: return "man"; case 1: return "vrouw"; case 2: return "onbepaald"; case 3: return "onbekend"; ...
5180e523-401c-4108-a200-29e11893f364
1
public int getRowCount(String sheetName){ int index = workbook.getSheetIndex(sheetName); if(index==-1) return 0; else{ sheet = workbook.getSheetAt(index); int number=sheet.getLastRowNum()+1; return number; } }
0990787d-d189-48c1-9d49-54c9de5a1494
6
public void loadDict(String fileName) { if(fileName == null || "".equals(fileName)) { return; } if(wordList == null) { wordList = new ArrayList<String>(); } // clear existing elements wordList.clear(); String line; String word; try { BufferedReader br = null; InputStream is = getClass()....
d71cc75a-8551-4001-b097-cbeb6a7e8a51
1
@SuppressWarnings("LeakingThisInConstructor") public Game(long period) { super("Game"); new RepeatingReleasedEventsFixer().install(); this.setUndecorated(false); Thread.currentThread().setUncaughtExceptionHandler(new EIError()); gp = new GamePanel(this, period, 800, 600);...
227025fd-f65f-47c5-809f-f7fea7d94ab6
6
static ArrayList<NoSchemaDocument> generateAccounts(int count) { ArrayList<NoSchemaDocument> accounts = new ArrayList<NoSchemaDocument>(); for (int i=0;i<count;i++) { NoSchemaDocument account = new NoSchemaDocument(); account.put("number",getUniqueAccountNumber()); ac...
30b6900a-fa9d-4096-badf-4533c8aacc07
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
ef061274-e7b1-4f9d-9aba-7ed96eea4caa
2
public void setParentsOpen(Collection<TreeRow> rows) { Set<TreeContainerRow> parents = new HashSet<>(); for (TreeRow row : rows) { collectClosedParents(row, parents); } if (!parents.isEmpty()) { setOpen(true, parents); } }
1d526137-6bb8-4a6a-8d61-ebfcab060410
9
@Override public Double documentRank(List<String> document, List<String> query) { if(iDFMatrix != null) return documentRankIDFWeighted(document, query, iDFMatrix); if(document.isEmpty() && query.isEmpty()) return 1.0; if(document.isEmpty() && !query.isEmpty()) return 0.0; if...
41153fed-d624-4323-9fae-cbb7faec6d40
7
public ArrayList<String> convertHexNumber(int number, ArrayList<String> hexNumber){ if(number < 10){ hexNumber.add(Integer.toString(number)); return hexNumber; }else{ switch(number){ case 10: hexNumber.add("a"); return hexNumber; case 11: hexNumber.add("b"); return hexNumber; case ...