method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
73b27a6a-8dd6-45fc-8a0a-ad5dfa60ed77
1
@Override public ArrayList<Map<String,String>> getAllOngoingBidsOfUser(String user) { ArrayList<Map<String,String>> ongoingBidsList = new ArrayList<Map<String,String>>(); TypedQuery<Bid> allOngoingBidsQuery = emgr.createNamedQuery("Bid.findOngoingBidsByUser", Bid.class); allOngoingBidsQuery.setParameter("u...
fcad21e5-e6bb-4763-9419-a10c81275e7a
5
public TurnAction tryToReachBoardState(BoardState startingState, BoardState endingState){ Iterator stateComparisonResults = compareStates(startingState, endingState); int selectedRow = noRowSelected; int selectedRowTokens = 0; boolean movePossible = true; int checkedRowTokens = 0; int rowNumber = 1; ...
0031c04c-310a-4682-95f1-d9c6450d1320
4
@Override public void setValue(int row, int col, double value) throws MatrixIndexOutOfBoundsException { if ((row < 0) || (col < 0) || (row >= mas.length) || (col >= mas[0].length)) { throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index."); } mas[row][col] = (...
28e193a3-bbad-4e3c-9bb2-20f14512dce6
5
public void clearLastAnnotationProcessing() { if (_stackCountInfos.isEmpty()) { throw new IllegalStateException("empty stack count infos"); } StackCountInfo info = _stackCountInfos.removeLast(); int i; for (i = 0;i < info.sourceLoaderCount;++ i) { popSourceLoaderStack(); } for (i = 0;i < info...
51157ba6-c992-469d-8053-771c684db9fb
6
public void checkIfNeedClean(Row row,Column col,String tableName){ BigTable table=TableManager.getTable(tableName); NewRowTransaction tr=buffertr; ValueWithTimestamp lock=tr.read(new Column("lock"), 0,start_ts,1); //If it exist with a non null value if(lock!=null&&lock.getValue()!=null){ System.out.println...
499c7dcd-4d0b-4ea3-9a86-3b226161a394
2
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Luodaan olio, johon aukiolot tallennetaan. Aukiolo aukiolo; // Luodaan muunnosta varten SimpleDateFormat. SimpleDateFormat merkkijono = new SimpleDateFormat("HH:mm"); // Haetaan tietoka...
c2ec3401-3dfa-41de-b4bc-4790a81bf233
9
public static void main(String[] args) throws InterruptedException, IOException { boolean test = true; if (test || m_test) { ConnectFour game = new ConnectFour(); Player player1 = new Human(game); Player player2 = new ConnectFourAI(game); player1.setPlayerName("Gavin"); player2.setPlayerName("So")...
11298512-ce50-4c76-961d-4f680d112dd0
1
public void writeData(final DataOutputStream out) throws IOException { out.writeShort(exceptions.length); for (int i = 0; i < exceptions.length; i++) { out.writeShort(exceptions[i]); } }
bac20650-b623-4ea4-a505-4721f953d22d
8
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission(Permissions.PERM_ADD_RES)) return false; if (args.length < 1) { Util.sendMessage("&cInvalid Syntax. Usage: /cpadd <username>", sender.getName()); return false; } Player player =...
c8191b8b-fd66-4eea-b69d-b1ea4bb32a5c
2
private void restart(){ System.out.println("Want to see history of steps?(yes/no)"); if(GetData.getYesOrNoAnswer()){ gameHistory.showHistory(); } System.out.println("Want to play again?(yes/no)"); if(GetData.getYesOrNoAnswer()){ playGame(); } else ...
29dc555c-a311-4e8e-b049-d0c60a370e60
6
public void getInput() { String command; Scanner inFile = new Scanner(System.in); do { this.display(); // display the menu // get commaned entered command = inFile.nextLine(); command = command.trim().toUpperCase(); ...
99c2a711-e98c-4ea9-8189-c2e0efa25a0c
4
private static String uncommentAndTrim(final String line) { int cur = 0; while (cur < line.length()) { final int pos = line.indexOf('#', cur); if (pos < 0) return line; final int doublepos = line.indexOf("##", cur); if (pos < doublepos || doublepos < 0) return line.substring(0, pos); ...
4bda7a2c-1d8b-4fee-a1b0-93ddf7a416fd
8
private static int longestValidParentheses(String s) { int result = 0; int tmp = 0; char[] cs = s.toCharArray(); Stack<Integer> st = new Stack<Integer>(); for(int i = 0;i < cs.length; i++) { if (st.isEmpty()) { st.push(i); } else { if (cs[i] == ')' && cs[st.peek()] == '(') { st.pop(); }...
2b52f239-fba1-4152-ad0b-250e0950b2a5
9
static void lsp_to_curve(float[] curve, int[] map, int n, int ln, float[] lsp, int m, float amp, float ampoffset){ int i; float wdel=M_PI/ln; for(i=0; i<m; i++) lsp[i]=Lookup.coslook(lsp[i]); int m2=(m/2)*2; i=0; while(i<n){ int k=map[i]; float p=.7071067812f; floa...
ff5e7339-e458-459d-814e-0570075c6a60
9
public static void emitUnboxArg(ObjExpr objx, GeneratorAdapter gen, Class paramType){ if(paramType.isPrimitive()) { if(paramType == boolean.class) { gen.checkCast(BOOLEAN_TYPE); gen.invokeVirtual(BOOLEAN_TYPE, booleanValueMethod); // Label falseLabel = gen.newLabel(); // Label endLabel = gen.n...
1afe1e14-a367-4187-96f6-8613c9143d4d
9
public void perform() { if (!OKConfig.useSecondaryGroups) { Player player = Bukkit.getPlayer(this.parameters.get(0)); if (player != null || OKFunctions.hasAccount(this.parameters.get(0))) { String playerName = this.parameters.get(0); if (player != null) { playerName = player.g...
221e7a6f-b442-468b-8574-b39a1c4423e6
9
public static ArrayList<Entity> loadEntities(Game game, int id, int mapHeight) { ArrayList<Entity> entities = new ArrayList<Entity>(); try { BufferedReader reader = new BufferedReader(new InputStreamReader(Assets.class.getResourceAsStream("/ca/josephroque/ld30/_resources/text/level" + id + "_entity.txt")))...
3d322c74-53ee-4d53-888e-7a94541faa96
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MealCategoryData other = (MealCategoryData) obj; if (mealCategoryName == null) { if (other.mealCategoryName != null) return false; } else if (!mealC...
b7596b66-e422-428c-ba22-bdbc3c8e3c6b
3
public void loadFromConfig(Configuration conf) { clearTitles(); ConfigurationSection cfgs = conf.getConfigurationSection("titles"); if (cfgs != null) { for(String key : cfgs.getKeys(true)) { setTitle(key, cfgs.getString(key)); } } for(Player player : fastTitles.getServer().getOnlinePlayers()) { u...
9a476f3d-a301-4529-9f6c-9f3e7ec99ace
3
@Override protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) { String key = RegionExecutor.parse(args, 0, "<Option>", sender); if (key == null) return false; key = key.toLowerCase(); if (!reg...
3bc7f0a0-c749-44d6-bcaa-184a9f70fdd7
4
public SQLite(Logger log, String prefix, String name, String location) { super(log, prefix, "[SQLite] "); this.name = name; this.location = location; File folder = new File(this.location); if (this.name.contains("/") || this.name.contains("\\") || ...
d46a2554-f778-4f2f-8340-1e9796001947
1
private boolean isValid() { if (favouriteSport.length() > 50) { System.err.println("Invalid argument(s) when inserting an interest!"); return false; } return true; }
c989e66b-901c-48c0-a1ad-743a0e8a5b55
8
public static void main(String[] args) { int i=0; String arg=null; while(i < args.length && args[i].startsWith("-")) { arg=args[i++]; if(arg.equalsIgnoreCase("--alg")) { symAlg=args[i++]; continue; } if(arg.equalsIg...
34478458-817a-44db-a2fd-ad621ab3cdf7
5
public void fadeOut( FilenameURL filenameURL, long milis ) { if( milis < 0 ) { errorMessage( "Miliseconds may not be negative in method " + "'fadeOut'." ); return; } fadeOutMilis = milis; fadeInMilis = 0; fadeOutGain ...
1fe3eb5f-2f6e-43c9-a32f-c81c6d331b64
5
public boolean isFree(int xx,int yy){ switch(Screen.land[yy][xx]){ //all the solids: case 1: case 2: case 3: case 4: case 8: return false; } return true; }
3a4323df-f7f3-4d42-8f81-223e3ff3684b
3
private void drawDividers(Graphics gc, DockLayout layout, Rectangle clip) { if (clip.intersects(layout.getX() - 1, layout.getY() - 1, layout.getWidth() + 2, layout.getHeight() + 2)) { DockLayoutNode[] children = layout.getChildren(); if (layout.isFull()) { if (layout.isHorizontal()) { drawHorizontalGri...
786e1acf-5da1-4061-8ded-1a9795c3904a
4
public static int getDashboardVelocityUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFound...
0d6beb8d-40ca-49e4-83b1-891a8bd3b6d0
9
public List<ABObject> findBirds() { if (_birds != null) return _birds; if (_sling == null) return null; _birds = new LinkedList<ABObject>(); // scan the birds from left to right int xMax = -2; final int BIRD_DISTANCE = 150; for (ConnectedComp...
9df0d38c-a7cc-4ed3-bd49-0f831dbfe6cc
9
public static void javaHelpOutputBinaryOperator(Cons expression, int nestlevel) { { Stella_Object arg1 = expression.value; StringWrapper op = ((StringWrapper)(expression.rest.value)); Stella_Object arg2 = expression.rest.rest.value; if (StringWrapper.javaNestedOperatorNeedsParenthesesP(op, arg1))...
1917ec6c-7aea-41e6-bb49-b910fb938b03
7
public void clickChooseSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) { String skillName = ""; int check = -1; for(int i = 0; i < heroies.size(); i++) { int choiceCount = 0; //For specific hero in hero slot MainMenuHeroSlot temp = (MainMenuHeroSlot) heroies.get(i); //Prin...
9a4f5211-2a29-42fa-b095-dec248695bed
7
public void dump() { endTime = System.currentTimeMillis(); final NumberFormat formatter = new DecimalFormat("000"); initReportWriter(); try { reportWriter.writeStartDocument(); reportWriter.writeStartElement("testsuite"); reportWriter.writeAttribute("errors", String.valueOf(countCall(Status.ERROR...
99566b0b-b236-494c-b539-8251304e43c7
0
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext( "context/jdbcContext.xml"); SampleService b = ctx.getBean(SampleService.class); b.doSomeThing(); }
56d83f54-539d-421d-8997-a6b0ec7fb451
9
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
8b169459-24ff-454b-b191-00b60bcd8408
9
public void addRow(File f) { AudioFile file = null; try { file = AudioFileIO.read(f); } catch (Exception e) { e.printStackTrace(); } Tag tag = file.getTag(); AudioHeader d = file.getAudioHeader(); FileTraverse.list.add(FileTraverse.list.size(), f); Object[][] temp = new Object[7][FileTraverse.l...
27d72c1d-ef0a-4c83-ba37-53f0c2bf269a
1
static final int Mix5To3(final int c1, final int c2) { //return (c1*5+c2*3)/8; if (c1 == c2) { return c1; } return ((((c1 & Mask2) * 5 + (c2 & Mask2) * 3) >> 3) & Mask2) | ((((c1 & Mask13) * 5 + (c2 & Mask13) * 3) >> 3) & Mask13) | ((((c1 & Mask4) >> 3) * 5 + ((c2 & Mask4) >> 3) * 3) & Mask4); }
0621bac8-532c-4eb4-8b07-4b1be458b480
8
protected static void menuTrajets(){ System.out.println("Menu Trajets. Tapez 'aide' pour voir le détail des commandes."); System.out.println("Commandes disponibles : creer, rechercher, afficher, aide."); System.out.print(">>"); Scanner sc = new Scanner(System.in); String choix = sc.nextLine(); if (choix.eq...
ec544ac7-2bf6-4e60-a2ce-7cb47e49456c
4
public void render(Graphics g){ // Redraw the clock with the current elapsed time minutesExpired = millisecondsExpired / 60 / 60; secondsExpired = (millisecondsExpired / 60) % 60; int minutes1 = minutesExpired / 10; int minutes2 = minutesExpired % 10; int seconds1 = secon...
6497a63f-7b17-4e34-908c-92e4a946bdce
4
public ArrayList<Integer> zeroRows(){ ArrayList<Integer> ret = new ArrayList<Integer>(); int nZero = 0; for(int i=0; i<this.numberOfRows; i++){ int m = 0; for(int k=0; k<this.numberOfColumns; k++){ if(this.matrix[i][k]==0.0)m++; } ...
a295c4ef-af0e-40a7-bcc4-9640ebb49ff6
3
@Override public void move(Excel start, Excel finish) { for(Excel ex: coloredEx) { if (ex.getX() == start.getX() && ex.getY() == start.getY()) { Dx += finish.getX() - start.getX(); Dy += finish.getY() - start.getY(); setColoredExes(); return; } } }
9562b218-bb39-4ead-bc2c-cfe20e2462e3
4
public void deleteAuthHeaderByCustId(int cust_id){ Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
473870b7-8c67-4b31-950a-e2e85aa090c6
9
public String play(String me, String him){ int myAmmo = findAmmo(me); int hisAmmo = findAmmo(him); //Special cases if(me.length() == 0){ return "R";} if(myAmmo > 5){ return "S"; } if(hisAmmo == 5 && myAmmo > 0){ return "S"; } if(myAmmo == 5 && hisAmmo > 0){ return "B"; } Random rand = new Rando...
8c74d2f3-8215-48d4-9c54-d66c2ef4c40c
9
@Override public IPrimitiveResult scan(PrimitiveContext context) throws SynException { if (context.current != '\'' && context.current != '"') { //Not a string literal. Return. return null; } //Out of memory error protection. context.setMaxBufferLength...
6049c4b8-62b1-4b85-b704-77cdc3b940a2
2
public void tick() { if (input.attack.clicked || input.menu.clicked) { game.setMenu(parent); } }
0c2e1165-85b0-4c8d-909a-1e06434c8499
8
private void determinarCuadrante(int x, int y) { if(x<=2) { if(y<=2) { pnlCuadranteAuxiliar=pnlCuadranteA; } else if(y<=5) { pnlCuadranteAuxiliar=pnlCuadranteB; } else { ...
198008c3-d6e9-4ca3-8519-bd35eb8629f4
7
private static Content parse(String entry) { Content content = new Content(); switch (entry.charAt(0)) { case 'u': content.type = Content.USER; break; case 'f': content.type = Content.FILE; break; case 'd': content.type = Content.DIR; break; } int pos = 1; int secondSpcPos = entry.inde...
345147ef-eb67-4561-9e2f-86bf37e646c7
8
public Type getCastHelper(Type fromType) { Type hintType = fromType.getHint(); switch (hintType.getTypeCode()) { case TC_ARRAY: if (!elementType.isClassType() || !((ArrayType) hintType).elementType.isClassType()) return tObject; Type middleType = elementType .getCastHelper(((ArrayType) hintTyp...
36abbc4a-bc00-4350-939b-1847a0e6e597
2
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed JTextField[] gg = {this.jTextField1,this.jTextField2,this.jTextField4,this.jTextField5}; for(JTextField a : gg){ if(a.getText().isEmpty()){ proyecto.Error wp = new ...
de498ec5-68ef-4238-97d7-9ca9b738438e
1
private String getCleanName(final String fileToString, String fileSeparator) { if (fileToString == null) return null; String file = getSuffix(fileToString, fileSeparator); file = Utils.getPrefix(file, Utils.DUMP_KEYWORDS); file = file.replace('.', ' ').trim(); return file; }
3b75c4ff-3800-44d1-b873-09c4ff6e431a
5
public static void main(String[] args) { Class<?> c; ArrayList classList = null; try { c = Class.forName(args[0]); TypeDesc desc = new TypeDesc(); for(String name : args){ desc.printType(c, 0, TypeDesc.basic); classList = desc.getClassList(); } for(int i = 0; i < classList.size(); i++){ ...
bd3dfe0d-a77d-4acc-8c51-c7acdcbb2247
2
public Collection subclasses(final Type type) { final TypeNode node = getExtendsNode(type); if (node != null) { final List list = new ArrayList(extendsGraph.preds(node)); final ListIterator iter = list.listIterator(); while (iter.hasNext()) { final TypeNode v = (TypeNode) iter.next(); iter.set(v...
99ac9533-7f49-4de2-bb55-a0719fef0641
3
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = "application/json") public ResponseEntity<?> update(@PathVariable("id") int contactId, @RequestBody Contact contact, @RequestParam(required = false) String searchFor, ...
00ab26fa-9bd5-4559-ba32-d034123ef052
5
private static String decoration2Dot(Styles.Decoration decoration) { switch (decoration) { case Arrow: return "vee"; case Aggregation: return "odiamond"; case Composition: return "diamond"; case Inheritance: ...
16927c18-495f-4975-bdbd-cd8fa721ba4e
8
public String toString() { StringBuffer result = new StringBuffer(); result.append("---- " + name + " ----\n"); if (dough != null) { result.append(dough); result.append("\n"); } if (sauce != null) { result.append(sauce); result.append("\n"); } if (cheese != null) { result.append(cheese); ...
bca56d60-0de5-4bcb-b202-3284f0026ea6
6
@Override public void deserialize(Buffer buf) { super.deserialize(buf); objectGID = buf.readShort(); if (objectGID < 0) throw new RuntimeException("Forbidden value on objectGID = " + objectGID + ", it doesn't respect the following condition : objectGID < 0"); powerRate = ...
353a9893-0619-43a0-864e-a188c18d13fd
0
public static void stop() { server.stopServer(); server = null; }
4b038718-4c6b-409e-86bf-12e442257bf0
0
public String getCode() { return code; }
718efcad-2dd2-4076-9b63-398a41679a1c
3
protected void processOtherEvent(Sim_event ev) { boolean result = false; // then process at local RC if previously not available if (localRC_ != null) { result = localRC_.processEvent(ev); } // process this event at data manager if (!result) { ...
13ee49e4-6cb9-400a-913e-ae10c00a0bb3
0
public DefaultComboBoxModel getModeleJComboBoxVisiteur() { return modeleJComboBoxVisiteur; }
7b8bb007-2c18-4f54-b952-b20a0e537e6d
5
@BeforeTest @Test(groups = { "Red Black Tree", "Insertion" }) public void testRedBlackTreeInsertion() throws DuplicateKeyException { Integer count; Reporter.log("[ ** AVL Tree Insertion ** ]\n"); try { timeKeeper = System.currentTimeMillis(); for (int i = 0; i < seed; i++) { // System.out.println(i)...
bf869cd5-beaf-49e1-b3e4-4a3484841cf5
7
public List<User> determineWinners() { User first = new User(); User second = new User(); User third = new User(); first.setPoints(-1); second.setPoints(-1); third.setPoints(-1); for (User u: allUsers) { if (u.getPoints() > first.getPoints()) { third = second; second = first; first = u...
37211c8b-05fe-4dbe-89bc-656c77839df5
5
public int getScore() { int sc = 0; try { sc = Integer.parseInt(score.getText()); } catch (Exception e) { return 0; } if (item.getPointMax() <= 0) { // if (sc > 0) // sc = 0; if (sc < item.getPointMax()) sc = item.getPointMax(); return sc; } if (sc < 0) sc...
b4c9cdce-e358-4372-9416-ac61733a047e
4
public FireBall(TileMap tm, boolean right) { super(tm); facingRight = right; moveSpeed = 3.8; if (right) dx = moveSpeed; else dx = -moveSpeed; width = 30; height = 30; cwidth = 14; cheight = 14; try { BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream(path)); sprites ...
7214cfb2-8715-4171-a977-6e6bd11eb05a
9
private static Solution makeBaby(Solution mommy, Solution daddy, ArrayList<Car> allCars) { //Preserve a section of the mommy Solution baby = new Solution(new Rider[mommy.getRiders().length], 0, allCars); Rider[] mommysRiders = mommy.getRiders(); Rider[] babysRiders = baby.getRiders(); Rider[] daddysRiders = d...
87d58dde-e6af-4e14-b419-113c9293d48d
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean....
7ec5d6b3-0434-477f-a837-a5349cdcc546
5
public boolean testFirsetCell(int H, int V) { // H&V number want be bls of // indH &indV A = index if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8 || (this.indexV + V) < 0 || (this.indexH + H) < 0) { this.availableCells[0] = null; } else if (myBoard.bordaCell[this.indexH + H][this.indexV + V].cellPie...
07c3bdb2-5c47-4f9b-a80f-36cbf001443e
3
public static long trouverE(long s, long phiN) { if (s <= 1 || phiN <= 1) throw new IllegalArgumentException(); while (Num2.euclideEtendu(phiN, s)[0] != 1) { s++; } return s; }
8709fcef-50d7-49c0-8f7b-05d015ee37c6
2
static int F3(int op, int c) { if ((c < 0) || (c > MemSize)) { System.out.println("Operand for F3 Format is referencing " + "non-existent memory location."); bug(1); } return op << 26 | c; }
1261499f-febf-4c5c-a612-874c765b3c06
3
public String generateInsertStmt(TransactionSet transactionSet) { //code to convert transactionSet object to SQL insert statement string for that transactionSet System.out.println("Generating Insert Statement for transactionSet"); String result = null; String start = transactionSet.getStart_date(); String end...
fcc8d817-a386-48bf-bc6c-f823ac482f42
2
public void continuemethod() { while (true) { System.out.println("Input an integer"); n = input.nextInt(); if (n != 0) { System.out.println("You entered " + n); continue; } else { break; } } }
18c0ca17-384a-486c-80af-9178ac4bd34b
0
public Point getFirstpoint() { return firstpoint; }
b10ec2a7-bb90-463f-be58-582f64ec0326
4
public synchronized void receive(File file, boolean resume) { if (!_received) { _received = true; _file = file; if (_type.equals("SEND") && resume) { _progress = file.length(); ...
f2f2bed0-c13e-4c02-9c36-e5ec9e453dd5
2
public int GetCommand(int devID) throws Exception { int command = -1; try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB _connect = DriverManager.getConnection(_url, _user, _password); // PreparedStatements...
b2269081-704a-41c3-8754-b48e56b08529
8
private synchronized void readPasswd(InputStream in) throws IOException { BufferedReader din = new BufferedReader(new InputStreamReader(in)); String line; entries = new Hashtable(); String[] fields = new String[7]; while((line = din.readLine()) != null) { StringTokenizer st = new ...
fe862687-404e-42f4-993e-e5f62909f99d
0
public void setAnswer(String answer) { this.answer = answer; }
4588d20e-3804-4725-aec5-f5c64a0c6499
5
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuffer rs = new StringBuffer(); int c1, c2; if (len <= 0 || len > d.length) throw new IllegalArgumentException("Invalid len"); while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_co...
55069f2e-b6b8-49fb-b365-9c9c6adae5f0
8
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Image)) { return false; } Image other = (Image)obj; return Objects.equal(filePath , other.filePath ) && Objects.e...
b7feca51-6c7f-44fe-a15a-03d4ed43e19d
5
protected String getStrByEmission(String str, T emission){ String out = str; if(Emissions.e_END_end.equals(emission) || Emissions.e_M_nonAlphaNumeric_to_none.equals(emission)){ out = ""; } else if(Emissions.e_M_partialWord_to_letter.equals(emission) || Emissions.e_M_word_to_firstLetter.equals(emission)){...
d6967700-abac-4788-9d91-c7fc2f14a7bd
1
public void test_DateTime_setHourZero_Turk() { DateTime dt = new DateTime(2007, 4, 1, 8, 0, 0, 0, MOCK_TURK); assertEquals("2007-04-01T08:00:00.000-04:00", dt.toString()); try { dt.hourOfDay().setCopy(0); fail(); } catch (IllegalFieldValueException ex) { ...
2751f528-3cc6-489d-9f48-f548bdaec034
0
public void copyFrom(SalableRange other) { this._departureStart = other._departureStart; this._departureEnd = other._departureEnd; this._destinationStart = other._destinationStart; this._destinationEnd = other._destinationEnd; }
20cb1ad0-38b7-4a2d-ad78-4df0b5cfd257
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...
ac31a558-661e-4846-8850-b69109e55644
2
public void writeString(String string, int stringSize) throws IOException { //Retirer les espaces superflus de la chaine string = string.trim(); if(string.length() > 30) string = string.substring(0, 30); int stringLength = string.length(); //Insérer les espaces nécessair...
222a2380-dd00-421d-912c-849e301002d3
3
public void addDep(String ligne){ if(ligne != null){ String[] split = ligne.split("="); if(split[0].contains("JOB")) bag.add(new JobBean(null,null,null,null,null,null,null,null,split[1])); else if(split[0].contains("USR")) bag.add(new JobBean(null,null,null,null,null,null,null,null,split[1])); } }
160c1951-95dd-4cb6-8a05-3867ac45a4ff
9
public boolean controlDate(String date){ if (date.length()==10){ String ss[] = date.split("[.]"); int day = 0; int month = 0; int year = 0; if(ss.length != 3) return false; try{ day = Integer.parseInt(ss[0]); month = Integer.parseInt(ss[1...
4bacc95c-f655-4cb0-88cb-4ac32fe50be6
4
@Test public void convertToJSON() { Properties props = new Properties(); try { props.load(new FileInputStream(TestConstants.RESOURCES + "/jmeter.properties")); JSONObject expected = Utils.convertToJSON(props); String s = Utils.getFileContents(TestConstants.RESOURC...
5fef2644-07ee-4b08-bd0e-7931a4c5cea4
6
void resetEditors (boolean tab) { TableItem oldItem = comboEditor.getItem (); if (oldItem != null) { int row = table.indexOf (oldItem); /* Make sure user has entered valid data */ try { new String(nameText.getText()); } catch (NumberFormatException e) { nameText.setText(oldItem.getText(NAME_...
744008d1-009b-4fdb-88a5-d69061f20592
0
PINUsageModeType(String v) { value = v; }
e1085560-3ef1-4ce3-b992-3af6e293a45d
7
public static String[] iScript(String scriptName) { String l = ""; BufferedReader in = null; String line = "A B 1"; String path = "res/script/" + scriptName; File f = new File(path); int counter = 0; int lines = 0; try { lines = count(path) + 1; } catch (IOException e1) { e1.printStackTrace(); ...
bf8a0c0d-fc6a-4b92-a4a3-c8ef62104c14
7
public static final boolean fullDharokEquipped(Player player) { int helmId = player.getEquipment().getHatId(); int chestId = player.getEquipment().getChestId(); int legsId = player.getEquipment().getLegsId(); int weaponId = player.getEquipment().getWeaponId(); if (helmId == -1 || chestId == -1 || legsId == -1...
2f1735a7-4617-4fa9-96ae-e7038c97c506
0
@Override public String toString() { return new ToStringBuilder(this).append("seqid", this.getSeqID()) .append("phone", this.getShopPhone()) .append("address", this.getShopAddress()) .append("name", this.getShopName()).toString(); }
587c749e-3d77-434d-872b-e57d6ae33c86
1
private void processMoveFromKingPile(MouseEvent e) { int index = (int) (e.getY() / (CARD_Y_GAP + CARD_HEIGHT)); if (index < 4) { activeMove = new CardMoveImpl(index, CardMoveImpl.MOVE_TYPE_FROM.FROM_KING_PILES); } }
19bba82f-99cc-4230-b464-1f1f2b6df610
4
private final int gen_noncaps_delta(int index, int[] delta, int nDelta, boolean sliding, Move[] moves, int startIndex) { int moveIndex = startIndex; // Record the board's en passant square, white/black castling rights and // half-moves for (int i = 0; i < nDelta; i++) // Loop through the 8 possible deltas ...
b7a4ec72-ec99-4b1b-955b-7118be0bcb0c
7
private void read(String csvFile){ // TODO split this! It's work fine final int ROOT = 0; final int folderIndex = 1; // in String[] final int topLevelIndex = 2; // in String[] BufferedReader br = null; String line = ""; String cvsSplitBy =...
1e160f72-2dd3-45e4-839a-19d2a211105e
6
@Override public int compareTo(TailStack<T> o) { if (this.size() > o.size()) return 1; if (this.size() < o.size()) return -1; if (this.size() == 0) return 0; Iterator<T> thisIterator = this.iterator(); I...
89487e63-2cb6-43a8-91dd-bdc1971c5e36
1
private void menuDirectorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDirectorioActionPerformed String resultado = statics.definirDirectorio(this); if(!resultado.equals("")){ Directorio.getInstance().setRuta_excel(resultado); Directorio.getInstance().g...
43ff4e34-7178-47d0-b69b-caf47e463fdb
5
public void generatel(int x, int w, byte type) { float vs = -random.nextInt(12),grav = random.nextFloat(), time = 12; for (int e = x; e < x+w; e++) { miGenH=(miGenH>450)?450:(miGenH<10)?10:miGenH; for (int i = miGenH; i < h; ...
1a744a4c-2fd6-4d0b-9606-a9a60c267d5d
5
public final synchronized void mouseReleased(MouseEvent mouseevent) { int i = method3600(mouseevent, -75); if (-1 == (i & anInt7422 ^ 0xffffffff)) i = anInt7422; if (0 != (0x1 & i)) addEvent(mouseevent.getX(), 3, mouseevent.getClickCount(), mouseevent.getY(), false); if (-1 != (i & 0x4 ^ 0xffffff...
965c24b3-1880-49b3-b7c2-27952be9b437
1
public int getRemainingSize() { int max = 0; for (int i=0; i<filters.length; i++) { max = Math.max(max, filters[i].getRemainingSize()); } return max; }
902ad5d5-6188-4af9-8210-3eac42ee7505
4
@Override public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException { DataTable dataTable = null; try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream())))) { TableRow row = new TableRow (); ...
17cff11f-1923-4de9-a7eb-bbeb301caeac
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...
bf43b93f-643c-4d2b-9b55-6ed35b15e6ff
0
@Override public void shuffle() { }