method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4cadf0c8-49dd-40d6-9282-be3de9415441
0
public FractalPanel getFractalPanel() { return fractalPanel; }
7f581d4e-54af-4309-8a27-89ef81c2d621
8
protected static void editPortletConfig(ActionRequest request, ActionResponse response) throws PortalException, SystemException, ReadOnlyException, IOException, ValidatorException, ParseException { //Variables init. VkPortlet parser = new VkPortlet(); String ID = ""; String group = "...
776d68f2-5cb2-44f9-9b86-696acdb5507b
0
public BulletTerrainListener(ProjectileManager bulMan) { this.bulMan=bulMan; }
fae8e7cb-e3ad-436b-9b08-9707c1430f3b
1
public boolean KeyDownListener(int key) { if(mainLogic.currentState == GameLogic.GameState.PLAYING) { /* if(key == Keyboard.KEY_LEFT) { Application.get().getEventManager().queueEvent(new ChangeSectorEvent(4L)); return true; } if(key...
2688e984-b14a-4c7b-a8c1-d0c7be50f466
2
@Override public double calculate(Function function) { double x1 = intervalStart + 0.382 * (intervalEnd - intervalStart); double x2 = intervalStart + 0.618 * (intervalEnd + intervalStart); double result; double y1 = function.calculate(x1); double y2 = function.calculate(x...
aaa4efa3-d5b3-4706-b026-02443a04ee93
9
private static Number parseInt(Buffer<Token> buf) throws JsonParseException { Token tkn = buf.next(false); boolean neg = tkn.str.equalsIgnoreCase("-"), isFloat = false; if (neg) { buf.skip(); } StringBuilder b = new StringBuilder(); String i = gatherInts(buf); if (i.equalsIgnoreCase(...
7a357885-de84-446d-a983-daaf408b9e27
8
void statsCloseConnection(long duration,int requests) { synchronized(_statsLock) { _connections++; _connectionsOpen--; _connectionsDurationTotal+=duration; if (_connectionsOpen<0) _connectionsOpen=0; if (_connectionsOpen<_co...
b7d4f7dc-a901-4415-a935-f57b48ac6c9c
5
public static TransactionSet DoApriori(TransactionSet transSet,double minSupportLevel) { ItemSet initialItemSet = transSet.GetUniqueItems();//get all singular unique items and put them into a ItemSet object TransactionSet finalLargeItemSet = new TransactionSet(); // resultant large itemsets TransactionSet LargeIt...
be7f6d9d-d781-4d37-96a1-5cbb9a03d2ad
1
public Expression simplify() { if (subExpressions[0].getType().getCanonic() .isOfType(Type.tSubType(castType))) /* * This is an unnecessary widening cast, probably that inserted by * jikes for inner classes constructors. */ return subExpressions[0].simplify(); return super.simplify(); }
90353427-d223-4ac8-b451-fc1f7eaab1ea
2
public void tick() { for (int y = 0; y < tiles[0].length; y++) { for (int x = 0; x < tiles.length; x++) { tiles[x][y].tick(); } } }
e5e901ca-076b-477c-91da-bec7f88c8ec5
8
public void keyPressed() { // keys pressed for avatar movement if(key == CODED && keyCode == RIGHT) { rightKey = true; } if(key == CODED && keyCode == LEFT) { leftKey = true; } if(key == CODED && keyCode == UP) { upKey = true; } if(key == CODED && keyCode == DOWN) { downKe...
c6f1b2e7-ee71-465d-9dc8-83c707df6b7c
2
public static String getEUsername (Integer _int) { Database db = dbconnect(); String query; String txt = null; try { query = ("SELECT username FROM employee WHERE bDeleted = 0 AND EID = ?"); db.prepare(query); db.bind_param(1, _int.to...
ee1720f3-3002-4f53-8a6f-6c88fe83a719
0
public static void main( String[] args ) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new FenPrincipale().setVisible(true); } }); }
3857f6fb-a344-4707-b3a7-9d06ea51069c
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
c9d4429c-282c-4a50-985e-a28362494496
5
public static void main(String[] args) { File file = new File("SCC.txt"); String line = null; BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); while((line = br.readLine()) != null) { computeVerticesAndEdges(line); } System.out.println("Input parsing and graph const...
e55c41fa-3509-4a3d-b1c1-b151ac810788
0
static public int getImageSizeH() { return imageSizeH; }
7d8382ea-62cc-4df2-a757-7cb32529488f
2
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); XMLTokener x = new XMLTokener(string); while (x.more() && x.skipPast("<")) { parse(x, jo, null); } return jo; }
0aa3cb46-620d-4fbd-8b84-63fe79b39b98
9
private boolean jj_3R_61() { Token xsp; xsp = jj_scanpos; if (jj_3_1()) { jj_scanpos = xsp; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3R_62()) { jj_scanpos = xsp; if (jj_3R_63()) { ...
6aafaba9-cf8e-483f-8adb-180e7ac3e835
4
@Override public void actionPerformed(ActionEvent event) { JButton button = (JButton) event.getSource(); Command command = mMap.get(button); KeyStrokeDisplay ksd = new KeyStrokeDisplay(command.getAccelerator()); switch (WindowUtils.showOptionDialog(this, ksd, TYPE_KEYSTROKE, false, JOptionPane.YES_NO_CANCEL_OP...
59fcb60c-5c76-4efa-ab5b-f1a8ad14eec1
8
private void drawItems(Graphics2D g) { for(int i = 0; i < Items.size(); i++) { ListviewItem item = this.Items.get(i); BufferedImage itemImage = new BufferedImage(this.getSize().getWidth() -10, 64, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) itemIma...
b6876945-550f-49de-bfe8-ccccdda2a8eb
5
public void sort3(List<Integer> list) { if (list.size() < 2) return; int count = 0; int end = list.size(); while (end > 0) { boolean swapped = false; int lastSwap = 0; for (int idx = 0; idx < end - 1; ++idx) { int left = li...
3eb4d92a-0695-4f09-a6d8-109bc993e72a
5
public static void makereport(OutputStream outs, Report rep) throws IOException { PrintWriter out = new PrintWriter(new OutputStreamWriter(outs, "UTF-8")); out.print(htmlhead("Error Report")); out.println("<h1>Error Report</h1>"); out.println("<p>Reported at: " + htmlq(dfmt.format(new Date(rep.time))) + "</p>"); ...
233cc914-203f-43e8-aac4-b8927e0771cf
7
private static void exitFrame(Context cx, CallFrame frame, Object throwable) { if (frame.idata.itsNeedsActivation) { ScriptRuntime.exitActivationFunction(cx); } if (frame.debuggerFrame != null) { try { if (throwable i...
61fcae7d-a144-4534-b130-97003ec77558
4
public void keyPressed(KeyEvent e) { //called whenever any key is pressed int keyCode = e.getKeyCode(); //e is when the user presses a key. when the key is pressed what key it is is stored in keyCode if (keyCode == e.VK_W) { } if (keyCode == e.VK_S) { ...
e78c5178-5faf-49fc-86ad-77684f54881a
5
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder sb = new StringBuilder(); diffWays(8); d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; int change = ...
4d7c3fe5-9007-4629-a589-1a34dbaad018
1
public void setWeight(Neuron perceptron, double weight) { if(weight != Double.NaN) dendrites.put(perceptron, weight); }
5c59b392-b77a-4db9-b68e-9bb286becb9a
5
public void calculateBounds() { for (int i = 0; i < blockArray.length; i++) { for (int j = 0; j < blockArray.length; j++) { if (bitArray[i][j] == 2) { Block tempBlock = blockArray[i][j]; if (xBound < tempBlock.getX()) { ...
cadd1801-96c6-4218-ba5f-d809f8d93a04
6
public void traverse(Graph<VLabel, ELabel> G, Graph<VLabel, ELabel>.Vertex v, Comparator<VLabel> order) { currTraversal = 0; stored = order; TreeSet<Graph<VLabel, ELabel>.Vertex> fringe = new TreeSet<Graph<VLabel, ELabel>.Vertex>(...
137a91b3-3f8a-4993-9f59-1dad779d505c
8
protected void processMouseEvent(NativeMouseEvent e) { int id = e.getID(); EventListener[] listeners; if (id == NativeMouseEvent.NATIVE_MOUSE_MOVED || id == NativeMouseEvent.NATIVE_MOUSE_DRAGGED) { listeners = eventListeners.getListeners(NativeMouseMotionListener.class); } else { listeners = eventListe...
9a36f574-c115-4687-b61a-8d70c16cf02a
8
private final static char determineUniqueAxis(float a, float b, float c, float alpha, float beta, float gamma) { if (a == b) return (b == c ? '\0' : 'c'); if (b == c) return 'a'; if (c == a) return 'b'; if (alpha == beta) return (beta == gamma ? '\0' : 'c'); if (beta == gamma) return 'a'; if ...
9d61ded7-2ec8-4113-b451-b6c5649a5fc7
3
@Test public void deleteKeepsCorrectOrderLastEntry() { DynamicArray<Integer> arr = new DynamicArray(); int[] expected = new int[10]; for (int i = 0; i < 10; i++) { arr.insert(i); if (i < 9) { expected[i] = i; } } arr.delete(...
767bdcbc-7ab7-4638-b7b6-07a4a7bfbbd6
0
@Override public void setPreference(Preference pref) { this.pref = pref; }
d3b8b413-ad96-4d22-a2af-580c2e1fa633
5
public static Reservation getReservation(int productID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt = conn.creat...
66b98c81-230f-490a-8d68-4505e2752df2
3
public StatDepletable getDepletableStat(String name){ if (health.getName().equals(name)) return health; if (mana.getName().equals(name)) return mana; if (stamina.getName().equals(name)) return stamina; return new StatDepletable(1,1,"COULD NOT MATCH");...
e7fa9a0c-1589-4389-b37e-4ff87f465bba
7
private void initialize(int type) throws IllegalArgumentException { // Initialize default variables board = null; xPos = 0; yPos = 0; orientation = 0; // Initialize figure type variables switch (type) { case SQUARE_FIGURE : maxOrienta...
cd468a79-64d9-4c90-afc9-8675061011d6
3
public double[] do160FFTHalfSymbolBinRequest (CircularDataBuffer circBuf,int start,int bin0,int bin1) { double vals[]=new double[2]; int a; double datar[]=new double[FFT_160_SIZE]; // Get the data from the circular buffer double samData[]=circBuf.extractDataDouble(start,40); for (a=0;a<datar.length;a++) { ...
8b922a70-893b-405a-8d3d-07b71afbb1b5
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...
a8c997bc-593d-46dc-879f-ca22379b3722
1
private void updateRollOver() { boolean wasBorderShown = mShowBorder; Point location = MouseInfo.getPointerInfo().getLocation(); UIUtilities.convertPointFromScreen(location, this); mShowBorder = isOver(location.x, location.y); if (wasBorderShown != mShowBorder) { repaint(); } }
74eb37e4-887c-4454-aa07-8eca91506855
8
protected void calculateCutPointsByEqualWidthBinning(int index) { // Scan for max and min values double max = 0, min = 1, currentVal; Instance currentInstance; for(int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isM...
04be76ad-fd61-45e3-a8c7-0fc51b8249da
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...
ae8cc72e-db61-4f93-9b64-46abb426b821
7
public void appendPause(double duration) { while (duration > 8.0) { appendPause(8.0); duration -= 8.0; } if (duration < 1e-5) { // numeric 0 // will result into */0 => omit return; } int n, d; final String frac = toDecFrac(duration); final String[] frac_a = frac.split("/"); if (frac.isEmp...
db9f83e8-2d03-4103-a551-cedc41478c01
2
public void expressionList() { if(have(NonTerminal.EXPRESSION0)){ expression0(); while(accept(Token.Kind.COMMA)){ have(NonTerminal.EXPRESSION0); expression0(); } } }
3ab99314-8445-4f07-929d-85fff352833f
0
public Context(Strategy strategy) { this.strategy = strategy; }
d1f7efbb-e710-4c6d-b7ee-53ad1cdcff49
2
public double[] calculatePlatformAndOtherConsuptions(SoftwareSystem system, FunctionalRequirement functionalRequirement) { double consumption[] = { 0, 0 }; for (HardwareSetAlternative hardwareSetAlternative : system.getHardwareSystem().getHardwareSetAlternatives()) if (system.getActuallyUsedHardwareSets().contai...
59ee02c2-d2c1-4a76-8af7-4d58a117ae33
8
public String getDirections(int[] x, int[] y) { if (x == null || y == null || x.length != y.length) { return ""; } int len = x.length; StringBuilder str = new StringBuilder(); for (int i = 0; i < len; i++) { if (safeDown(x, y, i, len)) { s...
fa09883d-e58d-4aa6-9858-a9169f1c9c19
7
@EventHandler(priority=EventPriority.LOW) public void furnaceBurn(FurnaceSmeltEvent event) { Block bfurnace = event.getBlock(); Furnace furnace = (Furnace)bfurnace.getState(); InventoryHolder key = furnace.getInventory().getHolder(); if(_hFurnaces.containsKey(key)) { Pla...
5d3885f9-3b75-4ea2-8b49-29af4da2dd58
9
public static ArrayList<String> closedSystem(ArrayList<Object> parameters) { ArrayList<String> output = new ArrayList<String>(); String[] processTimes = ((String)parameters.get(csMU)).split(","); for(int i = 0; i < processTimes.length; i++) processTimes[i] = processTimes[i].trim(); double z = (Double)p...
83a29a27-0c86-4d62-abab-f181ca859eef
7
public List<String> getFFmpegArgs() { List<String> args = new ArrayList<String>(); if (videoCodec != null) { args.add("-vcodec"); args.add(videoCodec.getName()); } else if (!sameQuality) { args.add("-vn"); } if (audioCodec != null) { args.add("-acodec"); args.add(audioCodec.getName()); } els...
c18e9c47-8179-4a9e-aa11-dd65c0794131
0
public long getSeatType() { return this._seatType; }
7ecbeb06-8b65-4c1d-8ca7-8025ad6123b1
0
@BeforeMethod public void setUpMethod() throws Exception { }
fd0d8669-1fdd-44f9-965f-c7355cb5899e
7
private void sendNetworkObject() { Integer portNum = Integer.parseInt(port); Class<?> objectClass = sendObject.getClass(); String outString = new String("Sending " + objectClass.toString() + " to " + ipAddress + ":" + portNum.intValue()); System.out.println(outString); ObjectOutputStream oostream = null...
8a28ec9a-659f-4547-afad-496ae901bf9d
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Edge other = (Edge) obj; if (p1 == null) { if (other.p1 != null) return false; } else if (!p1.equals(other.p1)) return false; if (p...
c8050b1e-4e06-4048-908c-54b1f68f918f
2
public UnificationRuleMatcher(UnificationStrategy unifier, Predicate target) { if (unifier == null) { throw new IllegalArgumentException( "The given unification strategy must not be null."); } if (target == null) { throw new IllegalArgumentException( ...
23d4a7bd-0f4b-455d-a829-a7f1495ba627
4
public Job getNextJob(){ for(int i = 0; i < queue.size(); i++){ Job job = queue.get(i); // Skip the jobs that are complete or canceled if(job.isComplete() || job.isCanceled()) continue; // If we have a new Job return the first new job we find ...
f139bf9e-dd4f-46f5-8ea0-2ac7af2c373b
8
private boolean isSimplified(AlgebraicParticle expr){ if(expr.exponent() != 1)return false; else if(expr instanceof Number) return true; else if(expr instanceof Variable && expr.sign()) return true; else if(expr instanceof Fraction && ((Fraction)expr).isSimplified()) return true; else if(expr instanceof Mixed...
c5d6ed99-e56e-4dc8-8ecd-c463b61d3e20
8
@Override public boolean check() { //TODO: check array values! return players != null && stockNames != null && initialStockValues != null && stockNames.length == initialStockValues.length && unitNames != null && initialUnits != null && initialUnitCosts != null && unitNames.length == initialUnits.l...
9b025966-a6d1-4cf0-b805-acea2d9cbabf
3
public Gridlet get(int gridletId, int userId) { Gridlet gl = null; Iterator<Gridlet> iter = super.iterator(); while (iter.hasNext()){ gl = iter.next(); if (gl.getGridletID()==gridletId && gl.getUserID()==userId) { return gl; } } ...
24fe7cd7-5efb-4f59-8cc6-52a9011ea324
9
public String[] getFormattedStrings() { String[] result = new String[3]; HVMInstructionSet instructionSet = HVMInstructionSet.getInstance(); result[1] = ""; result[2] = ""; result[0] = instructionSet.instructionCodeToString(opCode); if (result[0] == null) res...
bdfb609c-1a9e-4424-9fea-ccb5e08ac9a1
1
public UpdateFrame() { super("Менеджер обновлений\r\n", false, true, false, true); setIcon(true); setBounds(100, 100, 355, 229); setFrameIcon(Resources.getImageIcon("frame.png")); progressBar = new WebProgressBar(); progressBar.setBounds(12, 110, 324, 16); progressBar.setStringPainted(true); updat...
b48fa0b2-4e26-4bbb-9843-62b04fc89829
6
public void quickSort(int low, int high, int[] result) { int i = low, j = high; int pivot = result[i + (j - i) / 2]; do { while (result[i] < pivot) i++; while (result[j] > pivot) j--; if (i <= j) { exchange(i, j, result); i++; j--; } } while (i <= j); if (low < j) quickSo...
92b96905-f03f-4273-86e3-3464f259e4bb
1
public static boolean control(Path p) { return ((p != null) && Files.exists(p, LinkOption.NOFOLLOW_LINKS)); }
d60a78cf-d597-4e4a-87c0-3fe65c4155f0
9
private static ArrayList<Line> readLineInfo(Scanner input, HashMap<String, BusStop> busStops) throws Exception { String temp, lineNo; int period; Time start, last; ArrayList<Line> lines = new ArrayList(); input.useDelimiter("[:=<>,\\s]+"); while (input.hasNext...
5194e568-2d5a-44a1-bcde-2ed0fb22926f
9
private void setIdNumber(){ if(count<10) IdNumber="0000"+count; else if(count>9&&count<100) IdNumber="000"+count; else if(count>99&&count<1000) IdNumber="00"+count; else if(count>999&&count<10000) IdNumber="0"+count; else if(count>9999&&count<100000) IdNumber=""+...
c3298dbe-0d7b-49d1-84b9-14a373ed7254
7
private void moveGameDown(){ final int index = gameList.getSelectedIndex(); if(index < gameModel.getSize()){ byte movedGameId = games[index+1]; // Update the active games array if(Utils.getIndex(activeGames, games[index]) != -1){// O...
d3cfee4a-465a-48ea-8eea-8be849a901c5
4
protected Object getFieldTemplate(Object obj, String fieldname, Node child) { Object template = getFieldValue(obj, fieldname); // Arrays are replaced completely if (template != null && template.getClass().isArray()) { template = null; } // Collections are cleared else if (template instanceof Collecti...
c9342a4d-bab3-4702-a08e-7e513079e537
7
String getCallbackFunctionCall(FunctionTrace ft) { //Ensure ft is of type ASYNC_CALL String type = getLineType(ft); if (!type.equals("ASYNC_CALL")) { System.out.println("Error: Cannot get callback function call from non-ASYNC_CALL trace"); System.exit(-1); } //Find which index contains the variable F...
d6e5b75a-eff2-4c4f-8f98-6386c91189ac
5
public boolean equals(Object instance) { if (instance instanceof PairNonOrdered<?>) { PairNonOrdered<?> other = (PairNonOrdered<?>)instance; return super.equals(other) || super.equals(other.reverse()); } return false; }
b52e7e8d-7eee-42f1-8422-f132b3756b8b
1
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); JSONTokener x = new JSONTokener(string); while (x.more()) { String name = Cookie.unescape(x.nextTo('=')); x.next('='); jo.put(name, Cookie.unescape(x....
d964f247-78df-4b6b-a7bf-3841acf639dd
0
public void setDate_depreciated_by(String date_depreciated_by) { this.date_depreciated_by = date_depreciated_by; setDirty(); }
013aede0-0322-4cc1-8a12-abce99336fb3
5
private void updatePicture() { BufferedImage bufferedImage = null; try { Iterator<ImageReader> readers = ImageIO .getImageReadersByMIMEType(mimeType); ImageInputStream iis = ImageIO .createImageInputStream(new ByteArrayInputStream(image)); if (readers.hasNext()) { ImageReader reader = reader...
23a53df0-0205-42c5-b32c-c9c78b8843a3
1
public void drawCurrentCollectionTab() { // Draw tab for currentCollection if (!drawingCollectionMenu) { // Setup for drawing current Collection tab parent.stroke(0); parent.fill(255); parent.smooth(); parent.strokeWeight(2); //Draws circle for the currentCollection parent.ellipse(screenWidth -...
75ae51c2-0927-497a-a95e-04149f546a29
4
@Override public Value evaluate(Value... operands) throws Exception { // we want only two operandInspectorValueTypes if (operands.length != 1) throw new EvalException("Error: wrong number of operands ("+operands.length+")"); // get operands Value l = operands[0]; // if types match ...
2a81ec3c-6c2e-4e45-9a23-7da9dabcce80
7
public void draw() { int indice; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { indice = x + y * width; if (map[indice] == 0) { SingletonGraphics.getInstance().drawImage(Art.hierba, Grid.getBoxCorner(Grid.ge...
e2a3f41a-d710-47ad-88a4-fc0ab3ccca51
3
public void run() { try { while (true) { Resource cur; synchronized (queue) { while ((cur = queue.poll()) == null) queue.wait(); } synchronized (cur) { handle(cur); } cur = null; } } catch (InterruptedException e) { } finally { synchronized (Loader.t...
68db3cba-3b8e-46a1-a6d5-432927a3d357
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alrea...
da0fbdf5-934c-4a43-8311-3741ce4f3454
7
public void removeKey(String var) { Boolean changed = false; if (this.props.containsKey(var)) { this.props.remove(var); changed = true; } // Use an iterator to prevent ConcurrentModification exceptions Iterator<String> it = this.lines.listIterator(); ...
401f4d94-c4d9-4eb1-b963-7e3ef3108141
0
public FirstFollowModel(Grammar grammar) { variables = grammar.getVariables(); Arrays.sort(variables); terminals = grammar.getTerminals(); firstSets = new String[variables.length]; followSets = new String[variables.length]; Arrays.fill(firstSets, ""); Arrays.fill(followSets, ""); }
0dab6042-c8e9-410c-baa8-62971cd876e0
7
private void showPlayerList() { String reponse = ""; File oldStorageFile = storageFile; System.out.println("Option sélectionnée : 5. Liste de joueurs \n"); System.out.println("Voulez-vous creer la liste des joueurs dans un fichier ou l'afficher sur l'ecran ? (F/E): "); try { reponse = inputBufferedReade...
0e86abc1-b804-4fbb-b670-abdb20ae87a7
4
private void eventMenuPopup( ) { try { URI uri = new URI( Data.WIKI_URL + underscoreName( getWikiTopic() ) ); Desktop desktop = null; if ( Desktop.isDesktopSupported() ) { desktop = Desktop.getDesktop(); } // if if (desktop != null) { desktop.browse(uri); } // i...
65be6da0-0ef5-45f2-8b41-8c06caa6ea3b
1
public int queueLengthRec(){ if (nextPatient == null){ return 1; } int count = nextPatient.queueLengthRec() + 1; return count; }
87680261-eb9b-4409-9e27-bae939cf2200
3
public static EquipmentReasonEnumeration fromString(String v) { if (v != null) { for (EquipmentReasonEnumeration c : EquipmentReasonEnumeration.values()) { if (v.equalsIgnoreCase(c.toString())) { return c; } } } throw new IllegalArgumentException(v); }
e9a4add4-91df-4418-aa9f-1e44d5c7aa45
6
public static void main(String[] args) throws InterruptedException { Thread t1 = new Thread() { public void run() { for (int i = 0; i < 2_000_000; i++) { synchronized (monitor) { while (turn != 1) { try { ...
dd8b4218-1ace-49a9-ad4a-57080009af9e
1
public void delBild(int i){ for(int j = i; j < bilder.length-1; j++){ bilder[i] = bilder[i+1]; } numUsedBilder--; }
4400a70c-9b45-4bc3-b249-76fe12240260
9
@Override public void update() { //当食材的数量改变时,窗口的显示有可能改变 try { if (!display.isDisposed()) { Runnable runnable = new Runnable() { @Override public void run() { try{ moneyLabel.setText("当前营业额:" + Storage.getInstance().getRevenue()); customerLabel.setText("当前顾客人数:" + customers...
c667e6b7-a7eb-4c12-bd1e-18727575483a
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
6c46da45-6cdd-418c-8024-b003d8c944ea
9
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) { Vector numFields = gd.getNumericFields(); TextField xNumField = (TextField)numFields.get(0); TextField yNumField = (TextField)numFields.get(1); Checkbox linkCheckbox = (Checkbox)gd.getCheckboxes().get(0); linkXY = g...
4722ed59-dbde-4976-bc07-9a873cc1327f
4
public void extractEverything() throws IOException { int threadcount = Runtime.getRuntime().availableProcessors(); //int threadcount = 1; System.out.println(threadcount + " Threads"); System.out.println("building files"); System.out.println(" Offset Length Path"); Sy...
6408ac8f-db82-4d37-a439-f9d044f9ffa9
7
private int maaritaPienempi(int vasen, int oikea, int pienempi) { if (keko[vasen] != null && keko[oikea] != null) { if (keko[vasen].compareTo(keko[oikea]) <= 0) { pienempi = vasen; } else { pienempi = oikea; } } else if (keko[vasen] != ...
ea559095-05be-4380-b90c-ee86ae189d1d
0
public void setResult(Result result) { this.result = result; }
3b48d8d7-c81c-476d-8bf7-a14a35103e68
0
public FieldStats() { // Set up a collection for counters for each type of animal that // we might find counters = new HashMap<Class, Counter>(); countsValid = true; }
23a4ef89-dab7-4f4b-a935-e35bd4064971
4
private static String toUpperCase(final String st) { final char[] cArr = st.toCharArray(); boolean change = false; for (int i = 0; i < cArr.length; i++) { int c = (int) cArr[i]; if (c >= 'a' && c <= 'z') { cArr[i] = (char) (c+diff); change ...
1b420717-656f-4cca-8ceb-42da0584cc1b
5
void computeProbabilities() { int[] sums = new int[27]; // Summing up all occurences of each individual character for denominator for(int i=0; i<27; i++) for(int j=0; j<27; j++) sums[i] += bigramCounts[i][j]; // Finding individual probabilities as per definition // For example - P(x|a) = (No of o...
c2d299d6-3952-412f-8928-35823ff9bd90
3
public void start() { Thread t = new Thread() { public void run() { Utility.delay(1000); while (true) { Sprite[] spriteArray = (Sprite[])sprites.toArray(new Sprite[0]); long duration = 0; for (int i=0; i<spriteArray.length; i++) { long millisStart = System.currentTimeMillis(); sp...
0707f0d1-2671-4c0f-b9f6-81dbe8fb7fe5
7
private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i==k0) ? true : !cons(i-1); default: return true; } }
af55e21a-5d37-4ec6-8834-56725e631520
3
public void componentResized(ComponentEvent e) { if (e.getComponent() instanceof AppFrame) { AppFrame cf = (AppFrame) e.getComponent(); Dimension newSize = cf.getSize(); if (!preferredFrameSize.equals(newSize)) { double percentage = (double) newSize.height / preferredFrameSize.height; bu...
6d91864c-ecb6-4f6c-952a-cea0448025ed
0
public void setDisplacement(String displacement) { this.displacement = displacement; }
e5b485fd-a394-4b5f-95a2-ea6e0f935824
7
private String readTag(LineProtocolInputStream is) throws IOException, BadCommandException { int c; StringBuilder sb = new StringBuilder(); while ((c = is.read()) != -1) { if (c == '\r' || c == '\n') { is.unread(c); throw new BadCommandException("une...
0e25d582-4a04-4ddf-8b81-393f661e7611
4
public void goAboard(Boardable toBoard, World world) { if (aboard != null) aboard.setInside(this, false) ; aboard = toBoard ; if (aboard != null) aboard.setInside(this, true) ; final Vec3D p = this.nextPosition ; if (! aboard.area(null).contains(p.x, p.y)) { final Vec3D pos = toBoard.posi...
482068fb-62c4-485c-a1ac-8e59d4956573
1
public boolean unbanUser(String name){ //unban a user by name UserAccount user = users.get(name.toLowerCase()); if (user==null) return false; user.setIsBanned(false); return true; }
2c051e1c-fdfa-4e6e-a2f0-a6a9abe1dc93
7
public GameMenu(MenuType menuType) { this.background = null; switch (menuType) { case STARTUP: title="Triton"; try { background = ImageIO.read(new File("img/Background.png")); } catch (IOException e) { throw new RuntimeException("Background Image Didn't Load"); } buttons =...