method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7e8bf553-8aed-4dd6-a65c-e2cd5bb3c904
8
private static Product printItem(Map<String, AttributeValue> attributeList) { Product p = new Product(); for (Map.Entry<String, AttributeValue> item : attributeList.entrySet()) { String attributeName = item.getKey(); AttributeValue value = item.getValue(); ...
7911af96-e90f-4a24-9417-4e132baf9a51
1
public int hashCode() { return (int)(7 * id + fitness + weight + sugar + cost + ((name == null) ? 0 : name.hashCode())); }
98c2bf4f-389e-4ec1-b22e-9b6dfd2a5cf7
3
@Test public void resolve() { long result = 0; long num=0; long start = System.currentTimeMillis(); long N=1000000; for (long i = 2; i < N; i++) { long step = collatzSteps(i); if (step > result) { result = step; num=i; } cache.put(i, step); if(i%(N/100)==0){ print(i/(N/100), "% T...
59e98cdd-b7c9-44de-a5cf-2d56239c353d
8
public boolean executeLine(String line) { if (system == null && line.startsWith("xearth")) { extractDimension(line); system = new PSystemXearth(width, height, config, markers); return true; } if (system == null) { return false; } if (line.startsWith("#") || line.startsWith("'")) { return true; ...
d1d40026-1a3f-4300-888a-ba969a1b1523
0
public static long prevMonth(long month) { return getStartOfMonth(month - DAY_LENGTH); }
83f6a025-7d9e-427c-a178-062964b17dee
9
public static void judge(String p1, String p2) { String result="Draw"; switch(p1) { case "s": switch(p2) { case "r": result=("P2 Wins"); a2++; break; case "p": result=("P1 Wins"); a1++; break; } break; case "r": switch(p2) { case "s": result=("P1 Wins");...
e49127d3-1b2b-4c2d-a538-01ec5d8450c9
8
private static ArrayList<File> listFiles(String dirPath) throws FileNotFoundException { ArrayList<File> files = new ArrayList<File>(); File dir = new File(dirPath); if (!dir.isDirectory()) { throw new FileNotFoundException(dir.getName() + " is not a valid directory"); } ...
e0ef9dae-4670-4110-bfd0-43fccc443d47
3
@Override public List<Game> getListOfGames(Member member) { List<Game> allGames = getAllGames(); for(Game game:allGames){ if(!game.getMemberOne().equals(member) && !game.getMemberTwo().equals(member)){ allGames.remove(game); } } return null; }
e0cee620-ead1-4e85-8488-cf77929a290c
8
public static void processOutputEvent(OutputEvent outEvent){ switch(outEvent.getEventType()){ case JOIN_REQUEST: //Do nothing break; case ADD_LINK: //Do nothing break; case ADD_PEER: //Do nothing...
9a476b79-25b7-41c0-8ed6-fb7f0150ed75
9
public void select (int start, int end) { if (!selected || start != selectStart || end != selectEnd) { if (selectEnd < selectStart) { selectNone(); } else { if (selectStart >= wave.length()) selectStart = wave.length() - 1; if (selectEnd >= wave.length()) selectEnd = wave.length(...
2065c135-4520-4715-8041-351da9cf9164
8
private void setDrawBounds() { //The drawing area must be square if we're concerned about having actual branch lengths that are proportional //to the branch lengths specified by the tree. This is only a concern for non-SquareTrees, so if the tree //is an EqualAngleTree adjust the padding appropriately if (tree ...
826364fc-0034-4886-83a0-94e73c53ff49
7
public void commit() { if (this.isDeleted) { // Even if the field is newly-added, we can still delete it // without problems because its FieldInfo was already noted with // the ClassInfo. final ConstantPool cp = editor.constants(); final int nameIndex = cp.getUTF8Index(name); this.editor.classInfo(...
6fa82aed-fdc7-4243-ac0a-64a8b86e0f29
1
public void visitNewArrayExpr(final NewArrayExpr expr) { if (expr.size == from) { expr.size = (Expr) to; ((Expr) to).setParent(expr); } else { expr.visitChildren(this); } }
e0315972-ae4b-493c-ab31-fb782caf05f4
3
void print(Node t, int n, boolean p) { if (p) { t.getCar().print(-n, false); System.out.println(); printIf(t.getCdr(), n); } else { if (n > 0) { for (int i = 0; i < n; i++) System...
f7398bb2-c83e-4047-aefc-618a393d1f94
6
final private boolean jj_3R_118() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; if (jj_3R_40()) return true; if (jj_scan_token(RPAREN)) return true; if (jj_3R_47()) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_191()) jj_scanpos = xsp; return fal...
3c9d6675-1d71-40c3-91f9-843e1326df33
2
public void setFileRaw(byte[] file) { if (file != null) { if (file.length > this.file.length) { throw new IllegalArgumentException("File is too long:" + file.length + " max is:" + this.file.length); } Arrays.fill(this.file, (byte) 0); System.arrayc...
5e04242b-7099-47ef-8af0-752a18d9af9a
7
public int maxPathAsRoot2(treeNode curRoot, HashMap<treeNode, Integer> node_notRootMax, HashMap<treeNode, Integer> node_asRootMax) { this.running_time_asRoot2++; int curMax = -10000; if (node_asRootMax.containsKey(curRoot)) return node_asRootMax.get(curRoot); if (curRoot.leftLeaf == null && curRoot.r...
1b56a8cf-b99e-406d-9ca4-f438535163c3
0
public void setScore(int score) { scoreLabel.setText(String.valueOf(score)); }
773b186b-10dc-44d2-86a2-d443ed71a979
8
public static boolean isPrime(long n) { if (n < 2) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; long sqrtN = (long) Math.sqrt(n) + 1; for (long i = 6L; i <= sqrtN; i += 6) { if (n ...
0646767b-2195-49c7-be20-279b274fe958
9
public static void main(String[] args) throws Exception { for (int i = 1; i < 1000; i++) { // log中有打印[USE CACHE]时,表示使用了缓存 System.out.println("i=" + i); if (i < 10) { ActionTest1_0_6.cacheTest(); } if (i > 10 && i < 20) { ActionTest1_0_6.cacheTest2(); } if (i == 5) { // 删除域名即去除相应域名的所有缓...
8be48b0f-820e-4fb5-9ba9-6241e5c60dc6
3
private boolean isCheckedException(Class clazz) { boolean checked = true; Class superclass = clazz; while (superclass != Object.class) { if (superclass == RuntimeException.class || superclass == Error.class) { checked = false; break; } ...
d4b44483-5d8b-4f9f-b2e5-c5adcd740536
8
private final void calcGaps(ComponentWrapper before, CC befCC, ComponentWrapper after, CC aftCC, String tag, boolean flowX, boolean isLTR) { ContainerWrapper par = comp.getParent(); int parW = par.getWidth(); int parH = par.getHeight(); Bo...
65a02037-ab9e-4be1-8a04-2a27a368be1f
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); char grade = in.next().charAt(0); switch (grade) { case 'A': case 'B': case 'C': System.out.println("Passes"); break; case 'D': ...
eaaae332-515a-49bf-b55e-a86ecb668839
4
public void sendClueReward() { outStream.createFrameVarSizeWord(53); outStream.writeWord(6960); outStream.writeWord(clueItems.length); for (int i = 0; i < clueItems.length; i++) { if (clueItemsN[i] > 254) { outStream.writeByte(255); // item's stack count. if over 254, write byte 255 outStream.w...
53d7e829-3850-4480-8d85-37f9ca765ad9
0
public LoginFrame(DB database) { super("¼"); this.database = database; // òֹ GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); this.setLayout(layout); nameField = new JTextField(20); passwordField = new JPasswordField(20); // ¼:JLabel+JTextField JLabel l...
ac44a117-ca9f-442e-bfb0-96b66da63cac
4
private byte[] get_img_stream(File dot, String type) { File img; byte[] img_stream = null; try { img = File.createTempFile("graph_", "."+type, new File(GraphViz.TEMP_DIR)); Runtime rt = Runtime.getRuntime(); // patch by Mike Chenault String[] args = {D...
684dc673-60fa-4db4-80a1-4a762746767e
2
public boolean isEmpty ( ) { if(contains!=null && contains.length>0){ return false; }else{ return true; } }
cd192549-0e0a-4848-b70a-4ec1c78ecda0
8
public void setEvents(ArrayList<Vector<Vector<Object>>> data) { for(int i = 0; i<data.size(); i++) { columnNames = new Vector<Object>(); columnNames.add("ID"); columnNames.add("Type"); columnNames.add("Event"); columnNames.add("Start"); columnNames.add("End"); columnNames.add("Location"); colu...
c0e239df-5c2d-4db0-a1b0-105c7098d1be
0
public int getZ(){ return z; }
b7b371b5-b3e2-492d-9b25-c0d904f05020
2
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Color c = g.getColor(); // g.setColor(isEnabled() ? Color.GRAY : Color.LIGHT_GRAY); g.setColor(isEnabled() ? Color.BLACK : Color.GRAY); Insets i = getInsets(); // int opSize = getFontMetrics(get...
1810309e-2b41-4da2-9176-5a726e20de2d
8
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder();int caso=0; for (String ln;(ln=in.readLine())!=null;caso++) { if(caso>0)sb.append("\n"); int N=parseInt(ln.trim()); double[] c=new dou...
604bcade-cd8f-43d4-b4a7-ceee017a08f8
3
public void delete(Object obj) { StringBuilder sb = new StringBuilder(); sb.append("delete from " + obj.getClass().getSimpleName() + " where "); PreparedStatement stmt = null; Connection connection = null; try { connection = DB.getConnection(); String primaryKey = null; for (Field field : obj.getCla...
4b84e8ad-e6ea-4b95-9cbb-27db9518f508
1
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; GradientPaint gradPaint = new GradientPaint(0, 0, getLowerColor(), 0, getHeight(), getUpperColor()); g2.setPaint(gradPaint); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE...
eb6a80cb-a206-4579-8552-232aa9098fec
3
public static Properties readPropertiesFile(){ Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("Auto-DDWRT-Backup.properties"); // load a properties file prop.load(input); } catch (IOException ex) { ex.printStackTrace(); ...
ef6b0265-71d5-4547-b736-3afcb22fa339
1
@Override public void dispose() { this.roundView.dispose(); MusicPlayer.getInstance().dispose(); if (pauseScreen != null) { pauseScreen.dispose(); } }
ce75a202-b32d-478a-8132-369dadbf1060
0
public String toString() { return super.toString() + ": \"" + this.getDescription() + "\""; }
8b29196c-849c-4c27-8520-80f2c1ffec6c
3
public SceneObject getStair(String str) { if (str.contains("top")) { SceneObject Stair = SceneEntities .getNearest(new Filter<SceneObject>() { public boolean accept(SceneObject entity) { return entity.getId() == 36775; } }); return Stair; } if (str.contains("mid")) { SceneO...
941cc703-d6f6-45ce-a2b0-401afe79a7d9
8
public GuiSlotStatsBlock(GuiStats par1GuiStats) { super(par1GuiStats); field_77268_a = par1GuiStats; field_77266_h = new ArrayList(); Iterator iterator = StatList.objectMineStats.iterator(); do { if (!iterator.hasNext()) { brea...
552c3866-15c0-4ee3-82c8-02f457d0ede6
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
d53cdf2c-6c7f-4294-b387-c3ff3ef307d4
0
private void moveToFourByteBoundry() { // If i am already at a 4 byte boundry, I need to move to the next one int mod = streamPosition % 4; streamPosition += (4 - mod); }
8f042e42-5f57-4803-a217-1b4f49dd9660
9
public Move[] getMoves(String pokemonName){ Move[] moves = new Move[4]; String[] splitLine = null; try { reader = new BufferedReader(new FileReader(dataFile)); } catch (FileNotFoundException e) { System.out.println("File not found!"); } try { while((line = reader.readLine()) != null){ spl...
e7261710-f919-4ed6-99c0-5f8bdde6702a
4
public void refresh(mxCellState state) { this.state = state; handles = createHandles(); mxGraph graph = graphComponent.getGraph(); mxRectangle tmp = graph.getBoundingBox(state.getCell()); if (tmp != null) { bounds = tmp.getRectangle(); if (handles != null) { for (int i = 0; i < handles.lengt...
2eab1582-6288-474c-9c21-dcfb8d36136b
5
@Override public void setTitle(String title) { if (title != null) { super.setTitle(title); titleModified = false; } else if (Main.dataModified && !titleModified) { super.setTitle("MyMoney - "+Main.database.getName()+"*"); titleModified = true; ...
cc5f97db-b732-43f1-b511-8a8e5fc07c39
1
private void substitute(Term variable, Term replacement, List<UnificationPair> list) { for (int i = 0; i < list.size(); i++) { // Retrieve the current pair of terms .. UnificationPair currentPair = list.get(i); Term lhs = currentPair.getLhs(); Term rhs = currentPa...
496f29ec-3f4f-44e6-bd4c-ac95040a4f2e
7
public String command(final CommandSender sender, Command command, String[] args) { try { BufferedWriter banlist = new BufferedWriter(new FileWriter("banned-players.txt", true)); for (String p : plugin.cache.keySet()) { for (BanInfo info : plugin.cache.get(p)) { ...
f787427a-4948-435a-8911-6fddb7fef4d7
5
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); tree.setHeaderVisible(true); final Menu headerMenu = new Menu(shell, SWT.POP_UP);...
a8d60066-7f52-41e0-8c2f-ab18d5b122c9
8
final double getMindist(Point2D.Double pt) { double result = Double.MAX_VALUE; for (Point2D p : points.keySet()) { if (pt.equals(p)) { continue; } final double v = p.distance(pt); if (v < 1E-4) { throw new IllegalStateException(); } result = Math.min(result, v); } for (Line2D line : li...
4ed2ccad-b205-4cd5-ad76-3d7fbc80d3ac
7
@Override final protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg2) { final String code = arg2.get("CODE").get(0); if (getSystem().participants().containsKey(code)) { getSystem().putParticipantInLast(code); return CommandExecutionResult.ok(); } List<String> strings = null; ...
fcc781e5-1a14-403b-8634-8c59def4d4fa
4
public CustomColourMap InitMap() { ArrayList<Colour> colorList = new ArrayList<Colour>(); boolean continueAdding = true; /* true if user wants to add another colour */ final int YES = 0; while (continueAdding) { m_colour = null; SetColour(); if (m_colour == null) { //Terminate her...
8045893f-d250-413c-81ba-69cd451b2291
6
public final static Boolean start(MP3Info mp3, File file) throws SongFeatureException { FeatureExtractionOptions opt= null; File output= null; LowLevelExtractor lle= null; Logger log; try { log= SongLogger.getInstance().getLog(); } catch (LogException e) { throw new SongFeatureException("Lo...
35dfc007-97fc-4d46-88ff-a926cc04bb84
9
private void communicatorRespond(ModelCommunicator comm, boolean inserted) { if (page == null) return; if (!inserted) { if (comm.getModelClass() == null || comm.getModelClass().indexOf("org.concord.mw2d") != -1) { ModelCanvas mc = page.getComponentPool().get(comm.getModelID()); if (mc != null) { ...
51e5d887-f2ff-40b7-bd84-13a771724c00
5
private void removePlayer(Player user, PlayerStatusData actionData) { //Cancel all trades that the player had - upon receiving player give up the client will remove the player // anyway for(ActionThread thread : actions.get(actionData.getUserId()).values()) { synchronized(thread) { if(thread.getActionData(...
63926c58-96b8-4bef-8bb1-9f948fc5809a
5
@Override public void update(IPresenter presenter) { GetGameModelResponse response = getGameModel(presenter); if(response != null && response.isSuccessful()) { if(response.isNeedToUpdate()) { System.out.println("UPDATING MODEL"); List<Player> players = response.getGameModel().getPlayers(); p...
e7d3bcf6-7c1f-4f17-9c24-13d535d0353c
3
public static boolean useBed(Player player) { if (FearTheReaper.isBedsEnabled()) { if ((hasBed(player)) && (player.hasPermission("graveyard.respawn.bed"))) { return true; } } return false; }
9d91bd2a-b18d-433b-802f-5b3837770c46
3
public static String selectListParam(Map<String, Object> paramMap) throws SQLException{ @SuppressWarnings("unchecked") java.util.Map<String,Object> sqlWhereMap = (Map<String, Object>) (paramMap.get("sqlWhereMap")==null ? "": paramMap.get("sqlWhereMap")); BEGIN(); SELECT(Role.COLUMNS); FROM(Role.T...
53f3f076-ca8b-4a67-a5fa-aba94ceb058e
7
public static void main(String[] args) { int ballspeed = 700; int bobspeed = 500; // First we create our game objects. Paddle paddle1 = new Paddle(250,500); Paddle paddle2 = new Paddle(250,90); Ball ball = new Ball(300,300,4); ball.BALL_VELOCITY = ballspeed; //Create queues. Positio...
565c325e-cb9f-4248-9aa0-78dcba2eda95
8
@Override public void onDownstreamMessageEvent(ChannelMessageEvent event, PipelineHandlerContext context) throws Exception { if( !(event.getMessage() instanceof HttpResponse) ) { context.sendDownstream(event); return; } HttpResponse response = (HttpResponse) event.getMessage(); if( ...
79b826c8-9960-4e98-b6b2-a095eb295386
8
public List<?> getSelection(PropertyDescriptor propertyDescriptor, Locator locator) { if (CollectionUtils.isNotEmpty(selectionValues)) { return selectionValues; } if (CollectionUtils.isNotEmpty(selections)) { for (Selection selection : selections) { if (selections != null && selection.ge...
dfb99e9f-1030-4839-9247-385227a59894
0
public void setParentId(int parentId) { this.parentId = parentId; }
9806156b-e41f-43c6-bfcd-8abff29280ca
0
private int getStationSequence(final String name) throws Exception { return Queries.query(this._route.getStops()).first(new Predicate<RouteStop>(){ @Override public boolean evaluate(RouteStop stop) throws Exception { return stop.getStation().getName().equals(name); }}).getSequence(); }
b94b29e3-7ae8-4d9b-b941-b55b39b55fba
5
protected synchronized void processEvent(Sim_event ev) { switch ( ev.get_tag() ) { case GridSimTags.PKT_FORWARD: case GridSimTags.JUNK_PKT: processNetPacket(ev, ev.get_tag()); break; case GridSimTags.ROUTER_AD: rece...
b72fe77e-b1c5-4adc-94ea-420fe04b3b22
1
public void redraw(Graphics g) { g.setColor(Color.black); g.drawLine(0, g.getClipBounds().height - 1, g.getClipBounds().width - 1, g.getClipBounds().height - 1); if (loaded) { graph.draw(g, graph.getOrigin(), graph.getScale(), Color.blue, xdiff, ydiff); } drawing.repaint(); }
1e0e4bf9-a6b9-49a1-80d9-974e8ad224f5
4
private String encodeUri(String uri) { String newUri = ""; StringTokenizer st = new StringTokenizer(uri, "/ ", true); while (st.hasMoreTokens()) { String tok = st.nextToken(); if (tok.equals("/")) newUri += "/"; else if (tok.equals(" ")) ...
b36e16b3-d640-42be-bf74-e1f9fcbc0821
4
public void retry(String query) { boolean passed = false; Statement statement = null; while (!passed) { try { //Connection connection = getConnection(); this.connection = this.getConnection(); statement = this.connection.createStatemen...
9ebcba54-8051-4e20-87f8-53bafcb5fd34
0
public void setAgility(double agility) { this.agility = agility; }
19fe5f05-5ba9-4f2a-b83e-da2a0878cd66
5
public Point pointOfIntersection(Line l) { // Four points of two line and point of intersection Point a = this.p1; Point b = this.p2; Point c = l.p1; Point d = l.p2; Point pIntersection = null; // if denominator == 0 , two lines are parallel dou...
6c294b49-a8d9-4c5b-8e78-c7b9130d35a8
5
@Override public boolean equals(Object obj) { GridPacking<CatCage> gridPacking = (GridPacking<CatCage>) obj; if (getRowCount() != gridPacking.getRowCount() || getColumnCount() != gridPacking.getColumnCount()) { return false; } for (int row = 0; row < gridPacking.getRowCount(); row++) { for (int co...
4c653b1f-4555-48e8-a235-635c0bd2b46b
4
public void testConstructor_int_int() throws Throwable { TimeOfDay test = new TimeOfDay(10, 20); assertEquals(ISO_UTC, test.getChronology()); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals(0, test.getSecondOfMinute()); assert...
8e8375d9-d6c9-4dce-8fb6-33fd08afc164
2
public int max_number_of_frames(int streamsize) // E.B { if (h_vbr == true) return h_vbr_frames; else { if ((framesize + 4 - h_padding_bit) == 0) return 0; else return(streamsize / (framesize + 4 - h_padding_bit)); } }
1014b008-455d-491c-a867-e7f69e7178ae
4
@Override public void keyPressed(KeyEvent e) { if (e.getExtendedKeyCode() == KeyEvent.VK_TAB){ if (paintVars.skill_to_show == 1) { paintVars.skill_to_show = 2; } else { paintVars.skill_to_show = 1; } } if (e.getExtendedKeyCo...
119b63a6-f50c-42d9-96ac-d84cc883c78d
6
@Override public void onEnable() { instance = this; server = getServer(); config = new Config(this); debug = config.getDebug(); version = getDescription().getVersion(); usethread = config.getUseThread(); try { mt = new Metrics(); } catch (IOException e) { e.printStackTrace(); } setUpdat...
5862faf7-9741-4183-87e0-d5b2d819b62d
6
@Override public E get(int index) { E elem = null; if (index < 0 || index > count) { throw new IndexOutOfBoundsException(); } if (index == count) { elem = header.next.element; } else { Node<E> aux = null; if (index == count / 2)...
3c01a056-0d54-4805-8749-5521fb4fee5e
4
public void updateGameBoard(int[] gameBoard){ gl.gameField = gameBoard; File imageCross = new File("resources/cross_150_150.png"); File imageCircle = new File("resources/circle_150_150.png"); Image img1 = null; Image img2 = null; try { img1 = ImageIO.read(imageCross); img2 = ImageIO.read...
37b7d207-4e13-4b05-842f-527ebb84af19
9
public FordFulkerson(FlowNetwork G, int s, int t) { if (s < 0 || s >= G.V()) { throw new IndexOutOfBoundsException("Source s is invalid: " + s); } if (t < 0 || t >= G.V()) { throw new IndexOutOfBoundsException("Sink t is invalid: " + t); } if (s == t) { ...
16e16e6c-b37a-4fb1-824c-2360d849ae6c
5
@Override @SuppressWarnings("rawtypes") public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,boolean hasFocus){ Drawable figure = (Drawable) value; JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); String d...
d0945eeb-fb0a-4f9e-a0b7-279db1738a14
5
public boolean deploiementSuivant() { int nextJoueur = (indexSauvJoueurEnCours + 1) == lstJoueurs.size() ? 0 : (indexSauvJoueurEnCours + 1); for (; indexJoueurEnCours < lstJoueurs.size(); indexJoueurEnCours++) { if (indexJoueurEnCours == nextJoueur) { continue; } joueurEnCours = lstJoueurs.get(i...
7c64a236-36c6-4fb0-8cda-4524525a4f66
1
@Test public void ensureSalaryValueWithinBudgetIs12TimesTheValueInFormObject() { when(budgetFormData.getSalary()).thenReturn(new BigDecimal("10")); try { budget.buildBudget(budgetFormData); } catch (Exception e) { e.printStackTrace(); } assertEquals...
40425987-2e66-4d4a-8399-c2b9b74b065c
9
public final NTSParser.pred_rop_return pred_rop() throws RecognitionException { NTSParser.pred_rop_return retval = new NTSParser.pred_rop_return(); retval.start = input.LT(1); CommonTree root_0 = null; NTSParser.rop_return op = null; NTSParser.plusminus_return plusminus130 = n...
7cae395a-dae9-4ae5-a60e-a33b0f997164
5
protected static Ptg calcBin2Dec( Ptg[] operands ) { if( operands.length < 1 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "BIN2DEC" ); String bString = operands[0].getString().trim(); // 10 bits at most if( bString.length() > 10 ) { return new PtgErr( PtgErr.ERROR_NUM );...
cc490e1d-7be5-45b6-8002-d4e74a3ca18a
7
private void makeMenuBar() { /** JMenuBar **/ JMenuBar menuBar = new JMenuBar(); /** JMenu **/ JMenu fileMenu = new JMenu("File"); JMenu simulatorMenu = new JMenu("Simulator"); JMenu infoMenu = new JMenu("Info"); menuBar.add(fileMenu); ...
689e5eae-a579-49c2-aa40-6f29bf5f9c32
0
public long getAge() { return age; }
4abf31bf-b043-436d-a957-6952d2861e75
4
private void Escola_ComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Escola_ComboBox1ItemStateChanged Equipa_ComboBox2.removeAllItems(); if(Escola_ComboBox1.getSelectedIndex()>-1){ if ((Escola_ComboBox1.getSelectedItem().toString().equals(equipa))) { Escola_C...
a3c72614-5275-42f8-b9e4-96b653140a8f
9
private void cycleEntitySpokenText() { for (int p = -1; p < localPlayerCount; p++) { int pId; if (p == -1) pId = LOCAL_PLAYER_ID; else pId = localPlayers[p]; Player player = players[pId]; if (player != null && player.textCycle > 0) { player.textCycle--; if (player.textCycle == 0) p...
b70940f6-3a5d-4353-be52-436605809dbe
5
@SuppressWarnings("unchecked") public void reprendrePartie() { Map<String, Integer> map; Joueur j; Difficulte diff; Combinaison solution; List<CoupJoue> coups; ObjectInputStream lecteur = null; try { lecteur = new ObjectInputStream(new BufferedInputStream(new FileInputStream(NOM_FICHIER))); m...
6cc73cdf-1c52-4d06-82a8-c70654629a03
7
@Override public Token read(DocumentReader scanner) throws ScannerReadException { String buffer = ""; while (scanner.hasMore()) { if (scanner.hasMore()) { buffer += scanner.next(); } for (String delimiter : delimiters) { while (buff...
9d10819b-183c-4e5b-904c-158268b17604
7
@Override public int compareTo(Linha o) { if (this.pg > o.pg) { return -1; } else if (this.pg == o.pg) { if (this.v > o.v) { return -1; } else if (this.v == o.v) { if (this.sg > o.sg) { ...
03ced9ca-94b4-41ac-ab1e-f8dace8ed7fa
6
private void visitIntConst(int i) { if (i >= -1 && i <= 5) { main.visitInsn(Opcodes.ICONST_0 + i); } else if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) { main.visitIntInsn(Opcodes.BIPUSH, i); } else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) { main.visitIntInsn(Opcodes.SIPUSH, i); } else { ...
ad9ae96f-14be-431c-bc71-cbc4a1c56ed3
3
public void run() { for (int i = 0; i < 1000; i++) { if (i%3 == 0 || i%5 == 0) { sum += i; } } System.out.println(sum); }
31611043-0ae0-42d1-a754-7b7132ee67fb
0
public void setTextField(JTextField field) { this.field = field; }
58ee0102-f8b7-4ad5-bdce-fdabaa6f9d37
6
private void loadAll() { lowerLayers.clear(); middleLayers.clear(); ArrayList<SaveVariables> lowerVar = new ArrayList<SaveVariables>(); ArrayList<SaveVariables> middleVar = new ArrayList<SaveVariables>(); ArrayList<SaveVariables> invVar = new ArrayList<SaveVariables>(); ArrayList<...
22152a3a-1540-4e0c-b373-20b85fc9892b
5
@Override public void run() { // creating diversity try { Thread.sleep(LoadTestClient.rand.nextInt(60000/bidsPerMin)); } catch (InterruptedException e) {} while(!exit) { List<Integer> list = new ArrayList<Integer>((LoadTester.auctions.keySet())); if (list.size() >= 1) { int randomNumber = L...
a7e123b1-6cb0-439a-b85e-2ab1dab73bc8
6
private double matchFingerprints(List<Minutia> reference, List<Minutia> probe) { int i = 0; int match = 0; for(Minutia m1 : reference){ for(Minutia m2 : probe){ if( (m1.getType() == m2.getType()) && (Math.abs(m1.getAngle() - m2.getAngle())) <= thresholdAngle && (Math.abs(m1.getX() - m2.getX())...
131bee61-6033-46d3-a4f9-90e754d85bad
9
@Override public void actionPerformed(ActionEvent e) { Object s = e.getSource(); if (s == Return) { MenuHandler.CloseMenu(); Game.gui.LoginScreen(); } else if(s == ThunderbirdsAreGo) { MenuHandler.CloseMenu(); Game.btl.NewGame(mapname); Game.btl.AddCommanders(plyer, npc, 100, 50); Game.gui.InG...
1dfb19d3-f79d-4f80-8015-4bc2a6509bb0
0
public static FileType getFileType(File f) { return fileTypes.get(MediaFileUtil.getFileExtension(f)); }
4a4481e1-c83f-41f7-80ad-bea7450ec2b4
7
public void run() { friendsList.setVisible(true); //show the list when a thread is created //Set mac stuff - buggy in Lion System.setProperty("apple.laf.useScreenMenuBar", "true"); //if mac use the screen menu bar friends = Controller.getFriendsList(); //get the friends list ...
6108e271-05ad-4448-896c-5e42940f09cd
8
private void writeFeedItems(XMLEventWriter eventWriter, RSSFeedMessage message) throws XMLStreamException { XMLEventFactory eventFactory = XMLEventFactory.newInstance(); XMLEvent tab = eventFactory.createDTD("\t"); XMLEvent end = eventFactory.createDTD("\n"); eventWriter.add(tab); createNode(eventWriter, ...
c9229df9-0241-475d-aa37-d8cb16cf90e8
3
public void run() { while (flag) { try { Thread.sleep(1000); //每秒重绘 } catch (InterruptedException e) { e.printStackTrace(); } repaint(); if (currentTetro.isLive()) { currentTetro.move(); } } }
692baf9d-c516-429a-aa93-58f2478f119f
4
@Override public W delta(DC obj) { if(obj instanceof List) { List that=(List)obj; Set<Pair<PT<Integer>,T>> baseSetA=this.getBaseSet(); Set<Pair<PT<Integer>,T>> baseSetB=that.getBaseSet(); Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> phiMax=getPhiMax(getAllPhis(baseSetA,baseSetB)); ...
fb489444-be8c-43f1-9cf1-7f3dfd020a8b
0
@Override public BufferedImage draw() { //TODO temporary for testing BufferedImage i = new BufferedImage(6, 6, BufferedImage.TYPE_INT_ARGB); Graphics g = i.getGraphics(); g.setColor(Color.magenta); g.fillRect(0, 0, 6, 6); return i; }
970d8d91-dc4c-4820-bb2e-7f2be49cc9ed
6
private static void doUnarchive() throws MVDException { try { if ( archiveName == null ) throw new MVDToolException("No archive folder specified!"); File archiveDir = new File( archiveName ); File guideFile = new File( archiveDir, XMLGuideFile.GUIDE_FILE ); if ( !guideFile.exists() ) throw new ...