method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
dcdf3ae1-0926-4c1d-96f5-11dd996d3608
7
private void find(int opened, int closed, int n, String validPath) { //finish if(opened == n && closed == n) { if(!validCombinations.contains(validPath)) validCombinations.add(validPath); return; } //first pass or can we add a "(" ? if(opened == 0 || opened<n) { validPath += "(";...
de268379-b771-4538-9288-05be6461e51b
9
private void reshapeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reshapeButtonActionPerformed try { JViewport viewport = spriteSheetScrollPane.getViewport(); SpriteSheetPane ssPane = (SpriteSheetPane) viewport.getView(); ButtonModel selectedModel =...
c8466563-7535-448a-99a4-7478d89f08f4
7
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); String line = null; StringBuilder sb = new StringBuilder(); StringBuilder alertDiv = new StringBuilder(); String advisory = ""; try { URL url =...
5c3e82dd-a5b6-4397-8160-565c6ffdd5c9
2
public int getPlayerIndexByID(int id) { for (Player player : players) { if (player.getPlayerID() == id) return player.getPlayerIndex(); } return -1; }
c8ac58a4-71d9-40d5-9a24-59b149963ee5
7
@Override public void actionPerformed(ActionEvent event) { if (event.getSource()== m_generateBarButton){ generateBarChart(); } else if (event.getSource()== m_generatePieButton){ generatePieChart(); ...
4c208d90-ecf8-4bb8-ae3e-1c6c317d2646
9
public int firstMissingPositive(int[] a) { if (a == null || a.length==0){ return 1; } int i=0; while(i<a.length){ if(a[i] >0 && a[i]<a.length && a[a[i]-1] != a[i] && a[i] != i+1){ swap(a, i, a[i]-1); } else{...
162c8f50-2fbe-4deb-863f-3b125c8008d9
0
private boolean isValidNumber(final int aNumber) { boolean res = false; return !(Integer.toString(aNumber).endsWith("5")); }
a4ecdcab-ca2b-42ae-b0fb-9d39ecb09e90
8
public int threeSumClosest(int[] num, int target) { Arrays.sort(num); int min = Math.abs(num[0] + num[1] + num[2] - target); int rst = num[0] + num[1] + num[2]; for (int i = 0 ; i < num.length - 2; i++ ) { int k = num.length -1; for ( int j = i +1; j< num.length -1; j++...
8c0ef86b-0c2f-4c93-a829-b9691dcb669a
2
public String comparer(Carte carteAdverse){ if (puissance > carteAdverse.puissance){ return "gagne"; } else if (puissance < carteAdverse.puissance){ return "perdu"; } else return "bataille"; }
c9b61ef0-e246-47fd-922a-b030953e5651
3
private Socket connect () { Socket s = null; int attempts = 0; do { attempts ++; try { s = new Socket(host, port); s.setKeepAlive(true); s.setSoTimeout(0); } catch (Exception e) { String msg = String.format("Warning: connection attempt %d to %s failed.", attempts, ge...
a6ef6f15-628b-44e0-906a-12b94fc18e38
7
public void rotarAdelante() { if (direccion.equals(Direccion.derecha)) { rotar(tipoTrans.enZ, 90); } else if (direccion.equals(Direccion.izquierda)) { rotar(tipoTrans.enZ, -90); } else if (direccion.equals(Direccion.atras)) { rotar(tipoTrans.enZ, 180); ...
bf2bb3d3-afc3-451f-948d-234c0388db81
7
private void writeToFile( final MultiProcessor executor, final Map<String, ByteClass> byteClasses, final List<Pair<ZipEntry, byte[]>> fileEntries, final BiMap<String, String> nameMaps, final...
a794c60e-7584-4438-9acc-b874435e403c
6
public String getDescription() { StringBuffer result = new StringBuffer(String.valueOf(addr)) .append('_').append(Integer.toHexString(hashCode())) .append(": ").append(opcodeString[opcode]); if (opcode != opc_lookupswitch) { if (hasLocalSlot()) result.append(' ').append(getLocalSlot()); if (succs ...
d1acaf68-6f61-4c96-a4df-3b845c2856e2
7
@Override public void run() { if (bot.hasMessage()) { message = bot.getMessage(); channel = bot.getChannel(); sender = bot.getSender(); } if (this.message.startsWith("~vote")) { tokenize(false, 5, this.message); try { ...
6d6b75f1-f00c-4a49-a4b9-a086c6ef96e2
4
@Test public void getContactsWithIdsNormalTest() { contacts3 = generateListOfContacts3(); Contact steve = null; Contact jane = null; Contact tim = null; int idSteve = 0; int idJane = 0; int idTim = 0; for (Contact curr : contacts3) { if (...
cb5454ea-1d97-4886-a305-f9d143e6852c
4
public void setCoordinate(Coordinate a) { boolean test = false; if (test || m_test) { System.out.println("Grid :: setCoordinate() BEGIN"); } m_Grid[a.getX()][a.getY()] = a.getValue(); if (test || m_test) { System.out.println("Grid :: setCoordinate() END"); } }
510ba68b-83f5-4900-98c0-9cc4d4f58920
4
private static boolean isUnique(String input) { if(input==null || input.isEmpty()) return false; HashSet<Character> uniqueChars = new HashSet<Character>(); char[] inputStrArray = input.toCharArray(); for(char c: inputStrArray) { ...
e422bd7e-d067-4a01-99f5-411efc42025f
1
@Test public void storeTestInvalidUserId() { try { assertFalse(new Transaction().store(123, 56342)); } catch (IOException e) { System.out.println("Invalid data"); } }
939d9102-b20c-4993-b14b-a489a79de074
1
public static int calcularFatorial(int numero){ if (numero <= 0) { return 1; }else{ return (numero * calcularFatorial(numero-1)); } }
29523333-218b-49da-8901-517921e3ffe5
2
@Override boolean accepts(A value) { switch (polarity) { case Pos: return this.value.equals(value); case Neg: return !this.value.equals(value); } throw new IllegalStateException(); }
901562c2-ded3-4222-8034-33f2a849a0f0
5
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { dx = -1; } if (key == KeyEvent.VK_RIGHT) { dx = 1; } if (key == KeyEvent.VK_UP) { dy = -1; } if (key == KeyEvent.VK_DOWN) { dy = 1; } if (key == KeyEvent.VK_SPACE) { move(); ...
7c41cbb3-b8a8-40e1-8b35-fddaf2c0a1c6
7
void frameControl(Token token, boolean isSubCmd) throws ScriptException { switch (token.tok) { case Token.playrev: viewer.reverseAnimation(); case Token.play: case Token.resume: viewer.resumeAnimation(); return; case Token.pause: viewer.pauseAnimation(); return; case Token.next: viewer.set...
246bdf90-6962-480b-9328-2984b88b5b31
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...
a9d3d1e1-d23a-47bd-af84-c12ed3ccb6db
6
private void valid(int depth50m, int depth10m, int depth1m) throws AxisWithoutMeaningErrorException { if (depth50m < min50m || depth50m > max50m) { throw new AxisWithoutMeaningErrorException(); } if (depth10m < min10m || depth10m > max10m) { throw new AxisWith...
8f5e8d4e-4962-48f1-9cce-23ad3e88e975
4
public boolean containsMatchingLoad(CombineableOperator comb) { Operator combOp = (Operator) comb; if (comb.getLValue().matches(this)) { if (subsEquals((Operator) comb.getLValue())) return true; } for (int i = 0; i < subExpressions.length; i++) { if (subExpressions[i].containsMatchingLoad(comb)) r...
1df6d938-6828-44c9-beba-7366e5c04165
5
public boolean impacto(Disparo pDisparo) { boolean impactado = false; if((pDisparo.getX() >= x && pDisparo.getX() <= x + 90.0) && (pDisparo.getY() >= y && pDisparo.getY() <= y+90.0)) { impactado = true; } if(impactado) { toquesRecibidos++; } return impactado; }
8fb16a93-e4dc-4a49-8c81-08936a5c6501
6
LeagueError valid() { // check for lock if (!teamDivVector.isLocked()) { return LeagueError.NOTHING_EDITED; } // check nof teams for (int div = 1; div <= modus.getNofDivisions(); div++) { if (modus.getNofTeams() != teamDivVector.getNofTeams(div)) { // wrong nof teams for division teams (but don't c...
4b83815d-c382-4fa8-b495-43dc6159b0b9
6
public ListNode deleteDuplicates(ListNode head) { if(head == null || head.next == null) { return head; } ListNode firstHead = new ListNode(Integer.MIN_VALUE); ListNode lastDistinct = firstHead; ListNode slow = head; ListNode fast = head.next; boolean inDuplicated = false; while(fast != nu...
bf8a214e-18ae-4509-a52d-d5490ba3465e
3
public boolean equals(Object obj) { if(obj instanceof Element) if(protons == ((Element)obj).protons && quantity == ((Element)obj).quantity) return true; return false; }
1e6dae96-7c69-4116-9b30-7dc588a24291
5
@Override public List<Student> getStudent(int courseId) throws SQLException { List<Student> studentList = new ArrayList<>(); Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect = Dri...
5e7b27d1-87f7-449c-99bd-e25179fe2c97
8
public void setText(String text) { Assert.isNotNull(text); this.text = LegacyActionTools.escapeMnemonics(text); if (label != null && !label.isDisposed()) { label.setText(this.text); } if (this.text.length() == 0) { if (isVisible()) { setVisible(false); IContributionManager contributionManager...
a796e0a9-4f94-48ec-9d8c-c9a6ee76beb3
5
@Override public boolean equals (Object obj) { if (!(obj instanceof PollItem)) return false; PollItem target = (PollItem) obj; if (socket != null && socket == target.socket) return true; if (getRawSocket () != null && getR...
0833b955-c71b-4a9a-bebe-4ed3bf520471
0
public UpdateFrame getFrame() { return frame; }
3d71aff2-b36c-459a-ad67-a5377c02c108
6
public void getRollInfo(gamelogic.PublicGameBoard pub, boolean exp) { List<Integer> data = pub.rollData(); for (int i = 0; i < data.size(); i++) { Tile active = (exp)? getTileByIntExp(i):getTileByInt(i); if (active == null) return; if (active.resource() == TileType.Desert || data.get(i) < 2 || data.get(i) ...
91c47e45-d3eb-4c9d-902b-c3daafafdb15
8
public void ackRecieved(UtpTimestampedPacketDTO pair) { int seqNrToAck = pair.utpPacket().getAckNumber() & 0xFFFF; // log.debug("Recieved ACK " + pair.utpPacket().toString()); timeStampNow = timeStamper.timeStamp(); lastAckRecieved = timeStampNow; int advertisedWindo = pair.utpPacket().getWindowSize() & 0xFFFF...
5b4db100-6c0c-4fda-b589-a3b18e7dc20d
9
public static boolean generateItemFile(String fileName, Set<String> set, List<Set> listTree) { boolean ret = false; BufferedWriter bw = null; FileWriter fw = null; File file = null; PrintWriter pw = null; OutputStreamWriter osw = null; FileOutputStream fo = null;...
1eef2253-5e67-445f-acb6-8495a0575cba
1
public List<TipoCultivo> ObtenerTipoCultivo(String consulta){ List<TipoCultivo> lista=new ArrayList<TipoCultivo>(); if (!consulta.equals("")) { lista=cx.getObjects(consulta); }else { lista=null; } return lista; }
1d144e34-9baa-41e3-b3f6-24068edb8d05
2
public Timenode getnode(int id, ArrayList<Object> list) { Timenode node = new Timenode(); for (Object tmp : list) { node = (Timenode) tmp; if (node.getId() == id) return node; } return node; }
190d3b30-7f28-40c5-856a-7995940f156d
5
public String nextToken() throws Exception { // Skip blanks. while (Character.isWhitespace(ch)) { nextChar(); } while (ch == ';') { line = reader.readLine(); nextChar(); } // At EOF? if (ch == 0) { return nul...
f66140d0-2ad3-4d13-b6b5-e6b9207e1038
0
public Set<String> getPermissions() { return this.permissions; }
665c4501-42cc-417e-bfcf-04e766f49d22
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."); ...
7fea6110-20e7-4a16-be78-4d5ec88e2370
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this.opt(i...
b5d12401-0538-4eda-909a-2099fd59f2aa
7
public void rotarDerecha() { if (direccion.equals(Direccion.izquierda)) { rotar(tipoTrans.enZ, 180); } else if (direccion.equals(Direccion.adelante)) { rotar(tipoTrans.enZ, -90); } else if (direccion.equals(Direccion.atras)) { rotar(tipoTrans.enZ, 90); ...
9e88591c-da14-4c2e-af6a-300007539a72
9
public void setEffects() { switch(type) { case 0: typeString = "Splash"; splashRadius = 50*level; phrase1 = "Splash Radius: " + splashRadius; range = 300; damage = 2*level; reloadCount = 200-5*level; break; case 1: typeString = "Gold"; extraGold = 50*level; phrase1 = "Gold/Kil...
4f638e09-73fc-4b68-b3ea-871137e00569
8
public short getType(String name) { name = String.valueOf(name).toUpperCase(); if (name.equals("HUFFMAN")) return HUFFMAN_TYPE; if (name.equals("ANS")) return ANS_TYPE; if (name.equals("FPAQ")) return FPAQ_TYPE; if (name.equals("P...
edc619da-34b8-4207-a7eb-f57821320d2c
7
private static QuoteOrigin getOrigin(String text) { if (text.contains("/אונקלוס")) { return QuoteOrigin.ONKELOS; } if (text.contains("/בבלי")) { return QuoteOrigin.BAVLI; } if (text.contains("/ירושלמי")) { return QuoteOrigin.YERUSHALMI; ...
db9d0e35-c5fa-47fb-b337-9229fba798ee
1
private void init() { for (int x = 0; x < 10; x++) { int randx = random.nextInt(10); int randy = random.nextInt(10); addActor(ActorType.chicken, new Point(25000 + randx, 25000 + randy));//THis should add chickens } // for (int x = 0; x < 10;...
5d488df0-ff1a-4047-a91f-d2cd6c0ad2b3
6
public void startServer(){ ServerSocket server=null; try { try{ fetchUsers(); } catch (FileManagerException e){ FileManager.placeToLog(e.getMessage()); users=new ConcurrentLinkedDeque<>(); } serve...
995c8197-8d19-4b83-b0dc-7648ffeea97f
7
public void dropNew() { // Get all available items String[] playerItems = player.getInventory().getItemTexts(); if (playerItems.length == 0) { log.println("You have nothing to drop."); } else { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(0, 1)); final JCheckBox[] checkBoxes = new JCh...
8393be93-d39c-47ba-bd64-808b8805279e
9
private String prevediIzLatiniceUCirilicu(String rec) { String recLatinica = ""; String slovo = ""; char c; niz: for (int i = 0; i < rec.length(); i++) { //provera da li su u pitanju dvoslovna slova if ((i != rec.length() - 1 && String.valueOf(rec.charAt...
b3981c15-8c40-4c85-bd67-7dc8df2bd341
2
public double[] columnVariances(){ double[] variances = new double[this.numberOfColumns]; for(int i=0; i<this.numberOfColumns; i++){ double[] hold = new double[this.numberOfRows]; for(int j=0; j<this.numberOfRows; j++){ hold[i] = this.matrix[j]...
69cc0655-811d-4f23-bcca-6a1985badd8a
0
public String getStrada() { return strada; }
b5db72f7-1881-4300-aec0-463492e3ac7d
8
public void manger(Aliment mange, int quantite, Loft plateau){ if (plateau.plateauCase.get(this.getPosition()).contenuNeuneu.size() >1){ int k=0; for (Neuneu neuneu : plateau.plateauCase.get(this.getPosition()).contenuNeuneu ){ while (k==0){ if (neuneu.getId_joueur() != this.getId_joueur()){ ...
f7b8bbb7-db62-4a54-b070-a31209fb3cc1
0
public void setPersonId(int personId) { this.personId = personId; }
1c2fef7e-7602-4fa8-8205-d2341a1c3438
8
public static void saveToFile(String fileName, InputStream in) { FileOutputStream fos = null; BufferedInputStream bis = null; byte[] buf = new byte[BUFFER_SIZE]; int size = 0; bis = new BufferedInputStream(in); try { fos = new FileOutputStream(fileName); ...
53948b6c-d2e3-4065-8141-be98b2879387
2
private static List<Cards> choose2(Cards cards) { // Given a list of cards, give me back a list of the // complete list of subsets of size num int size = cards.size(); List<Cards> subsets = new ArrayList<Cards>(); for (int i1 = 0; i1 < size - 1; i1++) { Cards subset =...
bd446464-89a3-485d-8846-b7c04295d1ea
5
@Override protected void parseSelf(Document doc) throws ProblemsReadingDocumentException { List<?> result = queryXPathList(TITLE_XPATH, doc); if ((result != null) && (result.size()>0)) setTitle(((Element) result.get(0)).getText()); else throw new ProblemsReadingDocumentException("Can't read discography ti...
f28fef20-4cb7-476d-894b-9fcf537c0efa
6
private boolean register(String id) { ConnectionConfiguration config = new ConnectionConfiguration( XMPP_SERVER, XMPP_PORT); Connection connection = new XMPPConnection(config); if (registeredLastTime && REGISTRATION_DELAY > 0) { System.out.println("Sleeping for " + REGISTRATION_DELAY + " minutes. Need...
8104b286-2acf-4bf6-b295-e75713ea7333
9
private void parseCommand(String command) { // Commands: // !new-bid <description> // !auction-ended <winner> <amount> <description> String cmdRegex = "![a-zA-Z-]+"; String tmp; Scanner sc = new Scanner(command); sc.useDelimiter("\\s+"); sc.skip("\\s*"); if (!sc.hasNext(cmdRegex)) return; tm...
affaaeb8-6b9f-49cf-8195-0346f68f552c
0
@Override public void Area(double dx) { this.hight+=dx; this.rad+=dx; this.area = 2*Math.PI*rad*(rad+hight); }
58e6d017-d7a8-47d6-a9f1-40ee51daaa69
4
public static void stop() { try { System.out.println("main: stop the program"); // eventually write the statistics if (!win) { Gui.writeStatus(); } System.out.println("main: statistics written"); // Wait for the images to complete while (Gui.pro.size() != 0) { Gui.pro.get(0).join(); ...
1d4e52c6-a78c-4b8f-8bfd-a64b2c9eec4e
4
public void set_order_to() { if(Idx!=null) { if(Idx.fidx!=null) { try { Idx.fidx.close(); } catch (IOException e) { e.printStackTrace(); } } Idx = null; } order = ""; if(Cdx!=null) Cdx.I = -1; }
c04a0bd8-b6a8-41b6-affa-d9d855f5be3d
8
private int neighbors(int row, int col) { int count = 0; for(int r = row-1; r <= row+1; r++) for(int c = col-1; c <= col+1; c++) { if(r < 0 || r >= map.length || c < 0 || c >= map[0].length) continue; if(map[r][c] =...
4529ca14-3a44-421e-8d30-11f4564a4dbf
8
public MBB3D getMBB() { // Dag if (size() > 0) { Iterator<Point3D> it = this.iterator(); it.hasNext(); Point3D p = it.next(); double xMin = p.getX(); double yMin = p.getY(); double zMin = p.getZ(); double xMax = xMin; double yMax = yMin; double zMax = zMin; double value; while (it.h...
4bbcf9b4-1195-48d4-ad68-a7fff5a5e787
8
String classToType(Class cls) { if (cls==Point.class) { return "int2"; } else if (cls==Integer.TYPE || cls==Integer.class ) { return "int"; } else if (cls==Double.TYPE || cls==Double.class ) { return "double"; } else if (cls==String.class) { return "String"; } else if (cls==Boo...
e585392b-af9c-4798-8db5-4ca33a5f4211
6
private void validate(Match match) { if (match == null) { throw new ValidationException("match is null"); } if (match.getHomeTeam() == null || match.getAwayTeam() == null) { throw new ValidationException("match team is null"); } if (match.getResult() == nu...
2f95a3b7-72dc-4e17-a191-a228b1563003
8
public String get(String path,String fsxml,String mimetype) { if (auth==null) { auth = getAuth(); } String url = "http://"+ipnumber+":"+port+"/"+name+"/proxy/"+path; if (url.indexOf("?")!=-1) { url+= "&spw="+auth; } else { url+= "?spw="+auth; } System.out.println("PROXY URL: " + url); Response ...
0ea25e3f-a0ac-4952-ba9b-d459dc41f9ae
3
private void delete() throws SQLException { if (gui.connected) { int row = table.getSelectedRow(); if (row != -1) { rslt.absolute(++row); try { rslt.deleteRow(); reload(); } catch (SQLException e) { state("cant delete insert row"); gui.handleSQLException(e); } } else { ...
8dc10ff0-5adb-44c2-b069-4a4c038fffc9
4
public void run() { String s; try { System.out.println(timeStamp.getCurrentTime() + "::" +"Starting Status thread"); statusSocket = new ServerSocket(statusPort); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (true) { try { statusAcceptSocket = ...
6a090cde-2b24-444e-a502-f53e737a1943
6
@RequestMapping("/startQuiz") public ModelAndView startQuiz(@ModelAttribute QuizQuestion question, HttpServletRequest request) { System.out.println("In startQuiz"); ModelAndView mv = new ModelAndView("viewQuizQuestion"); String courseId = request.getParameter("courseId"); String quizId = request.getPar...
c9191b08-d65f-4440-980b-a507fd2fea9f
0
@Test(expected = ParkException.class) public void out_a_car_when_park_is_empty() { Park park = new Park(10); park.out(new Ticket()); }
93777de8-aceb-4eea-9ad7-b63f045ba960
6
Class318_Sub7(AbstractToolkit var_ha, Class129 class129, Class318_Sub10 class318_sub10, long l) { ((Class318_Sub7) this).aClass284_6444 = new Class284(); aClass284_6449 = new Class284(); aBoolean6453 = false; try { aLong6435 = l; ((Class318_Sub7) this).aClass129_6436 = class129; ((Class318_Sub7) ...
293af827-b7e4-4fe8-9773-bc916fcb8478
5
protected void getClosePlants() { Thread radarThread = new Thread(new Runnable() { @SuppressWarnings("unchecked") @Override public void run() { // True if this creature is alive while (isAlive()) { // clone the Grid.plants, the centralised repository of // plants, so there will less concurrent...
0c5e232d-d414-4b32-aba6-3e44e1a7bd7f
0
public static void updateFonts() { font = new Font(Preferences.getPreferenceString(Preferences.FONT_FACE).cur, Font.PLAIN, Preferences.getPreferenceInt(Preferences.FONT_SIZE).cur); readOnlyFont = new Font(Preferences.getPreferenceString(Preferences.FONT_FACE).cur, Font.ITALIC, Preferences.getPreferenceInt(Prefer...
f6091597-cfaf-4071-bd2b-57976f014253
8
private void createRootWindowProperties(GradientTheme theme) { rootProperties.getTabWindowProperties().getTabbedPanelProperties().addSuperObject(theme.getTabbedPanelProperties()); rootProperties.getTabWindowProperties().getTabProperties().getTitledTabProperties().addSuperObject( theme.getTitledTabProper...
dee24a96-fb31-4fd8-a59e-88eba0d6050f
4
private String getVersionfinal (Class classe) { String version = ""; try { ClassLoader cl = this.getClass().getClassLoader(); String threadContexteClass = classe.getName().replace('.', '/'); URL url = cl.getResource(threadContexteClass + ".class"); if ( url != null ) { String path = url.getPath(); ...
8cc2cdbc-7791-4773-9f31-f3c2feabf67d
0
public RoomEventType(final String name) { super(name); }
e1fdb4a3-1c72-41f9-8d90-c89b95cc3be4
1
public void remover(long pesquisaId) throws Exception { String sql = "DELETE FROM Pesquisainstituicoes_cooperadoras WHERE id1 = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, pesquisaId); stmt.execute(); } catch (SQLException e) { ...
8bfd72d6-b708-4dad-8e3b-581595803461
8
public List<AngularBond> getBends() { if (model == null) return null; if (model.bends == null || model.bends.isEmpty()) return null; List<AngularBond> list = null; AngularBond aBond = null; synchronized (model.bends.getSynchronizationLock()) { for (Iterator it = model.bends.iterator(); it.hasNext();)...
c3933519-6c26-4d66-87d1-29dae654e104
2
public void setOrderList() { listModel.clear(); for (Order order : driver.getOrderDB().getCustomerOrderList()) { if(order.isStatus()) listModel.addElement(textAlignment(" " + order.getId(), "" + order.getDateString(), "" +order.getPerson().getName(), "" +order.getCurrentlyLoggedInStaff().getN...
4aa01770-04fb-4e01-b17d-0fd78683ba39
6
@EventHandler public void SlimeSpeed(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.getSlimeConfig().getDouble("Slime.Speed.DodgeC...
28907053-81fe-4d1b-9f6f-d2c35427164d
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Dataset)) { return false; } Dataset other = (Dataset) object; if ((this.key == null && other.key != null) || (t...
75e0bf84-87f4-4bed-8e11-5242406b09ff
1
public InferenceIdentifier getInferenceIdentifier() { if (inferenceWorker != null) { return inferenceWorker.getInferenceIdentifier(); } return null; }
caacef5a-ac24-47bd-be94-99cd3ed41423
8
public String getPartnerName() { if(conProt == null && internetCon == null) return ""; if(conProt != null) { if(conProt.getConnectedName().equals("null") && getLANConnections()) return "Unidentified System"; if(!conProt.getConnectedName().equals("")) return conProt.getConnectedName(); } if(i...
a98b9279-b120-498c-987d-4770b464f96c
0
public void setPrice(String price) { this.price = price; }
31eca656-416b-4a2f-b7f2-ef054501afc5
1
private void trySetUTFEncoding() { try { setEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { System.err.println("Cannot set UTF-8 encoding."); } }
2bdfe3ac-e98a-4abc-823d-b19916b65f6d
9
public SessionListPanel() { final SessionTableModel dm = new SessionTableModel(); final JTable t = new JTable(dm); dm.setTable(t); t.getColumnModel().getColumn(1).setCellRenderer( new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = -61631797930767600...
8f3237ff-e8dc-4c6e-8ee1-e23d20cabce0
4
private int berekenIndex(boolean top, boolean right, boolean bottom, boolean left){ int index = 0; if(top) index += 1; if(right) index += 2; if(bottom) index += 4; if(left) index += 8; return index; }
25aeb6af-fa07-4d16-a626-febd21311e10
3
@Override public List<IllnessDTO> getAllIllnesses() throws SQLException { Session session = null; List<IllnessDTO> illnesses = new ArrayList<IllnessDTO>(); try { session = HibernateUtil.getSessionFactory().openSession(); illnesses = session.createCriteria(IllnessDTO.c...
3e5040a0-f9fe-4032-a084-1b031657c208
2
private String padTo(String padee, int length) { if (padee.length() >= length) return padee; StringBuilder builder = new StringBuilder(); for (int i = padee.length(); i < length; i++) { builder.append(" "); } builder.append(padee); return builder.toString(); }
f4df2bac-8b8e-4469-b1b2-3d68959597b3
3
public static long getDate(String buffer) { if (buffer != null) { buffer = buffer.trim(); for (int i = DateFormat.FULL; i <= DateFormat.SHORT; i++) { try { return DateFormat.getDateInstance(i).parse(buffer).getTime(); } catch (Exception exception) { // Ignore } } } return System.cur...
fed1b146-939b-408d-85d0-a18b6c483391
4
protected Name parseName(String contents) { int firstSlash = contents.indexOf('/'); int lastSlash = contents.indexOf('/', firstSlash + 1); String surname = null; String givenname = null; if (firstSlash >= 0 && lastSlash > firstSlash) { surname = contents.substring(firstSlash + 1, lastSlash); surna...
b927edbe-d911-4bad-afe9-96af0831b617
2
public void log(String message) { //skip if no writer if (this.bufferedWriter == null) return; try { //write message String logMessage = String.format("[%s] %s", Logger.FORMATTER.format(LocalDateTime.now()), message); this.bufferedWriter.write(logMessage + System.lineSeparator()); this.buffer...
794455d1-c608-4113-818f-b9ec78c8f06d
3
private static ArrayList<NumberToken> toTokens(ArrayList<String> in){ assert (in != null); ArrayList<NumberToken> toReturn = new ArrayList<NumberToken>(in.size()-1); for (String s : in){ NumberToken toAdd = new NumberToken(s); // If we could...
cd7fc342-d1f6-4468-99b7-37bb89af4c94
5
public List<Cineplex> getCineplexes(int month) { cineplexes = new ArrayList<Cineplex>(); for(Cineplex cineplex : cineplexDAO.getCineplexes()) { for(Cinema c : cineplex.getCinemas()) { for(ShowTime st : c.getShowTimes()) { calendar.setTime(st.getTime()); int sMonth = calendar.get(Calendar.MONTH); ...
476abe4a-0b6a-47ec-b41c-795331502586
9
protected boolean isValidDrop(GameState state, int x, int y) { boolean nifu = true; for (int i = 0; nifu && i < 9; i++) { nifu = !(state.getPieceAt(x, i) instanceof Pawn && state.getPieceAt(x, i).getAllegiance() == this.getAllegiance()); } Piece tempRep = s...
9e23020c-e3c7-48bc-8b63-9693404de6ae
1
private static ArrayList<String[]> makeGeneration(int poolSize) { ArrayList<String[]> decks = new ArrayList<String[]>(); for (int i = 0; i < poolSize; i++) { decks.add(Game.makeDeck()); } return decks; }
d028a96c-d862-46c4-87c6-85eba7a7ef65
5
public void filter(byte[] samples, int offset, int length) { if (source == null || listener == null) { // nothing to filter - return return; } // calculate the listener's distance from the sound source float dx = (source.getX() - listener.getX()); float ...
c9aee305-4c09-485a-815a-8ae4458e8cfa
7
public void sincronizaClientes(){ PhpposAppConfigEntity appConfig = getAppConfig("id_pos"); if (appConfig != null) { List<VPosFuncionarios> vPosFuncionarios = facOracleDAO.getVPosFuncionarios( Integer.parseInt(appConfig.getValue())); for(VPosFuncionarios funci...
851cd295-631c-4a09-816f-3906193c87c1
4
@Override protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) { String access = RegionExecutor.parse(args, 0, "<Access>", sender); if (access == null) return false; if (region.access.contains(access))...