method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8ebf0a3a-2acf-48e2-be41-256faeb0cb45
3
public synchronized boolean removeItem(FieldItem item, Position position){ if ((position.getX() <= this.getXLength()) || (position.getY() <= this.getYLength())) return false; if (field[position.getX()][position.getY()] == item) { field[position.getX()][position.getY()] = null; re...
abc75f23-c1c5-4297-8462-daaab2a9263f
4
private static int[] gcd( int numerator, int denominator ) { int highest; int n = 1; int d = 1; if( denominator > numerator ) { highest = denominator; } else { highest = numerator; } for( int x = highest; x > 0; x-- ) { if( ((denominator % x) == 0) && ((numerator % x) == 0) ) { ...
2984815f-9c6e-4fb4-bba7-5469590bab81
2
private static void verifyAntBuildFile(File currentFolder, PackDetails packDetails) throws ParserConfigurationException, SAXException, IOException { File antFile = new File(currentFolder, "build.xml"); System.out.println("Verifying ANT build file for validity..."); SAXParser parser =...
06739a04-bacc-43c3-b5f9-48cd103a496d
2
public void compileStmnt(String src) throws CompileError { Parser p = new Parser(new Lex(src)); SymbolTable stb = new SymbolTable(stable); while (p.hasMore()) { Stmnt s = p.parseStatement(stb); if (s != null) s.accept(gen); } }
6d4fc028-b7ba-4b16-8ef5-54dac6df546e
5
@Override public void run() { Client client = new Client(socket); try { InputStream in = socket.getInputStream(); byte type = (byte) in.read(); if (type == 0x00) { while (true) { byte[] buffer = Protocol.decode(in); System.err.println(new String(buffer)); String decoded; if...
97fda3ac-5364-4673-a65b-bcc89c02c1c1
1
private static boolean isDigit(char arg0) { return arg0 >= '0' && arg0 <= '9'; }
a55caa8b-69a6-4410-a4a9-6325efb7f716
3
public boolean Has3Items(int itemID, int amount, int itemID2, int amount2, int itemID3, int amount3){ if(HasItemAmount(itemID, amount)){ if(HasItemAmount(itemID2, amount2)){ if(HasItemAmount(itemID3, amount3)){ return true; } else{ return false; } } else{ return false; } } else...
402c99ef-c2c6-4e08-9254-e68666f98a4a
8
public boolean checkStates() throws BadLocationException { dialog.addMessageToLogger("Checking states for assignment resources to the states", 1); boolean[] assignedStates = new boolean[pn.getStates().size()]; for (State state : pn.getStates()) { int i = pn.getStates().indexOf(state)...
8032a70e-3b94-41ae-a6a2-546f15c924ca
5
static int[] getLocalIP() { try { InetAddress addr = InetAddress.getLocalHost(); byte[] ip = addr.getAddress(); if( ip == null || ip.length != 4 ) { return null; } int[] ret = new int[4]; for( int cnt = 0;cnt<4;cnt++) { ret[cnt] = (int)ip[cnt]; if( ret[cnt] < 0 ) { ...
7a5f8256-0087-4e9d-b097-9614caf32b4c
9
public String readLine(ByteBuffer buffer) throws LineTooLargeException { byte b; boolean more = true; while (buffer.hasRemaining() && more) { b = buffer.get(); if (b == CR) { if (buffer.hasRemaining() && buffer.get() == LF) { more = fal...
a4a7c156-bf78-4d0f-bcb5-a28ef205c785
5
public final Iterator<Path> filesIterator() { return new Iterator<Path>() { private DirTree currentTree = walkTo(DirTree.this.base); private Iterator<String> dirIter = this.currentTree.directories .keySet().iterator(); private Iterator<String> fileIter = this.currentTree.files.keySet() .iterator()...
9d96ddf3-092d-413e-a27b-c286196e9eb7
0
public void setB(float b) { this.b = b; }
af8d4cd4-7faa-4203-9d19-16004fde08d7
5
public Collection<DepartamentoDTO> buscarTodos(){ Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; try { con = UConnection.getConnection(); String sql = "SELECT * FROM departamento LIMIT 10"; pstm = con.p...
2c1c9c1a-3db7-428f-b873-5f5d166ed697
1
public boolean benutzerSchonVorhanden(String neuerBenutzername) { Benutzer benutzer = dbZugriff.getBenutzervonBenutzername(neuerBenutzername); if (benutzer != null){ return true; } return false; }
8e1a92a5-3846-4894-bf69-935348f10e09
4
@Override public void execute(String[] input) { if (input.length < 2) { laura.print("You need to give me a word to define."); return; } StringBuilder sb = new StringBuilder(); for (int i=1; i<input.length; i++) { sb.append(input[i]); } String query = sb.toString(); WordApi api = new WordAp...
bb3cf7f9-9ff4-4e66-a950-0cff69b2fb7c
9
public static void main(String[] args) { String fileName = null; ClassReader classReader = null; try { /* Filename should be the first command line argument */ fileName = args[0]; } catch(ArrayIndexOutOfBoundsException ex) { errorMessage("Usage: jav...
00d40257-af57-4b56-a5a5-f88f171147f7
6
public Ticket_Frame() { /* 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://download.oracle...
070d8895-3ed3-49f0-b6dd-fad9d7961304
2
protected void addedToWorld(World world) { // bereits existierende Aktoren auf der Kachel werden geloescht List l = getWorld().getObjectsAt(getX(), getY(), null); for (int i = 0; i < l.size(); i++) { Actor actor = (Actor) l.get(i); if (actor != this) { getWorld().removeObject(actor); } } }
ddd16b96-d68d-4e85-a246-1b182f6fd158
9
private int getActiveContestantCount(RobotPeer peer) { int count = 0; for (ContestantPeer c : contestants) { if (c instanceof RobotPeer) { RobotPeer robot = (RobotPeer) c; if (!robot.isSentryRobot() && robot.isAlive()) { count++; } } else if (c instanceof TeamPeer && c != peer.getTeamPeer())...
112e09f5-949b-44a5-ab3d-b57b2cc1fa7e
6
private void addLabel(BufferedWriter bw, int address) throws IOException { // add label if(rom.label[address] != null || rom.labelType[address] != 0) { String label = rom.getLabel(address); if(rom.labelType[address] > 1) label += ": ; "+prettyPrintAddress(address); if(rom.labelType[address] > 2) { ...
a978eac7-9652-413b-88a8-e2ff391ffe1f
7
private static boolean hasSuperclass(Class<?> c, Class<?> superClass) { if (superClass == Object.class) return true; Class<?> s = c.getSuperclass(); while(s != null && s != Object.class){ if (s == superClass) return true; s = s.getSuperclass(); } return false; }
1f041d1e-af01-4010-a89c-42518ba505e6
9
private Vector<XMLNoteReplacer> getReplacers() { Vector<XMLNoteReplacer> r=new Vector<XMLNoteReplacer>(); r.add(new XMLNoteReplacer("[<]head[^>]*[>].*?[<][/]head[>]","",true)); r.add(new XMLNoteReplacer("[<]p[>](.*?)[<][/]p[>]","::P:PAR:P::$1::P:EPAR:P::",true)); r.add(new XMLNoteReplacer("[<]p\\s[^>]+[>](.*?)[...
9f158324-0608-4940-b976-11f796fcfeac
0
public long getaField2() { return aField2; }
cf1f2b44-3a04-4bb6-8191-bd3ee0f94363
5
@Override public void update(Observable o, Object arg) { if (arg instanceof SearchModel) { this.model = (SearchModel) arg; } /**-50 to count for the offset of the textbox*/ show(this.textField, -50, this.textField.getHeight()); List<PictureObject> pictures = this.model.getPictures(); this.setListItem...
534a306d-86b4-4789-9043-13a1f8eafdf4
8
static void addElement(List<Node> list, Node node) { if ( null == list ) { throw new NullPointerException("The collection is null"); } if ( list.isEmpty() ) { list.add(node); } int size = list.size(); int i = 0; int j = size - 1; ...
d68bb5a4-8980-4aaa-a88b-bbb2eb15675b
8
public static void DFS(int node, int used, int parent, String path) { if (path.length() / 2 == size) ans.add(path.trim()); else { Stack<Integer> change = new Stack<Integer>(); for (int i = 0; i < ady[node].size(); i++) { int neigh = ady[node].get(i); if (check(used, neigh)) { if (parents[neigh...
a6e10b0f-8d10-46ea-ae66-fce1a1e1b1ee
8
private static boolean isMethodBetter( JavaAbstractMethod method1, int precision1, JavaAbstractMethod method2, int precision2) { //Methods comparison is done in a simplified way compared to the way how Java compiler //chooses the best method. The main ...
0712dbb3-83a9-450b-a716-8d7c35091dab
8
private static String canonicalize(final SortedMap<String, String> sortedParamMap) { if (sortedParamMap == null || sortedParamMap.isEmpty()) { return ""; } final StringBuffer sb = new StringBuffer(100); for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) { final String key = pair.getKey().to...
3ec82f75-bd99-4323-b081-4bd0ae76e0a0
9
public static List<CustomBlock> load(BlockAPI plugin) { ArrayList<CustomBlock> list = new ArrayList<CustomBlock>(); if (!PATH.exists()) { PATH.mkdirs(); return list; } BlockClassLoader classLoader = new BlockClassLoader(plugin.getClass().getClassLoader()); File[] classes = PATH.listFiles(); for (int x...
c2cf0f3b-82c1-413f-a808-34ea2d29bbee
2
protected static int indexOf(final char[] chars, final String str, final int fromIndex) { for (char ch : chars) { if (str.indexOf(ch, fromIndex) != -1) { return str.indexOf(ch, fromIndex); } } return -1; }
05e9c7c9-e335-489c-a149-6fc53e20e1c7
5
public void getWalkingAnimation(int direction){ removeAnimation(currentAnimation); if(crouch){ addAnimation(crouching[current]); currentAnimation = crouching[current]; if (current != direction){ removeAnimation(crouching[current]); current = direction; addAnimation(crouching[curre...
6311efc9-dc6c-416c-9b25-ac27175c2eb3
1
public static void main(String[] args) { // calculating the sum and average of integer values int[] nums = { 5, 10, 15, 20, 25 }; int sum = 0; double avg = 0; for (int i = 0; i < nums.length; i++) { sum = sum + nums[i]; } avg = sum / (nums.length); System.out.println("Sum: " + sum); ...
454e9f99-31ed-40e7-9538-fb1e44ffdef8
5
void dessineLab(Graphics g){ int[][] tab = monLab.defLab; int x = -1; int y = -1; for (int i=0;i<tab.length;i++){ if (tab[i][NORD]==-1){ x = (i%Labyrinthe.DIM)*dimCase; y = (i/Labyrinthe.DIM)*dimCase; g.drawLine(x,y,x+dimCase,y); } if (tab[i][SUD]==-1){ x = (i%Labyrinthe.DIM)*dimCase; ...
efb82089-ff52-46b1-9c2e-0d41d93b6f34
1
public float[] distribution(){ float[] bowl = new float[NUM_FRUIT_TYPES]; for (int i = 0; i < NUM_FRUIT_TYPES; i++){ // each fruit bowl[i] = fruitOccuranceMLE(i); } return Vectors.normalize(bowl); }
6975a81c-dabb-4fcd-8571-162991957d91
7
private void checkHighScore() { leaderboard.add(playerScore); // Find out if the score was a highscore, and where it falls if ( playerScore > leaderboard.get(4) && !enteredName ) { enteredName = true; // pop up to add name String name = JOptionPane.showInputDialog("Congrats! You've Made the Lead...
f7eb0448-5120-4dc0-8219-ed402598774e
0
public int getDefaultPoints() { return defaultPoints; }
55bf78a3-c04b-4f0d-b589-e497d07ed591
1
protected byte[] toByteArray(short[] samples, int offs, int len) { byte[] b = getByteArray(len * 2); int idx = 0; short s; while (len-- > 0) { s = samples[offs++]; b[idx++] = (byte) s; b[idx++] = (byte) (s >>> 8); } return b; }
36f2a236-3dd4-419a-bcd9-ac9a9d490e0c
9
@Override public boolean check() { System.out.println(this.getClass().getSimpleName()); if (isUpperExists() == false) { return false; } if (isCurrentEqualsUpper() == false) { return false; } if (isLowerExists(1) == false) { return f...
288de48c-10fb-4118-a7c5-9437d9df097e
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(cmd.getName().equalsIgnoreCase("Prefix")) { if(sender instanceof Player) { Player p = (Player) sender; PlayerUtil pu = new PlayerUtil(p); if(pu.hasPermission("Nostalgia.Command.prefix", Permissio...
c11b2dc1-cba3-4943-b4db-8c89b6e81a56
7
public void planNextStep(double s_elapsed) { for (Scenery scenery : sceneries) { scenery.planNextAction(s_elapsed); } for (Powerup powerup : powerups) { powerup.planNextAction(s_elapsed); } for (Shot shot : shots) { shot.planNextAction(s_elapsed); } for (ProximityBomb bomb ...
10a210fb-c981-4e4a-9919-3d660e5ce065
9
public void parseCommand(String command) { //Split command based on space String[] words = command.split(" "); //First word is the process/command String com = words[0]; //Remaining words are process arguments String[] args = new String[words.length - 1]; MigratableProcessWrapper mpw = null; ...
9506621d-4a2a-47c8-b5bd-524488e154b4
5
public void SimpleRunSameGameInterval(String dataFile, String outputFile, int interval){ globalLinkCounter = 0; L = new LinkSet(); MatchData M = new MatchData(dataFile); Match m; int c = 0; ArrayList<LinkSetNode> links; long longinterval = (long)interval*...
2d16a7df-ad5c-4eb5-8126-52119613cbc6
2
public EasyDate set(int year, int month, int day, int... args) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); if (args.length > 0) { int[] fields = new int[] { Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND...
56bc8bfc-69e6-4c64-a98e-d29c65333b0e
2
public double[] rawPersonMeans(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.rawPersonMeans; }
f7d230c9-f68a-4782-9301-5136742b4b9d
5
public DNSRR readRR() throws IOException { String rrName = readDomainName(); int rrType = readShort(); int rrClass = readShort(); long rrTTL = readInt(); int rrDataLen = readShort(); DNSInputStream rrDNSIn = new DNSInputStream(buf, pos, rrDataLen); pos += rrDataLe...
933badde-cc7d-4676-999a-b5790916179d
0
public Long getUpdatedAt() { return updatedAt; }
d5eea410-269e-4666-b383-e29842388696
0
public void setManufacturerId(String manufacturerId) { this.manufacturerId = manufacturerId; setDirty(); }
23f36070-26a7-4f82-9248-53db475e80f7
0
public static void main(String[] args) { makeAllPieces(); makeSideIcons(); }
75d935ac-0641-4e12-a9d0-6df999efe4ba
4
public String nextValue() throws IOException { Token tkn = nextToken(); String ret = null; switch (tkn.type) { case TT_TOKEN: case TT_EORECORD: ret = tkn.content.toString(); break; case TT_EOF: ret = null; ...
d724c01c-70c5-492e-9e25-fcb287124e01
4
private boolean createDatabase() { Utilities.outputDebug("Loading " + m_plugin.getDataFolder() + File.separator + m_databaseName + ".sqlite"); m_databaseFile = new File(m_plugin.getDataFolder() + File.separator + m_databaseName + ".sqlite"); if (m_databaseFile.exists()) { return true; } if (!m_...
6b8a2652-0339-4fd7-9c69-7cab09e17491
3
private boolean setID(String fileName, int id) { boolean result = false; int i = 0; File tempFile = null; Storage tempStorage = null; while ((i < storageList_.size()) && (tempFile == null)) { tempStorage = (Storage) storageList_.get(i); tempFile = tempSto...
400bee8e-1da2-4933-851b-380bc855baa5
4
private double[] calculateHDDConsumption(Component component, HardwareAlternative hardwareAlternative) { double consumption[] = { -1, -1 }; consumption[0] = component.getUsageHDD().getEnergyPoints(); for (HardwareComponent hdd : hardwareAlternative.getHardwareComponents()) { double temp = Utils.consumptionHDD(...
362e77f3-2dc5-4e33-82dd-d33ade2af73e
7
public Set<Map.Entry<Integer,V>> entrySet() { return new AbstractSet<Map.Entry<Integer,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TIntObjectMapDecorator.this.isEmpty(); } public...
00c51c7a-b0fa-4b96-adcb-f9955e057eee
8
private void handleReadyKey(SelectionKey key) throws IOException { if ((key.readyOps() & SelectionKey.OP_ACCEPT) == SelectionKey.OP_ACCEPT) { // accept the new connection ServerSocketChannel newChannel = (ServerSocketChannel)key.channel(); SocketChannel sc = newChannel.accept(); sc.configureBlocking(false...
d094c7b3-fae6-4e07-a474-90bb1398d48c
1
public static void allocate(int size, FileRequester fileRequester) { try { Model.modelHeaderCache = new ModelHeader[size]; Model.fileRequester = fileRequester; } catch (ArrayIndexOutOfBoundsException arrayoutofbounds) { Model.modelHeaderCache = new ModelHeader[size + Short.MAX_VALUE]; Model.fileRequeste...
0860c224-eeea-4028-9d91-0c75f5edecfe
5
@Get("json") public Representation _get() { String keyword = getAttribute("keyword"); String input = format("^%s", escapeRE(keyword)); Pattern ptrn = compile(input.toLowerCase()); Find find = $namespaces.find(FIND, ptrn).limit(20); List<String> rslts = new ArrayList<>(); f...
52cf158e-7e8c-467b-bcd4-9f5fdb6d3ee1
5
@Override public void actionPerformed(ActionEvent e) { Object s = e.getSource(); if(s instanceof JButton) { if(s instanceof ThemeItem) { Option.setTheme(((ThemeItem) s).getTheme()); themeName.setText(Option.getThemeName().replace("/", "")); frame.dispose(); changeTheme.setEnabled(true); } ...
94415a89-aa27-48e8-b95a-0cbb499310c3
2
private static String getTime(String time) { time = time.split(" ")[3]; time = (Integer.parseInt(time.split(":")[0]) > 12 ? Integer.parseInt(time.split(":")[0])-12 : time.split(":")[0]) + ":" +time.split(":")[1] +(Integer.parseInt(time.split(":")[0]) > 12 ? " PM" : " AM"); retur...
4ac36fd9-3c99-43e8-b1c0-4900c15d2484
6
public boolean colorMatch(P p) { if (this.R==250 && this.G==250 && this.B==250) return false; if (this.R == p.R && this.G == p.G && this.B == p.B) return true; return false; }
caa28f13-471f-49ef-89d5-09c74390a964
0
public void setMoney(double money){ this.money = money; }
b8cfb1fc-4694-4bad-a76e-b736e0d93ebf
5
private void drawGrid(Graphics2D g) { for (int i = 0; i < 9; i++) { for (FieldSlot s : field.areas.get(i)) { int x = s.getX(); int y = s.getY(); g.setColor(new Color((200 + 25 * i) % 255, (120 * i) % 255, 90 * i % 255)); g.fillRect(x * width / 9, y * height / 9, width / 9 + 1, height / ...
ef1b55df-6083-4357-a0a5-15e8ae3edc8d
1
public void delStudent(String no) { String delete = "DELETE FROM STUDENT WHERE NO=?"; try { PreparedStatement ps = conn.prepareStatement(delete); ps.setString(1, no); ps.executeUpdate(); ps.close(); } catch (SQLException e) { e.printStackTrace(); } }
86c32182-b894-436f-b97b-e953b58e9e51
0
public void clear() { configurationToButtonMap.clear(); selected.clear(); super.removeAll(); }
32e16249-1c82-4feb-8d89-87700a057139
1
public void repaintSelection() { repaintSelectionInternal(); for (OutlineProxy proxy : mProxies) { proxy.repaintSelectionInternal(); } }
4277967e-8f48-4543-b336-8b8d6c77f24b
0
public void moveAnchor(int x, int y, int width, int height) { ((Rectangle) shape).x = x; ((Rectangle) shape).y = y; ((Rectangle) shape).height += height; ((Rectangle) shape).width += width; updateCornerRects(); canvas.repaint(); }
8341b250-77c1-4a36-aae8-3110a3c6a532
8
public final void setSliderButtonImage(BufferedImage image) { double sliderWidth = isVertical ? scrollBarThickness : getSliderSize(); double sliderHeight = isVertical ? getSliderSize() : scrollBarThickness; if (slider == null) slider = new TButton(x + (isVertical ? 0 : scrollBarThickness), y + (isV...
3dc0895c-5080-4490-b294-69441a148c71
2
public int getBit(int n) { if (n < 0 || n > length - 1) { throw new IllegalArgumentException( "n must be between 0 and " + (length - 1)); } return ((bits & (1 << n)) >> n); }
1c07f885-b86a-4940-9573-071cebc137ea
5
*/ private void jComboB_ItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboB_ItemsActionPerformed /* * lokale Variablen für diese Methode, momentan zu Testzwecken */ int currentSemester = Sims_1._maingame.getSemester(); // current Semester boolean...
32d316c2-c3fb-4dc9-b411-d0720fd1f3ca
0
public String run(PrintWriter out) throws InstantiationException, IllegalAccessException { classInstance = (Program)className.newInstance(); startTime = System.currentTimeMillis(); status = 0; classInstance.run(out, args); status = 3; endTime = System.currentTimeMillis(); return getName() +" ran...
71f1dbfe-713c-4b04-b7f7-1f63fead72e9
0
public BuilderPattern build() { return new BuilderPattern(this); }
7ae25c36-98e6-4522-a8df-724784e161f8
8
@Override public void handle(HttpExchange he) throws IOException { String response = ""; int statusCode = 200; String method = he.getRequestMethod().toUpperCase(); switch (method) { case "GET": break; case "POST": isr = n...
daae5c23-e48e-4419-b5b6-eb1e225aa73d
3
private int dantzig() { int q = 0; for (int j = 1; j < M + N; j++) if (a[M][j] > a[M][q]) q = j; if (a[M][q] <= 0) return -1; // optimal else return q; }
5d1bba06-82e5-47de-b015-1522826b2e67
2
public String readStr() { if(inf) { if(sc.hasNext()) return sc.next(); else return null; } else { ExceptionLog.println("Попытка записи в неоткрытый файл"); return null; } }
b2743733-a461-4ae7-a975-2893e5cd88b4
0
public void setNode(boolean isNode) {this.isNode = isNode;}
78f76442-e88f-4321-957b-bbc36e303aa7
3
private static boolean trackCut(double[] upper, double[] under, int position, int deep) { if (upper[position] <= under[position]) { return false; } for (int i = (position - 1); i > (position - deep); i--) { if (upper[i] < under[i]) { return true; ...
aa073db9-3a36-4fcf-9418-80ad90636938
7
private LinkDecor getDecors1(String s) { // System.err.println("s1=" + s); if (s == null) { return LinkDecor.NONE; } s = s.trim(); if ("<|".equals(s)) { return LinkDecor.EXTENDS; } if ("<".equals(s)) { return LinkDecor.ARROW; } if ("^".equals(s)) { return LinkDecor.EXTENDS; } if ("+".e...
8eb275b7-e3e9-4158-913a-bad2f7c2ae07
1
public Couleur obtenirCouleurInverse() { if (this == BLANC) return NOIR; return BLANC; }
665f9dc3-937e-4024-86c3-e957e8bd4862
8
public void newFruit() { int r = rand.nextInt(5); Fruit fruit; if (r == 0) { fruit = new Orange(); } else { fruit = new Apple(); } // Makes sure fruit doesn't spawn on obstacles or snakes if (fruit.spawned == false) { for (Obstacle o : obstacles) { if (fruit.x == o.getX() && fruit.y == o.get...
95d8c0d1-af84-4bfa-9295-0624a2b75cb1
2
public List<EntidadBancaria> findAll(){ try{ List<EntidadBancaria> ListaEntidades; Connection connection = connectionFactory.getConnection(); ListaEntidades = new ArrayList(); String selectTodasEntidades = "SELECT * from EntidadBancaria"; PreparedStatement prepared = nul...
a3c1dfcd-af7a-4db8-b8c3-426ad25fda55
6
public static void chooseHeuristicDynamicCell(List<Measurement> measurements, Computation comp, int threshold, boolean useRSS) { if(useRSS) { HashSet<Integer> indices = Generate.randomInts(threshold, measurements.size(), null); int sum1 = 0; int sum2 = 0; int count1 = 0; int count2 = 0; for(int i : ...
23faa47d-4c7f-4caa-a401-a3eda3cebe3a
2
public static void count_vowels(String s) { s = s.toLowerCase(); int count = 0; List<Character> vowels = Arrays.asList('a', 'e', 'i', 'o', 'u'); for (int i = 0; i < s.length(); i++) { if (vowels.contains(s.charAt(i))) count++; } System.out.println(count); ...
22118db3-e020-4912-8d09-2c26dc467953
5
public static void main(String args[]){ Scanner sc = new Scanner(System.in); int A,C; while(true) { A= sc.nextInt(); if(A==0) break; C = sc.nextInt(); int recentElement = 0; int cutCount = 0; for(int ...
3cc258b3-bd69-4085-acad-0fd94e3718c8
0
public static void main(String[] args) { ExGui exGui = new ExGui(); exGui.go(); }
563421ce-3fda-4ce5-92af-a30ff4c66f29
9
public void faireActivite() { this.choixActivite = "0"; boolean test = false; boolean recommencer = true; while (!test) { System.out.println("\n\nQuelle activite souhaitez-vous faire ?" + "\n Tapez 1 pour entrer dans le casin...
443bfc08-018f-4a2b-a8dd-617f0572335a
9
public void cargarTabla(NodoBase raiz){ while (raiz != null) { if (raiz instanceof NodoIdentificador){ InsertarSimbolo(((NodoIdentificador)raiz).getNombre(),-1,((NodoIdentificador)raiz).getTipo()); //TODO: A�adir el numero de linea y localidad de memoria correcta } /* Hago el recorri...
de913d24-da9a-44be-815a-6fbf20664a71
6
@Override public double getClippedValue(double input, double clip) { double result = 0; if (input >= a && input <= c) { result = (input - a) / (c - a); if (result < clip) { return result; } else { return clip; } ...
ef4f980e-6314-4b55-b16d-da11fba9219b
3
public boolean isInAcceptState() { return getState() >= 0 && getCurrState().isAcceptState() && !isInSpaceState() && !isInErrorState(); }
befdaf12-fabb-4c32-9f63-dd78b372941a
2
@RequestMapping(method = RequestMethod.POST, produces = "application/json") public ResponseEntity<?> create(@ModelAttribute("contact") Contact contact, @RequestParam(required = false) String searchFor, @RequestParam(required = false, defaultVal...
b9bd834f-a0ff-4516-8f4d-e80c4b4feba1
4
private boolean isValid() { if (firstName.length() > 50 || lastName.length() > 75 || (!gender.equals("M") && !gender.equals("F"))) { System.err.println("Invalid argument(s) when inserting a user!"); return false; } return true; }
669e5fbf-0b8c-4549-badf-d254cc5fc468
5
public void action(Sac[] tabSacs, DomaineDesMorts ddm, JFrame page, Dieu deus) { this.avancer(1); int k = 0; int nb = 0; int val; if ("Tyr".equals(deus.getNom())) { int det1 = de.getCouleur(); int det2 = de.getCouleur(); String[] choix1 = {ta...
8b653177-cf11-4650-85b7-9343a60e6ffa
0
public void mouseMoved(MouseEvent e) { String str = "x: " + e.getX() + ",y: " + e.getY(); System.out.println(str); }
ce4dde93-d411-4acb-bcc7-7beabe9bdc3e
4
private static final long getTimeOfDate(Object date) { long theTime; if (date == null) { theTime = System.currentTimeMillis(); } else if (date instanceof Date) { theTime = ((Date) date).getTime(); } else if (date instanceof EasyDate) { theTime = ((EasyDate) date).getTime(); } else if (date instanceof...
fe70541c-86d5-4161-815b-b19762ab8e77
1
public void initiate() { new MainFrame(); serverConnection = new DummyConnection(); int id = serverConnection.assignPlayer("Anders"); if(id != 0)thePlayer = new ThisPlayer("Anders", id, 0); startGame(); }
4c1e1b46-f80a-4db2-a737-b741091bfee9
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...
bb80ac69-09af-448e-b1f5-b98021627dd9
4
private void addProgrammaticLogging(Level level, File dir) { try { dir.mkdirs(); File file = new File(dir, "jscover.log"); if (file.exists()) file.delete(); FileHandler fileTxt = new FileHandler(file.getAbsolutePath(), true); Enumeratio...
d091ea30-9a4f-4655-9519-3f5227856fc4
0
public ArmorItem(){ super(); this.defenseScore = 1; this.name = "Unknown ARMOR name"; }
9584de0d-62b2-4aa9-b14f-68b9554875eb
6
public static void main(String[] args) { final double PBAIN = 20; final double PTONTE = 25; final double PCOUPE = 30; String strNom; String strService; strNom = JOptionPane.showInputDialog("Nom de l'animal:"); strService = JOptionPane.showInputDialog("Services [B] [T] [G]:"); NumberFormat ...
68189c90-7020-4e88-8b35-88a9b7a465a0
1
public boolean checkPositionUsed(Map<String, EnumElement> board, EnumLine line, EnumColumn column) throws PositionAlreadyUsedException { if (board.get(this.createPosition(line, column)) == EnumElement.HIT) { throw new PositionAlreadyUsedException(); } else { return true; } }
7b8d9fab-6d53-4c8a-ac4a-c6a9e546fc79
3
@Override public void execute(CommandSender arg0, String[] args) { //plugin.dbConfig.players.add(arg1[0]); if(args.length != 1) { arg0.sendMessage(TextComponent.fromLegacyText(ChatColor.DARK_AQUA+"["+ChatColor.RED+"#"+ChatColor.DARK_AQUA+"] "+ChatColor.GOLD+"Utilizzo: /watch [nome]!")); }else{ if(plugin....
dedb40ea-02e8-46ed-8039-63c57be335b3
1
public static void main(String[] args) { FancyHouse fancyHouse = constructFancyHouse(args); if (fancyHouse == null) { System.out.println ("Illegal arguments"); return; } //testing house with fancy collection of balloons //FancyHouse fancyHouse = FancyHou...