method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
94a5448e-5e55-4df2-91f6-1b4a7ecfa67f
3
private void setConfig(String config) { if (config == null) { throw new NullPointerException("Configuration name may not be null"); } for (Configuration configListItem : configurations) { if (config.equals(configListItem.getName())) { connectionsList.setSelectedItem(configListItem); return; } }...
890d788a-b3d2-43a3-887f-fee290c0fc10
5
@Override public void run() { //~!!!!! int fps = 0; int updates = 0; long fpsTimer = System.currentTimeMillis(); double nsPerUpdate = 1000000000.0/60; //last update time in nanoseconds double then = System.nanoTime(); double unprocessed = 0; while(running){ boolean shouldRender = false; ...
acf5c6c6-76ab-4813-957c-b8c31a02ed43
0
@Override public String toString() { return "Second State"; }
57d9db48-8e41-4328-81a6-3c8cf92be109
6
public static int longestConsecutive(int[] num) { HashMap<Integer, Boolean> temp = new HashMap<Integer, Boolean>(); for (int i = 0 ; i < num.length ; i++) { temp.put(num[i], false); } int len = 0; for (int i = 0 ; i < num.length ; i++) { int curr = 0; if (temp.get(num[i])) continue; int numC =...
03304b1a-68da-43c1-b670-2dd78e5f61f2
2
private static int elementsNotNull(int[] array){ int elementsNotNull = 0; for (int x = 0; x <= array.length-1; x++){ //searches through the array if (elementString(array[x]) != null){ //check the elements that are not null / int is not elementsNotNull++; // -1 } } return elementsNotNull; }
1b3764d0-8935-4090-aded-6aed68594f89
0
public DataManager getDataManager() { return dataManager; }
9504b00b-11d3-4f52-94e9-1024c5fc53fa
2
public PinCount(Integer count) throws PinCountRangeException { if(count < IConstants.PIN_COUNT_MIN || count > IConstants.PIN_COUNT_MAX) { throw new PinCountRangeException(); } value = count; }
d276f384-361c-4355-9c21-6375ac7c8913
3
private void queue(Response res) { String tag = res.getTag(); if (tag != null) { ResultListener rl = listeners.get(tag); if (rl != null) { if (res instanceof Result) { rl.receive((Result) res); } else...
9785184c-a266-4a18-bd9e-afad4f701262
5
public static boolean isSpaceship(Contact contact){ Object obj = contact.getFixtureA().getBody().getUserData(); Object obj1 = contact.getFixtureB().getBody().getUserData(); if(!(obj instanceof BodyData)){ System.err.println("Collision: Fixture A, "+contact.getFixtureA()+", does not have BodyData! Abort!"); ...
81e40305-3da0-4c14-ba7a-14a9e018b144
9
private Graphics2D startGroup(ReportGroup group, Graphics2D g, Point p) { // // Notify the report listeners that we are starting a new group // ReportEvent event = new ReportEvent(ReportEvent.GROUP_STARTED, state); event.setGroup(group); int expCount; ReportExpre...
0d6bcd36-3cbb-4132-a24d-8d33dbf95080
9
private Element parseChild() throws ParserException, XMLStreamException { List<Element> children = new ArrayList<>(); while (is(START_ELEMENT)) { String name = getNameOfStartElement(); switch (name) { case "block": children.add(parseBlock()); break; case "procedure": children.add(parseP...
457c9190-2ae0-4a8f-8ece-4f0ab364b9d0
2
@Override public int compareTo(bean1 o) { if(sal > o.sal) return -1; else if(sal < o.sal) return 1; else return 0; } } // advanced comparison using iterator class BeanComparator implements Comparator<bean1> { public int compare(bean1 o1, bean1 o2) { if(o1.sal > o2.sal) return -1; else if (o1.sal...
7c44d5e2-5f51-425b-a7a5-a6ec46216366
4
public static void main(String[] args) { List<String> strList = new ArrayList<String>(); strList.add("one"); strList.add("two"); strList.add("three"); for (String str : strList) System.out.println(str); strList.remove("two"); // two 제거 System.out.println("## String 리스트에서 two object 를 제거 한 뒤 ###"); ...
b6403e46-2265-4981-bb7d-38667c7c458f
4
public void setTree(Coordinate coord) { ElementType elementType = getCell(coord).getElementType(); if (!(elementType == ElementType.WATER || elementType == ElementType.WALL || elementType == ElementType.INTRUDE || elementType == ElementType.GUARDIAN)) { setCell(coord, Trunk.getInstance()); expandsLeaf(coo...
7fcbda98-0958-4598-bd46-d90281cc481b
1
public int getSize() { int i = 0; for (CacheableNode cacheableNode = head.nextNode; cacheableNode != head; cacheableNode = cacheableNode.nextNode) { i++; } return i; }
303a45ad-7aa7-4249-8c25-d9b141b06e3a
5
private byte[] getByteArrayFromStream( BDecoderInputStream dbis ) throws IOException { int length = (int) getNumberFromStream(dbis, ':'); if (length < 0) { return null; } // note that torrent hashes can be big (consider a 55GB file with 2MB pieces // this generates a pieces hash of 1/2 meg ...
a3631d73-cea5-44fc-910f-8997d501ceec
1
private void throwErrorMessage(ValidBean validBean) { try { throw validBean.getExceptionOnInvalid(); } catch (Exception e) { new ErrorMessageBox(mySettingsSWT.getShell(), e.getMessage()); } }
ee6708c8-a9fd-4edb-92db-2dd74f923ac6
5
@Override public List<StrasseDTO> findStreetsByStartPoint(Long startPunktId, boolean b) { List<StrasseDTO> ret = new ArrayList<StrasseDTO>(); if(startPunktId ==1){ StrasseDTO s= new StrasseDTO(); s.setStartPunktId(Long.valueOf(1)); s.setEndPunktId(Long.valueOf(2)); s.setDistanz(Long.valueOf...
da9e337b-31dd-4519-ad72-7160cd15ab6a
5
public static ArrayList<ArrayList<String>> getData(String s){ ArrayList<ArrayList<String>> ret = new ArrayList<ArrayList<String>>(2); try { File file = new File("./test.xml"); DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = dBuilder.parse(file); NodeL...
89e82626-c666-4e48-944e-7c44ddefe0ae
5
@Test public void testExecutionOrder() throws InvalidProcessStateException, ProcessExecutionException { // define names String nameParent = "P"; String nameChild1 = "C1"; String nameChild2 = "C2"; String nameChild3 = "C3"; String nameChild4 = "C4"; String nameChild5 = "C5"; // define order of execu...
bc8a8ff8-5520-4c89-b3ab-14b3044f8d50
5
public boolean isCauseFulfilled(Integer newNode, Map<Integer, Integer> nodeStates) { if (events.size() == 0) { return true; } Event event = events.get(newNode); if (event == null) { return true; } for (Entry<Integer, Integer> cause : event.getCauses().entrySet()) { Integer visited = nodeStates...
cdd19eb1-207f-497a-b30a-04ba41907fbc
5
void cosqf1(int n, double x[], double wtable[]) { int modn, i, k; int kc, np2, ns2; double xim1; ns2=(n+1)/ 2; np2=n+2; for(k=1; k<ns2; k++) { kc=n-k; wtable[k+n]=x[k]+x[kc]; wtable[kc+n]=x[k]-x[kc]; } modn...
19df6b7f-ce11-472d-a7b9-d38d51b3c417
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoServico other = (TipoServico) obj; if (this.IdTipoServico != other.IdTipoServico && (this.IdTipoServi...
85346943-4173-456d-8053-487160ec0051
8
private Hand getHand(List<Card> cards, List<Card> hand) { Collections.sort(cards); Hand h; if (isStraightFlush(cards, hand)) { h = Hand.STRAIGHTFLUSH; } else if (isFourOfAKind(cards, hand)) { h = Hand.FOUROFAKIND; } else if (isFullHouse(cards, hand)) { ...
2c3ae119-4ddb-42af-b206-0832239240e0
8
public Object getValueAt(int row, int col) { PlotLine plotLine = LineGraphViewPanel.this.plotLines.get(row); switch (col) { case 0: return plotLine.curve; case 1: return plotLine.colour; case 2: ...
c7081a0a-cb4e-4cf0-9d61-04e065c98d6f
4
public void jumpToLocation(String jumpTo){ Iterator<String> connections = game.iteratorByLocation(game.getCharacter().getLocation()); boolean found = false; while (connections.hasNext()){ String temp = connections.next(); if(jumpTo.equals(temp)){ found = true; if(game.getCharacte...
94044eb2-96a8-4b37-b3de-66e662a6063f
1
public void cleanUp() { for(int i=0;i<markers;i++) { marker[i].cleanUp(); } }
3be7bd88-e965-4796-a9ef-89f24302f7b7
5
private Node solveIteration(Node startNode, PriorityQueue<Node> minPQ) { for (Board board : startNode.board.neighbors()) { Node node = new Node(board, startNode.moves + 1, startNode); if (node.previousNode != null) { Node node1 = new Node(node); boolean addIn = true; while (node1...
35c5b464-d392-4bfc-a96d-834b2fe7b665
5
public static int sizeOfUnsignedNullable(Number n) { if (n == null) return 1; int value = n.intValue(); return (value < (1 << 6) ? 1 : (value < (1 << 13) ? 2 : (value < (1 << 20) ? 3 : (value < (1 << 27) ? 4 : 5)))); }
e6c01a43-5bd7-4bbf-be32-43ff039de4ee
9
public static String[] getFiles(String category) throws Exception { List<String> filelist = new ArrayList<String>(); database = new DataBase(); boolean iscategory = false, allcategories = false; if (category.equals("Categories")) allcategories = true; for (int i = 0; i < categories.length; i++) { if (ca...
f388475d-451c-44bf-8006-f138a9d4efd9
8
static final String method3551(int i, int i_5_, int i_6_, boolean bool) { anInt7374++; if (i_5_ < 2 || i_5_ > 36) throw new IllegalArgumentException("Invalid radix:" + i_5_); if (!bool || (i_6_ ^ 0xffffffff) > -1) return Integer.toString(i_6_, i_5_); int i_7_ = 2; int i_8_ = i_6_ / i_5_; while (i_8_ != ...
90245ae8-8a25-4c04-82fb-5ace27e2cebf
3
public <T extends Enum<T>> T getEnum(Class<T> type) { if (getBoolean()) { int ordinal = getUshort(); if (valid) { T[] constants = type.getEnumConstants(); if (ordinal < constants.length) { return constants[ordinal]; } valid = false; } } return null; }
4bb1ba5b-9d39-4b9e-aa6d-9edf5b97155a
7
@Test public void smallBoardSize3WithBishopAndRook() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 1); figureQuantityMap.put(ROOK.toString(), 1); int dimension = 3; Set<String> boards = prepareBoardsWithBishopAndRook(fig...
50848aae-2c5e-4fc3-b6d8-d0d17649174f
1
public long getAverage() { long sum = 0; for (int i = 0; i < duur.size(); i++) { sum += duur.get(i).longValue(); } return sum / duur.size(); }
d7d174a6-ac1d-49c1-8ebf-ba61cf57559d
7
public static <E extends Comparable<? super E>> Node<E> sort(Node<E> head) { Node<E> currentNode = head; Node<E> sortedHead = null; while (currentNode != null) { Node<E> toBeRemoved = currentNode; currentNode = currentNode.next; if (sortedHead == null) { ...
9e91e5a8-d6a0-49ef-848b-733fe6638e8f
7
static Class compileStub(String superName, NewInstanceExpr ret, String[] interfaceNames, Object frm){ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); ClassVisitor cv = cw; cv.visit(V1_5, ACC_PUBLIC + ACC_SUPER, COMPILE_STUB_PREFIX + "/" + ret.internalName, null,superName,interfaceNames); ...
02b1332c-8400-4b0d-9794-00fd5cf063db
4
@RequestMapping(value = "form-upload-file", method = RequestMethod.POST) public String fileUploaded(@RequestParam("email") String email, Model m, UploadedFile uploadedFile, BindingResult result) { if (result.hasErrors()) { String errmsg = ""; for (ObjectError err : result.getAllErrors()) { errmsg = errm...
fb6a5b17-0439-446c-a859-301a686351ff
8
private int parseB() { Token token = skipWhitespace(); switch (token.type) { case RIGHT_PAREN: return 0; case DELIM: switch (token.value) { case "+": return parseSignlessB(1); case "-": return parseSignlessB(...
91cd6c1f-2953-4ced-8c10-40050ad81ac5
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...
11929a1b-55de-4e64-9d35-5fd3933f7347
5
@SuppressWarnings({ "unchecked", "unused" }) @ApiMethod(name = "listDeviceInfo") public CollectionResponse<DeviceInfo> listDeviceInfo( @Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) { EntityManager mgr = null; Cursor cursor = null; Lis...
a9f9d95b-5089-4b0b-8bfa-e7728f3577de
6
private void openParticipants() { JFileChooser fc = new JFileChooser(); // XML file filter FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter( "xml files (*.xml)", "xml"); fc.addChoosableFileFilter(xmlfilter); // Setting dialogs parent and showing it ...
acbdddaa-9318-4a79-ae94-d220e9a0e5b5
6
public static double two(int sameField, double field1SVal, double field2SVal, int diffField, double field1DVal){ double a = field1SVal; double b = field1DVal; double c = field2SVal; System.out.println("a:" + a); System.out.println("b:" + b); System.out.println("c:" + c); if(sameField == 2 || sameField ...
4dde886c-5e93-476e-965f-2554cc224bfb
4
public Node getNextNode(){ if(transitions.isEmpty()) return null; double maxP = 0d; for(Transition t:transitions) maxP += t.p; double ran = random.nextDouble() * maxP; for(Transition t:transitions){ if(ran > t.p){ ran -= t.p; } else { return t.n; } } return transitions.getLast...
53bb8e91-9034-48ab-98ea-350848a80560
8
private int choseY(int counter) { switch (counter) { case 0: return -1; case 1: return -1; case 2: return -1; case 3: return 0; case 4: return 0; case 5: return 1; case 6: return 1; case 7: return 1; } return 0; }
122a4ac6-ebb8-4236-ad3a-1406f21af60d
0
static public int getNumTypes () { return Id3PictureType.types.length; }
0a979d98-3357-4bfd-a822-f8cf17a66227
5
public static boolean haveWindow(String name) { Widget root = UI.instance.root; for (Widget wdg = root.child; wdg != null; wdg = wdg.next) { if (wdg instanceof Window) if (((Window) wdg).cap != null && ((Window) wdg).cap.text != null) ...
3ea4333d-dfbc-41ff-b876-13785205146a
4
@Test public void demoIsResetted() { rp.resetDemo(); assertTrue(rp.getEntities().getList(Rat.class).isEmpty() && rp.getEntities().getList(Ball.class).size() == 10 && rp.getEntities().getList(Cheese.class).size() == Const.cheeseamount && rp.getEntit...
c85a9594-d265-4ade-9fd6-84cbf1b7d09b
2
public Rama_Hoja getObjectoNombre(String pNombre){//el criterio es el nombre de cada objeto (String) unico Rama_Hoja resp = null; //si no encuentra retorna null. for(Nodo<Rama_Hoja> iterador = _salidasDelArbol.getHead(); iterador != null; iterador = iterador.getSiguiente()){ ...
ad5ddbb1-2d76-4f8c-9599-6e92e80bd6a4
4
public static void method173(Stream stream, OnDemandFetcher onDemandFetcher) { label0: { int i = -1; do { int j = stream.getSmart(); if (j == 0) { break label0; } i += j; ObjectDefinition objectDefinition = ObjectDefinition.forId(i); objectDefinition.method574(onDemandFetcher); ...
6c484407-24a5-43d6-9c16-79a218d13562
7
private void hashGraphCountCollisions(NamedGraph g){ //Sort triples in graph by their hash values Collections.sort(g.getTriples(), new Comparator<Triple>() { public int compare(Triple t1, Triple t2) { if (t1.getHash()==null){ throw new RuntimeException("hash of triple "+t1+" does not exist"); } ...
bacbcc10-30ca-4e58-9cd5-1fe08b29c380
8
public Instances generateExamples() throws Exception { Instances format = getDatasetFormat(); Instance example = null; if (format == null) throw new Exception("Dataset format not defined."); // generate examples for one cluster after another for (int cNum = 0; cNum < getClusters().length; c...
1f622be4-e3ff-4a80-b8d4-4a180f1c82b3
3
public String hexToBin(String hex){ String bin = ""; String binFragment; int iHex; hex = hex.trim(); hex = hex.replaceFirst("0x", ""); for(int i = 0; i < hex.length(); i++){ iHex = Integer.parseInt(""+hex.charAt(i),16); binFragment = Integer.toBin...
7b2bf23f-ab7c-4352-bd5b-25d15f69fee4
5
public void scrapeSearchResults(String siteText) { Document doc = Jsoup.parse(siteText); if (doc.select("td:containsOwn(No results found)").size() == 1) { return; } Elements rows = doc.select("table").get(1).select("tr"); rows.remove(0); ArrayList<CharacterS...
add5d23b-074d-4440-9d93-95d6ad4a83b0
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 2) { final String remoteVersion = title.split(delimiter)[1].split("...
204730b2-2d53-418c-810b-4e709b4f3a83
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...
c65a7cff-4673-4b79-9105-2278051ad55b
9
public static void main(String[] args) { byte tujuan = 2; byte kelas = 1; int harga; int tiket; byte i = 15; String kota; String kelasName; switch(tujuan){ case 1: kota = "Jakarta"; if (kelas == 1) { harga = 70_000; kelasName = "Eksekutif"; } else if (kelas == 2) { harga...
eabac71f-9070-4d62-8e1f-8c31ef6d6c56
1
private static boolean isSimilar(String a, String b) { a = a.toUpperCase(); b = b.toUpperCase(); if (a.equals(b)) return true; return false; }
fc38315f-f013-4546-a2e0-fb20d4a6387d
4
public void sendMessage() { if (textField != null) { String msg = textField.getRealText(); resetTextField(); if (osl != null && msg != null && msg.length() > 0) { osl.onSend(msg); } } }
3bf3cad6-4414-43c3-995a-1ead5db125a2
2
@Override public void mousePressed(MouseEvent e) { if (animating) { return; } Cell cell = getCellAt(e.getX(), e.getY()); if (cell != null) { cell.setAlive(true); } }
6ef45c3c-47f5-4736-92e0-a9204f6539bf
1
private void renderPlayerInventory(Graphics2D graphics) { for (int i = 0; i < objectTron.getActivePlayer().getInventory().size(); i++) { int xCoordinate = startPointXCoordinate + (i * 40); int yCoordinate = startPointYCoordinate + 350; drawGameElement(graphics, objectTron.getActivePlayer() .getInventory...
61b6f6fd-5d93-469b-8991-5eb8687199e5
9
public Serveur(){ try { // HashMap contenant les taches taches = new HashMap(); nbTaches = 0; logins = new ArrayList(); // Logins acceptés pour la connections logins.add("jouberta"); logins.add("test"); // Socket de connection socketserver = new ServerSocket(8080); socketduserveur = s...
dc8af1bd-d9d4-4338-8072-6282c2bc6b2c
8
public SettlementChooserView() { display = new Display(); shell = new Shell(display); Monitor primary = display.getPrimaryMonitor(); Rectangle r = primary.getBounds(); shell.setBounds((int) (r.width * 0.1), (int) (r.height * 0.1), (int) (r.width * 0.8), (int) (r.height * 0.8)); Point shellSize = shell.getSi...
3b08d70c-44bd-465e-a1ea-90118888fea6
7
public static String getOAIdcx(String oai_url, Logger log) throws MalformedURLException { String buffer=""; URL url = new URL(oai_url); try { BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String readin; Boolean go...
1a41218c-c253-4a69-8d8a-3842b4f99923
2
public String pickUp() { if(currentRoom instanceof ItemRoom) { ItemRoom ir = (ItemRoom) currentRoom ; if(!ir.itemTaken()) return inventory.pickUp(currentRoom) + "\n" + currentRoom.getExitString(); } return "There is nothing in this room.\n" + currentRoom.getExitString(); }
23d8d810-1840-4504-99fc-ad6d75d6a67f
0
public void addplayer(Player p) { players.add(p); }
2f5db22f-5754-4c5f-8399-f8c44de51408
2
public static Corpus[] splitCorpus(Corpus corpus, int splitCount) { Corpus[] splittedCorpora = new Corpus[splitCount]; // initialize all corpora for (int i = 0; i < splittedCorpora.length; i++) { splittedCorpora[i] = new Corpus(corpus.getThreshold()); } int counter = 0; for (Sentence sentence : corpus....
bca50e49-3c76-443f-b730-c7fe3fca4d00
4
@Override public void run() { try { socket.setSoTimeout(1000); } catch (SocketException e1) { e1.printStackTrace(); } while(!finished) { byte[] buf = new byte[65536]; DatagramPacket packet = new DatagramPacket(buf, buf.length); try { socket.receive(packet); byte[] data = Arrays.copyOf...
fdd7f112-c372-4b09-82fa-79dd9cd25c49
3
final public Boolean saveLink(String link) throws ForceErrorException { // TODO przerobić na obiekt Link PreparedStatement prepared; long hostId = this.getHostID(link); try { prepared = this.con .prepareStatement("INSERT INTO urls(HostID,`Hash`,Url) VALUES(?,?,?)"); prepared.setLong(1, hostId); ...
4c4fc9de-61f7-439b-9ed0-b6ce91e7a39c
5
public void calculate(double x) // double = mathematischer wert mit kommastellen { // x = Ergebnis ; betätigen der Knöpfe (+, -, *, /, = ) -> Ergebnis wird angezeigt if (lastCommand.equals("+")) result += x; else if (lastCommand.equals("-")) result -= x; else if (lastCommand.equals("*")) result *=...
02412a70-6aec-4b29-b014-ac09e554099b
7
@Override public int compareTo(Key key) { if (key == null) { throw new NullPointerException(); } String otherKey = key.toString(); if (key_.equals("") && otherKey.equals("")) { return 0; } else if (key_.equals("") && !otherKey.equals("")) { ...
8f85889f-19dc-40c0-a105-5493461ef303
2
@Override public int compare(Column column, Row one, Row two) { String oneText = one.getDataAsText(column); String twoText = two.getDataAsText(column); return NumericComparator.caselessCompareStrings(oneText != null ? oneText : "", twoText != null ? twoText : ""); //$NON-NLS-1$ //$NON-NLS-2$ }
157d527f-f4a6-44ae-a5bd-522ec0d5b5a4
4
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof FacpercampId) ) return false; FacpercampId castOther = ( FacpercampId ) other; return (this.getCampId()==castOther.getCampId()) && (this.getFacId()==c...
b47cb0b2-9b37-4b7b-96e7-3698761a60e8
0
@Override protected int getNumberCylinders() { return 4; }
72e67f2a-10a9-4ef3-a2ea-3f9e0256edf7
9
static Printer.Fn<Map<?, ?>> writeMapFn() { return new Printer.Fn<Map<?,?>>() { @Override public void eval(Map<?,?> self, Printer writer) { writer.append('{'); for (Map.Entry<?,?> p: self.entrySet()) { writer.printValue(p.getKey()) ...
1660013f-58a8-4d67-8fc5-5e15ea5971af
3
private static Integer toInteger(String paramName, Object o, boolean required) throws BadConfig { if (o == null) { if (required) throw new BadConfig("Parameter \"" + paramName + "\" is required"); return null; } if (!(o instanceof Number)) throw new BadConfig("In parameter \"" + paramName + "\", valu...
8d667430-451a-4f5c-afa6-0f8913f6b9fd
8
@GET @Path("/getMood") @Produces(MediaType.APPLICATION_JSON) public MoodResponse getMood(@QueryParam("startDate") String startDate,@QueryParam("endDate") String endDate,@QueryParam("userId") String userid ) { MoodResponse resp=new MoodResponse(); if(startDate==null) return resp; if(endDate==null){ endDate=...
b13fa915-4e3e-47c2-8e2d-c7742ae5501e
4
public void init() throws IOException { graph = new DirectedGraph<Integer>(); reversedGraph = new DirectedGraph<Integer>(); ZipFile zipFile = new ZipFile(getClass().getResource("/SCC.zip").getPath()); Scanner scanner = new Scanner(zipFile.getInputStream(zipFile.getEntry("SCC.txt"))); ...
a18ca9d1-c73d-410a-95fd-b91448f681d8
3
public static void carregar() { try { ObjectInputStream is = new ObjectInputStream(new FileInputStream("quadro.ser")); instance = (Flanelografo) is.readObject(); is.close(); } catch (FileNotFoundException e) { criarDoNada(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoun...
4042d7ba-dcd7-43f2-a0c8-c98c76c609cd
0
public String getDescription() { return description; }
cd06dda2-3c66-4063-b9ab-bba05deb2373
3
private void documentChanged() { // View of the component has not been updated at the time // the DocumentEvent is fired SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { ...
2cc3719b-e2c3-4eeb-ba11-e3ac32ff6ea8
6
public static void main(String[] args) throws Exception { // création de la socket int port = 5989; ServerSocket serverSocket = new ServerSocket(port); System.err.println("Serveur lancé sur le port : " + port); // repeatedly wait for connections, and process while (true) { ...
d430ebad-f89a-4ea4-bb8a-42a8502b44ba
2
public HashSet getSetIncludingState(State state, Automaton automaton) { HashSet set = new HashSet(); ArrayList list = new ArrayList(); list.add(state); while (!list.isEmpty()) { ArrayList toAdd = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { State s = (State) it.next(); ...
9a7874b9-4621-4318-8378-d8f856dd8c12
1
public Boolean getPrintOnFormSheet() { if (printOnFormSheet == null) printOnFormSheet = new Boolean (true); return printOnFormSheet; }
95e47189-63e3-44f9-8d62-9817e72118d9
0
@Test public void testArgSet() { ArgSet a1 = new ArgSet("some set of args"); assertTrue(a1.peek().equals("some")); assertTrue(a1.peek().equals("some")); assertTrue(a1.pop().equals("some")); assertFalse(a1.peek().equals("some")); assertTrue(a1.pop().equals("set")); assertFalse(a1.peek().isEmpty()); asse...
f908e2ad-1399-48d0-a92c-43a9f2d65900
3
protected void renderRange(IRenderContext target, double viewportX, double viewportY) { Set<Entity> renderableEntities = structure.queryRange( new TreeSet<Entity>(new Comparator<Entity>() { public int compare(Entity e0, Entity e1) { if (e0.getAABB().getMinZ() > e1.getAABB().getMinZ()) { retur...
2241e0b1-8088-4a8d-90a0-e5ba13771f80
6
public void close (final SocketChannel sc, final Callback.TCPClient client) { if ( !sc.isConnected() || !sc.isOpen() || sc.socket().isClosed()) { return; } if (this.isLoopThread()) { R r = r(sc); assert r != null; // try to (more or less) follow close/s...
8c37e4fd-0286-4c8c-9a2a-5e42c9cc8bb3
1
public static void main(String[] args) { Scanner in = new Scanner(System.in); int testCases = in.nextInt(); while (testCases > 0) { decentNumber(in.nextInt()); testCases--; } }
12191038-5116-47ea-91ad-499e07704324
4
private static void writeByte(int x) { assert x >= 0 && x < 256; // optimized if byte-aligned if (N == 0) { try { out.write(x); } catch (IOException e) { e.printStackTrace(); } return; } // otherwise write one bit at a time for (int i...
b65350af-d78d-4df3-81d3-dcb0d7c3e6b2
3
private static void consume_j(GraphicsState graphicState, Stack stack, Shapes shapes) { // collectTokenFrequency(PdfOps.j_TOKEN); // grab the value graphicState.setLineJoin((int) (((Number) stack.pop()).floatValue())); // Miter Join - the outer edges of the strokes for the two // ...
094040e3-9d59-412b-81dc-d33384b45705
1
private void write_tunnel_config() throws Exception { System.out.println("write_tunnel_config"); String config = read_file(template_file); for (Iterator keys = props.keySet().iterator(); keys.hasNext(); ) { final String key = (String) keys.next(); final String val = props.getProperty(key); config = replace...
42aa7b82-3c57-4a67-a934-3822f86e6437
8
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } if (args.length == 0) { Language.CMD_CHUNKY_CHUNK_SET_NAME_HELP.bad(sender); ...
596f2c6f-9011-40b0-81c3-faefd2b260ae
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(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S-...
e07b87f9-86f9-45aa-ba28-9c74b8327e73
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...
825e3d34-8612-4cfb-8b59-aa098add12ff
5
@Override public String toString() { StringBuilder sb = new StringBuilder(name); if(username != null) sb.append(" aka. ").append(username); if(roles != null && roles.size() > 0) { sb.append(" ("); boolean first = true; for(String role : roles) { if(!first) sb.append(", "); ...
cc64ac57-c240-45e4-a4f4-ce97ef23eec2
6
public static OS getPlatform() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("win")) return OS.windows; if (osName.contains("mac")) return OS.macos; if (osName.contains("solaris")) return OS.solaris; if (osName.contains("sunos")) return OS.solaris; if (osName.contains("l...
3b2b7071-04dc-457a-b852-3984ae07f14b
4
private void Init_cand(int[] num_key,HashMap<Pair<Integer>,ArrayList<Integer>> c) { int total=num_key.length; for(int i=1;i<total;i++) { for(int j=0;j<total;j++) { Pair<Integer> p=new Pair<Integer>(i,j); ArrayList<Integer> cur_c=new ArrayList<Integer>(); for(int k=1;k<=total;k++) { if(k==...
1a546b9c-5500-49e0-b938-b42a618951d8
7
static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
69105acb-ddef-4f03-ac4a-05339fb66b6e
0
public static void main(String[] args) { System.out.println(Float.MIN_VALUE); // 1.4E-45 System.out.println(Float.MAX_VALUE); // 3.4028235E38 System.out.println(Double.MIN_VALUE); // 4.9E-324 System.out.println(Double.MAX_VALUE); // 1.7976931348623157E308 }
cc94eeb4-b6b5-4d93-83c2-64932887f6f5
8
public static void main (String[] args) { int num; int tassa = 0; Scanner kb = new Scanner (System.in); do { System.out.println("Inserisci Un Numero Intero Tra 0 e 500: "); num = kb.nextInt(); } while ( num < 0 && num > 500 ); if ( num <= 100 ) { System.out.println ("num <= 100)");...
8a006afe-9f08-4a5b-9c0b-47fb1f7b1ab0
1
private void handlePosVelUpdate(PosVelUpdatePacket packet) { ShellObject obj = objects.get(packet.id); if (obj == null) { System.err.println("[Client] Received PosVelUpdate for object that doesn't exist"); return; } obj.updateData(packet); }