method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bacc4dd4-9aa8-47a6-8b19-7775a9899a27
5
private void isaac() { lastResult += ++counter; for (int i = 0; i < 256; i++) { int j = memory[i]; if ((i & 3) == 0) { accumulator ^= accumulator << 13; } else if ((i & 3) == 1) { accumulator ^= accumulator >>> 6; } else if ((i & 3) == 2) { accumulator ^= accumulator << 2; } else if ((i &...
12e79b34-46eb-4915-ae62-0289eb812bce
8
public static void main(String[] args) { System.out.print("Ile znajduje sie w bankomacie banknotow o nominale 100: "); int nominalStoKomora = IO.readInt(); System.out.print("Ile znajduje sie w bankomacie banknotow o nominale 50: "); int nominalPiecdziesiatKomora = IO.readInt(); ...
108181ce-1f3a-434b-837b-86a96d95343a
6
public static char[] encodeText(char[] c, int n, char[] A) { char[] o = new char[c.length]; //create an array to output encrypted message for (int i = 0; i < c.length; i++) { //if array elemnt is punc. mark or space, copy it if (c[i] == ' ' || c[i] == '.' || c[i] == ',') o[i] = c[i]; //else, find in alpha...
b82a03b0-d4bd-4ff9-a624-a53f91284f11
9
public void actionPerformed(ActionEvent e) { JComboBox combo = new JComboBox(); // Figure out what existing environments in the program have // the type of structure that we need. EnvironmentFrame[] frames = Universe.frames(); for (int i = 0; i < frames.length; i++) { if (!isApplicable(frames[i].getEnviron...
f3a32c4d-03c9-447c-b9bf-fbcf917f44c7
4
public static void main(String[] args) { try { if (args.length < 5) { System.out.println("parameters error!"); showHelp(); System.exit(0); } else { txtPath = args[1]; xmlPath = args[2]; StanfordInputpath = args[3]; outputPath = args[4]; } if(args[0].equals("-o")){ System.o...
b7ff3a50-bef3-4594-9795-591b3c4dd6ad
5
@Override public void loop() { switch (step) { case 0: if(Motors.movement.isMoving()){ if(Motors.ts.isPressed()){ Motors.movement.forward(); reset(); step++; } } else{ Motors.movement.backward(); } break; case 1: if (delta()>400){ Motors.movement.stop(); Mot...
cbfc7c24-69cc-4d4b-aaae-96dbf0732808
3
public int maxWins(int initialLevel, int[] grezPower) { int n = grezPower.length; Arrays.sort(grezPower); int ans = 0; while(true){ if(ans == n)break; if(initialLevel > grezPower[ans]){ initialLevel = initialLevel + grezPower[ans] / 2; ans++; }else{ break; } } return ans; }
2c87cc27-3bf0-42f0-b0f0-dc1b6fd51209
4
public void mouseClicked(MouseEvent e) { if(e.getClickCount()==2) { //if it was the left mouse button if(e.getButton() == MouseEvent.BUTTON1) { int row = table.getSelectedRow(); int column = table.getSelectedColumn(); //only open the dialog, if a row is selected if (row > -...
3f661e2c-a028-483f-9156-36fc1b719182
8
@Override public void move(int direction) { super.move(direction); rest++; if (rest > 20) { rest = 0; if (getHealth() < getMaxHealth()) { setHealth(getHealth() + 1); } } if (!isRunning() || rest % 3 == 0) { Game...
1d9e22e8-575e-470b-9926-d9f68ec1eb1f
1
@Test public void OccupiedName() throws Exception { LoginCheck logCh = new LoginCheck(); name = "sunny3548"; if (kesh.containsKey(name)) { assertTrue(kesh.get(name)); } else { boolean result = logCh.validate(name); kesh.put(name, result); ...
ca341e28-f365-4a39-ace1-3118b6064276
8
public void actionPerformed(ActionEvent ae) { try { if (ae.getSource() == this.tmrInterrupt) { if (!this.continueInterrupt) { String kill = "Orbiter Kill command received.... killing this thread softly..."; sendToController(kill); try { ...
027c2186-9d83-48ac-9143-9ac74f346a92
5
public void saveLevel() throws IOException { if(level != null) { if(level.worldType != WorldType.CLIENT) { File f = level.getChunkFolder(); if(f == null) { f = new File(new File(getFolder(), "saves"), level.g...
792e2896-5f13-4653-a00a-ff65849111b7
5
@Override public Student getCourses(int userId) throws SQLException { List mainCourses = new ArrayList(); List<Course> addCourses = new ArrayList<>(); Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDr...
2ec115be-d055-4428-a501-ebc3f0b847c8
5
public String toString() { if (this == BOGUS) return "BOGUS"; if (this == UNINIT) return "UNINIT"; if (this == RETURN_ADDRESS) return "RETURN ADDRESS"; if (this == TOP) return "TOP"; return clazz == null ? "null" : clazz.getName();...
5ac09567-e8f4-4a2d-8a23-2816100b2f6a
6
public boolean initializeFolders() { switch (OsTypes.getOperatingSystemType()) { case Windows: appStore = new File(System.getenv("APPDATA") + File.separator + "PermissionsChecker"); break; case MacOS: appStore = new File(System.getProperty("user.home") + File.separator + "Library/Application Support...
5ed83646-567b-4f7e-9d77-f02b9fabb68d
8
public void punktverschieben(JPanel punkt, Point neuePosition) { Point pv = punkt.getLocation(); if (parentClass.parentFrame != null) { punkt.setLocation(parentClass.parentFrame.getMousePosition()); } else { punkt.setLocation(parentClass.parentApplet.getMousePosition()); ...
e01e55c1-497c-4551-abf1-93b061dd50b4
2
public void update(int delta) { if(elapsedTime < this.sprite.getAnimationSpeed()) { elapsedTime += delta; } else { if(this.sprite.getCurrentFrame() < this.sprite.getFrames().size() - 1) this.sprite.incrementFrame(); else this.sprite.setCurrentFrame(0); elapsedTime = 0; } }
b1a564a1-1c90-4377-809b-b7d0a31cc7eb
0
public void setjPanelTitre(JPanel jPanelTitre) { this.jPanelTitre = jPanelTitre; }
ab416c4a-876c-4c8e-9519-3075f9196be4
7
final boolean method347(int i, boolean flag) { if (!flag) { method341(true); } if (anIntArray574 != null) { for (int j = 0; ~j > ~anIntArray574.length; j++) { if (~anIntArray574[j] == ~i) { return Class82.aClass73_1265.method796(anIntAr...
c9862ce3-fe51-463a-8dbb-47ae4f89b1a8
4
public void access() throws IOException { try { BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String inputLine; addOnline(); while (socket.isConnected()) { inputLine = in.readLine(); if (inputLine != null) { if (inputLine.equalsIgnoreCase("Exi...
74865c1f-3930-4b59-be3c-1faae16a7c3f
9
public void run() { try ( // Create objects to handle client input/output BufferedReader clientIn = new BufferedReader( new InputStreamReader(socket.getInputStream())); PrintWriter clientOut = new PrintWriter( socket.getOutput...
654c5043-e0ca-4c43-acde-6f92b4a37d47
0
public static void main(String[] args) { Resource resource = new ClassPathResource("applicationContext.xml"); BeanFactory factory = new XmlBeanFactory(resource); HelloBean helloBean = (HelloBean) factory.getBean("helloBean"); log.debug(helloBean.toString()); HelloBean2 helloBean2 = (HelloBean2) factory.getBe...
b84faf1f-ada4-4a05-a7e9-09fb9b1806ab
6
public static void main(String[] args) throws Exception { // game parameters String output = null; int d = 0; if (args.length > 0) d = Integer.parseInt(args[0]); if (args.length > 1) group0 = args[1]; if (args.length > 2) gro...
5ff4c8a3-c716-4d9e-bd6e-a5a1262286a4
6
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FieldFilter)) return false; FieldFilter that = (FieldFilter) o; if (!field.equals(that.field)) return false; if (operator != that.operator) return false; if (value != null...
497ab34e-a716-4e0e-a4be-d08aa32143a9
1
@Override public String describeNode() { String description="Frame:"+this.frameIdentifier; if(this.name!=null) { description+="/"+this.name; } /* if(this.nativeValue!=null) { description+="="+String.format("%.15s", this.nativeValue.toString()) +(t...
57bccaec-a797-4c62-a465-1b260520cc1e
3
public void unregisterNode(String key) { Iterator<Entry<String, GenericNode>> it = nodes.entrySet().iterator(); Iterator<GenericEdge> it2; GenericNode tmp; while( it.hasNext() ) { tmp = it.next().getValue(); it2 = tmp.getEdges().iterator(); while(it2.hasNext()) { if(it2.next()...
ec12dcc7-03b1-45f8-bff2-ff407d7acaac
8
private void btnFinishRoundMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnFinishRoundMouseClicked String courseName = currentCourse.getName(); HashMap<String, ArrayList<Integer>> theScores = new HashMap<String, ArrayList<Integer>>(); ArrayList<Integer>...
d620d5a2-b184-4c44-bdfe-541c4ede314b
4
public static void main(String[] args) throws Exception { for (String file : args) { try { accumulateXrefs(file, VERBOSE_RUN); } catch (Exception e) { System.out.println(e + " in file " + file); } } for (String s : refs.keySet()) { if (!decls.contains(s)) { System.out.println(refs.get(s) +...
e82825b1-17fa-4a03-a50a-df9a61b3df8d
1
public void update() { final double MS_TO_S = 0.001; long newMilliseconds = System.currentTimeMillis(); double elapsedSeconds = (newMilliseconds - _lastMilliseconds) * MS_TO_S; // DEBUG // System.out.println(elapsedSeconds); _lastMilliseconds = newMilliseconds; ...
a075907b-2b6b-4bc3-9d00-f532f5541127
8
public boolean checkFields(){ boolean allGood = true; boolean noEnzymes = true; String name = this.nameTextField.getText(); String prefix = this.prefixTextField.getText(); String suffix = this.suffixTextField.getText(); // check name if(name.compareTo("") == 0){ ErrorMessage.giveErrorMessage("Ple...
0c3dab9d-7872-453b-98ea-8b5123afea30
5
public static LuaValue longBitsToLuaNumber(long bits) { if ((bits & ((1L << 63) - 1)) == 0L) { return LuaValue.ZERO; } int e = (int) ((bits >> 52) & 0x7ffL) - 1023; if (e >= 0 && e < 31) { long f = bits & 0xFFFFFFFFFFFFFL; int shift = 52 - e; long intPrecMask = (1L << shift) - 1; if ((f & intPr...
8903420e-172f-4fdf-acc4-c956c4412e28
4
private boolean checkWithin(int x, int y) { if (x < 0 || x >= width || y < 0 || y >= height) return false; return true; }
92488595-b0ce-4d64-9f51-8b6d8696e643
2
public void GetMultiIDInRelation(String ids) { multiMap=new HashMap<>(); String query = "select * from inauthor where paperid in(" + ids+")"; ResultSet rs = sqLconnection.Query(query); try { while(rs.next()) { String paperid=rs.getString("paperid"); String name=rs.getString("name"); String...
0ca82f4d-0a30-4121-bb63-7e0efe5e8294
9
public EDGeneral() { setOpaque(false); setLayout(new MigLayout("", "[150px:150px:150px][50px:70px:80px][50px:100px:100px][200px:200px:500px,grow][230px:230px:230px]", "[20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20p...
eb8abf02-cf1c-49a7-912f-5f84ce4d913d
3
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.axe) { if (player.payStamina(4 - tool.level)) { hurt(level, xt, yt, random.nextInt(10) + (tool.level) * 5 + 10); ...
618d9656-5800-4bf9-a3a6-d215565ce555
2
protected int setDocPath (int docSelector, String docPathName) { // make sure we're in bounds if ((docSelector < 0) || (docSelector > docPaths.length)) { return ARRAY_SELECTOR_OUT_OF_BOUNDS ; } // end if // we're in bounds. // TBD ASAP // if the supplied path is relative rather than absolute ....
4c77a168-43a4-4fb8-a200-bec5c4ed155a
8
public void render() { // Get the loaded materials and initialise necessary variables Material[] materials = trackMesh.materials; Material material; Triangle drawTriangle; int currentMaterial = -1; int triangle = 0; // For each triangle in the object for (triangle = 0; triangle < trackMesh.triangles.l...
20fbc383-6570-4028-aa55-677fb398a478
3
@Override public boolean newUser(String userName, String password, int sentBy) { boolean retVal = false; System.out.println("register: " + userName + ", " + password); retVal = db.register(userName, password); if((sentBy == ServerInterface.CLIENT) && (backupServer != null)) { try { backupServer.ping(); ...
80bd56ec-3d21-4aae-b4ca-a5020b485939
8
public static int osd_set_display(int width, int height, int attributes) { /*TODO*/// struct mode_adjust *adjust_array; /*TODO*/// int i; /* moved 'found' to here (req. for 15.75KHz Arcade Monitor Modes) */ int found; if (gfx_height == 0 || gfx_width == 0) { ...
300c1590-9145-4adf-8c91-4857ef35f27a
3
public static TreeMap<Integer,Integer> pitchRangeTrunkate(TreeMap<Integer,Integer> pitchTreeIn){ TreeMap<Integer,Integer> pitchTreeOut = new TreeMap<Integer,Integer>(); Iterator<Integer> pitchIterator = pitchTreeIn.keySet().iterator(); while(pitchIterator.hasNext()){ int key = pitchIterator.next();...
624fb6e6-612d-4f8f-a041-dbae96aa68de
2
private void allocateElements(int numElements) { int initialCapacity = MIN_INITIAL_CAPACITY; // Find the best power of two to hold elements. // Tests "<=" because arrays aren't kept full. if (numElements >= initialCapacity) { initialCapacity = numElements; initial...
45fc12d4-9a6a-4f02-8b35-0b5c96281d3b
3
@Action(name = "hcomponent.handler.onkeydown.param", args = {"event.keyCode"}) public void onKeyDownAction(Updates updates, String[] args, String param) { HComponent<?> html = (HComponent<?>) Session.getCurrent().get( "_hcomponent.object." + param); Session.getCurrent().store("_hcomponent.object." + param + "....
e7e75d7d-35da-4107-aadf-b53096d79b41
6
void decodeGrbit( byte[] grbytes ) { if( (byte) (grbytes[0] & 0x1) > 0x0 ) { isLink = true; } if( (byte) (grbytes[0] & 0x2) > 0x0 ) { isAbsoluteLink = true; } // 20060406 KSC: need both bits 2 & 4 to be set for hasDescription // if ((byte)(grbytes[0] & 0x14) > 0x0)hasDescription = true; if( (byt...
3abac20b-18a3-4005-b7b0-0ead2dc3459f
2
static void printList(final PrintWriter pw, final List l) { for (int i = 0; i < l.size(); ++i) { Object o = l.get(i); if (o instanceof List) { printList(pw, (List) o); } else { pw.print(o.toString()); } } }
fb145698-ba7e-47de-8a46-c412c2aaf98d
4
public static void removeCols(JTable paymentTable) { TableColumnModel tcm = paymentTable.getColumnModel(); System.out.println("getColumnCount:" + tcm.getColumnCount()); if (tcm.getColumnCount() == 13) { paymentTable.removeColumn(tcm.getColumn(12)); } if (tcm....
4ef01d3f-50ae-4c96-89fd-ea6ce17055f4
8
public void useSkillEx(SkillBarSkillSlot skillSlot, int targetId, int delay) throws IOException { LOG.debug("Using skill in slot {} on target {}", skillSlot, targetId); //FIXME: why isn't the delay used???? if (this.isDead(-2)) { LOG.debug("The player is dead"); return; ...
4e7c7335-2f3d-4cad-8bf7-57b1229c3730
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the server with glorious data task = plugin.getServer().getScheduler().runTaskTimerAsynchronous...
88ba96ee-4cd4-42f3-b199-02607ee7669c
7
public void setupAttribLists() { String [] tempAttribNames = new String[m_data.numAttributes()]; String type; m_classAttrib.removeAllItems(); for(int i=0; i<tempAttribNames.length; i++) { switch (m_data.attribute(i).type()) { case Attribute.NOMINAL: type = " (Nom)"; break; case Attr...
be731c5c-19b8-4e09-86fa-270e081ec63f
2
public StackManipStmt(final StackExpr[] target, final StackExpr[] source, final int kind) { this.kind = kind; this.target = target; for (int i = 0; i < target.length; i++) { this.target[i].setParent(this); } this.source = source; for (int i = 0; i < source.length; i++) { this.source[i].setParen...
710119bc-49f8-4985-b9b2-505f2fb43040
0
public boolean isIntersectingEnemy(EnemyObject enemy){ Rectangle2D.Double r = new Rectangle2D.Double(me.getX(), me.getY(), 20, 20); Ellipse2D.Double e = new Ellipse2D.Double(enemy.getX(), enemy.getY(), 20, 20); return e.intersects(r); }
828518cd-6720-4fd7-aeaf-26c9cff45c01
0
public void testCircleEquation() { CircleEquation equation = CircleEquation.newInstance(0, 0, 5); assertEquals(Math.acos(3.0f / 5.0f), equation.getT(3), 0.01f); }
29be8160-af82-43b9-a599-e1c00c4b369e
4
public void setAllLedStatesToRepresentInputValue() { for (LED led : ledArray) { led.setState(LED.OFF); } // if input value is less than lowest step, no leds are lit if (highestLitLedIndex == -1) { return; } for (int i = 0; i < ledArray.length; i++) { ...
60f58414-3019-4165-b680-7a343a10b29d
7
private static float getFloatValueForByteBinaryString(String bits) { if (bits.matches("[01]{8}")) { int sign = 1; if (bits.charAt(0) == '1') { sign = -1; } float result = 0f; int exponent = getExcessThreeValue(bits.substring(1, 4)); ...
e62aedf1-bbb3-4ad7-a27e-dfbccba584c9
2
protected String getClientInput(){ String input = ""; //Try to read input from client. try{ if(clientInput.ready()){ input = clientInput.readLine(); } } catch (IOException e) { System.out.println("Error reading from client " + user.getName() + "(" + user.getIP() + ")."); e.printSta...
f29e94ed-3f2c-4253-8f5a-1a6451e73699
0
public String getName() { return name; }
eeb82f7a-15f0-4c4b-82a8-b4d08731bb6a
6
public void printGrid() { for(int i = 0; i < width + 2; i++) System.out.print("_"); System.out.println(); for(int y = 0; y < height; y++) { System.out.print("|"); for(int x = 0; x < width; x++) { if(grid[x][y] instanceof EmptyTile) System.out.print(" "); else if(grid[x][y] instance...
3b67f4a2-a8ce-4804-8ab1-c7e6528776d7
3
@Override public void run() { while(Running) { for(Room mRoom : Grizzly.GrabHabboHotel().GrabRoomHandler().GrabPopulatedRooms().values()) { mRoom.Tick(); } try { Thread.sleep(500); } catch (InterruptedException e) {} } }
dfc5091d-8c10-4542-acc6-c4aa59c3f9db
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
777b5619-dfa4-4db6-a168-5142989c3e41
2
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (tag == null || Tags.MESSAGE == tag) { return; } valueTag = new String(ch, start, length).trim(); }
84a2d569-0688-425d-be38-e04d9427bc46
8
private static void logToDetailsHTMLFile(UniProtEntry uniProtEntry) { StringBuffer sb = new StringBuffer(); sb.append("<html>"); sb.append("<body>"); sb.append("<table border=\"1\">"); sb.append("<tr><td>\r\n"); //String imageTag = ncbiDownloadManager.getProteinImage(uniProtE...
dc06ce32-bc8f-4401-a056-88a8df8d7b57
4
public static int runToNextInputFrameLimit(int move, int limit) { if ((move & 0b00001111) == 0) { return runToNextInputFrameHiLimit(limit) ? 1 : 0; } else if ((move & 0b11110000) == 0) { return runToNextInputFrameLoLimit(limit) ? 1 : 0; } else { return runToNextInputFrameHiLoLimit(limit); ...
2832e848-0ce7-44c9-85a4-3005c5f52b4b
9
public int getArmorClass() { Integer armorClass = 10; Slot armor_slot = slots.get("armor"); Slot shield_slot = slots.get("weapon1"); Item item_a = null; Item item_s = null; if( armor_slot != null ) item_a = armor_slot.getItem(); if( shield_slot != null ) item_s = shield_slot.getItem(); Shi...
27b456c9-55ea-473b-994d-3733e234d4bc
9
public static int[][] generateSudoku(int size, int numbers) { final int S = size * size; final int[][] array = new int[S][S]; final Random r = new Random(); // int x = r.nextInt(S); final int x = 0; for (int i = 0; i < S; i++) { for (int j = 0...
4af88259-405f-49fd-8801-b51d35047d23
7
void selectStatement() { ArrayList<Condition> conditions = new ArrayList<Condition>(); ArrayList<String> columnNames = new ArrayList<String>(); Table table2 = new Table(new String[]{}); Table result; _input.next("select"); String column = columnName(); columnName...
b8983beb-bbe3-4bc2-a82a-7f262a7ec805
1
public T peek() throws NoSuchElementException { T returnValue; try { return heap.get(0).item; } catch (IndexOutOfBoundsException npe) { throw new NoSuchElementException(); } }
70915711-fc39-41aa-99ab-e6d318f6b2f5
5
public UriParseResult(final Uri uri) { //uri formats: //content://[authority] for general queries //content://[authority]/[tables] for table specific queries //content://[authority]/[table]/[id] for entity specific queries //check if authority matches if (!authority.equals(uri.getEncodedAuthority())...
3ec70f76-fca9-46d0-a43c-375226c25b12
7
public String[][] retrieveRows(String table, double limit, String regExp, String[][] tags, String[][] attributes, String[] columns, String[][] values, String[] doubleColumns, Double[][] doubleValues, double[][] range, String cursorName) throws MobbedException { validateTableName(table); validateColumns(col...
b6bf581f-fedd-4232-b085-da32131e429a
4
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass().equals(Card.class)) { if (this.ID == null || ((Card) obj).ID == null) { Debug.p("Comparing cards with null ID!", Debug.W); return false; } else { return thi...
17f0ca89-ea2d-4984-9be3-2fe2fd562ae7
6
public void bombbrick(int c, int r) { int remove = 1; for (int i = c - remove; i <= c + remove; i++) { for (int j = r - remove; j <= r + remove; j++) { if (i >= 0 && i < bricks.length && j >= 0 && j < bricks[0].length) { bricks[i][j].state = false; } } } }
9b6b6014-b16e-443b-908c-994a7f87f5fb
5
public void drawOutput(Graphics2D g, OutputConnector op) { int[] xs = null, ys = null; if (op.pos == Position.right) { xs = new int[] { x + width - connectorSize / 2, x + width + connectorSize / 2, x + width - connectorSize / 2 }; ys = new int[] { y + height / 2 - connectorSize / 2, y + height ...
027fa6e3-6aa0-46f1-be62-666512bc454f
3
public void sort(Map map){ for(int i = 0; i < map.getIDList().length; i++){ for(int j = i+1; j < map.getIDList().length; j++){ if(map.getIDList()[i] > map.getIDList()[j]){ swap(i, j); } } } }
0d117a93-6d57-4413-8662-fae81ecca057
8
protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement(getXMLElementTagName()); out.writeAttribute(ID_ATTRIBUTE, getId()); if (transport != null) { if (transport.getUnit() == null) { logger.warning("transport.getUnit() == nul...
db7bc21e-42e3-495e-bbc2-26354e4851f5
1
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("|"); for (T i: filter) { sb.append(i.toString()).append("|"); } return sb.toString(); }
2c5ce639-469d-4259-aa3e-1b1c7dbb4ee9
7
public void inboundTrainInfoOutput(){ try { jxl.Workbook readWorkBook = jxl.Workbook.getWorkbook(new File("outputFile.xls")); //唯讀的Excel工作薄物件 jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("outputFile.xls"), readWorkBook); //要寫入的路徑以及檔名 jxl.write.WritableSheet writeSheet = wri...
8e400b0b-1e38-4818-84bc-190f4341a13c
9
public static final String vfsifyFilename(String filename) { filename=filename.trim(); if(filename.startsWith("::")) filename=filename.substring(2); if(filename.startsWith("//")) filename=filename.substring(2); if((filename.length()>3) &&(Character.isLetter(filename.charAt(0)) &&(filename.charAt(1)==...
40fdb173-f88c-4397-aa58-cd17141d4120
9
public int numDecodings(String s) { if (s == null || s.length() == 0) return 0; if (s.charAt(0) == '0') return 0; if (s.length() == 1) return 1; if (s.length() == 2) { if (s.charAt(1) == 0) return 1; else if (Integer.parseInt(s.substring(0, 2)) > 26) return 1; else return 2; } ...
8a7b0dbf-c1d8-4f1e-af40-c964254325e0
5
public returnTypes deleteAllChunks(byte[] fileID) { String recID = Packet.bytesToHex(fileID); boolean found = false; for(BackupChunk chunk : backedUpChunks) { String comID = Packet.bytesToHex(chunk.getFileID()); if(comID.equals(recID)) { String filepath = "storage/"; filepath += chunk.getFilename();...
6fdcded1-6afa-42d5-bffe-f5b8a462f0a4
5
public int[] getRange(){ if (mRange != null){ return mRange; } mRange = new int[2]; boolean isFirst = true; for (Map.Entry<Integer, Integer> entry : mHistorgram.entrySet()) { if (isFirst) { isFirst = false; mRange[0] = mRang...
de69df23-95b9-441b-940d-8902251806d1
9
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed int row = jTable2.getSelectedRow(); int opc = select1.getSelectedIndex(); jLabel3.setText(""); if (avaliacoes_vendas.size() > 0 && opc == 1 && row != -1) { AvVenda av = (AvVenda) avaliacoes_vendas....
e14b0c51-c279-42b4-a5ac-f69741efee55
6
public static void drawMainMenu() { // Clear the last screen GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Turn off lighting GL11.glDisable(GL11.GL_LIGHTING); // Enable alpha testing (transparent backgrounds) GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11....
c3764b0f-3812-4e4e-9327-64072340fb66
7
public void runControlServer() { try { controlServerSocket= new ServerSocket(controlDataSocketNumber); this.changeServerType(); while(true) { controlSocket = controlServerSocket.accept(); controlInput = new ObjectInputStream(controlSocket.getInputStream()); ClientMessage c = (ClientMessage...
77f229fb-81ff-4ce8-aa68-b6636b18ddb2
8
private long updateRewrite(Master master, File f, Location accessLoc, int rewriteCount) { MasterMeta fm = null; if (master.map.containsKey(f.getId())) { fm = master.map.get(f.getId()); } else { fm = new MasterMeta(f); master.map.put(f.getId(), fm); } int cCount = master.clusters.s...
42cd2fbb-207f-4863-a6dd-cdc490915b01
4
@Override public void run() { for(int i=0; i<25; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("name->" + info.getName() + " age->" + info.getAge()); } }
aba5bde4-3879-46b0-8ab1-9bbd0485bcb6
0
public Long getId() { return id; }
210a9b2d-b6e3-45ae-8c2b-63a85cfccb86
1
public RuleAdaptor(RuleMatcher<T> matcher) { if (matcher == null) { throw new IllegalArgumentException( "The given filter must not be null."); } this.matcher = matcher; }
03577cbf-61f9-457e-94bb-bbbe4ad8e4f9
9
public void displayQuestions(String urls) throws IOException { URL url = getClass().getResource(urls); BufferedReader reader = new BufferedReader(new InputStreamReader( url.openStream())); contentPane.removeAll(); for (int i = 0; i < 4; i++) { label[i] = new JLabel(reader.readLine()); //display fi...
d833ad2b-1a20-4da1-838a-a5bad7a6fffc
6
private void rdepth(Graph<VLabel, ELabel> G, Stack<Graph<VLabel, ELabel>.Vertex> fringe) { if (fringe.isEmpty()) { return; } Graph<VLabel, ELabel>.Vertex curr = fringe.pop(); try { if (marked.contains(curr)) { return; } ...
b4a32f37-9982-4536-bf4e-162546ae0b99
6
@Test public void testConnection() { Connection con = null; Statement st = null; ResultSet rs = null; try { con = DriverManager.getConnection(DatabaseSetup.HOST, DatabaseSetup.USER, DatabaseSetup.PASSWORD); st = con.createStatement(); rs = st.exec...
c89d4178-57eb-4862-a81b-ef3f73c1791e
9
public static void main(String[] args) throws NumberFormatException, UnknownHostException { if (args.length > 1) { usage(); return; } // null server address means bind to everything local InetAddress serverAddress = null; int port = NGConstants.DEFAULT_PORT; // parse the sole command line paramet...
55f93f37-9d46-4609-a95d-ccbbff13abbe
9
synchronized Object getPkgProperty(String name, Scriptable start, boolean createPkg) { Object cached = super.get(name, start); if (cached != NOT_FOUND) return cached; String className = (packageName.length() == 0) ...
dd72ee30-21f7-46a7-a233-10b52c2062c1
9
public void readFromFile(String file) { try { BufferedReader fin = new BufferedReader( new FileReader((file))); String line; while ((line = fin.readLine()) != null) { line = line.replace("\t", ""); String side[] = line.split("->"); List<String> rhp = null,lhp = null; if( side.length...
807ef9d6-6877-4c5f-a003-ccc4d468cb4c
5
public static void main(String[] args) { System.out.println("Lancement du test de la Tablier"); // verification de l'initialisation du tablier Tablier tab1 = new Tablier(); System.out.println("TABLIER : "); for(int i=0;i<tab1.getListeCase().size();i++) System.out.println(tab1.getListeCase().get(i).get...
013fc2db-42a5-444a-8c7f-0570902fcb5a
8
@BeforeClass public static void setUpBeforeClass() throws Exception { defaultPhone = new AndroidPhone(); phoneDescription = new HashMap<String, Object>(); phoneDescription.put("name", "Cink Five"); phoneDescription.put("brandName", "Wiko"); phoneDescription.put("screenSize", 5); phoneDescription.put("scr...
da5796ab-ec59-4f1c-90d7-cc2ea1b4055f
7
public static final boolean isAllowedEverywhere(final MOB mob, final SecFlag flag) { if(mob==null) return false; if(isASysOp(mob)) return true; if((mob.playerStats()==null) ||((mob.soulMate()!=null)&&(!mob.soulMate().isAttributeSet(MOB.Attrib.SYSOPMSGS)))) return false; if(mob.playerStats().getSecur...
c251346c-3ae5-4660-8016-2551516ba74b
4
public Shape next() { switch (rand.nextInt(4)) { default: case 0: return new Circle(); case 1: return new Square(); case 2: return new Triangle(); //for ex4 case 3: return new Rectangle(); } }
fb70e32e-8b93-4c32-b245-b929a0921eaf
6
* @param maskImage image mask to be applied to base image. */ private static void applyExplicitMask(BufferedImage baseImage, BufferedImage maskImage) { // check to see if we need to scale the mask to match the size of the // base image. int baseWidth = baseImage.getWidth(); int ...
c187dceb-6702-438d-8ca2-08446adf1846
1
public void dropRoster(Integer rosterID, javax.swing.TransferHandler.DropLocation dropLocation) { TripComponent tc = tripList.getSelectedValue(); if (tc == null) { tc = new TripComponent (MainWindow.tripDB.add ( targetDay.getTime() )); tripListModel.addElement (tc); } tc.getTrip().addRoster(MainWindow.ros...
5b5ab25d-b027-4a7d-8152-129026644bdc
3
public int buildDistribution(int[] bowl, int bowlId, int round) { std_dev = 0; int bowlScore=0; for (int i = 0; i < 12; i++) { fruits[i] += (double)(bowl[i])/2; bowlScore = bowlScore + (bowl[i]*preferences[i]); dist[i]+=bowl[i]/2.0; } double mean = 0; for(int i=0;i<scoresSeen.siz...
cc2ddb1a-84a2-490d-b7f2-9b2aed4a49c8
2
public static String printStream(HttpURLConnection conn){ BufferedReader responseBuffer; String output, response = null; try { responseBuffer = new BufferedReader(new InputStreamReader((conn.getInputStream()))); while ((output = responseBuffer.readLine()) != null) { response=output; System.out.p...
3b046b73-eee8-443c-9810-e964649b5bfe
9
public int numDistinct(String S, String T) { int a = S.length(); int b = T.length(); if (a <b) { return 0; } int[][] tem = new int [a][b]; for (int i = 0;i<a;i++) for (int j=0;j<b;j++) tem[i][j] = 0; if (S.charAt(0) == T.cha...