method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c93aebbd-40af-4f75-9495-e4d2f82c4583
7
@Override public synchronized void clearDebri(Room room, int taskCode) { TickableGroup almostTock=null; TickClient C=null; ItemTicker I=null; Iterator<TickClient> roomSet; MOB mob=null; for(final Iterator<TickableGroup> e=tickGroups();e.hasNext();) { almostTock=e.next(); roomSet=almostTock.getLoc...
3d4af342-781d-4d19-82f8-afcf1f7b3835
4
public List<Byte> getByteListFromString(String xArg) { if (xArg == null || xArg.equalsIgnoreCase("")) return null; List<Byte> d = new ArrayList<Byte>(); char[] c = xArg.toCharArray(); int lastPos = 0; for (int i = 0; i < c.length; i++) { if (c[i] == ',') { d.add(Byte.valueOf(returnMerged...
f0855cf7-48f9-447d-970e-f03651ad6107
4
@Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null || (object instanceof String && ((String) object).length() == 0)) { return null; } if (object instanceof Cotizacion) { Cotizacion ...
d9068666-5da2-48a2-bf42-7e3d0adf4b22
8
public String [] getOptions() { String [] options = new String [9]; int current = 0; options[current++] = "-X"; options[current++] = "" + m_CVFolds; if (m_evaluationMeasure != EVAL_DEFAULT) { options[current++] = "-E"; switch (m_evaluationMeasure) { case EVAL_ACCURACY: options[curr...
2efc2ce4-ea25-481a-b4c5-5036ae94bb4b
4
public void actionPerformed(ActionEvent event) { System.out.println("TitleScreen.actionPerformed()"); Object source = event.getSource(); if (source == button_start) advanceTutorial(); else if (source == button_exit) game.quit(); // else if (source == buttonList[BUTTON_CONFIG_IDX]) toggleUserPanel...
f22f203e-6ab8-4564-81e9-e9f8af87cbc6
7
public void parseRange(final BitSet bitSet, final int min, final int max, final String range, final int interval) { if(range.equals("*")) { setBits(bitSet, min, max, interval); return; } String[] split = range.split("-"); if(split.length == 1) { int val = parseInt(split[0]); if(val < min) th...
1857a3e4-82c1-4290-97df-7ee43231b46c
0
public Float getXMax() { return xMax; }
4ed915f7-7180-4daf-b420-60bec1b47650
3
public static void hypothesizeChomsky(GrammarEnvironment env, Grammar g) { CNFConverter converter = null; try { converter = new CNFConverter(g); } catch (IllegalArgumentException e) { JOptionPane.showMessageDialog(env, e.getMessage(), "Illegal Grammar", JOptionPane.ERROR_MESSAGE); return; } Prod...
78e60be3-a8e3-44e5-aa11-a8840ab0ec8e
4
public void deploy(Territory territ, boolean all) { if (territ.owner != activePlayer) return; String placing = troopAmountCombo.getSelectedItem().toString(); int toPlace = (all || placing.equals("All")) ? deployNum : Math.min(Integer.parseInt(placing), deployNum); territ.addUnits(toPlace); deployNum -= toP...
0f92b543-feb1-4141-8d13-538f37ed4150
2
private void designator() { if (have(NonTerminal.DESIGNATOR)) { tryResolveSymbol(current); nextToken(); while (accept(Token.Kind.OPEN_BRACKET)) { expression0(); expect(Token.Kind.CLOSE_BRACKET); } } }
1ff3908c-b48c-4a9f-86d0-ede350992c01
2
public boolean isEnabled() { return comp.isEnabled() && comp.getSelectedText()!=null; }
e6154ee9-af7a-4afb-a8f7-02c490cf24bd
4
public String toString() { checkInvariants(); int numBits = (wordsInUse > 128) ? cardinality() : wordsInUse * BITS_PER_WORD; StringBuilder b = new StringBuilder(6 * numBits + 2); b.append('{'); int i = nextSetBit(0); if (i != -1) ...
0ee5491e-4ce8-4ab9-9d23-954037f1990c
8
public static int numberActionsApplicableInState(State currentState, GroundedAction action1, GroundedAction action2, boolean reverse) { GroundedAction firstAction = (reverse) ? action2 : action1; GroundedAction secondAction = (reverse) ? action1 : action2; int count = 0; State nextState = currentState.copy(...
5cd4f89c-476f-4f49-8e5d-70251e9b16df
9
public boolean comparePattern (Pattern tablePattern ){ boolean levelingOK = (tablePattern.lowestRank < this.lowestRank); log.debug("tablePaTTERN lowest Rank"+ tablePattern.lowestRank+" this lowest Rank "+ this.lowestRank); boolean patternMatch = false; //__catch bombs___ if(this...
7fe32307-a81d-4503-b234-3d6b2768b090
9
private boolean doReturnedReading() { if (this.ended) return false; while (!this.returned.isEmpty()) { IByteReader rest; while (true) { rest = this.returned.getFirst(); if (rest.isEnded()) this.returned.pollFirst(); else break; ...
7220a48b-20cd-4ace-8cc2-4f57cc70fa95
7
public void parserWithTokenByChar() throws Exception { Ngram ngram; int count = 0; Token pre = new Token(null, null); String preWordWithAttr = null; for (int i = 0; i < 10; i++) list = lexer.nextTokenList(); while (current != null) { if (current.getKind() == Token.Kind.TOKEN_WORD) { if (pre.getK...
4ceae5b4-2434-48aa-8404-17d8936044a7
3
int classCount(RoomScheme r, int code){ int count = 0; for (Subject[] room : r.rooms) { for (int j = 0; j<r.rooms[0].length; j++) { if (room[j].getCode() == code) { count ++; } } } return count; }
92474cbd-2057-45e5-873e-536545fd2735
6
public static String getDnaSequenceFromFrame(String inSequence, int frame) throws Exception { if ( frame == 0 ) return inSequence; if ( frame == 1 ) return inSequence.substring(1); if ( frame == 2) return inSequence.substring(2); if ( frame == 3) return reverseTranscribe(inSequence);...
561edd74-c012-4264-9c86-46d9c1934fe2
5
@Override public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_UP: instance.level.getPlayer().move(0, -1); break; case KeyEvent.VK_RIGHT: instance.level.getPlayer().move(1, 0); break; case KeyEvent.VK_DOWN: instance.level.getPlayer().move(0, 1); break; case KeyEven...
e1428d81-c4de-42ed-b65c-1be35a41f2bc
5
public PermClass getClassUnderPoint(int x, int y) { for(PermClass p : PermData.getData().classes) { if(x >= p.x && x <= p.x + 30 && y >= p.y && y <= p.y + 30) { cox = x - p.x; coy = y - p.y; return p; } } return null; }
cc1f347f-01a2-43b0-bff9-6e011988cf8c
8
private boolean checkPackage() { if (getBarPackage().getApkFile() == null || !getBarPackage().getApkFile().canRead()) { getLog().error("APK file is not specified or cannot be read."); return false; } String apkName = getBarPackage().getApkFile().getName()...
6b3b7ad1-a236-4b17-8391-7b57bf25b1ab
4
private void writeInt(List<Byte> ret, int val) { if (val < 0 || val >= 0x200000) { ret.add((byte)(((val >> 22) & 0x7f) | 0x80)); ret.add((byte)(((val >> 15) & 0x7f) | 0x80)); ret.add((byte)(((val >> 8) & 0x7f) | 0x80)); ret.add((byte)(val & 0xff)); } else { if (val >= 0x4000) { ret.add(...
778c5d5f-02c8-45e1-a7a3-9a05089f0845
7
@SuppressWarnings("unchecked") public String open(String message,Signature signature){ //System.out.println("\n---------------Open protocol--------------\n"); long start = System.currentTimeMillis(); // Check if the signature is valid String result = ""; try{ // Check validity // Catch the fields El...
aa0025ff-4d3a-45be-9d54-1236522c5418
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + cacheSize; result = prime * result + frequency; result = prime * result + numberOfCores; result = prime * result + numberOfThreads; result = prime * result + ((socket == null) ? 0 : socket.hashCode()); ret...
e51dad2a-9157-41a1-b9eb-6e9d0ee0c195
1
public static String selectQuery(String queryString) { BasicConfigurator.configure(); //create an object Sparql Query from a parameter string Query query = QueryFactory.create(queryString); try { //it connects to the server with Parliament and execute the query QueryExecution exec = QueryExecutionF...
7724d9e3-d493-4e69-bbd5-932013a44025
1
public void deconnexionServeur() throws IOException { connexion.envoyer("QUIT"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } connexion.fermer(); }
c58465f7-be1a-4d71-a6cf-d6a0aa3a6f80
4
public static String validateArtist(String artist) { HashMap<String,String> artists = DataManager.getArtistMap(); for(String artistFromMap : artists.keySet()) { int levDist = StringUtils.getLevenshteinDistance(artistFromMap.toUpperCase(), artist.toUpperCase()); double ratio = (artistFromMap.length() - levDist...
295e72ea-939e-455f-b551-f45453194ff8
2
public void putAll(Map<? extends K, ? extends V> m) { cache.putAll(m); }
2fa116f6-d74e-4be7-9170-aacc54ee263e
4
static public String fixUrl(String inUrl) { int docLoc = inUrl.lastIndexOf('.'); int protLoc = inUrl.indexOf("://"); int slashLoc = -1; if (protLoc > 0) slashLoc = inUrl.indexOf('/', protLoc+3); else slashLoc = inUrl.indexOf('/'); if (slashLoc < 0 || (slashLoc > 0 && docLoc < slashLoc)) // non...
c0f52f90-fae5-4b8e-8cdc-c284f3ac1613
1
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
e8b79202-03e1-41fd-980e-9cca59eb6c9c
1
private static Schedule getSchedule(Schedule bean, PreparedStatement stmt, ResultSet rs) throws SQLException{ stmt.setDate(1, bean.getWorkDay()); stmt.setString(2, bean.getUsername()); rs = stmt.executeQuery(); if (rs.next()) { Schedule newBean = new Schedule(); newBean.setWorkDay(rs.getDate("work_d...
8e17cb42-479f-4836-8fa9-a7fe5eb87fde
2
@Override public void init(ServletConfig config) throws ServletException{ try { // Create a JNDI Initial context to be able to lookup the DataSource InitialContext ctx = new InitialContext(); // Lookup the DataSource, which will be backed by a pool // that the application...
9027f096-1c27-4ebf-82dc-e6c189b1d3ed
1
public SimpleReplace(String args[]) { // Get input from the console String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: "); String match = ConsoleTools.getNonEmptyInput("Enter string to match: "); String replacement = ConsoleTools.getNonNullInput("Enter string to replace: "); String[]...
cc85a44d-a7a2-44f5-b357-e7d59f82eae8
1
private static void parseTestNgResultCreateCsv(List<String> urlsOrFiles, String csvFileName) { List<TestResultData> testNgResultData = parseTestNgResultFromFilesOrUrls(urlsOrFiles); CsvResultFile csvResultFile = new CsvResultFile(); try { System.out.println("Creating csv file..."); ...
0380c619-70cc-4171-aca9-5cd51c422743
6
public Archive.ArchiveData read(HistoryLinkMap linkMap, LinkDataFactory linkFactory) throws IOException { Archive.ArchiveData data = readArchiveData(linkMap, linkFactory); for (Archive.RootObject obj : data.mRootObjects) { if (obj.mDigest.isNullDigest()) { continue; ...
1d0a7d75-a69f-4af8-8667-c19f0e8589b7
6
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object controller) throws Exception { String uri = request.getRequestURI(); if(uri.endsWith("/login/login") || uri.endsWith("/login/logar")|| uri.endsWith("/usuario") || uri.e...
20f6e1a9-bf95-4eec-aa3b-58913b32870c
1
public void onStart(IContext context) throws JFException { this.engine = context.getEngine(); this.indicators = context.getIndicators(); this.acount = context.getAccount(); this.rsizone = false; try { File file = new File("copyOfRsi_onBar2.csv"); printWriter = new PrintWriter(new BufferedWriter(new Fil...
e532075b-f5f3-40c3-80cb-4554148fe257
8
public int dUpdateReservation(Reservation res) throws UnauthorizedUserException, BadConnectionException { PreparedStatement pStmnt = null; // close a reservation and leave a comment try { pStmnt = con.prepareStatement(qs.update_res_d); pStmnt.setString(1, res.get...
7daec9cc-da89-4445-abd0-4ddfa51938e0
7
public void removeKey(String var) { Boolean changed = false; if(this.props.containsKey(var)) { this.props.remove(var); changed = true; } for (int i = 0; i < this.lines.size(); i++) { String line = this.lines.get(i); if (line.trim().lengt...
47f2be63-3d06-4a90-b63b-b0e2834d7d6f
7
@Override public void onMoveFile(String arg0, String arg1, boolean replace, DokanFileInfo arg3) throws DokanOperationException { try { if (replace) { try { EntityInfo inf = fileSystem.getFileMetaData(mapWinToUnixPath(arg1)); if (DirectoryInfo.class.isInstance(inf)) fileSystem.deleteDirec...
1ff3da62-6760-44e9-970d-0d92a8caf249
9
@Override public boolean canMove(int x, int y) { int diagnolY = 0, digonlX = 0,dx=1,dy=1; isValid = false; isOccupiedByOppsitPiece=true; if (Math.abs(x-(locationX/Chess.sizeOfSquare)) == Math.abs(y-(locationY/Chess.sizeOfSquare))) { isValid=true; if (x < (locationX/Chess.sizeOfSquare)) { ...
d5eca667-b8ae-492f-b584-dab3e36179c2
7
public SkladnikiManagerFrame(){ super("Zarz�dzaj sk�adnikami"); setSize(szerokosc, wysokosc); setAlwaysOnTop(true); Toolkit kit = Toolkit.getDefaultToolkit(); Dimension screenSize = kit.getScreenSize(); setBounds((screenSize.width-szerokosc)/2, (screenSize.height-wysokosc)/2,szerokosc,wysokosc); setRes...
879d01ee-1c9a-4928-b416-83c12df3b342
3
public ConfigurationSection getConfigurationSection(String path) { Object val = get(path, null); if (val != null) { return (val instanceof ConfigurationSection) ? (ConfigurationSection) val : null; } val = get(path, getDefault(path)); return (val instanceof Configura...
3ab81742-ec7e-419b-a58e-1945a3579ef3
7
private StringManager(String packageName) { String bundleName = packageName + ".LocalStrings"; try { bundle = ResourceBundle.getBundle(bundleName); return; } catch( MissingResourceException ex ) { // Try from the current loader ( that's the case for trusted ap...
b724066a-e717-41ee-b505-bd1c226d7ec1
9
public static void convert(String kfDescPath, String textFilePath) throws IOException, ParserConfigurationException, SAXException { // Get the file descriptor from the XML file. KFileDescriptor kfd = new KFileDescriptor(kfDescPath); // Validate that keyed file and output text file ...
b1705784-6bc4-462f-b5b5-2b2216c6ea14
4
public void removeAutoFilter() { removeFilterDatabase(); // remove the _FILTER_DATABASE name necessary for AutoFilters int zz = getIndexOf( AUTOFILTER ); // remove all AutoFitler records while( zz != -1 ) { SheetRecs.remove( zz ); zz = getIndexOf( AUTOFILTER ); } // remove the two unknown records ...
0c4bf74f-c5b7-4981-ac7d-eb52a1893bfc
2
public void run() { boolean done = false; while (!done) { showMenu(); int option = getOption(); doAction(option); if (option == EXIT_OPTION) { done = true; } } }
5f5112d6-5677-409a-9b66-7283bcedc97b
7
protected void genClosedText(MOB mob, Exit E, int showNumber, int showFlag) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; if(E instanceof Item) mob.tell(L("@x1. Exit Closed Text: '@x2'.",""+showNumber,E.closedText())); else mob.tell(L("@x1. Closed Text: '@x2'.",""+showNumber,E....
8b283447-a9b1-46bc-bfe8-1eaeec6f78eb
9
public void extract(String getdata) { if (getdata.startsWith("GET")) { get = getdata; url = (getdata.substring(getdata.indexOf("/"))).split(" ")[0]; try { url = URLDecoder.decode(url, "UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(...
6ab055fd-4455-44fc-91ca-e30ae79c6ddc
2
public void roundInit(int round) { if(debug) print("Custom Initializing..."); firstInvocation=true; passNumber=1; timesCanPass=nplayers-1-getIndex(); if(round==1) { timesCanPass=nplayers-timesCanPass-1; } timesCanPassInitial=timesCanPass; stoppingThreshold=(int)Math.floor(timesCanPa...
6236b336-0679-44cd-bab3-77a91c67edd0
3
public static void renderSVG(Card card, Graphics2D g) { try { SVGDiagram diagram; if (card == null) { diagram = universe.getDiagram(ImageManager.class.getResource(urlBase + "blank.svg").toURI()); } else { diagram = universe.getDiagram(ImageMa...
7ab763b2-a7d2-416c-8bb9-0c4f9cac7555
7
static final void method3514(byte i) { anInt4465++; for (Class348_Sub27 class348_sub27 = ((Class348_Sub27) Class348_Sub42_Sub20.aClass262_9711.getFirst(4)); class348_sub27 != null; class348_sub27 = (Class348_Sub27) Class348_Sub42_Sub20.aClass262_9711 .nextForward((byte) 57)) { if (((...
25544b7f-383c-4ea3-812a-3250dfe8282d
7
public void run() { byte[] receiveData = new byte[20000]; while(true && !this.stop) { try { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); getServer().receive(receivePacket); ByteArrayInputStream bis = new ByteArrayInputStream(receivePacket.getData()); ObjectI...
294bf2cb-24f0-4cb9-9033-ca8b969fbfe1
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
0f877c51-0d67-4363-97e9-6786f7ef4dd4
5
@Override public void setDisplay() { switch (area.terrain) { case PLAINE: this.color = Color.yellow; break; case FORET: this.color = Color.green; break; case DESERT: this.color = Color.red; break; case MONTAGNE: this.color = Color.cyan; break; case VILLE: this.color = Color.pink;...
edbfc66d-9aff-4532-b04a-ccf0a615ee42
4
void init() { // Calculate pvalue cutoff scoreCutOff = scoreCutOff(); //--- // Calculate Fisher parameters //--- N = D = 0; for (String geneId : geneSets.getGenes()) if (geneSets.hasValue(geneId)) { N++; if (isTopScore(geneId)) D++; } if (verbose) Timer.showStdErr("Fisher Exact test para...
d3cae653-c7ef-457c-a4da-407d08fd17e8
1
public static ClassInfo getClassInfo(String typeSig) { if (typeSig.charAt(0) != 'L') throw new IllegalArgumentException(); return ClassInfo.forName(typeSig.substring(1, typeSig.length() - 1) .replace('/', '.')); }
75e56a72-6a5d-4cf2-9869-f7eb300620cf
6
private int clearArea(int zombiesAboutToEncouter) { int zombiesKilled = 0; List<Survivor> team = this.raidSettings.team; for (int i = 0 ; i < zombiesAboutToEncouter ; i++) { Survivor target = team.get(Math.abs(new Random().nextInt()) % team.size()); double zombieAttack = BitingDeathGame.getRandomProb...
4d72c816-cb41-4ff6-8737-513eb1dd40be
9
private final void parseChangeLog(String changelog) { String lines[] = changelog.split("\\r?\\n"); String checkVersion = lines[0]; String currentVersion = Main.getVersion(); boolean updateNeeded = false; String[] versions1 = checkVersion.split("\\."); String[] versions2 = currentVersion.split("\\."); int...
8cc96c46-b4da-41ea-896a-9c80af8c0e0d
1
public static String[] getFileNames(String version) throws IOException { String s = OberienURL.get(version); String[] fileNames = s.substring(s.indexOf("[files]")+7, s.indexOf("[/files]")).split("\n"); for (int i = 0; i < fileNames.length; i++) { fileNames[i] = "Game/" + fileNames[i]; } return fileNames; ...
eeac9198-971b-416f-a6a8-76981d8f7527
9
public static void main(String[] args) { Fast fast = new Fast(); StdDraw.setXscale(0, 32768); StdDraw.setYscale(0, 32768); StdDraw.show(0); String filename = args[0]; In in = new In(filename); int N = in.readInt(); Point[] points = new Point[N]; ...
735015b6-724d-4d11-abd4-1647722728cf
7
public Expression parseExpression(String methodName, boolean allowPrefix, Object... symbols) { try { Method method = Parser.getInstance().getClass().getDeclaredMethod(methodName); method.setAccessible(true); Binary binaryExpression = null; Expression leftExpression; if (allowPrefix && SyntacticValidat...
1fa9668a-4a8f-425f-a9c2-0384b40345af
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepeatStatementNode other = (RepeatStatementNode) obj; if (exp1 == null) { if (other.exp1 != null) return false; } else if (!exp1.equals...
9931037d-2098-45c8-8831-b8ba9e3003f8
7
public static void checkAndCreateSchema(Connection conn,PrintWriter pw) { Statement stmt = null; ResultSet rs = null; try { conn.setAutoCommit(true); } catch (SQLException se) { pw.println("[NsSampleWork] Error when setting autocommit on connection; exception thrown: "); se.printStackTrace(); } ...
7e2c2032-e522-45b7-b5c3-e43e352d3694
0
public void setEnableExceptionTracking(boolean enableExceptions) { this.enableExceptions = enableExceptions; }
32860764-d3ac-4e2c-9830-7f23f111a704
9
public List<String> locateJDK() { String JAVA_WINDOWS = "where javac"; String JAVA_LINUX = "readlink -f $(whereis javac)"; // readlink -f $(which java) //String JAVA_MAC = "ls -l `which javac`"; String JAVA_MAC = "/usr/libexec/java_home -v 1.8"; String osName = System.getProperty...
8d6e980f-5bff-484a-925b-11ee9df2d9a6
8
private void menor() throws Exception{ op2 = pila.pop(); if (op2.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); op1 = pila.pop(); if (op1.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); Elem resultado = new Ele...
d743d99f-9414-494b-b11c-fb582b64b2ca
0
public long getBlogId() { return blogId; }
68a6c1cf-fd80-42d0-a603-e89ae1bf8725
2
public void addPosition(Position position) { if(position == null) throw new NullPointerException("null cannot be added as a Position"); System.out.println("TEST1: " + otherPositions.size()); otherPositions.add(position); System.out.println("TEST2: " + otherPositions.size()); if (otherPositions....
8b9d668d-4f82-47b5-869d-af4563e9f70d
1
public Card dealCard() { if (cardsUsed == deck.length) throw new IllegalStateException("No cards are left in the deck."); cardsUsed++; return deck[cardsUsed - 1]; // Programming note: Cards are not literally removed from the array // that represents the deck. We just keep track ...
79c5494a-66eb-4ccf-a1f9-b39e1b0b81a0
5
private void AddAllAttributes(String shaderText) { final String ATTRIBUTE_KEYWORD = "attribute"; int attributeStartLocation = shaderText.indexOf(ATTRIBUTE_KEYWORD); int attribNumber = 0; while(attributeStartLocation != -1) { if(!(attributeStartLocation != 0 && (Character.isWhitespace(shaderText.charAt...
26c8a1f7-7aec-4578-a40d-c3057012210d
5
private Point getWorldCollision(Dynamic obj, Texture target) { Rectangle r = obj.getCollisionBox(); Point lowerLeft = new Point(r.x, r.y); Point upperRight = new Point(r.x + r.width - 1, r.y + r.height - 1); int cell = World.CELL_SIZE; //If x is negative, offset...
dcabf285-7949-4413-b188-a0a3f7a82f85
1
@Override public int hashCode() { return playerName != null ? playerName.hashCode() : 0; }
1355b563-7708-4ead-b018-f27ef806e511
1
private void process() { int picsize = source.length; result = new int[picsize]; for (int i = 0; i < picsize; i++) { int p = source[i]; int r = (p & 0xff0000) >> 16; int g = (p & 0xff00) >> 8; int b = p & 0xff; result[i] = luminance(r, g, b); } }
3734a0bc-cf41-41ee-b25c-7ac2ad63f932
8
@Override @SuppressWarnings("unchecked") public List<Poll>[] getMyPollTypes(MOB mob, boolean login) { final Iterator<Poll> i=getPollList(); final List<Poll> list[]=new List[3]; for(int l=0;l<3;l++) list[l]=new Vector<Poll>(); for(;i.hasNext();) { final Poll P = i.next(); if(loadPollIfNecessary(P))...
0dd13f1c-5bed-4165-8cd2-c8fac6c86bfe
0
@Column(name = "PCA_POS_ID") @Id public BigInteger getPcaPosId() { return pcaPosId; }
36ab29e6-abd4-4d69-9f48-8b09dd026f18
1
public void removePush() { if (stack != null) instr = stack.mergeIntoExpression(instr); trueBlock.removePush(); }
28b437de-864b-4959-be44-a288de551845
4
private float[] staggeredLine( int length, int initStep, float variation, boolean sub ) { // NOTE: Length must be an exact power of 2, plus 1. float line[] = new float[length] ; int step = (initStep > 0) ? initStep : (length - 1) ; while (step > 1) { for (int i = 0 ; i < length - 1 ; i += ...
fa11bcb4-d1b4-4908-99ab-585c70da300a
5
@Override public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; int size = Math.min( MAX_SIZE, Math.min(getWidth() - this.imagePadding.left - this.imagePadding.right, getHeight() - this.imagePadding.top - this...
7ae460ff-531a-45c4-9e37-957f86b5eed9
6
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.ipban + " (PlayerName/IP)"); return; } try ...
4c7d64ac-a6e2-4ae4-972a-583ec5f780a6
5
public int diff_slFormat() { int size = Paid_SoLuongSP.size(); double dnum = 0.0; double dnum1 = 0.0; int return_val = 0; int inum; int diff; for(int i = 0; i < size ; i++) { dnum = Paid_SoLuongSP.get(i); inum = P...
00c574c5-5cbb-4b9f-9978-6df7845e1469
9
public List<MemberBean> getMemberList(int start, int end) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List<MemberBean> memberList = null; String sql = ""; try { conn = getConnection(); sql = "select a.* from (select ROWNUM as RNUM, b.* from (select * from member" ...
a0f36c7e-038b-4d45-82ea-b5934cef9800
3
public static String encodeParameters(PostParameter[] postParams) { StringBuffer buf = new StringBuffer(); for (int j = 0; j < postParams.length; j++) { if (j != 0) { buf.append("&"); } try { buf.append(URLEncoder.encode(postParams[j].n...
5beb7322-8608-4e25-b0e3-6af1de55a2f3
5
public void removeMangeable(Mangeable alimentation){ List<Nourriture> alimentationLoft = new ArrayList<Nourriture>(); //alimentation.setValeurEnergie(0); alimentationLoft = this.getLoftCorrespondant().getAlimentation(); System.out.print("Liste Alimentation : \n"); for (int i = 0; i < alimentati...
16fd7933-e9fe-446a-8610-04625eaebf80
2
private boolean isNewerVersion(){ JSONObject obj = apiHome("imgurdl/version", "", "GET"); if(obj == null)return false; JSONArray data = (JSONArray) obj.get("imgurdlVersion"); JSONObject item = (JSONObject) data.get(0); String newestVer = (String)item.get("ver"); String newestLink = (String)item.get("link");...
04549577-8994-40e6-b057-2a3ad911d370
6
@Override public void approveSelection(){ File f = getSelectedFile(); if(f.exists() && getDialogType() == SAVE_DIALOG){ int result = JOptionPane.showConfirmDialog(this, Localization.getInstance().get("messageConfirmOverwrite"), Localization.getInstance().get("messageConfirmOverwriteTitle"), JOptionP...
a5031044-834e-4d12-b845-00d1c0797f7b
6
public void receiveFirst() { System.out.println("-- Bob --"); if (MitM) { System.out.println("ACHTUNG: MitM aktiv!!!"); } // fingerprint werte aus datei auslesen fingerprint = new Fingerprint(new File("HashParameter")); // bob bekommt p und g von alice p = new BigInteger(Com.receive(...
42bca9ea-0772-4993-a2da-348e521bac26
1
private String getShortValue(final Field field, final Object object) { Object result = getRawValue(field, object); if (result == null) { result = ""; } return result.toString(); }
c4f5ce16-9f10-46b5-96e5-2e3c5c2ab192
2
public boolean isEventHandledByState(final StateEnum state, final EventEnum event) { for (Transition transition : transitions.getTransitions(state)) { if (transition.getEvent() == event) return true; } return false; }
290ab8ec-2b0d-43e2-aa86-7f53dc9f0b50
9
public void checking_bfs(char[][] board, int x, int y) { Queue<Integer> que = new LinkedList<Integer>(); que.add(x * board[0].length + y); int n; while (!que.isEmpty()) { n = que.remove(); x = n / board[0].length; y = n % board[0].length; board[x][y] = '+'; if (x > 0 && board[x - 1][y] == 'O') ...
72b79440-4a6b-4633-99c0-bd9a974c5d3d
1
void drawShip(Ship ship, Coordinate sgc) { final int x = (int) (sgc.x - 1); final int y = (int) (sgc.y - 1); final int diameter = 3; if (Main.isFastBlinked) { g.setStroke(new BasicStroke()); g.setColor(ship.meta.color); g.fillOval(x, y, diameter, d...
317ee5df-110b-4480-9b10-3ba43322ac22
3
@Override public void deserialize(Buffer buf) { barType = buf.readByte(); if (barType < 0) throw new RuntimeException("Forbidden value on barType = " + barType + ", it doesn't respect the following condition : barType < 0"); slot = buf.readInt(); if (slot < 0 || slot > 99...
1807c445-85c9-4e4e-bf5a-fda1a3c6bee9
1
public void testPrint_bufferMethods() throws Exception { Period p = new Period(1, 2, 3, 4, 5, 6, 7, 8); StringBuffer buf = new StringBuffer(); f.printTo(buf, p); assertEquals("P1Y2M3W4DT5H6M7.008S", buf.toString()); buf = new StringBuffer(); try { f.p...
cefb1d95-c4ad-415a-9216-57e74f557287
8
protected NeuralOutputs(Element outputs, MiningSchema miningSchema) throws Exception { m_classAttribute = miningSchema.getMiningSchemaAsInstances().classAttribute(); int vals = (m_classAttribute.isNumeric()) ? 1 : m_classAttribute.numValues(); m_outputNeurons = new String...
ca6a7066-fd70-4dbf-a16b-1dea704f5f2e
8
public void setBounds(Rectangle rect) { int x = bounds.x, y = bounds.y; boolean resize = (rect.width != bounds.width) || (rect.height != bounds.height), translate = (rect.x != x) || (rect.y != y); if ((resize || translate) && isVisible()) erase(); if (translate) { int dx = rect.x - x; int dy ...
d3e91be3-a8cf-4bbc-8423-89ea045aa629
7
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...
45e800f2-31d7-45b9-8ef9-621830dc9c9b
2
public InnerClassInfo getOuterClassInfo(ClassInfo ci) { if (ci != null) { InnerClassInfo[] outers = ci.getOuterClasses(); if (outers != null) return outers[0]; } return null; }
c44730df-d820-4fd6-b513-6ef266849d44
7
private void btnOpenFileActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnOpenFileActionPerformed {//GEN-HEADEREND:event_btnOpenFileActionPerformed JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setDialogTitle("Open something inte...
f3bbdfd7-7227-4161-915d-c2525b516fab
0
public void setReturnNearestValue(boolean returnNearestValue) { this.returnNearestValue = returnNearestValue; }
867dfde0-2ae4-4b3a-80e9-527a6123b8db
6
public boolean testMultJumps(){ // Boolean for whether or not it passed the test. boolean multJumpTest = true; /** * A high number of moves must be made for this to be set up. * A diagram was made to figure out this sequence. It is: * * For ...