method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
60ac92b3-e75d-470d-9a7c-342d372d21a3
9
protected static IntervalList[] splitIntervals(IntervalList intervals) { IntervalList[] subIntervals = new IntervalList[2]; subIntervals[0] = new IntervalList(); subIntervals[1] = new IntervalList(); //If only one interval, split it in half if (intervals.getIntervalCount() == 1) { List<Interval> intList...
7d3306da-ab8b-4dbc-a30b-76e4fc36dfaf
1
private static void printMenu() { System.out.println("What will you like to have?"); for (Integer item : menu.keySet()) { System.out.println(" " + item + ". " + menu.get(item)); } }
d75c1eac-7f62-411b-91cf-58636038eb58
7
public static void main(String args[]) { Server myServer = new Server("mySuperGameServer"); User a = new User(myServer, "a"); User b = new User(myServer, "b"); myServer.addUser(a); System.out.println(myServer.currentUser().hashCode()); myServer.addUser(b); System.out.println(myServer.currentUser().hashC...
e6184213-4ba6-4343-ac4d-77b4746bd12e
8
@Override public boolean equals(Object o) { if (!(o instanceof Thread)) { return false; } Thread t = (Thread) o; if (!this.getHeadLine().equals(t.getHeadLine())) { return false; } if (!this.getReplies().equals(t.getReplies())) { ...
82c079e4-56d1-490c-ac60-4ce5be586c95
7
@Override public void run() { Game game = pacManBB.game; int[] pills = game.getPillIndices(); int[] powerPills = game.getPowerPillIndices(); ArrayList<Integer> powerTargets = new ArrayList<Integer>(); ArrayList<Integer> targets = new ArrayList<Integer>(); for( int i=0; i < pills.length; i++ ) ...
bdbb41fd-d0a3-4865-a238-1c6fb7a2e209
9
public static void main(final String[] args) throws Exception { int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flag...
a9e60c1b-a338-4eae-86ed-49d3928a66d1
8
private boolean r_Step_1c() { int v_1; // (, line 51 // [, line 52 ket = cursor; // or, line 52 lab0: do { v_1 = limit - cursor; lab1: do { ...
a43cc2de-b089-46f0-8363-1d1f5e4903f4
8
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; //g2d.setColor(Color.blue); g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStrok...
606828f2-3bc5-4e85-9c9f-79d1f2736bcc
7
public static void main(String[] argv) throws Exception { Class<Mapper> mhj =(Class<Mapper>) JarLoader.getClassFromJar("C:\\Temp\\1/0.jar", "temperaturetest.Mapper1"); Logger.log("SDssd"); /*Socket sock = new Socket("127.0.0.1", 23456); byte[] mybytearray = new byte[1024]; InputStream is = sock.ge...
505cb947-f595-4fd6-93a3-6f5c98267be2
1
private void setUpTechnicalsGraphData() { TreeMap<Float, float[]> technicals = Database.TECHNICAL_PRICE_DATA .get(Database.dbSet.get(id)); TreeMap<Float, Point2D.Float> marketToStockPairing = pairPriceWithMarketByDate( technicals, 6); TreeMap<Float, Float> stockPrices = new TreeMap<Float, Float>(); Tre...
47c99046-cf4f-4e2c-b7ff-301cafece8d6
2
public static String encodeInventory(Inventory inventory) { YamlConfiguration configuration = new YamlConfiguration(); configuration.set("Title", StringUtil.limitCharacters(inventory.getTitle(), 32)); configuration.set("Size", inventory.getSize()); for (int a = 0; a < inventory.getSize()...
a06d0cde-f743-4028-8638-226c238c2e96
4
public String countAndSay(int n) { StringBuilder res = new StringBuilder("1"); for (int i = 2; i <= n; ++i) { StringBuilder tmp = new StringBuilder(); int j = 0; while (j < res.length()) { int cnt = 1; while (j + cnt < res.length() && res.charAt(j) == res.charAt(j + cnt)) { ++cn...
4ddbdbd1-641a-4742-9064-6a7cd8ee3c24
3
private List<String> completeResultWithCharactersTill(final String aCharacter) { List<String> result = new LinkedList<String>(); for (final String anAlphabet : alphabet) { if (!anAlphabet.equals(aCharacter)) { if (result.size() >= 1) { result = addCharacte...
a3567639-99a3-4e80-8c61-469f26e78818
5
private boolean isValidMineLoc(Block block){ final HashSet<Material> naturalMats = new HashSet<Material>(4); naturalMats.add(Material.COBBLESTONE); naturalMats.add(Material.DIRT); naturalMats.add(Material.GRASS); naturalMats.add(Material.GRAVEL); naturalMats.a...
bde75027-11e6-48b8-8792-051ec4d4fc63
9
public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (true) { String a = in.readLine(); if (a == null || a.equals(""))break; String arr[] = a.trim().split(" +"); if (Integer.parseInt(arr[0]) > 1) { TreeSet<Integer> ...
2406fe3d-f302-42e9-8130-a5ee34f79693
9
void updateMouse(MouseEvent e,boolean pressed, boolean released, boolean inside) { mousepos = e.getPoint(); mousepos.x = (int)(mousepos.x/el.x_scale_fac); mousepos.y = (int)(mousepos.y/el.y_scale_fac); mouseinside=inside; int button=0; if ((e.getModifiers()&InputEvent.BUTTON1_MASK)!=0) button=1; if ((e.g...
d9f90eb2-fbfa-4d5a-a588-5cb91b78032d
9
@Override public void endElement(String uri, String localName, String qName) { // we need to find out if the element ending now corresponded // to matches in some stacks // first, get the pre number of the element that ends now: if (openNodesPreNumbers.isEmpty()) { // We ...
df1d852a-cb4c-42f3-9ebd-9b89d3d1f5bd
4
@Test(expected = DuplicateInstanceException.class) public void addDuplicateBookingTest() throws DuplicateInstanceException { Student s = null; Booking b = null; try { s = familyService.findStudent(3); } catch (InstanceNotFoundException e) { assertTrue("Student not found", false); } SimpleDateFormat ...
fd80c297-bd2b-4295-a55c-9ff2ad4b0208
3
public boolean equals(Object object) { try { MealyTransition t = (MealyTransition) object; return super.equals(t) && getLabel().equals(t.getLabel()) && getOutput().equals(t.getOutput()); } catch(ClassCastException e) { return false; ...
949af545-dfe2-4450-ab2c-c9429a9b2ddd
1
public String getImageName() { String name = ""; if (itemType != null) { name = itemType.getImageName(); } return name; }
99b3a4d9-9e88-46a9-9867-0e9938151b9d
4
private TreeNode successor(TreeNode predecessorNode) { TreeNode successorNode = null; if (predecessorNode.left != null) { successorNode = predecessorNode.left; while (successorNode.right != null) { successorNode = successorNode.right; } } else...
e8479ce0-a7ef-45d7-9e0f-23081daea719
3
@Override public void onConnect() { String channel = config.get("Chan0"); int i = 0; while(channel != null) { this.joinChannel(channel); channel = config.get("Chan" + ++i); } components = new LinkedList<ComponentInterface>(); i = 0;...
a782c56b-51a4-46ae-bd23-89f32cb61b22
9
@Override public String toString() { StringBuilder sb = new StringBuilder(); // unconfirmed wrapper? if (!confirmed) sb.append("[Unconfirmed: "); // add time sb.append("Time T+").append(time).append(". "); // internal/external? if (threatPosition == THREAT_POSITION_INTERNAL) { if (threatLevel == THREA...
4a185ad1-aced-4540-9b6a-29e8583df6ac
0
private void fillGroupForm(GroupObject groupObject) { type("group_name", groupObject.getName()); type("group_header", groupObject.getHeader()); type("group_footer", groupObject.getFooter()); }
a98b958b-8817-4c23-a062-9c78c0bedd51
5
public String generate() { if (details) System.out.println("Producing floors overview. It can be found in: output/"+name+"/overviews"); int dimx = MyzoGEN.DIMENSION_X * chunksX; int dimy = MyzoGEN.DIMENSION_Y * chunksY; NoiseMap overviewnoise = null; try { overviewnoise = new NoiseMap(dimx, dimy); ...
38f911a9-5415-4dbf-8e8b-d74ef2f474c7
3
@Override public void update(final int delta) { if (startLoading) { Sounds.get(); Textures.get(); Fonts.get(); final List<Object> options = Config.loadOptions(); Sounds.get().setSoundEnabled(options.isEmpty() ? true : (Boolean) options.get(3)); Sounds.get().setMusicEnabled(options.isEmpty() ? true ...
d5eb765c-4117-4a10-b935-bcebcb72f546
9
public void display(){ Dimension currentPanelSize; // Current size of the presentation panel. double sizeFactor; // Factor between 800x600 grid and current panel size. if (Debug.audio) System.out.println("AudioPlayer -> display called"); if (null != player){ currentPanelSize = Gui.getSlidePanel().getSiz...
4ab3994d-aed7-4105-be99-736cc35f8aa3
2
public void run() { while(true) { try { this.NFull.acquire(); this.NEmpty.release(); System.out.println("Comsommateur : " + this.counter--); } catch (Exception e) { e.printStackTrace(); } } }
0e99c575-387d-4cdc-9280-0ae905447903
0
public void setWypoz(Boolean wypoz) { this.wypoz = wypoz; }
8cf87c83-78f3-4ee8-85c4-643ea89f2cc4
0
public static void main(String[] args) { Logger log = LogManager.getLogger(Log4jTest.class); log.info("info通过 class 对象来获取 logger 对象"); log.debug("debug通过 class 对象来获取 logger 对象"); log.warn("warn通过 class 对象来获取 logger 对象"); }
715defe3-b7cb-4f2e-ae42-507af06fdd0f
0
public void setaField1(int aField1) { this.aField1 = aField1; }
dee75ea9-b9c4-4126-b62e-d0b0052723ef
9
public static void main(String [] args) throws BiffException, IOException, RowsExceededException, WriteException { ArrayList<pinfo> paperlist = new ArrayList<pinfo>(); String title,link,abs, session, author; Map<String, String> linkinfo = new HashMap<String,String>(); Map<String, String> absinfo = new HashMap<...
10463258-3db1-4d7c-af2c-e58567fbee7c
8
public boolean validate() throws Exception { boolean result = true; if (this.products.size() == 0) throw new Exception("Не указаны товары"); if (this.payed.size() == 0) throw new Exception("Не указаны платежи"); for(int i = 0; i < this.taxes.length; i++) ...
9a7d269d-1e54-43c0-8c05-eb86add5c845
1
@Override public void printAnswer(Object answer) { if (!(answer instanceof String)) return; System.out.print((String)answer); }
588c6cfb-54ad-441f-a4a6-0547a5c6a603
6
public void executeOrder(Order order) { Planet planet = order.getPlanet(); switch (order.getType()) { case BUILD: buildOrder(planet, false); break; case SPECIAL_BUILD: buildOrder(planet, true); break; case MOBILIZE: mobilizeOrder(planet, false); break; case SPECIAL_MOBILIZE: mobilizeOr...
129ce284-a39c-4dde-970d-d52a54c634fa
6
public static Double[][] readData(String fileName) { BufferedReader b; Double[][] data = null; try { b = new BufferedReader(new FileReader(fileName)); String line; // count number of lines int N = 0; while ((line = b.readLine()) != null) { N++; } b.close(); // data is of the form: (us...
a8e4ff79-53d2-44fc-912d-189719ad169b
3
public static Map<JComponent, List<JComponent>> getComponentMap( JComponent container, boolean nested) { HashMap<JComponent, List<JComponent>> retVal = new HashMap<JComponent, List<JComponent>>(); for (JComponent component : getDescendantsOfType(JComponent.class, container, ...
a0cd66ca-5cf7-4d7b-8efd-e35dab623f05
3
public char findCircleStart() { circularLinkedListNode p1 = head; circularLinkedListNode p2 = head; // find meeting point for (int i = 0; i < nodeCount; i++) { p1 = p1.next; p2 = p2.next.next; if (p1.item == p2.item) break; } p1 = head; while (p1.item != p2.item) { p1 = p1.next; p2 =...
a506784e-5ef1-49b4-80f7-d726cca2df26
9
private void readDirectory() { List<File> listfile = new ArrayList<File>(); File folder = new File(path+App.FILE_SEP); File[] listOfFiles = folder.listFiles(); //compter les sous dossiers for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isDirectory()) { listfile.add(list...
0adc2b05-8db0-406e-9281-9276aa2cdf6f
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 fe...
ed5f877c-8fc2-4884-a8fb-0edf491b5062
5
public synchronized int replaceAllByName(String name, JixelEntity entity) { if (entity == null) { JixelGame.getConsole().printErr(new NullPointerException("Can not set entity to null")); return -1; } int count = 0; synchronized (entityList) { for (int i = 0; i < entityList.size(); i++) { if (name =...
58956aa7-ea18-4e33-a4a6-d34994b35e06
0
public ArrayList<PathItem> getLines() { return lines; }
64bf7936-2e3c-4e0e-a6bd-67b2ce60ffd6
0
public String getUsername() { return username; }
5da3b180-3a97-4fb2-b79f-7b854250763e
9
private boolean messageCC(String channel, String sender, String message) { if (!channel.equals("#cirno_tv")) return false; int duplicateWordCap = 15; String[] words = message.split(" "); if (words.length < duplicateWordCap) return false; //<3 Encryp...
15ed37e7-faf6-4a27-856a-6676ace08651
4
public static int[] buildFingerPrint(Path path, HashFunction func, int b, int k) { if (b <= 0 || b > 16) throw new AssertionError("hyperLogLog : b <= 0 or b > 16"); int m = 1 << b; // m = 2^b int[] M = new int[m]; // M initialized to 0 by default // A little more complicated than the first version bec...
90c2abd3-e4f8-499d-bdb4-5dd1a0d80c2f
6
public static VoidParameter getParam(String name) { VoidParameter current = head; while (current != null) { if (name.equalsIgnoreCase(current.getName())) return current; if (current instanceof BoolParameter) { if (name.length() > 2 && name.substring(0, 2).equalsIgnoreCase("no")) { ...
aaa575a5-2d09-4904-a450-11ee254c7ca1
9
public void generateWorldChunk(int posHeight){ Block block = new Block((byte) 0); Random material = new Random(); if (posHeight==0){ for(int x=0; x<chunkBase; x++){ for(int y=0; y<chunkBase; y++){ for(int z=0; z<chunkBase; z++){ if(y==0){ this.voxel[x][y][z]=18; } else{ ...
62f7eb78-edef-4882-a611-7c69e06809fb
9
private static void processJarfile(URL resource, String pkgname, ArrayList<Class<?>> classes) { String relPath = pkgname.replace('.', '/'); String resPath = resource.getPath().replace("%20", " "); String jarPath = resPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); Jar...
9aa672ee-76d0-444f-9fc4-d1a238c3df19
7
public void createPollingScheme(String schemeName, int interval, String notificationMethod, String notificationHost, int port, String readinessProperty, String readinessValue) { Folder pollingSchemeFolder; try { try { pollingSchemeFolder = (Folder) s...
4861ddd1-32ed-4a84-b826-f0448361f5f1
4
private boolean buildingPreconditions(int playerIndex) { return (playerIndex == serverModel.getTurnTracker().getCurrentTurn() && (serverModel.getTurnTracker().getStatus().equals("Playing") || serverModel.getTurnTracker().getStatus().equals("FirstRound") || serverModel.getTurnTracker().getStatus().equal...
99a7ab86-b93c-4a1d-b3a6-b8861c79afce
4
public AvailableGroup getThisItems() { if (Script.holdExecution()) return new AvailableGroup(); AvailableGroup ret = new AvailableGroup(icache, ecache); if (icache == null) ret.add(Inventory.getItems(true)); if (ecache == null) { if (Bank.isOpen()) ret.add(Equipment.getItems()); else ret.add...
cebbb8e5-fe14-41de-8b78-2c319e4c4060
3
@Override public String toString() { return "file [" + (filename==null?"embedded":filename )+" " + (crc32==null?"":(", crc="+Long.toHexString(crc32.getValue())))+" " + (imageAttributes==null?"":imageAttributes.toString()) +"]"; }
58933ae9-a717-4736-91b2-ec706c45b8eb
6
public static void main(String[] args) throws Exception { // take the player number from command line and connect to the appropriate // TCP port playerNo = Integer.parseInt(args[0].trim()); int port = portOffset + playerNo; Socket socket = new Socket("localhost", port); BufferedReader in = new BufferedRe...
7018b478-5ce8-409a-95fa-ef0912a4fb95
1
@SuppressWarnings("unchecked") public TreeMap arbitrary(Random random, long size) { int length = (int) Arbitrary.random(random, 0, Math.min(Integer.MAX_VALUE, size)); TreeMap map = new TreeMap(); for (int i = 0; i < length; ++i) { Object...
818ea89f-cd8b-4813-9655-5bf4fb98274b
5
public static Map<String, List<String>> readWords(File f) { Map<String, List<String>> m = new HashMap<String, List<String>>(); Scanner s = null; try { s = new Scanner(f); while (s.hasNext()) { String word = s.next(); String alpha = sortLett...
a4974823-383a-4d80-9b53-617be3dad2e9
4
public void addBookLanguage(BookLanguage lng) { Connection con = null; PreparedStatement pstmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
9b8d5a2b-5b2c-440d-b395-e31e0d85ce3a
4
public void toggleAmmo() { speedSpinner.setEnabled(false); piercingCheck.setEnabled(false); distanceSpinner.setEnabled(false); ammoDamageSpinner.setEnabled(false); diameterSpinner.setEnabled(false); multiCheck.setEnabled(false); areaTextureText.setEnabled(false); movingCheck.setEnabled(false); duratio...
bedf956e-03fc-443c-94fe-051548735abc
6
public void keyPressed(KeyEvent keyEvent) { if(keyEvent.getKeyCode() == KeyEvent.VK_LEFT) { iDireccionCanasta = 1; } if(keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) { iDireccionCanasta = 2; } if(keyEvent.getKeyCode() == KeyEvent.VK_P) { // si no...
e0cf6c09-b712-4d5b-8b1c-97eaab4aa65a
3
@Test public void testReceive() { try { consumer = new AbstractMessageConsumer(mockTopic) { }; } catch (DestinationClosedException e) { fail("Unexpected exception on constructor"); } assertNotNull(mockTopic.getTopicSubscriber()); try { Message msg = new MockMessage("TestMessage"); mockTopic.ge...
6c65c225-2bd3-458d-a39e-6eb60cdea202
0
private int binarySearch(String string, ArrayList<String> array) { int currentPos = array.size()-1 / 2; int min = 0; int max = array.size()-1; // Returns the location that string will go in the array return binarySearchTail(array, string, min, max); }
309e170f-0abe-4551-bb90-2b216e2888e4
3
public static void main(String[] args) { /** ****************** */ try { PlasticSettings settings = PlasticSettings.createDefault(); Options.setDefaultIconSize(new java.awt.Dimension(16, 16)); UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings....
afbece82-68da-4b5e-9b37-280332605e4f
1
public void addGroup(StringTokenizer tokens) { int tokenCount = tokens.countTokens(); String[] settings = new String[tokenCount+1]; String line = ""; for (int i = 0; i < tokenCount; i++) { settings[i] = tokens.nextToken(); line += " " + settings[i]; } ...
969df143-512b-41b5-80bc-4d51063e0507
9
@Override public void flush(Map<TermsHashConsumerPerThread,Collection<TermsHashConsumerPerField>> threadsAndFields, final SegmentWriteState state) throws IOException { // Gather all FieldData's that have postings, across all // ThreadStates List<FreqProxTermsWriterPerField> allFields = new ArrayList<Freq...
b4e79eb3-898d-4d94-b46f-741e909607dd
9
public java.lang.Float getByMethod(int method, boolean repeat) { elapsed = ((double) System.currentTimeMillis() - timeStart) / timeAnim; if (!repeat && elapsed > 1.0) elapsed = 1.0; switch (method) { case -METHOD_LINE://line elapsed = elapsed * 2 - 1; ...
664f0e41-b165-400d-82cc-e8b32f4061de
3
@Override public boolean equals(Object obj){ if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof User)) return false; User user = (User)obj; return this.u_id.equals(user.u_id); }
11380a79-7ffa-4c53-abce-feb228148a52
1
public void reset() { if(!dead) { done = false; moved = false; attacking = false; } updateActions(); }
811bf6eb-52b7-4d09-8aea-d26f8b745e00
0
public int getSeqNum(){ return this.seqNum; }
8020c06d-23ea-455f-9185-4785e6fc2737
0
@Override public String toString() { return "Offrir{" + "vis_matricule=" + vis_matricule + ", rap_num=" + rap_num + ", med_depotLegal=" + med_depotLegal + ", quantite=" + quantite + '}'; }
4250d4ff-2012-49d7-b1da-105dd1fbc3e5
9
public static void main(String[] args) throws Exception { List<FastaSequence> list = FastaSequence.readFastaFile(ConfigReader.getCREOrthologsDir() + File.separator + "contig_7000000220927531_postAlign.txt"); BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getCREOrthologsDir...
51f53b36-06ad-44e9-a3d2-bd92f31a35f4
1
public static void main(String[] args) { if(args.length > 0) { portLocal = Integer.parseInt(args[0]); System.out.println("TAILLE : "+args.length+";ARGS:"+args[0]/*+";ARGS:"+args[1]*/); controleur = new Controleur(); service = new InterfaceService(portLocal); lignes = new HashMap<String, Ligne>...
b3b2d525-c9ef-459b-84ef-484f80c9bf86
0
public HelloWorldSoftware() throws Exception { frame=new JFrame("Hello world"); frame.setSize(800, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); world = new World(); world.setAmbientLight(0, 255, 0); TextureManager.getInstance().addTexture("box", new Texture("b...
5611bc41-39e5-4d80-bd1e-d8e21ee67733
3
public static Bitmap loadBitmapFromWeb(String location) throws Exception{ final URL url = new URL(location); final HttpURLConnection connection = (HttpURLConnection) url .openConnection(); connection.setRequestProperty( "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (...
cf5d445c-64cc-4ec7-9782-321f4efdf8e0
9
public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY .equals(prop))) { Object value = optionPane.getValue(); if (value == JOptionPa...
3e107825-6f0b-4056-be29-b98abd152693
6
final boolean method1413(Class258_Sub1 class258_sub1, Class258_Sub1 class258_sub1_2_, int i, float f) { try { anInt2517++; if (!method1414(35632)) return false; Class206 class206 = ((OpenGlToolkit) aHa_Sub2_2511).aClass206_7778; int i_3_ = 30 % ((-55 - i) / 59); Class348_Sub42_Sub2 c...
5def5895-5c1c-4c6e-8da4-7ecf9ebcc9ec
4
@Override public List<Usuario> filterGrid(String filter) { List<Usuario> lista = service.findAll(); if("".equals(filter) || filter.equals("*")){ return lista; } List<Usuario> filtro = new ArrayList<Usuario>(); for (Usuario user : lista) ...
156f6393-f23f-4c26-a9be-257f516640ca
8
void parse(InputStream in) throws IOException { while (!endOfFile) { n = in.read(buffer, 0, bufSize); if (n < 0) { endOfFile = true; n = 1; buffer[0] = '\n'; } for (int i = 0; i < n; ...
5c609878-afb1-4d49-9b3f-8d6870b4063e
6
private boolean collision() { for(Platform p : level.platforms) { if(p != null) { int left = x + 11; int right = x + 21; if(right >= p.x && left <= p.x + p.getPixelWidth()) { if(y >= p.y-3 && y <= p.y + p.getPixelHeight()) { y = p.y; return true; } } } } ...
8c914404-0517-4d96-a4f8-5e04296fa20f
6
public void startWork () { try { boolean hashFound = false; String inputLine; Scanner netScanner; String serverString; String instType; //Open socket to server toServer = new Socket (hostAddr, portNumber); //Set up output from socket socketOutput = new PrintWriter(toServer.getOutpu...
14823607-a3b1-4b63-9ccf-a7139936b6c0
6
public static final String getFileContents(String file) throws Exception { InputStream is = null; if (!GoCoin.hasValue(file)) { throw new FileNotFoundException("File must be passed!"); } try { File f = new File(file); if (!f.exists()) { throw new FileNotFoundException("File ["+file+"] not ...
b7e8be9c-d33b-4c48-8e86-46533b8bef7c
0
@Override public void mouseEntered(MouseEvent e) {}
4d9f314b-b969-48b2-b5e4-cb5d9ae055df
3
public void setScheiding(GregorianCalendar datum) { if (scheiding == null && huwelijk != null && datum.after(huwelijk)) { scheiding = datum; } }
0036ecd6-b11f-4247-bd98-80d1474f3695
6
public WorkTable(String firstName) throws SQLException{ db = new DBAccess(); String type = ""; boolean musician = false; boolean actor = false; Statement statement = db.connection.createStatement(); ResultSet result = null; works = new ArrayList<String>(); ResultSet typeOfPerson = statement.executeQu...
b630b64d-0255-4414-8975-113107ae352c
5
public static boolean isPrimeTrunc(int k, ArrayList<Integer> arr) { if (k / 10 == 0) return false; for (int i = 1; k / i > 0; i *= 10) { if (!(Collections.binarySearch(arr, k / i) >= 0)) { return false; } } for (int i = 10; k / i > 0; i *= 10) { if (!(Collections.binarySearch(arr, k % i) >= 0)) ...
ae3b7624-ea3b-443e-acf5-c28ab6ddf764
1
public void testMinus_int() { Seconds test2 = Seconds.seconds(2); Seconds result = test2.minus(3); assertEquals(2, test2.getSeconds()); assertEquals(-1, result.getSeconds()); assertEquals(1, Seconds.ONE.minus(0).getSeconds()); try { Seconds.M...
b07daf03-656c-47c8-a43d-3637df6090f6
8
public void setOptions(String[] options) throws Exception { // Pruning options m_unpruned = Utils.getFlag('U', options); m_reducedErrorPruning = Utils.getFlag('R', options); m_binarySplits = Utils.getFlag('B', options); m_useMDLcorrection = !Utils.getFlag('J', options); String confidenceString ...
7f4376cd-fa4e-4fe5-ad9c-da5749b11eca
8
public boolean intersects(S2Cell cell, S2Point[] vertices) { // Return true if this cap intersects any point of 'cell' excluding its // vertices (which are assumed to already have been checked). // If the cap is a hemisphere or larger, the cell and the complement of the // cap are both convex. Therefor...
7a46a846-9426-4709-ae95-120911c9d5e4
1
private static void assertThatParamsCanBeBound(String template, Object[] parameters) { int nbTokens = countTokens(template); if (nbTokens != parameters.length) { String message = "绑定参数到查询语句[" + template + "]失败:参数个数[" + parameters.length + "]和Shell中Token个数[" + nbTokens + "]不匹配"; throw new IllegalMongoShe...
0c889231-4a28-4c07-a826-2eff25830a88
1
public static void repaintWhileDealing(CardPanel panel) { panel.repaint(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } }
49d63363-633a-491a-9792-1a4448e9008c
5
public boolean addCoef(String name, BigDecimal coefficient) { if (name != null && !name.equals("") && !this.existInList(name) && coefficient != BigDecimal.ZERO && this.coefficientList != null) { Unit unit = new Unit(name, coefficient, false); this.coefficientList.add(unit); u...
521c220f-2e2a-45c9-a63d-1223bf8740cf
8
public void processGedcomFile(GedcomReader reader) throws IOException, GedcomReaderException, PropertyException { for (GedcomRecord record = reader.nextRecord(); record != null; record = reader .nextRecord()) { if (record.getLevel() != 0) throw new GedcomReaderException("Level is not zero in " + record,...
25f7bde5-d69b-4264-b423-56b13aaf30fc
1
protected void recalcsz(Coord max) { sz = max.add(wbox.bsz().add(mrgn.mul(2)).add(tlo).add(rbo)).add(-1, -1); wsz = sz.sub(tlo).sub(rbo); if (folded) wsz.y = wsz.y / 2; asz = wsz.sub(wbox.bl.sz()).sub(wbox.br.sz()).sub(mrgn.mul(2)); }
0f8dbb1a-12ef-4d82-8753-e16423230aea
0
public ViewController(Frame frame, GameServerSocket socket) { server = socket; view = frame; initEvents(); }
2a3215e2-0486-45d2-8aeb-c29876269d9b
6
private boolean isChunkOpDone(int x, int z, int op) { if (x < 0 || x >= xSize) return true; if (z < 0 || z >= zSize) return true; if (savedChunks[x][z]) return true; if (chunks[x][z] == null) return false; return chunks[x][z].o...
fd1ff85d-6a65-4016-aff2-72e56559b33e
0
@Override public void sign(String apikey) { this.apikey = apikey; }
b85ac794-8d2f-4044-a3f0-f6507239d1aa
5
static void translateXML() throws Exception { BufferedReader jin = new BufferedReader(new FileReader("37.xml")); FileWriter citeSeer = new FileWriter("citeSeer.txt"); FileWriter assistant = new FileWriter("assistant.txt"); String line, lineMark, lineInfo, lines = ""; int count = ...
ad734461-0a36-4ac4-9d3b-0b267c50b387
6
public String[] build(int[] values) { int a[] = new int[10]; Arrays.fill(a,0); int n = values.length; for(int i = 0;i < n;i++){ a[values[i]]++; } int f = 0; for(int i = 0;i < 10;i++){ if(a[i] > f)f = a[i]; } String ans[] = new String[f + 1]; Arrays.fill(ans,""); for(int i = f;i > 0 ;i--){ ...
5c86d541-6e9f-42f8-93ff-9bd3e03bbd3d
1
private void startServer_adbMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startServer_adbMenuActionPerformed try { adbController.startServer(); } catch (IOException ex) { logger.log(Level.ERROR, "An error occurred while starting the ADB server!"); ...
4f2b5270-9b85-44b6-9257-51fb9fdf53c8
4
public void analyze(String param) { StringTokenizer st = new StringTokenizer(param); // System.err.println("in analyze " + param); if (st.countTokens() < 2) return; String first_word = st.nextToken().toLowerCase(); // System.err.println("in analyze(first_word) " + first_word); if (first_word.equals("a")) {...
19015457-2c08-46c5-8cf3-7f31963a1460
3
private void acao166(Token token) throws SemanticError { if (tipoFator != Tipo.INTEIRO && tipoFator != Tipo.REAL) { throw new SemanticError("Operador unário exige operando numérico", token.getPosition()); } if(!indexandoVetorParametro) parametroAtualPodeSerReferencia = false; }
0903c3c7-1a04-4b1f-9034-8f5cb4289aea
1
public String getCurSongname() { if (mp3list != null) { return mp3list.getSong().getName(); } return "nichts"; }