method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
112dfe5d-f2b2-4b77-a2f1-29ed2b199205
3
public boolean set(String param, Object value) { try { try { value = Integer.parseInt((String) value); } catch(Exception ex) { try { value = Boolean.parseBoolean((String) value); } catch(Exception ex2) { value = value.toString(); } } main.getConfig().set(...
0e1f16cc-d7d1-48df-b37d-363bc73b75a0
0
@Override public int getScheduleSize() { return (numSlots * bitsPerSlot) / 8; }
537667d2-512f-4e09-9708-638b515c8688
0
protected JToolBar initInputToolbar() { JToolBar toolbar = new JToolBar(); toolbar.add(startAction); stepAction.setEnabled(false); toolbar.add(stepAction); // Set up the view customizer controls. toolbar.addSeparator(); final JComboBox box = new JComboBox(getViewChoices()); box.setSelectedIndex(0); ...
6c4c3bc3-f697-4f10-bd60-dcdefa289e36
0
@Override public void mouseReleased(MouseEvent e) {}
bc77026f-c764-4343-9543-e8667b51db85
9
public wineClubMenuGUI(Cellar c) { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame = this; myCellar = c; setBounds(100, 100, 300, 350); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblWineClub...
5f6617c1-f5e3-4f71-a023-b32ee0247510
0
public void draw(Graphics g) { }
4cb6f52f-26a2-4ea3-8680-342ab9fa2b12
0
public String getCommand() { return this.command; }
6cd6ce50-c088-41eb-a7ae-347b90eaa392
0
public void initialTable() { conn=DBUtil.getConn(); stmt=DBUtil.createStmt(conn); DBUtil.update(useDatabase, stmt); DBUtil.update(tableContent, stmt); DBUtil.close(conn, stmt, null, null); }
cd3aaff8-b644-4a0f-a065-2aeb484ac2f9
9
public void assertTurn(){ // print("assertion called"); int count = 0; int countX = 0; int countO = 0; for (int i=0;i!=8;i++){ for (int j=0;j!=8;j++){ if (grid[i][j] == 0){ count++; countO++; } el...
a556c527-32f5-4110-8e03-b8f20bab6ff9
2
public static Path unpackFileFromSkin(Path skinfile) throws IOException { assert FileUtil.control(skinfile); Path ret = null; FileUtil.unzipFileFromZip(skinfile, Constants.SKIN_PREVIEWFILE, Constants.PROGRAM_TMPSKIN_PATH); Path previewPath = Constants.PROGRAM_TMPSKIN_PATH.resolve(Const...
fd4e0619-31df-46ca-83dc-61d528fba16e
1
public static boolean isMuted(Player p) { return (PlayerChat.plugin.Mute.contains(p.getName()) ? true : false); }
c6b2b3ca-bd3a-400e-95f9-11424f32c042
6
void gotData(Object key0, String error, byte[] data) { String key = (String)key0; ImageIcon result = blank; if (error == null) { try { BufferedImage img = ImageIO.read(new ByteArrayInputStream(data)); int s = size * scale; if (im...
09fc4a5e-e52d-4e30-9abb-667353ef7601
7
public void OrderPriority(HDD d, RAM r) { r.jList.clear(); Job tempJ, tempK; for(int i = 0; i < d.jList.size(); ++i) { tempJ = d.jList.get(i); if(r.jList.isEmpty()) { r.jList.add(d.jList.get(i)); } for(int j = 0; j < r.jList.size(); ++j) { tempK = r.jList.get(j); if(tempJ.getPri()...
49a5bae5-3319-41ba-8a70-27c83ea83877
4
public void onExit() { int numberOfNodes = Tools.getNodeList().size(); int density = 0; int simulationID = 0; try { density = sinalgo.configuration.Configuration.getIntegerParameter("Density"); simulationID = sinalgo.configuration.Configuration.getIntegerParameter("SimulationID"); } catch (CorruptConfig...
a4ce06db-d6f4-419a-9295-e0243369b654
4
public void update() { up = key[KeyEvent.VK_UP] || key[KeyEvent.VK_W]; down = key[KeyEvent.VK_DOWN] || key[KeyEvent.VK_S]; left = key[KeyEvent.VK_LEFT] || key[KeyEvent.VK_A]; right = key[KeyEvent.VK_RIGHT] || key[KeyEvent.VK_D]; }
36ea1266-5138-4584-880b-a1233a4cf78d
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
cbba92c9-89f4-4eee-9d0d-23c5451bc4e9
3
public static TowerDefense_TransData JOSNToArray(String jsonString) { JSONParser parser = new JSONParser(); TowerDefense_TransData towerDefense_TransData = null; try { JSONObject jsonObject = (JSONObject) parser.parse(jsonString); towerDefense_TransData = new TowerDefense_TransData( ...
b2e4911a-2c62-403f-b1be-f9c85bc6c840
7
@Override public String getContent() { // word 2003: 图片不会被读取 InputStream is = null; WordExtractor ex = null; try { is = new FileInputStream(inputFile); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { try { ex = new WordExtractor(is); ...
99371df7-e0a9-4b43-ac82-869d78d79a37
1
private void assertPlaying() { if (state != State.PLAYING) throw new IllegalStateException("not playing"); }
3a63c935-94f8-41bd-a975-04b5b336ba24
5
protected static boolean isTrueOrOn(final String value) { if (value != null) { if ("true".equalsIgnoreCase(value.trim()) || "on".equalsIgnoreCase(value.trim())) { return true; } else if ("false".equalsIgnoreCase(value.trim()) || "off".equalsIgnoreCase(value.trim())) { return false; } else { LogL...
2878877d-fa8f-43b0-b809-b72478bc7b60
9
private void checkRange() { if (a == b) throw new RuntimeException("the first number{" + a + "} should not equals to second number{" + b + "}"); if (a == c) throw new RuntimeException("the first number{" + a + "} should not equals to third number{" + c + "}"); if (b == c) throw new RuntimeException("the ...
864c8069-3cbe-41e7-af13-b80d559c5950
1
private static final long guidLSB(byte[] data) { long lsb = 0; assert data.length == 16; for (int i=8; i<16; i++) lsb = (lsb << 8) | (data[i] & 0x0ff); return lsb; }
534eb1ca-0372-4e36-9b6b-64fe8323ea31
9
private void setScoreLocationInfo(Attributes attrs) { // loop through all attributes, setting appropriate values for (int i = 0; i < attrs.getLength(); i++) { if (attrs.getQName(i).equals("x")) quizSlide.getScoreStart().setX( Integer.valueOf(attrs.getValue(i))); else if (attrs.getQName(i).equals("y"...
5a1ae839-25f0-42af-85d1-ed5424d3acf9
3
public void registMediaUrl(Status status) { // TODO 設定ファイルでMariaDBなどに切り替える IMediaUrlDao dao = new MediaUrlDao(); MediaEntity[] arrMedia = status.getMediaEntities(); if (arrMedia.length > 0) { System.out.println("メディアURLが見つかりました"); } for (MediaEntity media : ...
3bf51c97-bf4c-4c71-adee-94b74e7ae98b
8
public static String getSquare(int x, int y) { char location = ' '; y = y / 100; x = x / 100; switch (x) { case 0: location = 'a'; break; case 1: location = 'b'; break; case 2: location = 'c'; break; case 3: location = 'd'; break; case 4: location = 'e'; break; case 5...
9b3a6321-4824-4fff-bb2d-02bab189eb86
6
@Override public void run(){ while(true){ try { JSONObject o = read(); if(o == null){ throw new IOException("Graphics disconnected"); } connection.input(o); } catch (IOException e){ Debug.error("GUI disconnected, exiting!"); } catch (ProtocolException e){ try { JSON...
5f189a10-800e-4d9c-853c-ddd6b2382537
6
public String toString() { if (this == tObject) return "java.lang.Object"; if (ifaces.length == 0) return clazz.getName(); if (clazz == null && ifaces.length == 1) return ifaces[0].getName(); StringBuffer sb = new StringBuffer("{"); String comma = ""; if (clazz != null) { sb = sb.append(clazz....
86871cc0-eb2f-4a00-ab7c-4a593f59ecd2
8
public static void enrolUsers(MoodleEnrolUser[] user) throws UnsupportedEncodingException, MoodleRestEnrolException, MoodleRestException { try { StringBuilder data=new StringBuilder(); String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_ROLE_ASSIGN:MoodleService...
8f24fd7b-b401-4700-9f9f-e85c165047df
3
public static void Query(String nick) { boolean NoExist = true; for (int i = 0; i < DarkIRC.channelsList.size(); i++) { if (DarkIRC.channelsList.get(i).name.equalsIgnoreCase(nick)) { NoExist = false; ...
b8dc76e2-b574-49ce-a3ef-9d3fc8046bb7
9
private int[][] up() {//all numbers will go up and combine when possible int[][] egrid = clone2DArray(grid); for (int xIndex = 0; xIndex < 4; xIndex++) { for (int yIndex = 3; yIndex > 0; yIndex--) { if (egrid[yIndex - 1][xIndex] == 0) { for (int a = yIndex...
e8b6a665-51f9-481f-b702-3ddc8036ba92
7
public final void update() { // See if this morph needs to be deactivated // TODO replace with usage of requirements. if (getMass() < getClass().getAnnotation(MorphInfo.class).disableMass()) { LOGGER.trace("Disabling morph"); tryToDeactivate(true); } for (Behavior<?> behavior : getAlwaysActiveBehavior...
68612f80-8cca-4df0-b9e2-6d8fa268e620
6
public void update() { this.removeAll(); try { Image i = ImageIO.read(new File("Skyrim Art/character_.png")); double scale = Math.min(getWidth()/402.0, getHeight()/952.0); layer = new JLayeredPane(); picture = new JLabel(new ImageIcon((i.getScaledInstance((int) Math.floor(402*scale), (int) Math.floor(95...
d763bb60-4af1-48f7-8552-7303467062c2
9
static final void method347(int[] is, int[] is_20_, int i, int i_21_, int i_22_) { do { try { anInt473++; if (i_21_ != -22222) aClass60_463 = null; if (i >= i_22_) break; int i_23_ = (i - -i_22_) / 2; int i_24_ = i; int i_25_ = is[i_23_]; is[i_23_] = is[i_22_]; is[i_22_] = i_25_; ...
5c03a85b-860a-497b-aa24-4371132f7cb0
8
public JSONObject generatePutJSON() throws JSONException { JSONObject globalJSON = new JSONObject(); JSONObject trackingJSON = new JSONObject(); JSONObject customFieldsJSON; if (this.title != null) trackingJSON.put("title", this.title); if (this.emails != null) { JSO...
983311a1-0c0b-4a3d-8ebf-845daec8a478
3
private int getCurOnline(ASPlayer data, TableType table) { switch(table) { case DAY: return data.curDay.online; case WEEK: return data.curWeek.online; case MONTH: return data.curMonth.online; default: plugin.severe("Invalid Type in getCurOnline"); } return 0; }
662c128d-67ce-49ab-98f8-2e56ce25d76d
7
@Test public void testMany () { int numRects = 300000 / 2; MBR queryInside = new SimpleMBR (495, 495, 504.9, 504.9); MBR queryOutside = new SimpleMBR (1495, 495, 1504.9, 504.9); int shouldFindInside = 0; int shouldFindOutside = 0; List<Rectangle2D> rects = new ArrayList<Rectangle2D> (numRects * 2); // build ...
455ee646-a140-4b0b-9cf9-19f1f32516a1
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
042a4e41-899e-4520-bd9b-92268355fbcc
9
public void update(){ ArrayList<Entity> moveOut = new ArrayList<Entity>(); for (int i = e.size() - 1; i >= 0; i--) { if (e.get(i).needRemoval()){ e.remove(i); } else if(!e.get(i).makeRect().intersects(x, y, w, h)){ e.remove(e.get(i)); } } for (int i = p.size() - 1; i >= 0; i--) { if (p.ge...
4be3c587-e6a9-4927-a3a4-40f70e5f1361
4
public void add(List<Node> n, int distance) { // Valeur à ajouter LinkSimple temp = new LinkSimple(); LinkSimple newValue = new LinkSimple(); newValue.setListNodes(n); newValue.setDistance(distance); newValue.setNext(null); // LinkSimmple == NULL if (linkSimple == null) { linkSimple = newValue; } e...
eb158301-2024-4d78-a726-4367805d7d57
6
private static boolean isPrime(long i) { if (i == 2) return true; if (i == 1) return true; if (i == 3) return true; if (i % 2 == 0) return false; for (int j = 3; j * j <= i; j += 2) { if (i % j == 0) return false; } return true; }
59934d9a-36e6-4945-9880-fc4031e7ee5c
8
@Override public RenderingResult render(Plugin plugin, ActiveObjectSystem objectSystem, FireworkObject object) { // Determine whether the different effects should be spawned double objectVelocity = object.getVelocity().length(); boolean spawnNoTrailObjects = !object.hasSpeedBasedFrequency()...
a0ae8bea-792d-4c3b-ae83-a1fc0be25aa7
8
public static void multAddTransA_small( RowD1Matrix64F A , D1Matrix64F B , D1Matrix64F C ) { if( C.numCols != 1 ) { throw new MatrixDimensionException("C is not a column vector"); } else if( C.numRows != A.numCols ) { throw new MatrixDimensionException("C is not the expected ...
9cf3479f-dd01-45c0-b9a1-0d4e3b2899dc
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
8f699b6e-6946-42d8-81d0-d2600ace607f
5
@Override public void processCas(CAS aCAS) throws ResourceProcessException { JCas jcas; try { jcas = aCAS.getJCas(); } catch (CASException e) { throw new ResourceProcessException(e); } File collectionFile = new File(((String) getConfigParameterValue(PARAM_OUTPUT)).trim()); ...
34fb0e0f-baf1-4f31-b96a-2a6ccde19ec6
9
private void fillDatabase(String sentenceFile) { Scanner in; try { //reads sentence file in = new Scanner(new FileReader(sentenceFile + ".txt")); in.useDelimiter("\n"); Result r = new Result(); String temp = ""; //separate words and add the to the input arg while (in.hasNext()) { temp...
ae1a823e-0ebc-487d-886c-a9727c3d0654
9
@Around("MapReduceInvokeAspect.partitionInvocationPointcut(pmr)") public Object mapreduceInvocation(ProceedingJoinPoint pjp, PartitionMapReduce pmr) throws Throwable { if (hazelcast != null) { Member local = hazelcast.getCluster().getLocalMember(); // look for PartitionKey annotation in the method s...
6eb01363-c658-4b83-81c1-293f42733cae
0
public void update(Point p) { ((Rectangle) shape).setFrameFromDiagonal(firstpoint, p); this.initialHeight = ((Rectangle) shape).height; this.initialWidth = ((Rectangle) shape).width; this.initialPoint = new Point(((Rectangle) shape).x, ((Rectangle) shape).y); updateCornerRects();...
208731ea-592b-4258-9074-ab1b5f2a6dd2
3
public int maxPathSumRec(TreeNode root) {// return a path that must end up at root if(root == null) return 0; if(root.left == null && root.right == null) return root.val; int pathSumLeft = maxPathSumRec(root.left); int pathSumRight = maxPathSumRec(root.right); int maxCur = Math....
4b0d49b1-d2f2-49cc-acc4-2a1df8ce4947
1
@Override public void onFinish() { System.out.println(" ^ Refactored " + (methodId - 1) + " methods!"); if (nCount > 0) { System.out.println(" ^ Refactored " + nCount + " native methods due to illegal naming!"); } }
af7ef95c-d140-4d91-94ef-6345be22a012
8
public void permut(int i, int j, int ip, int jp) { // Permute les boules de coordonnées (i,j) et (ip,jp) // SEULEMENT SI elles sont adjacentes ! if (((i == ip) && (j == (jp + 1))) || ((i == ip) && (j == (jp - 1))) || ((j == jp) && (i == (ip + 1))) || ((j == jp) && (i == (ip - 1)))) { int s = matrix[i][...
c59d7b70-b5bc-49c8-801b-0178d3846b5d
5
public int typeLen(){ if(length<=0) return 0; if(tagVal() != 0x1f) return 1; int k=offset+1; int len=2; while((k<length+offset) && (gs(data[k])>127)) {len++; k++;} if (len > length) return 0; return len; }
fee8b016-62ac-4aba-b590-f3458917ea1d
3
@Override public final int compareTo(final DropTarget<?, ?, ?> o) { throw new UnsupportedOperationException(); }
6778e4b5-aeb7-4d61-b98d-60bd5ab74ba6
3
static void writeln(String txt) { int x,z = 0; x = txt.length(); while(z < x) { try { fos.write(txt.charAt(z)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } z++; } try { fos.write('\n'); } catch (IOException e) { // TOD...
9db882c8-8577-438a-9870-cc61a8c1e755
4
@SuppressWarnings("unchecked") private List<Message> loadLog(String logRef){ String logName = logPath + logRef; List<Message> res = null; try { FileInputStream fis = new FileInputStream(logPath + logName); ObjectInputStream ois = new ObjectInputStream(fis); res = (List<Message>)ois.readObject(...
117d3943-3181-4006-b308-04bb1ff56cbe
6
private void drawTriangles() { int cn = this.caseNumber(); boolean directTable = !(isAmbigous(cn) && !this.amb); // address in the table int offset = (directTable)?cn*15:(255-cn)*15; for (int index = 0; index < 5; index++) { // if there's a triang...
605611e8-167f-4bc3-b18c-5739016cbe4b
4
public static SubDFA getSubDFAbyCharacter(char c) throws UnDefinedCharacterException { if (WordTable.isLetter(c)) { return new DefaultStringSubDFA(); } else if (WordTable.isDigit(c)) { return new DefaultNumericalDFA(); } else if (WordTable.isDelimiter(c) /*|| WordTable.isDelimiterPart(c)*/) { return n...
1818bca9-d784-4989-a92f-9d7ca63d8986
3
public JSONObject accumulate(String key, Object value) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value); ...
06e593fd-5fd0-403e-9bd3-ecec78a65bc4
8
protected String shortenText(GC gc, String t, int width) { if (t == null) return null; int w = gc.textExtent(ELLIPSIS, DRAW_FLAGS).x; if (width <= w) return t; int l = t.length(); int max = l / 2; int min = 0; int mid = (max + min) / 2 - 1; if (mid <= 0) return t; TextLayout layout = new Text...
4088b741-6c17-4992-9f68-d4d6f128c960
8
public boolean equals(Object passedObj) { //Checks if the object exists if (passedObj == null) { return false; } //Checks to ensure the class is an instance of this class if(!(passedObj instanceof MyAllTypesFirst)) { return false; } if(passedObj == this) { return true; } MyAllTy...
36aeb686-87be-4d2a-a774-559657853424
2
public static boolean supportsBatchUpdates(Connection con) { try { DatabaseMetaData dbmd = con.getMetaData(); if (dbmd != null) { return dbmd.supportsBatchUpdates(); } } catch (SQLException e) { throw new RuntimeException(e.getSQLState() + "\nCaused by\n" + e.getCause(), e); } retur...
368f1c42-32b8-4f16-983b-228aa528be00
5
public int getCount(String type, int i) { int result = 0; String line = ""; if(type.equals("row")) { line = jTable.getRow(i); } else if(type.equals("column")) { line = jTable.getColumn(i); } else if(type.equals("diagonal")) { line = jT...
cddc946e-c3e2-4315-bccf-e36488931d5b
2
public Percolation(int N) { gridSize=N; grid = new int[N * N]; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { grid[i * j] = BLOCKED; } } }
ab9b222f-7a81-4262-bfdb-4fd041bba213
0
public AutomatonSimulator(Automaton automaton) { myAutomaton = automaton; myConfigurations = new HashSet(); }
152c8518-0aa5-4878-8bde-c59f62939f81
8
public void update(ChiVertex<Integer, Integer> vertex, GraphChiContext context) { if (context.getIteration() == 0) { /* Check vertex value was loaded properly */ int originalId = context.getVertexIdTranslate().backward(vertex.getId()); if (loadedVertexValues.containsKey(origi...
d4849037-8d82-4f0a-a468-fb26313b2a1f
2
public List<String> getCommonIDS(List<String> terms) { List<String> IDList = new ArrayList<>(getTermIDList.getIDList(terms .get(0))); List<String> tmpList = new ArrayList<>(); if(terms.size()>1) { for (String term : terms) { tmpList = getTermIDList.getIDList(term); IDList = listOperation.getInter...
7f7a9c25-3587-4e9c-bebe-cb9085613c03
6
public boolean doitOuvrirPorteCabine() { // Si un passager veut aller à l'étage courant. for (Passager p : this.passagers) { if (p != null) { if (p.getEtageDestination().equals(etage)) { //Il veut aller ici return true; ...
194c44d7-69c8-492d-8ce3-4ffc7852dba5
4
public double[] getSpectrum (double[]data) { double spectrum[]=new double[data.length/2]; double highS=0; if (spectrumRecord==true) spectrumVals.clear(); // Clear the total energy sum totalEnergy=0.0; int a,count=0; componentDC=data[0]; for (a=2;a<data.length;a=a+2) { spectrum[count]=Math.sq...
8cde72da-ce1e-4c04-adce-801bde5126d3
7
private void sendCommand(String s) throws NoCommandException, NoSuchCommandableException { int i = s.indexOf(' '); if(i == -1) throw new NoCommandException(); if(i == s.length()) throw new NoCommandException(); String s1 = s.substring(1, i); Sh...
3dda8e07-bd2b-4775-b806-44878f7ee238
5
public Playback(String fileName) { try { File file = new File("audio/" + fileName); if (file.exists()) { fileExists = true; System.out.println("found it!"); theClip = AudioSystem.getClip(); ...
9d96f9fc-0061-480a-9cc1-d9a496f687f5
3
private int[] renderGenerationToPixelArray(Generation currentGeneration) { int scaledHeight = getScaledHeight(currentGeneration); int scaledWidth = getScaledWidth(currentGeneration); int[] pixels = new int[scaledHeight * scaledWidth]; for (int row = 0; row < scaledHeight; row++) { for (int col = 0; col < sc...
89f3f441-99ca-425d-a9d1-f43027241de9
8
public static Cons extractGoalArguments(Proposition goal) { { Vector arguments = goal.arguments; { Keyword testValue000 = goal.kind; if ((testValue000 == Logic.KWD_ISA) || ((testValue000 == Logic.KWD_PREDICATE) || ((testValue000 == Logic.KWD_FUNCTION) || (testV...
43370510-5a49-488c-b8e4-d660cafc9c36
1
public synchronized void increaseRange() { if (range < 5) { range++; } }
6495594f-a62b-4f48-82e3-4e330e4857ff
9
private static int lo0bits(int y) { int k; int x = y; if ((x & 7) != 0) { if ((x & 1) != 0) return 0; if ((x & 2) != 0) { return 1; } return 2; } k = 0; if ((x & 0xffff) == 0) { ...
a37fb5ac-b27a-449d-802b-bdc325793fa1
8
private List<Boolean> getRegionData(CoordXZ region) { List<Boolean> data = regionChunkExistence.get(region); if (data != null) return data; // data for the specified region isn't loaded yet, so init it as empty // and try to find the file and load the data data = new ArrayList<Boolean>(1024); for (int i...
00f3907c-6a9c-4555-a2e2-388cba3c52df
0
public double getPaybackMoney(){ return this.buyBackMoney; }
f33c0a30-90af-4c8c-98f5-6bcf69c7e0d5
5
private boolean attemptLoad(URL versionUrl) { URLConnection urlConnection = null; try { urlConnection = versionUrl.openConnection(); } catch (IOException e) { Log.w("IOException when attempting to open connection to version list."); ...
859d8195-034f-4a88-9ee4-e96c3a3d9767
8
public static Tlv[] TlvAnalysis(byte[] buffer) { int cur = 0; byte[] tlv = new byte[buffer.length - cur]; System.arraycopy(buffer, cur, tlv, 0, tlv.length); //System.out.println(Hex.rhex(tlv)); Vector<Tlv> tmptlv = new Vector<Tlv>(); for (int loc = 0; loc < tlv.length;) { int tlv_Tag = TypeConvert.byte2s...
fbb5dc15-35a8-49bc-a31f-e21417317cd6
8
public void actionPerformed(ActionEvent e) { if("add".equals(e.getActionCommand())){ eventWindow = new JFrame("add"); eventWindow.setSize(500,300); eventWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); eventWindow.setVisible(true); eventWindow.add(new Add...
a81a0b78-21ad-4036-b63d-d0835ee95c41
5
public TBox getBlkVirtualBox() { TBox b = new TBox(); int xMin = 0, xMax = 0, yMin = 0, yMax = 0; //find the min & max relative coordinate first for (int i = 0; i < this.getNumSquare(); i++) { Point p = (Point)sq[i].getSecondVertex(); if (p.x >= xMin) { xMin = p.x; } if (p.x <= xMax) { xMax ...
ea4d387e-bb99-479c-9f8e-578c8a5c2e75
3
@Test public void testMoveBackwardUnlanded() throws UnlandedRobotException { exception.expect(UnlandedRobotException.class); Robot r = new Robot(); try { r.moveBackward(); } catch (InsufficientChargeException e) { e.printStackTrace(); //To change body of catc...
95e95e34-62bf-4a1d-961e-b9672df3e004
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...
7e6960fa-b2db-485b-b067-7acb9aba0db9
7
public static boolean NTarraySizeList() throws IOException { boolean success = true; success = ErrorRecovery(NonTerminal.arraySizeList); switch (lookahead) { case LSQBRACKET: if (!NTarraySize()) success = false; if (!NTarraySizeList()) success = false; if (success) writetoFile(derivation...
8c86a001-9446-4bae-af3f-d44655d990db
4
public static <TElement, TCollection extends Collection<TElement>> TCollection addAll(final TCollection target, final Iterable<? extends TElement> source) { if (target != null && source != null) { for (TElement element : source) { target.add(element); } } ...
ff353560-a604-4015-b406-9624d48dace0
3
private ArrayList<Integer> stringKoordinaateiksi(String string) { /** * Alotetaan string[2]:sta koska ekat 2 merkkiä on E ja spacebar */ ArrayList<Integer> koordinaatit = new ArrayList(); int luku; int j = 2; for (int i = j; i < string.length(); i++) { ...
5ee74fa6-5e3c-4be7-890d-c281f0eeba9b
4
private boolean authenticatingToMailbox() { sendToMailbox("USER " + konto.getUser()); if (readFromMailbox().startsWith("+OK ")) { sendToMailbox("PASS " + konto.getPassword()); if (readFromMailbox().startsWith("+OK")) { try { logfile.update(" + ...
766e5a16-60b6-4a43-9c58-7e7e3350993f
9
public void addCheat(String cheat) { String[] validCheats = {"daniel", "kaboom", "lulz", "profit!"}; boolean valid = false; for(String validCheat:validCheats) { if(cheat.equals(validCheat)) { valid = true; break; } } if(valid) { boolean firstTime = cheats.isEmpty(); if(firstTime) { che...
f25ab07f-51b2-41b6-a2c1-31571331d4b9
2
public boolean isStartSymbol(String variable, Automaton automaton) { State startState = automaton.getInitialState(); State[] finalStates = automaton.getFinalStates(); if (finalStates.length > 1) { // System.err.println("MORE THAN ONE FINAL STATE"); return false; } State finalState = finalStates[0]; St...
3aa46e64-b92a-43e0-8d2c-155a127456c3
9
public void start(Archive streamLoader, Client client1) { String as[] = { "model_version", "anim_version", "midi_version", "map_version" }; for (int i = 0; i < 4; i++) { byte abyte0[] = streamLoader.decompressFile(as[i]); int j = abyte0.length / 2; Buffer stream = new Buffer(abyte0); versions[i] = n...
82c14e9e-d218-4f70-8690-87da6e629634
2
public static void saveScorecard() { ArrayList<Integer> aaron = new ArrayList<Integer>(); for (int i = 0; i < 18; i++) { aaron.add(3); } ArrayList<Integer> pars = new ArrayList<Integer>(); for (int i = 0; i < 18; i++) { pars.add(4); } HashMap<String, ArrayList<Integer>> map = new HashMap<String, ArrayList<In...
e48c2222-029c-4343-af2f-16c4bd468da1
1
public static String makeFiller(int amt, char filler) { StringBuilder buffer = new StringBuilder(amt); for (int i = 0; i < amt; i++) { buffer.append(filler); } return buffer.toString(); }
ff2d0e98-b1c1-4a96-abe3-708eb9a80e08
6
protected void appendHitUpdate(stream str) { try { HP -= hitDiff; if (HP <= 0) { IsDead = true; } str.writeByteC(hitDiff); // What the perseon got 'hit' for if (hitDiff > 0 && !poisondmg) { str.writeByteS(1); // 0: red hitting - 1: blue hitting } else if (hitDiff > 0 && poisondmg) { st...
a533be70-2922-42fc-9745-76c17b798fe1
0
public Point2D getTopLeft() { return new Point2D(x, y); }
eefeeed5-eb0f-48bb-99b3-c9ab6e7f4262
1
public boolean Increment() { //set the status flag of onboarding a passenger boolean status = false; //ensure passangers onboard is within the bus capacity if ((passengersOnBoard + 1) <= busCapacity) { //increment passenger onboard ...
a85526e0-9bb8-4842-a86f-ac61819ac238
8
private void appendShapeInternal(StringBuilder sb) { if (type == ShapeType.RECTANGLE && shield > 0) { throw new UnsupportedOperationException(); } else if (type == ShapeType.RECTANGLE) { sb.append("shape=rect"); } else if (type == ShapeType.DIAMOND) { sb.append("shape=diamond"); } else if (type == Shap...
72d145f5-a480-4b01-9bd1-2416b2182305
0
@Override public void actionPerformed(ActionEvent e) { Outliner.html_viewer.show(); Outliner.html_viewer.addURL(getResourceURL()); }
37925d22-c1d0-4c93-bd1e-5d1959f96cab
6
public boolean runCommand(String command) { Matcher matcher = commandPattern.matcher(command); if (matcher.find()) { BoardPage currentPage = (BoardPage) pagesPane.getSelectionModel().getSelectedItem(); String action = matcher.group(1); String argString = matcher.gro...
3d2c9432-8ed5-402a-b9bd-75091e047571
7
@Override @SuppressWarnings({ "nls", "boxing" }) protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder enc) { super.initialize(type, oldInstance, newInstance, enc); DefaultComboBoxModel model = (DefaultComboBoxModel) oldInstance; int count = model.getSize(); Expre...
793277e1-484d-4bf0-8969-8a2245150fd0
1
private String pad(String binaryNum, int length) { int numZeros = length - binaryNum.length(); for (int k = 0; k < numZeros; k++) { binaryNum = ZERO.concat(binaryNum); } return binaryNum; }
d8ff08b4-b629-421e-8e29-2b92c3ee15d0
3
@Override public void deserialize(Buffer buf) { pageIndex = buf.readShort(); if (pageIndex < 0) throw new RuntimeException("Forbidden value on pageIndex = " + pageIndex + ", it doesn't respect the following condition : pageIndex < 0"); totalPage = buf.readShort(); if (tot...
6794b75e-998c-49bc-98ed-8843e8999eee
0
public RecvGUI() { initComponents(); }