method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
97e14cc7-9837-4dc4-a9b8-177ac728c79d
0
public static void main(String[] args) { Dinosaur n = new Dinosaur(); n.f(); n.i = 40; n.j++; }
0150749d-42ab-49f9-b379-6bf402d8cef3
4
private void saveCompletedLevel(String mapName) { boolean createdNewFile = false; try { File file = new File(COMPLETED_TXT_PATH.toString()); if (!file.exists()) { createdNewFile = file.createNewFile(); } String mapUrl = COMPLETED_TXT_PATH.toString(); File inFile = new File(mapUrl); //...
e657da17-373a-41f7-95ff-0d5f5bcd4875
3
public void expandPath(TreePath path) { for(Object node : path.getPath()){ TreeItem parentItem = (TreeItem) node; if(parentItem != path.getLastPathComponent() && !isExpanded(new TreePath(parentItem.getPath()))){ return; } } super.expandPath(pat...
bd9a0953-435c-4dcd-b401-44886693e22d
6
public void followWaypoint() { if(!close) { setWaypoint(targetX + (scrollX - state.get(9)), targetY + (scrollY - state.get(10))); //calculate speed and direction to waypoint (same as last turn) double eachTurn; //turn this frame is a fraction of the total turn if...
31187788-33cb-4467-91f2-64c1d278e3f6
1
public String updateGradeItem() throws IOException { InputStreamReader in = new InputStreamReader(System.in); BufferedReader keyboard = new BufferedReader(in); DBConnector db = new DBConnector(); System.out.println("Updating an assignment"); System.out.println("Assignmen...
27d741d7-f735-4cd3-bda4-2754bdafccca
3
public void disabledPeriodic() { if (System.currentTimeMillis() >= time + 20) { time = System.currentTimeMillis(); if (oi.getGunS() > 0.5) auton = "Left"; else if (oi.getGunS() < -0.5) auton = "Right"; else auton = "None"; Log.println(auton); } SmartDashboard.putString("Auton selector"...
d36910df-ab4b-43c6-831b-f0738f0851e9
3
public void setLeft(PExp node) { if(this._left_ != null) { this._left_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
8ea04676-8f63-4317-bf73-cdbb00bb520e
3
@Override public boolean insert(DataRow row) { String statement = "INSERT INTO " + row.getTableName(); String args = ""; String values = ""; boolean isFirst = true; for(DataCell cell : row.row) { if(isFirst) { isFirst = false; ...
edfd9dfc-c429-4f2b-8dd1-9dd972898912
6
public long getLong(int bits) throws IOException { if (bits > 64) { throw new IllegalArgumentException("Argument \"bits\" must be <= 64"); } long res = 0; if (endian == LITTLE_ENDIAN) { for (int i = 0; i < bits; i++) { if (getBit()) { ...
ccb33c28-6b30-4a6a-89e0-34831366284c
2
public Result execute(Command command) { LabelDTO labelDTO = (LabelDTO) command.getCommandSource(); Account account; account = accountDAO.getAccountByname(labelDTO.getAccount()); Set<Label> labels = account.getLabel(); //labels = account.getLabel(); for (Iterator<Label> ...
13ba508a-045f-4a3c-bbf8-7c4f5091359a
8
protected String toLetter(String c) { if(" ".equals(c)) return "space"; if("<".equals(c)) return "less then"; if(">".equals(c)) return "grater then"; if("&".equals(c)) return "ampersand"; if("\\".equals(c)) return "back slash"; if("/".equals(c)) return "slash"; if("'".equals(c)) return "quot...
58b6fd41-9ba5-4571-b2e3-b6dc4a484299
0
public void setId(long Id) { this.Id = Id; }
9dbefd02-7bc7-4df2-bd51-3402b2338f5b
9
final private boolean jj_3R_63() { if (jj_scan_token(LPAREN)) return true; if (jj_3R_29()) return true; if (jj_scan_token(RPAREN)) return true; Token xsp; xsp = jj_scanpos; if (jj_scan_token(88)) { jj_scanpos = xsp; if (jj_scan_token(87)) { jj_scanpos = xsp; if (jj_scan_token(73)...
5ffdc3fa-1889-428f-80c2-1d907bfd8b7c
3
private void checkWeekend() { //Friday is 5 //Saturday is 6 //Sunday is 7 if (weekday == 5) { infoList.add(bundle.getString("SaturdayTomorrow")); tomorrowValid = false; eventPresent = true; } else if (weekday == 6) { infoList.add(b...
11eab2ce-d3bb-41ca-a13c-41ca281583c5
1
@Override public void handleNewConnection(Socket client) { try { new ChatGUI(client); } catch (IOException e) { System.out.println("Failed to connect!"); e.printStackTrace(); } }
704c7ec9-2267-4981-bec8-efbb2aafda14
6
@Test public void nonceTest() throws IOException { String nonce = "myUniqueNonce" + System.currentTimeMillis(); String result = null; TeleSignRequest tr; if(!timeouts && !isHttpsProtocolSet) tr = new TeleSignRequest("https://rest.telesign.com", "/v1/phoneid/standard/" + PHONE_NUMBER, "GET", CUSTOMER_ID, SEC...
2fcaf4af-e515-4ab0-8e28-06f1426ce32a
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.equal...
6346a0a8-ceed-4a35-a5e1-65e3c1bb519d
0
public Explosion(int x, int y , TankClient tc){ this.x = x; this.y = y; this.tc = tc; }
b6e9c36a-5784-40ce-aef6-93e86dd576c9
6
@Override public void train(List<Instance> instances) { // initialize w values for (Instance instance : instances) { for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) { linearParam.add(entry.getKey(), 0.0); } } int iter = 0; while (iter < iters) { iter ++...
4b203b27-0d15-4058-9d8c-fc5e039149e2
4
final byte getByte(int pos) { int b0 = charAt(pos) - '0'; int b1 = charAt(pos + 1) - '0'; if (b0 > 9) { b0 -= 7; if (b0 > 16) { b0 -= 32; } } if (b1 > 9) { b1 -= 7; if (b1 > 16) { b1 -= 32; } } return (byte) ((b0 << 4) + b1); }
a14d7edf-74cd-42ac-8a32-446d298ec9d0
4
public Edge get(){ if(lastStack == null || Configuration.hasEdgeTypeChanged()){ lastStackTypeName = Configuration.getEdgeType(); lastStack = stacks.get(lastStackTypeName); if(lastStack == null) { lastStack = new Stack<Edge>(); stacks.put(Configuration.getEdgeType(), lastStack); } } if(lastStac...
5e4e37f0-49ce-48c9-9676-3fbe31dd34f9
2
@Override public void run() { long time = System.nanoTime(); final double maxTick = 30.0 * gameSpeed; double ns = 1000000000 / maxTick; double delta = 0; while(running) { long now = System.nanoTime(); delta += (now - time) / ns; ...
f8975eb2-dd37-424d-9f4c-5a5b4a6209a9
8
@Override public KThread nextThread() { boolean debug = false; Lib.assertTrue(Machine.interrupt().disabled()); ThreadState winner = null; if (queue.isEmpty()) { return null; } ...
8b88b7c6-3f3a-403a-b319-9d77bbea0140
9
public boolean getCollision(ArrayList<Tetromino> tetrominoArray) { // Can't use TetrisPanel's getArray()'s, because that will include // itself. ArrayList<Double> xArray = new ArrayList<Double>(); ArrayList<Double> yArray = new ArrayList<Double>(); for (Tetromino tetr : tetrominoArray) if (tetr != this) ...
77d820a9-6eba-4473-9d18-a6be32a76257
6
@Override public Object getValueAt(int row, int col) { { StockItem s = si.get(row); switch (col) { case 0: return s.getID(); case 1: return s.getStockQuantity(); case 2: ...
1ee3b384-5c2b-44fd-99aa-582e1b32b816
0
public void AddNew(ServerHandleConnect serverHandleConnect) { this.curconnected++; this.serverHandleConnectList.add(serverHandleConnect); }
e799402c-8ce8-40ae-8794-070a9482360c
0
public int getATK() { return atk; }
a1ba7350-75ce-4d30-a3ae-feb0abdc2ad2
2
public boolean vihkoTaynna(){ for(int i=0; i<pelaajat.size(); i++){ if(!pelaajat.get(i).getVihko().full()){ return false; } } return true; }
436f5fa3-9f5c-42ab-a875-12e0bf35515a
4
public Menu getMenu() throws NoPagesException, InvalidMenuException{ if(style == null){ throw new InvalidMenuException("No style set"); } if(pages.size() <= 0){ throw new NoPagesException(); } Menu menu = new Menu(); menu.setStyle(style); for(Page page : pages){ try{ menu.addPage(page); }c...
623a5bae-de38-426e-a4df-e690cb0a88ab
9
public JSONObject asJson() { JSONObject obj = new JSONObject(); if (minValue != null) { obj.put("min", new JSONNumber(minValue)); } if (maxValue != null) { obj.put("max", new JSONNumber(maxValue)); } if (decimalPrecision != null) { obj.put("tickDecimals", new JSONNumber(decimalPrecision)); } if...
9b57dfd5-67fb-453d-9542-f3ba5c4be0d5
5
static byte[] transferArray(byte[] buffer, int start, int x, byte[] hashArray, int hashStart, boolean hashToBuffer) { if(buffer == null) { return null; } int bufferPos = startPoint[x] + start; int thisStep1 = step1[x]; int hashPos = hashStart; for(int outer=0;outer<16;outer++) { for(int mid=0;mid<1...
efb029c0-372f-40f3-be54-eba325b443f4
7
private void updatePlayerList(Buffer stream, int count) { while (stream.bitPosition + 10 < count * 8) { int pId = stream.readBits(11); if (pId == 2047) break; if (players[pId] == null) { players[pId] = new Player(); if (playerAppearanceData[pId] != null) players[pId] .updatePlayerAppe...
1d69a69e-ba0c-4364-bd13-b65b1be678d5
8
public static void main(String[] args) { try { CsvReader trips = new CsvReader("C:\\Users\\ThejaSwarup\\Box Sync\\Fall 2014\\CS 424\\Project2\\InputFiles\\trips_updated.csv"); String allDates = "C:\\Users\\ThejaSwarup\\Box Sync\\Fall 2014\\CS 424\\Project2\\TempFiles\\Temp1.csv"; String execptionCase = "...
f1f5e8a1-f46b-4bbc-be4a-b84732b625ec
3
public boolean isEatable() { String s = GetResName(); if (s.indexOf("gfx/invobjs/bread") >= 0) return true; if (s.indexOf("gfx/invobjs/meat") >= 0) return true; if (s.indexOf("gfx/invobjs/mussel-boiled") >= 0) return true; return false; }
91303757-9204-46cc-841b-804a16b32bcd
1
@Test public void random_test() { try{ double [][]mat= {{1.0,2.0}, {3.0,1.0}}; int m=2; int n=2; double[][]result = Matrix.random(m,n); double exp[][]={{1.0,2.0},{3.0,1.0}}; Assert.assertNotSame(exp, result); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemen...
d51cc89e-c44c-4ed6-952a-88cb71715bd8
3
public void randomizeCurrentGeneration() { Random random = new Random(); for (int row = 0; row < currentGeneration.getHeight(); row++) { for (int col = 0; col < currentGeneration.getWidth(); col++) { if (random.nextBoolean()) currentGeneration.resurrectCell(col, row); } } }
8319b332-c9ae-42c1-82cf-fd47704ecec8
5
protected void processEndSimulation() { resList_.clear(); arList_.clear(); if (regionalList_ != null) { regionalList_.clear(); } if (globalResList_ != null) { globalResList_.clear(); } if (globalResARList_ != null) { glob...
c4e18641-7788-46fe-a1fe-b67c68782c42
5
private final void method702(byte byte0, int i, Stream stream, int j) { if (i != 1) { if (i != 2) { if (i != 3) { if (i == 4) { anInt1013 = -1; } } else { aBoolean1020 = true; ...
c5113703-bcc1-4381-8a75-a16b8968f282
2
public boolean equals(Token t) { if(!(t.getType()==type)) { return false; } if(!(t.getUnderlyingObject().equals(this.underlyingObject))) { return false; } return true; }
6876d0ea-4ae9-45bc-88b7-93ae80e998b5
3
public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String sNumber1 = reader.readLine(); String sNumber2 = reader.readLine(); String sNumber3 = reader.readLine(); String sNumber4 = reader.read...
bb9524be-98af-4c39-b644-0429a4536914
1
private static void fillData(Sheet s, int rownum, ProcessedCell cell){ //Assume that a header was already generated Row r = s.createRow(rownum); String[] headers = ProcessedCell.getTags(); Cell c = null; for(int i = 0; i < headers.length; i++){ c = r.createCell(i); c.setCellValue(cell.getAttribute(heade...
0a2da9ee-a531-447d-9dc9-f8a244f03379
4
public void newParamSet() { for (OptParam op : opt_params) { Param p = op.getParam(); double new_mean = random.nextDouble() * op.getRange() + p.getLower(); op.setMean(new_mean); // Calculate new parameter values based on the random mean. double[] pro_...
e5679181-a658-4868-9145-ec082bb6855e
9
private boolean crossingInternal(Point2DInt direction1, Point2DInt direction2) { if (angles.size() < 2) { return false; } final double angle1 = convertAngle(new LineSegmentInt(center, direction1).getAngle()); final double angle2 = convertAngle(new LineSegmentInt(center, direction2).getAngle()); Double las...
2a777d90-f702-4ed4-8fc5-1f98b8b5fc24
5
public String toString() { String ret = ""; try { ret = getLocation(); if( (ret.indexOf( "!" ) == -1) && (sheetname != null) ) { // prepend sheetname if( (sheetname.indexOf( ' ' ) == -1) && (sheetname.charAt( 0 ) != '\'') ) // 20081211 KSC: Sheet names with spaces must have surrounding quotes ...
96693b12-746c-493f-8bf3-91a2434b1a62
8
@Override public StringConverter<?> findConverter(Class<?> cls) { if (cls.isArray()) { if (cls == Long[].class) { return LongArrayStringConverter.INSTANCE; } if (cls == Integer[].class) { return IntArrayStringConverter.INSTANCE; ...
cd565c1a-3e1d-4c0a-a78e-30d5e5134fbf
7
@Override public List<List<String>> breakOutMudChatVs(String MUDCHAT, TriadList<String,String,Integer> behaviors) { final int mndex=behaviors.indexOfFirst(MUDCHAT); String mudChatStr=(mndex<0)?"":(String)behaviors.get(mndex).second; if(mudChatStr.startsWith("+")) mudChatStr=mudChatStr.substring(1); final L...
66dd87cb-6721-490a-98e5-9feeac7dac13
5
public void itemExpanded(TreeItem item){ if(item == tree.getRoot()){return;} expand(((FilePathTreeItem) item).getFilePath()); for(int i=0; i<item.getChildCount(); i++){ FilePathTreeItem childItem = (FilePathTreeItem) item.getChildAt(i); if(childItem.isLe...
a689a58b-349d-4668-9ab4-a0f2a56ed779
2
public Map<Integer, Integer> getCountReps(Map<String, Integer> map) { List<Integer> list = new ArrayList<>(map.values()); Map<Integer, Integer> reps = new TreeMap<>(); Integer first = 1; Integer current; for (Integer e : list) { if (reps.containsKey(e)) { current = reps.get(e); current++; reps.put(e, ...
5925ae73-ad19-4e42-9e93-3ebb6079e890
7
public static void main(String args[]){ int op; do{ System.out.println("\n\n1- Agregar Servidor"); System.out.println("2- Agregar Entry"); System.out.println("3- Navegar"); System.out.println("4- Ver Detalle"); System.out.println("5- Consultar ...
d1c374d8-cb56-452d-8c6c-0fc0549771e6
1
protected void readAllocation() throws DecoderException { // start to read audio data: for (int i = 0; i < num_subbands; ++i) subbands[i].read_allocation(stream, header, crc); }
adcfccad-cdfb-4ba5-8846-11e649f46417
8
public Boolean loadPlayer(String file) { boolean test = false; if (test || m_test) { System.out.println("Loader :: loadPlayer() BEGIN"); } m_valid = false; m_playerInfo = new String[PLAYER_INFO_SIZE]; m_hashString = ""; try { ...
0955ddb2-d311-41de-8085-8b8773f4ee94
3
@Override public Object drawCell(mxCellState state) { Map<String, Object> style = state.getStyle(); if (state.getAbsolutePointCount() > 1) { List<mxPoint> pts = state.getAbsolutePoints(); // Transpose all points by cloning into a new array pts = mxUtils.translatePoints(pts, translate.x, translate.y...
9a909f97-8e4c-4135-8cb6-664ac970d124
3
public static void computePaths(Vertex source) { source.minDistance = 0.; PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>(); vertexQueue.add(source); while (!vertexQueue.isEmpty()) { Vertex u = vertexQueue.poll(); // Visit each edge exiting u for ...
d3f17195-ecb7-44de-983a-2ea5216a26d3
6
public void writeCSV(Collection<?> entities, String fileName, boolean override) throws ParsingException, ClassValidationException, ConverterException { if (configuration == null) { throw new NullPointerException("Initialize engine with init method first!"); } StringBuil...
d6668d54-a863-48ad-9289-b97e2e988a62
8
private boolean correctChar(char a) { if (a >= '0' && a <= '9') { return true; } if (a == 'A') { return true; } else if (a == 'B') { return true; } else if (a == 'C') { return true; } else if (a == 'D') { re...
6683b2ac-0614-4e98-9177-1c7fc1032223
2
public Account create () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("create", true); $in = _invoke ($out); Account $result = AccountHelper.read ($in); return $result...
61698080-7a88-4cae-bb3f-37a1931671c4
5
@Test public void getSurplus() { AmateurAthlete test = null; AmateurAthlete test1 = null; try { test = new AmateurAthlete("Franz", 3); test1 = new AmateurAthlete("Karl", 5); } catch (Exception e) { // expected } try { AmateurAthlete test3 = new AmateurAthlete("Sepp", 12); } catch (ValueExcept...
82c388d8-48f1-4fd5-8f4d-935342e1dc8d
3
public void assemble() throws MbiException, IOException { if(deBruijnGraph == null) System.out.println("graph NULL"); // System.out.println("edges: " + deBruijnGraph.getEdgeCount()); // System.out.println("vertices: " + deBruijnGraph.getVertexCount()); List<String> path = deBruijnGraph.findEulerPath_FleuryA...
b783eb31-e4cb-4d00-a3bc-f8f10f2dd4e3
3
public static void main(String args[]) { String players[] = new String[4]; for (int i = 1; i <= 4; i++) { players[i-1] = "P" + i; } StringBuilder playbackString = new StringBuilder(); InputStreamReader input = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(inp...
6476391c-edbf-4fe6-bf5d-d55a8ae27f5b
3
public void updateMemory() { DecimalFormat format = new DecimalFormat("0.0"); Runtime rt = java.lang.Runtime.getRuntime(); float maxMemory = rt.maxMemory() / (1024f * 1024f); float totalUsed = (rt.totalMemory() - rt.freeMemory()) / (1024f * 1024f); float docMem = 0; float undoMem = 0; CPArtwork artwork ...
5efb2b19-c990-4563-a113-b7da67b83294
2
private static void missingNumber(int[] array) { int startingTerm = array[0]; int commonDiff = array[1] - startingTerm; int currentTerm = startingTerm; for (int i = 0; i < array.length; i++) { if (currentTerm != array[i]) { //System.out.println(currentTerm); //System.out.println(array[i]); ...
6565674a-82c3-48d9-b575-2029d9a690b7
2
public String getPredictedThrow() { if(computerResponse == 0) return "Scissors"; else if(computerResponse == 1) return "Rock"; else return "Paper"; }
06788c80-10f6-45f7-8d9a-788b2fdd73b0
9
public int maxProfit(int[] stations, int demand) { if(stations == null || stations.length == 0 || demand < 1) { throw new IllegalArgumentException("error"); } Comparator<Integer> comp = new Comparator<Integer>() { @Override public int compare(Integer a, Integer b) { return b - a; } }; Priorit...
e9ddb7b6-8f25-42da-b3ec-2a7f27cfb9eb
2
public ExportTrackingResponse exportTrackings(ParametersTrackingExport parameters) throws AftershipAPIException,IOException,ParseException,JSONException{ List<Tracking> trackingList = null; String requestParams = parameters.generateQueryString(); JSONObject response = this.request("...
51970f0f-c8a7-474f-b64c-3958461bdb16
8
public static Cons cppTranslateFunctionCall(Cons tree, MethodSlot method) { { Symbol functionname = ((Symbol)(tree.value)); Cons functionargs = Cons.copyConsList(tree.rest); Stella_Object firstarg = functionargs.value; MethodSlot function = ((method != null) ? method : Symbol.lookupFunction(functi...
69ec2bd3-c93b-4bc2-a5f8-ba7f11c566e6
1
public QuickFind(int n){ id = new int[n]; for(int i=0;i<n;i++) id[i]=i; }
d876d4f0-5006-44b8-b833-7ec1c6680bc9
1
public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { minSize += 3; maxSize += 3; if (mv != null) { mv.visitFieldInsn(opcode, owner, name, desc); } }
c72b9d5f-c3fc-4f16-951a-ce91be573bdd
1
private int IncDigit(int number, int pos) { int term = 1; int i; for (i = 0; i < pos; i++) term *= 10; return number + term; }
118bd403-2b3f-49cd-82c3-25b154bafa0c
3
public void saveScore(String pseudo, int time, Calendar date, String gD) { Score newScore = new Score(pseudo, time, date); ObjectOutputStream os = null; try { this.removeLastElement(); os = new ObjectOutputStream(new FileOutputStream(gD+".ser", false)); bestSc...
9df0d715-d14b-47f7-8f30-c2c2dd214ba7
3
protected void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 371); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } meaningsLabel = new JLabel("...
0352bf4f-8f9c-42e0-b9ef-a95f0bf64d06
9
protected static void removeCompressTag(MediaWiki wiki, String fileFullName) throws MediaWiki.BlockException { while (true) { try { MediaWiki.EditToken editToken = wiki.startEdit(fileFullName); // Remove the {{compress}} tag from the description page. Iterator<MediaWiki.Revision> descriptionPageRevisio...
994dafd4-7eec-4790-aefa-21d9886bb333
8
*/ public void setSplashBackgroundColor(String s) { String prevText = IOSImageUtil.isNullOrWhiteSpace(this.splashBackgroundColor.getText()) ? PLACEHOLDER_SPLASH_BGCOL : this.splashBackgroundColor.getText(); Color col = null; if (!IOSImageUtil.isNullOrWhiteSpace(s)) { while (s.length() < 6) s = "0".concat(s); ...
703fd5a9-57a4-4806-8c98-802b6bb646e3
9
static boolean isStandardProperty(Class clazz) { return clazz.isPrimitive() || clazz.isAssignableFrom(Byte.class) || clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(Long.class) ...
7a83552e-da08-4f0e-940e-f2c4e1166969
7
private static void attackColonyAnt(Ant ant) { int XLoc = ant.getLocationX(); int YLoc = ant.getLocationY(); int randNum = RandomNumGen.randomNumber(0, 3); // 50% Chance of killing an ant in the same node as the bala // If the number 1 or 3 is generated, the attack is successful and an ant is killed i...
22057d12-7bcc-4923-9b35-252cdf1f229c
9
private void loadPlugins() { print("Loading modules"); File pluginsDir = new File(homeDir, "plugins"); // Create plugins folder if it doesn't exist if (!pluginsDir.isDirectory()) { pluginsDir.mkdir(); } // Scan for plugins File[] pluginFiles = pluginsDir.listFiles(new FilenameFilter() { @Over...
8dd3831d-46cb-4536-a9cb-5f84f401107d
2
public void dfs(Graph G, int v) { marked[v] = true; preAnyAdjacentVerticesVisit(G, v); for (int w : G.adj(v)) if (!marked[w]) { preAdjacentVertexVisit(v, w); dfs(G, w); postAdjacentVertexVisit(v, w); } }
d022c02c-cbc9-40b4-9823-bbd49ed73a23
9
private static void init() { Class<Selenium> selC = Selenium.class; for (Method m : selC.getMethods()) { if ("void".equals(m.getReturnType().toString()) ||"boolean".equals(m.getReturnType().toString()) || m.getReturnType().isAssignableFrom(String.class)) { Class<?>[] types = m.getParameterTypes()...
c98cfa0a-fd9e-4c1f-935a-983e0456a7b6
3
public boolean writeMsg (String sender,String message) { DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Calendar cal = Calendar.getInstance(); String date = " Sent on-" + dateFormat.format(cal.getTime()); String text = message; String Msg = sender + ": " + text + date; Buff...
5b5dbcc8-c72b-428b-ac49-470fdb04789e
3
public static ArrayList<CubeNode> getSuccessors(CubeNode node) { ArrayList<CubeNode> successors = new ArrayList<CubeNode>(); for (Map.Entry<Character, int[]> face : Cube.FACES.entrySet()) { // Make a clockwise turn char[] newState = Cube.rotate(node.state, face.getKey(), 1); // Encode the corner int enc...
d758c961-70a7-4a47-8af3-95f8668a2c06
7
public void populateMap() throws FroshProjectException { // Get the list of IDs // String idList = FroshProjectConfig.getProperty("WorldMap.ids"); // Log a message // FroshProject.getLogger().log(Level.FINE, "List of Element ids " + idList); // C...
dcac0e92-0305-4703-9eb2-6ad3a1f1c75c
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); ...
f288da5c-5924-4df5-9599-05a33e329cb1
3
public static void main(String args[]) { Gongming gongming = new Gongming(merchantId, merchantSecret); try { String userIdentityNumber = "1" + String.format("%017d", new Random().nextInt(1000000000)); logger.log(Level.INFO, "创建理财账户"); CreateUserRequest createUserRequest = new CreateUserRequ...
61e247c1-fc31-4449-81ed-8f6d82c29cf7
1
@Override public void run() { if (isAlive) { System.out.println(name + " running"); Controller.start(); hunger = new stats.Hunger(); health = new stats.Health(); social = new stats.Social(); } else { kill(); } }
29b92d6a-d474-4383-8c8a-ea08ef625b03
1
public void run() { for(int i = 0; i < _rounds; i ++){ ClusterRound(_minSpanningTree); } }
38d74ef2-37d2-403f-868e-02f7cac134f6
1
public List<QuadTree> getTopNeighbors() { QuadTree sibling = this.getTopSibling(); if ( sibling == null ) return new ArrayList<QuadTree>(); return sibling.getBottomChildren(); }
a25f6363-8cf7-40ff-9f06-707742863b71
4
public void repaint(Game game){ for(List<Token> row : game.getBoard().tokens()){ for(Token token : row){ fieldButtons[token.yPos()][token.xPos()].setState(token.color(),token.isMoveable()); } } String startText = "<html><ul style='list-style-type:disc; margin:0 0 0 15; padding:0;'>"; String endText...
9d22a4de-6c6c-422c-8dda-bf43526a18ee
6
public V put (K newKey, V newValue) { if (root == null) { root = new Node(newKey, newValue); size++; return null; } Node node = root; while (true) { if (newKey.compareTo(node.mKey) < 0) { if (node.left == null) { node.left = new Node(newKey, newValue); size++; return null; ...
becb3ce7-5794-4392-b9b7-0850a4a3840f
4
public void Tick() { while (true) { if (this.stage == 1) { this.LH = new LobbyHandler(net, userName); StageFlipper passOn = LH.init(new StageFlipper()); stop(passOn); } else if (this.stage == 20) { this.TH = new TiarHandler(net, userName); StageFlipper passOn = this.TH.init(lastMsg); sto...
8e5d06b5-730f-4655-bdb4-049b4c006082
1
private Tile[] getLine(int idx) { Tile[] result = new Tile[4]; for (int i : _0123) { result[i] = tileAt(i, idx); } return result; }
545cc3c5-9088-4414-8398-39fb77f58b5d
5
public long directorySize(boolean includeSubDirs) throws IOException { if (!file.isDirectory()) { throw new IOException("FileConnection.directorySize() cannot be invoked on a file: " + file); } else { if (includeSubDirs) { throw new RuntimeException("FileConnection.directorySize(includingSubDirs) not i...
267f9604-ef7f-4386-a1ba-a8de7a1523ab
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
24f6d7bc-1c8f-4c69-96ef-bcc76aef35b0
7
protected Content getNavSummaryLinks() throws Exception { Content li = HtmlTree.LI(summaryLabel); li.addContent(getSpace()); Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderF...
84402670-9a7f-4823-9ddb-46d58a7b494f
4
private void dumpBArray( BitSet[] barray ) { for ( int i=0;i<barray.length;i++ ) { StringBuilder sb = new StringBuilder(); for (int j = barray[i].nextSetBit(1); j>= 0; j = barray[i].nextSetBit(j+1)) { if ( j <= sigla.size()&&j>0 ) ...
111a932c-3e8b-42fe-bbe9-284384bbec5c
6
public void render(Point top_left, int width, int height) { DungeonFloor dungeonFloor = dungeonHandler.getActiveDungeon().getActiveFloor(); float ppt = (DisplayConstant.width_no_ui / (float) width); float scale = (float) ppt / (float) DisplayConstant.sprite_size; for (int x = (int) top_l...
59a08afd-0d15-4dea-856e-219a4e076433
0
private void openMainPage() { driver.get(baseUrl + "/addressbookv4.1.4/index.php"); }
3715f5fe-e2c0-4705-b927-f64875d2e50d
0
private void drawWorld(Graphics2D g) { BufferedImage i = Main.getLoadedWorld().draw((int)screen.getMinX(), (int)screen.getMinY(), (int)Math.ceil(screen.getWidth()), (int)Math.ceil(screen.getHeight())); g.drawImage(i, 0, 0, GraphicsMain.WIDTH, GraphicsMain.HEIGHT, null); }
af167559-7e8e-4d5c-8b3a-68a4522dcc60
1
private void compute_pcm_samples2(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[2 + ...
befa9981-06c3-4191-9939-a69a65de89b1
8
public void generateNQueens(ArrayList<String[]> result,String[] temp,int[] position,int insertN,int n) { for (int i=0;i<n;i++){ position[insertN-1] = i; boolean satis = true; for (int j=0;j<insertN-1;j++){ if(insertN-1-j==position[insertN-1]-position[j]||inser...
ae2c50f9-9467-4549-804f-6f59409d6ec1
3
public boolean removeTile(int x, int y) { for (int i = 0; i < tiles.size(); i++) { Tile t = tiles.get(i); if (t.getX() == x && t.getY() == y) { tiles.remove(i); return true; } } return false; }
d545ec4c-9f17-436c-bbcf-a1bf1d55582d
0
public Tiedostonlukija(String tiedostonnimi) throws Exception { this.tiedosto = new File(tiedostonnimi); lukija = new Scanner(tiedosto); this.rivit = new ArrayList(); rivitTalteen(); }