method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2d48e31d-a7c6-4e72-a4e6-8e35745b08d2
3
public void doPrint() { List<String> nodes = this.graph.getVertexes(); for (String node : nodes) { List<String> edges = this.graph.getIncident(node); for (String edge : edges) { if (this.graph.getSource(edge).equals(node)) { System.out.format("%4s (%3s,%3s) %4s", node, this.graph.g...
c85ff068-dcbf-4db8-8d5d-847d7172a4cb
3
public CellModel rule(){ int option = board.rule(); if(option == 1){ return new Normal(statistics, model); } else if(option == 2){ return new HighLife(statistics, model); } else if(option == 3){ return new DayAndNight(statistics, model); ...
5631d3ee-6e1a-4a75-a4f4-8ae98bb3e6c9
5
private void updatePageButtons() { if (currentDisplay.size() < 51) pages[5].setEnabled(false); else pages[5].setEnabled(true); if (currentDisplay.size() < 41) pages[4].setEnabled(false); else pages[4].setEnabled(true); if (currentDisplay.size() < 31) pages[3].setEnabled(false); else pag...
a966d60d-bf19-483f-ac4c-adac4fd14aff
4
@Override public void run() { while (true) { try { IPacket p = net.receive(); if (!(p instanceof JoinGamePacket)) { p.setSender(playername); pq.addPacket(p); } } catch (IOException e) { ...
4eaf47f5-e364-4f20-ba5a-41339140e9d7
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Email other = (Email) obj; if(!(this.getLocal().equals(other.getLocal()))) return false; else if(!this.getDomain().equals(other.getDomain())...
5b6d7b0a-9e6b-4e24-b7de-0ad6ce58325f
7
protected void prepare_sample_reading(Header header, int allocation, //float[][] groupingtable, int channel, float[] factor, int[] codelength, float[] c, float[] d) { int channel_bitrate = header.bitra...
86e9df6f-0534-41f3-bedb-08112e82b092
8
public void setAppliedEffects(Vec2 maximumMovement){ removeEffects(); addEffect(left ? Effect.LEFT_KEY_T : Effect.LEFT_KEY_F); addEffect(right ? Effect.RIGHT_KEY_T : Effect.RIGHT_KEY_F); if(maximumMovement.getY() > 0) addEffect(Effect.FALLING_DOWN_T); if(maximumMoveme...
112b0bca-a990-4554-b8a3-c50a48fafa3f
5
private void btncalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncalcularActionPerformed int x,r,vali,valf; vali=Integer.parseInt(txtinicial.getText()); valf=Integer.parseInt(txtfinal.getText()); if(rbtnpar.isSelected()){ x=0; String n; ...
2889121f-bdae-41f6-9501-c92c6874a0d5
1
public void testWithField_DateTimeFieldType_int_2() { LocalTime test = new LocalTime(10, 20, 30, 40); try { test.withField(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
edfe6ea8-c023-4e63-823d-3e7d598f0c00
7
public int newlineDetected(StringBuffer buf, int i, boolean[] eatEOL) { if ((mode() == MXP.MODE_LINE_LOCKED) || (mode() == MXP.MODE_LOCK_LOCKED)) { eatEOL[0] = false; return 0; } eatEOL[0] = eatNextEOLN; eatNextEOLN = eatAllEOLN; if (eatTextUntilEOLN) { eatTextUntilEOLN = false; eatEOL[0] = t...
8489228d-4b9e-4079-a6c7-9756d985b612
8
private boolean waitForAck() throws IOException { byte buffer[] = new byte[PAYLOAD_LEN]; DatagramPacket responseDatagram = new DatagramPacket(buffer, PAYLOAD_LEN); //this.sendingSocket.receive(responseDatagram); try{ this.ackSocket.receive(responseDatagram); }catch (SocketTimeoutException ste){ ...
1929d9d3-61b4-4aa9-8011-6cc2bac5f41e
0
ExternalTestLinkId(String id) { super(id); }
3791e0ce-237b-4f65-bc32-0c2846eb2b79
2
public Vector<Patient> getPatientList(ResultSet rs) { Vector<Patient> patients = new Vector<Patient>(); try { while (rs.next()) { Patient patient = new Patient(); patient.setHealth_care_no(rs.getInt("health_care_no")); patient.setName(rs.getString("name")); patient.setBirth_day(rs.getDate("birth_...
794cc428-abb7-4fb3-92a6-ae6561162e47
1
@Test public void indexFromValue() { Goo g1 = new Goo(114, "lu-" + 114); Goo g2 = new Goo(13, "lu-" + 13); Goo g3 = new Goo(600, "lu-" + 600); Goo g4 = new Goo(9, "lu-" + 9); Goo g5 = new Goo(7, "lu-" + 7); objh.insert(114, g1); objh.insert(13, g2); ...
ef6034ee-6c54-43fb-b720-b1a3703ec5a9
2
@Override public ListGamesResponse listGames(String cookie) { ArrayList<Pair<String,String>> requestHeaders = new ArrayList<Pair<String,String>>(); requestHeaders.add(new Pair<String,String>(COOKIE_STR, cookie)); ICommandResponse response = this.clientCommunicator.executeCommand(RequestType.GET, requestHeaders, ...
91a1d13c-5e2a-4f10-a482-f5902656352f
3
public CMD_Banned (CommandSender sender, ArrayList <String> colors) { ArrayList <String> bannedcolors = new ArrayList <String> (); for (int i = 0; i < colors.size(); i++) if (config.getConfig().getString("BANNED."+colors.get(i)).equalsIgnoreCase("true")) bannedcolors.add(colors.get(i)); if (bannedcolors.si...
4e3a5600-7ee8-410d-a305-cc80152c1b80
8
private String[][][] readTransitionGroups(int groupSize, int idPosition, int numStates, BufferedReader reader) throws IOException { String[][][] groups = new String[numStates][][]; for (int s = 0; s < numStates; s++) { ParseException p = new ParseException("Transition line " + (s + 1) + " badly formatted...
a0515f31-0f5c-458f-99bb-ce6ad4dcc89b
8
@Test public void urlCount() { Path path = Paths.get("D:\\\\Download\\SecureCRT\\logs"); File[] files = path.toFile().listFiles(); System.out.println(Arrays.toString(files)); String dateStr = "26/Apr"; String line = null; Map<String, Integer> count = new HashMap<String, Integer>(); // for (int i=0; ...
4f725f19-c132-43db-826b-7fc7f72101a6
5
static public void main(String args[]) throws FileNotFoundException, IOException { boolean ok = false; boolean encrypt = true; String key = null; String name_in = null; String name_out = null; String mode = null; if (args.length == 4) { mode = args[0]; key = args[1]; name_in = args[2]; ...
1a1dcb5c-8c4a-49ad-b1b7-7357bc6f9a7a
1
public ComService(User user, String server, SigService sigServ) throws ConnectException, InvalidURIException, IllegalArgumentException, IOException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException { this.sigServ = sigServ; this.user = user; notificationHa...
37886c51-4f86-4422-a030-b0f40d6f3493
4
private void createTimerElement(Attributes attrs) { timer = new TimerElement(); // loop through all attributes, setting appropriate values for (int i = 0; i < attrs.getLength(); i++) { if (attrs.getQName(i).equals("playtime")) timer.setPlayTime(Integer.valueOf(attrs.getValue(i))); else if (attrs.getQNam...
e069f747-cd17-4525-b68a-54eb2e526816
9
@Test public void as_a_connected_user_i_can_visualize_the_house_highscores(){ // Add occupants HashMap<String,String> headers = new HashMap<String,String>(); headers.put(AUTH_KEY_HEADER, token); ArrayList<String> newOccupants = new ArrayList<String>(); newOccupants.add("{\"name\":\"CTEST_OCCUPANT1\"}"); n...
bd4b3a41-ce81-4a36-88db-b243eebc529d
0
@AfterClass public static void tearDownClass() { }
b2e84fe4-1313-46bc-8ac9-71fbca7ed2bc
8
@Override protected TerminalSize calculatePreferredSize() { int width = preferredSize.getColumns() > 0 ? preferredSize.getColumns() : longestLine + 1; int height = preferredSize.getRows() > 0 ? preferredSize.getRows() : lines.size() + 1; if(maximumSize != null) { if(width > maxim...
221d1dbd-6252-46b6-8ad0-ed1204c2e27f
8
protected void setupInventory() { ownSlots = new ArrayList(rows * 4 - 1); otherSlots = new ArrayList(rows * 4 - 1); seperatorSlots = new ArrayList(rows - 1); for (int slot = 0; slot < rows * 9; slot++) { if ((slot != 3) && (slot != 4) && (slot != 5)) { int collum = slot % 9; if ...
46ca3ce4-ac70-46c0-9b99-516635639711
9
public String getConfigPath(String filename) { if (isApplet()) return null; File jgamedir; try { jgamedir = new File(System.getProperty("user.home"), ".jgame"); } catch (Exception e) { // probably AccessControlException of unsigned webstart return null; } if (!jgamedir.exists()) { // try to crea...
8099a777-da78-4f67-b108-26d725c721be
5
public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; //Center everything int centerX = this.getWidth()/2; //Scale the hexagons so that the triangle takes up the panel hexRadius = (int)((this.getHeight()-centerY-50)/(this.totalRows*1.5)); hexRadius = Math.min(hexRadius, (t...
34e2458d-9532-4483-9a9f-39b86547e472
7
private void setRows(BufferedImage image, Colour backgroundCol, HashMap<Color, Colour> colorMap, ArrayList<Row> rows) { for (int i = 0; i < image.getHeight(); i++) { Row row = new Row(); row.setIndex(i); ArrayList<Block> blocks = new ArrayList<Block>(); Block block = null; ...
f5e82510-cda5-4c94-b010-29671bfa33fe
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Region other = (Region) obj; if (getLocation() == null) { if (other.getLocation() != null) return false; } else if (!getLocation()....
1dfa60db-b51c-41cd-8b62-d5663a6f8168
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Bus other = (Bus) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (p...
79b4002d-718d-4084-88a0-a8ee21f2f54b
4
public void loadXmlToTree() { Document xml = getDocument(); System.out.println("Begin load xml = " + xml); GeneralUtils.clearTree(vermilionCascadeNotebook.getTree()); if (xml != null) { Element root = xml.getDocumentElement(); handleDocumentOptions(root); NodeList children = root.getChildNodes(); ...
b95b1ec4-e54b-4825-8d34-de3fb75ce1f1
6
public int calcFreeSeats(HashMap<Integer, Integer[]> passengerByStation, List<Object[]> allStationsByTrain, Station stationFrom, Station stationTo, Train train) { log.debug("Start method \"calcFreeSeats\""); int occupiedSeats = 0; int maxOccupied = -1; boolean calcMax = false; fo...
3dd9fb77-1b7b-45bc-bdb9-542b36692d8f
6
public PicturePanel() { this.setVisible(true); this.setSize(PANEL_SIZE, PANEL_SIZE); numberOfPoints = IntroFrame.POINTS_NUMBER; speedX = new JTextField("0", 3); speedY = new JTextField("0", 3); speedZ = new JTextField("0", 3); speedX.getDocument().addDocumentLis...
1a99f792-916d-4ab9-af0b-da06723e13ce
5
static final void method1834 (Mob class318_sub1_sub3_sub3, byte i) { anInt6125++; int i_2_ = (((Mob) class318_sub1_sub3_sub3).anInt10239 - Class367_Sub11.logicCycle); if (i < 0) { int i_3_ = ((((Mob) class318_sub1_sub3_sub3) .anInt10293) * 512 + 256 * class318_sub1_sub3_sub3.method2436((byt...
c0bfe455-4ec5-4b51-9103-d8f0c3e0f7de
4
public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) contentTree.getLastSelectedPathComponent(); if (node == null) //Nothing is selected. return; Object nodeInfo = node.getUserObject(); if(!node.isRoot()){ Engine.goto...
781cf9ca-1bc4-40fa-a3b4-6162df337d3b
8
protected void stopAgents() { // Stop task. if(worker != null) { try { agentPrintMessage("Stopping task..."); worker.stop(); } catch (InterruptedException e) { } catch (AgentException e) { } } if(master != null) { try { agentPrintMessage("Stopping CA..."); master.stop(); ...
6a3062ff-3a88-42af-9e71-ff446dc73d36
0
public GameScore(AudioClip clip) { this.clip = clip; }
45af77da-9c24-4533-9c5a-7c6d7516e516
0
public static void setData(String data) { OS.data = data; }
a824135f-eb9a-4303-b58d-f1a40f394399
1
public static void main(String[] args) { // TODO Auto-generated method stub List<String> fruits = new ArrayList<String>(); fruits.add("Pine Apple"); fruits.add("Mango"); fruits.add("Banana"); fruits.add("Apple"); fruits.add("Orange"); Collections.sort(fruits); for (String temp : fruits) { Sys...
e44f7b55-a0b4-4a26-813c-445731197ba0
1
private static List<Appointment> findOnceByDaySpan(long uid, long startDay, long endDay) throws SQLException { List<Appointment> aAppt = new ArrayList<Appointment>(); // select * from Appointment where frequency = $ONCE // and startTime >= $startDay and endTime <= // $(endDay+DateUtil.DAY_LENGTH) Prepared...
37cf1f17-6e5b-4e68-8298-5114f362a8dc
6
private static ManifestInfo getManifestInfo() throws IOException { Enumeration resEnum; resEnum = Thread.currentThread().getContextClassLoader().getResources("META-INF/MANIFEST.MF"); //$NON-NLS-1$ while (resEnum.hasMoreElements()) { try { URL url = (URL)resEnum.nextEl...
34d59c54-a771-48ed-af95-5cc0b33ca329
0
public static void main(String[] args) { String ข้อความ = "สวัสดี"; System.out.println(ข้อความ); }
4481d595-0bb0-4e38-a4c0-bd6b8a72027e
9
public int getSolution() throws Exception { // calculate primes in 5 levels // from level 2 up check the concatenation of the previous levels for (long p1 = 3; p1 < MAX_PRIME; p1 = _primes.generatePrime(p1)) { for (long p2 = _primes.generatePrime(p1); p2 < MAX_PRIME; p2 = _primes.gen...
927407d9-f1dd-41c7-bfd5-e2043fbfeb6d
1
public Object objectValue() { if (newObj != null) return newObj.objectValue(); return value; }
0c11974b-e82d-4d52-8476-4f0141640e50
5
public void insertAndPush(Event ev) { //This algorithm supposes that the store is always ordered (which it will always be since it is declared private) if(this.store.size() == 0) { this.store.add(ev); } else { int numberOfItems = this.store.size(); for(int i = 0; i < numberOfItems; i++)//Loops tro...
84def38f-1ada-41d6-9c2c-0cb095628e37
8
public void actionPerformed(ActionEvent arg0) { String command = arg0.getActionCommand(); if (command.compareToIgnoreCase("Begin") == 0) { // disable the begin button and the configPanel (freeze the config) controlPanel.begin.setEnabled(false); configPanel.setEnabled(false); controlPanel.tournam...
4fb8b55d-e0e7-4065-b9f2-c43a90f5a287
7
protected PngChunk processHeadChunks(PngImage result, boolean removeGamma, Iterator<PngChunk> itChunks) throws IOException { PngChunk chunk = null; while (itChunks.hasNext()) { chunk = itChunks.next(); if (PngChunk.IMAGE_DATA.equals(chunk.getTypeString())) { break; } if (result != null && chunk.isR...
4cba5667-391f-4703-bba3-db8988dc464b
1
private int getNameAndType(ConstPool cp) { int pos = currentPos; int c = iterator.byteAt(pos); int index = iterator.u16bitAt(pos + 1); if (c == INVOKEINTERFACE) return cp.getInterfaceMethodrefNameAndType(index); else return cp.getMethodrefNameAndType(inde...
bef94222-b885-4ddc-acb6-504f88c9da2a
6
public int getMul(int start, int end) { if (this.start == start && this.end == end) return mulVal; int mid = (this.start + this.end) / 2; if (mid >= start && mid >= end) return left.getMul(start, end); if (mid < start && mid < end) return right.getMul(start, end); return left.getMul(start, mi...
bf7305c7-2cf2-4dc9-a1a9-2d876c5fb87a
5
public static Object unserialize(byte[] objBytes) { Object returnObject; PHPDeserializer serializedPhpParser; serializedPhpParser = new PHPDeserializer(objBytes); try { returnObject = serializedPhpParser.parse(); } catch (Throwable e) { return null; } if (returnObject instanc...
2c6e22fe-2ac0-4f38-97c9-8fea5bc48850
2
public void open(Player player) { Inventory inventory = Bukkit.createInventory(player, size, name); for (int i = 0; i < optionIcons.length; i++) { if (optionIcons[i] != null) { inventory.setItem(i, optionIcons[i]); } } player.openInventory(inventor...
e6a51a70-aa32-47b2-8be5-e932d20a2b80
9
public String toString() { String result = templateType.toString() + ": "; switch (templateType) { case LABEL: if (replacements == null) { result += getId(); } else { for (StringTemplate object : replacements) { result +...
66302d14-a768-43d0-b23e-49f8ec41d860
7
public void fillHeightMap(GL_Vector start, GL_Vector end) { float x0 = start.x * getScaleRatio() + transX; float y0 = start.y * getScaleRatio() + transY; float z0 = start.z * getScaleRatio() + transZ; float x1 = end.x * getScaleRatio() + transX; float y1 = end.y * getScaleRatio()...
9e5e22da-3bc7-4821-bd65-ea3244c8ad1a
4
public static void main(String[] args) { double a[] = MetNumericos.polinomioGradoNCM(new Punto[]{new Punto(1.0, 2.9), new Punto(1.2, 3.5), new Punto(2.0, 5.8), new Punto(2.1, 6.42), new Punto(2.5, 8.25), new Punto(3.0, 10.8)}, 2); for (double v : a) { System.out.println(v); ...
0a9b9e3a-ff7c-4bc0-931c-59150c03d3b0
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
c0bf6e28-2ab5-49d8-bcd5-9dbad50f240d
6
private Chunk readNonblocking() throws IOException { boolean done = false; while (!done) { switch (state) { case SIZE_NEXT: if (attemptToReadSize()) { if (chunkSize == 0) { return new Chunk(new byte[0]); } else ...
c9593e37-1aea-4531-aa8d-90454c307e3f
9
boolean hasToolbarButton(AbstractButton rb) { if (!EventQueue.isDispatchThread()) throw new RuntimeException("must be called by the event thread."); if (rb == null) return false; int n = getToolBar().getComponentCount(); if (n == 0) return false; Component c = null; for (int i = 0; i < n; i++) { ...
f70d05de-53ee-4af4-8725-98650950bab7
2
public void stateChanged(ChangeEvent e) { String tabName = acebotsGUI.inputTab.getTitleAt(acebotsGUI.inputTab.getSelectedIndex()); if (tabName.endsWith(channelName)) { if (isLive) acebotsGUI.someExtraLabel.setText("Moderating for " + totalViewerCou...
65a555ba-dc9d-4dfb-b69d-e53275e53bdf
4
public int match(Person other, String category){ List<String> selfops = target.get(category); List<String> targetops = other.self.get(category); if (selfops == null || targetops == null) return 0; Option op = Option.get(category); if (op == null) { throw new RuntimeEx...
63c1aefa-f6ba-463f-a1af-29c00033877a
9
public void run() { boolean skipout = false; for (;;) { int b; try { b = in.read(); } catch (IOException e) { if (!Thread.interrupted()) { e.printStackTrace(); } break; } if (b == -1) { break; } if (!skipout) { try { out.write(b); } catch ...
8c37d793-e193-44bf-a55e-4c1bb60d34ab
1
public int getIndex() { if (table.getSelectedRow() < 0) { return -1; } return showCon.getResourceNumber(table.getSelectedRow()); }
a2ca7668-fe48-4445-bb84-7edd1f00920e
3
public String agregarGrupoEstudio(GrupoEstudio ge) { ArrayList<GrupoEstudio> nuevoGE = new ArrayList<GrupoEstudio>(); String nombre=ge.getNombre(); String fechaini=ge.getFechaini(); String fechafin=ge.getFechafin(); String result="Se ha dado de alta el registro satisfactoriamente...
eae26536-2cc8-418c-b4e9-92f00efaee7b
2
public int min_number_of_frames(int streamsize) // E.B { if (h_vbr == true) return h_vbr_frames; else { if ((framesize + 5 - h_padding_bit) == 0) return 0; else return(streamsize / (framesize + 5 - h_padding_bit)); } }
173826c9-676b-4b72-af7f-cf358b5a9331
8
public IFigure getPreviousFocusableFigure(IFigure root, IFigure prevFocus) { if (prevFocus == null) return null; boolean found = false; IFigure nextFocus = prevFocus; while (!found) { IFigure parent = nextFocus.getParent(); /* * At root, return null to indicate traversal is complete. */ if...
5da4aa9c-f0ed-402b-acbb-0bbe779c3660
9
boolean nextImage() { currentImageName = getNextImageName(); if( null == currentImageName ) return false; String realCurrentImageName = currentImageName; boolean variousNucleus = currentImageName.contains("-"); if ( variousNucleus == true ) { int realLast = currentImageName.lastIndexOf("-");...
1314ca97-7341-49a1-bf57-b2fefbfac667
3
public final void setTitle(final String string) { for (final Integer i : this.indices.keySet()) { final String title = this.titles.get(i); if ((title != null) && !title.equals(string)) { this.dirty = true; } } this.titleNew = string; }
bae19588-12a7-413e-99c8-424d6636349c
8
private static void StackWithListMenu(StackWithList<Integer> StackWithList){ System.out.println("What do you want to do ?"); System.out.println("1) pop"); System.out.println("2) top"); System.out.println("3) push"); System.out.println("4) Print"); System.out.println("Enter your option"); try{ choose...
c62ee812-f0da-4433-b295-d0826372bed1
6
public static String getCommitResult(int result) { String str = null; switch (result) { case GridSimTags.AR_COMMIT_SUCCESS: str = "AR_COMMIT_SUCCESS"; break; case GridSimTags.AR_COMMIT_FAIL: str = "AR_COMMIT_FAIL"; ...
3d4fed3b-8f8c-41b3-b968-444dd87386ba
7
public boolean isPQMap(int mapId) { if (isDojoMap(mapId)) { return true; } switch (mapId) { case 103000800: //kpq stage 1 case 103000801: case 103000802: case 103000803: case 103000804: case 103000805: //...
2884b45c-2f01-46c3-8c04-39ff07a3bfaf
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null) { int[] nm = readInts(line); if(nm[0] == 0 && nm[1] == 0) break; m ...
001179fa-da22-4ff9-bcda-e3e14f8db329
6
public void insert() throws ESellException { makeConnection(); PreparedStatement preparedStatement = null; ResultSet res; if (conn != null) { try { // Statement vorbereiten String sql = "INSERT INTO petitions (`user_id`,`title`,`description`,`price`,`category_id`,`amount`,`image_url`,`state`,`cre...
26ea91d3-6c79-4664-9dc4-4855baa54b0f
9
protected void drawSeries(Graphics2D g2d) { int i = 0; for(Entry<String, SortedMap<X, Y>> series:data.entrySet()){ g2d.setColor(getColor(i)); Point2D previousPixel = new Point2D.Double(0, 0); boolean previousVisible = true; Point2D data = new Point2D.Double(); Point2D pixel = new Point2D.Double();...
ade704ae-2ac3-46e3-9cea-177d85990ed0
3
public Group getGroup(int Id) { Connection connection = ConnectionManager.getConnection(); if (connection == null) { logger.log(Level.SEVERE, "Couln't establish a connection to database"); return null; } try { PreparedStatement ps = connection....
2a9fe0dd-ed31-4175-a6bb-bc339d367842
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...
d896ea68-1976-4b3c-9762-3b62a2c83474
3
protected static void buscarPalabraDescripcion(String buscar){ try{ BufferedReader stdin=Files.newBufferedReader(path, java.nio.charset.StandardCharsets.UTF_8); String linea=""; while((linea=stdin.readLine())!=null){ String [] part=linea.split(";"); if(part[1].contains(buscar)){ Sys...
a50a968c-8b1c-49d8-b204-5f981826a458
0
public static void main(String[] args) { Parent parent = new Child(); System.out.println("field=" + parent.field + ", getField()=" + parent.getField()); Child child = new Child(); System.out.println("field=" + child.field + ", getField()=" + child.getField() + ", getSuperField()=" + child.getSuperField()); ...
62611aa2-c7d7-4ddc-87c8-972e6717d435
7
public void print(String pathFile){ StringBuffer res = new StringBuffer(); resetCounters(); for(int i=0;i<size;i++){ res.append( "\""+this.PoNumber.get(i) +"\",\""+ this.parameters.get(i)+"\",\""+ this.isKindOfWD.get(i)+"\",\""+ this.poGenerated.get(i)+"\",\""+ this.proofStatePmiF...
5ecb3a1e-8d40-4c85-97a0-bc9aadbde373
3
@Override public LinkedList<String> words() { LinkedList<String> l = new LinkedList<String>(); // Return only the words appearing with low frequencies. Here words with less than 5 occurrences // in the text. for (int i = b; i <= 32; i++) for (Occurrence occ : strTab.get(i)) i...
8d9961b8-8ffb-4f22-9abc-dc23405b9fb2
6
private void modificar(){ r_con.Connection(); // Controlo los campos Numericos si son en blanco hay que ponerle null, sino da error // ej:String dni = field_codigo.getText(); String codigo=null; if (!field_codigo.getText().equals("")){ codigo=field_codigo.g...
9600103a-e90f-4a14-83f6-46ec37d2c02b
7
private void pushInsert(final Object key, Object value) { //System.out.println("PushKeyHash:" + key + "\t" + hash(key.hashCode()) + "\t" + hash(hash(key.hashCode()))); int code=key.hashCode(); int hash =hash(code); int hash2 =hash2(code); int hash3 =hash3(code); //assert hash != hash2 && hash2 != hash3; h...
a5c7a866-9645-4b01-92c1-9e9c6c9e8265
2
public static void EurosToDolares(){ final BufferedReader stdin2=new BufferedReader (new InputStreamReader(System.in)); try{ System.out.print("Intoduce el importe en euros => "); euro=Double.parseDouble(stdin2.readLine()); System.out.println("El valor de cambio es "+cambio+"€ => 1 $"); System.out.print...
10875f7a-eb51-4439-a3aa-2e4255f708fd
8
public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (obj.getClass() != this.getClass()) return false; Picture that = (Picture) obj; if (this.width() != that.width()) return false; if (this.height() != that.height()) return...
3ca9a1a2-886b-41fc-8530-f67bf8632243
2
public void read_activated(Pipe pipe_) { // Skip activating if we're detaching this pipe if (pipe != pipe_) { assert (terminating_pipes.contains (pipe_)); return; } if (engine != null) engine.activate_out (); else pipe...
821b4ab8-c51a-4edc-bafa-b00d79db8b17
4
public static void main(String[] args) throws IOException { if ((args.length != 1) && ((args.length != 2) || ! args[0].equals("-no-opt"))) { System.err.println("Usage: java SFECompiler [-no-opt] <file>"); System.exit(1); } String fileName; boolean opt = true; if (args.length == 2) { fileNam...
f3fe1363-05ee-4b58-9087-bb51bd9616af
3
private String moveCardOntoKingPile(List<Card> from, int indexFrom, int indexTo) { List<Card> toPile = kingPiles.get(indexTo); if (indexFrom == -1) indexFrom = from.size() - 1; Card toMove = from.get(indexFrom); //Assumes at least one card remaining. Card pileTop = toPile.get(to...
ddac79fc-59cd-45ce-9134-09d6b6c9ce61
6
@EventHandler public void EndermanResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEndermanConfig().getDouble("Enderma...
73ccacfd-40b6-4481-8a58-dc73be1682b3
9
public boolean isSpecialFacultyTitle(String jobtitle) { return ( "Andrew D. White Prof-At-Large".equals(jobtitle) || "Prof Assoc Vis".equals(jobtitle) || "Prof Asst Visit".equals(jobtitle) || "Prof Visiting".equals(jobtitle) || "Prof Adj".equals(jobtitle) || "Prof Adj Assoc".equals(jobtitle) || "P...
82f7e208-c7c3-4aa3-81a6-7ed61b2a5089
0
public SliderPanel(String s, HumanFirstPane p) { super(new BorderLayout()); myPane = p; myDisplay = new JTextArea(1, 30); myDisplay.setEditable(false); myLengthDisplay = new JTextArea(1, 5); myLengthDisplay.setEditable(false); JPanel displayPanel = n...
9ab8761e-1df9-48ed-97e9-d4a12891de83
1
public Shader() { program = glCreateProgram(); uniforms = new HashMap<String, Integer>(); if(program == 0) { System.err.println("Shader creation failed: Could not find valid memory location in constructor"); System.exit(1); } }
1e8a77ad-61d5-4753-bfb2-ab1469bc9d36
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
37d6d333-7bc5-4b23-9263-9132221cfe61
6
public static void setDefaultGraphStyle(mxAnalysisGraph aGraph, boolean resetEdgeValues) { mxGraph graph = aGraph.getGraph(); Object parent = graph.getDefaultParent(); Object[] vertices = aGraph.getChildVertices(parent); mxIGraphModel model = graph.getModel(); for (int i = 0; i < vertices.length; i++) { ...
25126ec8-df69-4d5d-8ca1-51a08d0e85a1
4
public String convertPlayerListToString(HashMap<String, GameTeam> hash) { if (hash == null || hash.isEmpty() || hash.size() < 1) return ""; StringBuilder sb = new StringBuilder(); for (Map.Entry<String, GameTeam> en : hash.entrySet()) { sb.append(en.getKey()+"#"+en.getValue().toString()+","); } sb.deleteCh...
52a06695-c1c6-4293-97b3-4b008a50373f
8
private void titleHelper() { if (title != null) { // Controls. if (input.get("left") || input.get("right")) { clearKeyBinds(); title.switchButton(); // Throttle input so it doesn't constantly switch. try { Thre...
8ec0c096-3876-4cf3-8e3b-1ec2b604857a
2
public void testPropertySetCopyMonth() { LocalDateTime test = new LocalDateTime(1972, 6, 9, 10, 20, 30, 40); LocalDateTime copy = test.monthOfYear().setCopy(12); check(test, 1972, 6, 9, 10, 20, 30, 40); check(copy, 1972, 12, 9, 10, 20, 30, 40); test = new LocalDateTime(1...
7469b7f6-77d6-4382-8b33-5332e97f2f0a
4
private int printDown( ArrayList<Pair> pairs, Arc a, int hint ) throws MVDException { if ( a.numChildren() > 0 ) numParents++; Pair p = a.toPair( parents, orphans ); pairs.add( p ); a.to.printArc( a ); if ( a.to != null ) { Node u = a.to; if ( u.allPrintedIncoming() ) { if ( hint != -1 ) ...
ffee0533-09dd-44d5-a2bb-1d73d1fc0562
1
public void doLargeFixedLengthWithPZMap() { try { final String mapping = ConsoleMenu.getString("Mapping ", LargeFixedLengthWithPZMap.getDefaultMapping()); final String data = ConsoleMenu.getString("Data ", LargeFixedLengthWithPZMap.getDefaultDataFile()); LargeFixedLengthWit...
27b612ba-7dd0-4023-b488-8d1b1c32f72a
3
private List<Vertex> getNeighbors(Vertex node) { List<Vertex> neighbors = new ArrayList<Vertex>(); for (Edge edge : edges) { if (edge.getSource().equals(node) && !isSettled(edge.getDestination())) { neighbors.add(edge.getDestination()); } ...
7d8ce32d-c0a5-4461-a7cd-b57e9ccb8396
6
@Override public void close() throws IOException { synchronized (this) { if (state == SystemState.CLOSED) throw new IOException("Storage was closed earlier."); boolean needGCrun = false; try { if (randomAccessFile != null) { ...
cd2ed9c5-6660-4080-85fd-32a49a19b38c
7
public static void main(String[] args) { System.out.println("nr of frames: "); Scanner scanner = new Scanner(System.in); int frames = scanner.nextInt(); Bowling bowling = new Bowling(); Roll currentRoll = new RollBuilder().createRoll(); for (int i = 1; i <= frames; i++) {...
9b37f885-e15c-4286-bf08-d8750e4542e9
0
public ItemList() { }