method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9371ff87-478a-4183-b9f5-7a3a888b44fb
6
@Override public void populate(World world, Random random, Chunk source) { ChunkSnapshot snapshot = source.getChunkSnapshot(); for (int i = 0; i < ITERATIONS; i++) { if (random.nextInt(100) < TORCH_CHANCE) { attemptloop: for (int j = 0; j < ATTEMPTS; j++) { int x = random.nextInt(16); int z = ran...
5f336a0d-ba97-4f93-b404-ba388afb43a2
9
public void infoDensityStat(double threshold) { double minDensity = 2.0; double maxDensity = -1.0; double avgDensity = 0.0; double avgScore = 0.0; double minScore = 2.0; double maxScore = -1.0; // OptimallyDiscriminativeSet _answerSet = new OptimallyDiscriminative...
1e300bba-ac6d-4d67-b3d0-4057dc9ae8b5
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Item other = (Item) obj; if (!Objects.equals(this.name, other.name)) { return false; ...
6e95dee5-b18d-4728-9684-15c5a6bd133a
8
public void destroy() { if (destoyed) return; destoyed = true; try { // destroy resources Iterator it = windows.iterator(); while(it.hasNext()) { Window w = (Window)it.next(); if (w != null) w.dispose(); } // interru...
ac146da1-8e95-4865-86d3-cf34cd94a294
2
private String getResultString(final Object resultObj) { return (isCycLObject(resultObj)) ? cyclify(resultObj) : (resultObj == null) ? "null" : resultObj.toString(); }
24b98051-897a-4406-bc1c-759f77ea76de
0
public TestTicketPool(Train train) { this._train = train; }
d70321fb-4f0c-43cd-82c3-43db60a81afa
6
public static boolean isNotHoliday(Calendar date) throws ParseException { create(); for (Calendar cal : holidays) { if ((cal.get(Calendar.DAY_OF_MONTH) == date .get(Calendar.DAY_OF_MONTH) && cal.get(Calendar.MONTH) == date.get(Calendar.MONTH) && cal .get(Calendar.YEAR) == date.get(Calendar.YEAR)) ...
dc726a73-d849-40ab-9775-d381683fddb3
0
@Test public void testCondFromString() { System.out.println("condFromString"); String name = "FOE"; Sense.condition expResult = Sense.condition.FOE; Sense.condition result = Sense.condFromString(name); assertEquals(expResult, result); name = "FRIEND"; ...
4b5b6b63-c890-4458-9d23-feaaf793b7d5
0
@Override public Integer call() throws Exception { Random rand = new Random(); TimeUnit.SECONDS.sleep(rand.nextInt(7)); return rand.nextInt(); }
9b193e81-9a08-4ba4-a0b6-285506c6d65c
2
public void initialize() { while (il == null) try { Thread.sleep(1); } catch (InterruptedException e) { continue; } // Set up staff. HBox[] staffLedgerLines = { staffExtLinesHighC, staffExtLinesHighA, staffExtLi...
34b506be-34ec-4b50-8f5d-5284035def4e
3
@Override public void execute(HttpServletRequest request, HttpServletResponse response) { List<News> list; Iterator<News> newsIterator; newsDao newsDao = dao.newsDao.getNewsDao(); list = newsDao.getListAllNews(); newsIterator = list.iterator(); StringBuffer st = new StringBuffer(); st.append("<ul>"); w...
5dde09a0-5379-44ae-a30e-d601db56ccca
0
public void setNewSeller(IautosSellerInfo newSeller) { this.newSeller = newSeller; }
9d43d722-cc4c-4f4b-a2de-8e7f620af132
6
public static <T> void runPPLGG() { int mapSamples = 100; ArrayList<Generator<T>> allGens = new ArrayList<Generator<T>>(); File dir = new File("C:/PPLGG/"); String[] dirs = dir.list(new GeneratorFilter()); for (String dirName : dirs) { for (String genName : new File(dirName).list()) { FileInputStr...
e34fb512-43cb-4b04-acd7-f2b2c1a6f946
7
private void setGL(GraphicsHelper gh) { Vector2f scale = getScale(); gh.getPrivates(); if (portPos.x != 0 || portPos.y != 0) gh.g.translate(-portPos.x,-portPos.y); if (angle != 0) gh.gl.glRotatef(-angle,0f,0f,1f); if (scale.x != 1f || scale.y != 1f) gh.g.scale(1f/scale.x,1f/scale.y); if (pos.x != 0 || pos.y...
8f344f8f-2066-4baf-ae71-7d898e5ae31c
3
@Override public Object getValueAt(int row, int col) { SettingQuestion tempQuestion = questions.get(row); switch (col) { case NO_COL: return tempQuestion.getCounter(); case ID_COL: return tempQuestion.getId(); case QUESTION_COL: return tempQ...
4eadc154-b3ef-42df-b5cf-40b28f90bdac
3
public void initBoardPanel() { boardPanel = new BoardPanel(this.boardModel); this.add(boardPanel, BorderLayout.CENTER); this.pack(); this.revalidate(); boardPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { ...
7e137e9e-8e62-4728-9a6c-0aa2c464aab8
7
@Override public void mouseMoved(MouseEvent e) { for (Button button : _buttons) { _next += button.update(e); } r = (e.getY() - _board.getYOffset()) / 64; c = (e.getX() - _board.getXOffset()) / 64; if (r >= 0 && c >= 0 && r < 20 && c < 20) { _board.highlight(r, c); if (_oldxhighlight != c || _oldyh...
c85408af-bd04-4a3d-9366-b3d7af4f62f0
7
public synchronized void anagram(LinkedList<Brick> bricks) { setAnagramModeOn(true); AnagramListener anagram = new AnagramListener(bricks, elements.getBrickSize(), elements.getWidth() * numPlayer); gb.addMouseListener(anagram); elements.setAnagramOn(bricks.get(0).getAbsoluteCoords().y); while(true...
7f70a650-343c-4c14-8890-213066155539
5
private boolean isWater(Point p) { p = new Point(2 * (p.x / bounds.width - 0.5), 2 * (p.y / bounds.height - 0.5)); double angle = Math.atan2(p.y, p.x); double length = 0.5 * (Math.max(Math.abs(p.x), Math.abs(p.y)) + p.length()); double r1 = 0.5 + 0.40 * Math.sin(startAngle + bumps * an...
c6c77c5a-bc8f-47a5-85c6-037ccf9ae260
4
*/ public void setText(String[] lines) { code.clear(); if (lines == null || lines.length == 0) { code.add(new StringBuilder()); } else { for (String line : lines) { code.add(line); } } if (code.isEmpty()) { code.add(""); //$NON-NLS-1$ } fireLineChange(0, co...
19f1ef5c-3553-4d92-9b7c-fa4b7943c4fe
6
public Player findPlayer2() { if(!p2) return null; else { for(Cell[] c : grid) { for(Cell cell : c) { if (cell.contains(Player.class)) { try { if((Player)cell.getOccupant() == findPlayer()) continue; else return (Player) cell.getOccupant(); } catch (Exception e) { System...
dd2f7e29-556b-461d-91e8-9849fdb194a7
0
public Integer getShowMonth() { /** * Integer getShowMonth() 获取在组给框中显示的中文格式月份:如七月/八月等 */ return turnMonth(sysNowTime[1]); }
e92f3d7d-16e9-40a2-af91-1d9f67691c30
8
public TravelDataBean getArticle(int idx) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; TravelDataBean article = null; String sql=""; try{ conn = getConnection(); sql = "update travel set read_count = read_count + 1 where idx=?"; pstmt = conn.prepare...
a35e5268-9525-41e4-bb40-f70f8584791c
3
Class<?> defineClass (String name, byte[] bytes) throws ClassFormatError { try { // Attempt to load the access class in the same loader, which makes protected and default access members accessible. return (Class<?>)getDefineClassMethod().invoke(getParent(), new Object[] {name, bytes, Integer.valueOf(0), Integer...
70692c8b-2eb0-4349-bceb-7505faa9e20b
3
public void unfollow(int followerId, int followeeId) { if(followeeId==followerId) return; //update subscribe list TreeSet<Integer> subscribeList=subscribeMap.get(followerId); if(subscribeList==null) subscribeList=new TreeSet<>(); subscribeList.remove(followeeId); subscrib...
09c4b745-6a6b-4c95-8bea-bb849536fcc7
9
public JsonWriter value(Object value) throws IOException{ if (value == null){ return nullValue(); } writeDeferredName(); beforeValue(false); if (value instanceof Timestamp) { string(datetimeF.format(value)); } else if (value instanceof java.sql.Date){ string(dateF.format(value)); } else if (value...
b009cc30-7161-4517-8a02-7e4ee37f8646
1
public boolean add(Prestamos p){ PreparedStatement ps; try { ps = mycon.prepareStatement("INSERT INTO Prestamos VALUES(null,?,?,?,?)"); ps.setDate(1, p.getFecha()); ps.setString(2, p.getEstado()); ps.setString(3, p.getIdLibro()); ps.setString(4...
87f1dceb-eff7-4528-a42b-8241435b40d9
0
public Double getTimeStep() { return timeStep; }
2eb7077e-111e-47c9-98a2-1aec473267f4
2
public void validateDirectory(NoseCandyPlugin plugin) { if (!this.dataFolder.exists()) { this.dataFolder.mkdirs(); } this.configFile = new File(this.dataFolder, "config.yml"); if (!this.configFile.exists()) { this.copyFile(plugin.getResource("config.yml"), this.configFile); } this.load(); }
9526a018-a23c-4dbd-ba89-c7786e598c12
1
public TreePanel(TreeRoot root) { mRoot = root; mRoot.getNotifier().add(this, TreeNotificationKeys.ROW_REMOVED); setUnitIncrement(mRowHeight + getRowDividerHeight()); setFocusable(true); addFocusListener(this); addMouseListener(this); addMouseMotionListener(this); addKeyListener(this); if (!GraphicsUt...
00c73a44-30a1-4f4f-b9a6-b8f20b3f55ea
2
public Point getPosOnGrid(main.position.Point pixelPosition) { int xPixel = pixelPosition.getX(); int yPixel = pixelPosition.getY(); int xtmp = Board.getSquareWidth(); int ytmp = Board.getSquareHeight(); int xGrid = 0; int yGrid = 0; while (xPixel >= xtmp) { ...
a77b3f7b-cdc5-4d72-95c3-5b0ab933c81a
9
* @throws ArithmeticException if numeric overflow occurs */ @Override public YearMonth plus(PlusAdjuster adjuster) { return (YearMonth) adjuster.doPlusAdjustment(this); }
1e6a9b70-5706-432a-97ac-3f903983545f
7
public String[] mapTypes(String[] types) { String[] newTypes = null; boolean needMapping = false; for (int i = 0; i < types.length; i++) { String type = types[i]; String newType = map(type); if (newType != null && newTypes == null) { newTypes =...
670977b9-dc09-4609-9f63-430949dddb00
5
public static void main(String args[]) { int testX = 123; int testY = 456; int textXTwo = 5; int testYTwo = 10; /**Test case 1 (Constructor)*/ Coordinate c = new Coordinate(123,456,Game.PlayerTurn.PLAYER2); if(c.getX() == testX) System.out.println("Correct X value set"); if(c.getY() == testY) Syst...
1c97a26d-6fc0-4626-9134-6c8e0b63f5db
5
public void update() { up = keys[KeyEvent.VK_W] || keys[KeyEvent.VK_UP]; down = keys[KeyEvent.VK_S] || keys[KeyEvent.VK_DOWN]; left = keys[KeyEvent.VK_A] || keys[KeyEvent.VK_LEFT]; right = keys[KeyEvent.VK_D] || keys[KeyEvent.VK_RIGHT]; space = keys[KeyEvent.VK_SPACE] || up; enter = keys[KeyEvent.VK_ENTER];...
b6e37da9-1b04-4e33-ac48-0599b54d4e63
3
public Properties getOutputProperties(){ Properties properties = super.getOutputProperties(); if(addressLine1!=null) properties.put(ADDRESS_LINE_2,addressLine2); if(addressLine2!=null) properties.put(ADDRESS_LINE_1,addressLine1); if(tvaNumber!=null) properties.put(TVA_NUMBER, tvaNumber);...
86f70afb-1319-40c0-b779-2a1efc467130
2
public void removeBids(Integer userId) { for (Bid b : bids) { if (b.username.equals(userId)) { bids.remove(b); } } }
955dadee-3fc6-4caf-a63c-fb2c3b9c5113
5
public void checkBorderCollision(){ for(Character c : characters){ if(c.getX() > 800-c.getWidth() || c.getX() < 0+c.getWidth()){ moveBack(c); } if(c.getY() > 640-c.getHeight() || c.getY() < 0+c.getHeight() ){ moveBack(c); } } }
90b8cfaa-4d1a-4536-ad7b-dcee69ab4cdd
2
public boolean purchaseItem(ItemStack item){ if(type.equals(StoreType.ADMIN)) return true; if(!inStock(item.getData(),item.getAmount())) return false; chest.getInventory().removeItem(item); return true; }
7b45375e-b370-41f5-973b-03be8c80482a
6
public static int evaluateBoard(Board b, Move m, int color, int numberOfSuccessors) { int sum = 0; int opponentColor = Board.opponentColor(color); try { boolean isCapture = Board.isCaptureMove(b, m, color); if (isCapture) { sum += bounty(b, m.end.rank, m.end.file, opponentColor); } b.handleMove(m...
2588c7d4-3dff-4106-94a7-11d7480f645e
8
public JTextField getTextFieldThatSelectDirectory(){ final JTextField selectInstallationDirectoryField = new JTextField(28); selectInstallationDirectoryField.setHorizontalAlignment(JTextField.LEFT); selectInstallationDirectoryField.setText(InstallerUtils.getFileFullPath(installationDirectory)); ...
08245f96-9a82-409d-8276-450d367af76f
9
static char[] sol(char[] s){ TreeMap<Character,TreeSet<Character>> mapa=new TreeMap<Character, TreeSet<Character>>(); for(int i=0;i<arr[0].length;i++) for(int j=0;j<arr[0][i].length;j++) for(int h=0;h<arr[1][i].length;h++) if(s[arr[0][i][j]-'A']=='\0'&&esPosible(arr[0][i][j], arr[1][i][h], s)){ Tr...
dd68c6f2-de89-4865-b665-1e2b9411d429
0
public CheckResultMessage check8(int day) { return checkReport.check8(day); }
100dba1c-adb1-4398-af02-675d1795dcc9
7
public void paint(Graphics g) { sounds.nomNomStop(); /* Draw the pacman */ g.drawImage(Board.PACMAN_IMAGE, board.player.x, board.player.y, Color.BLACK, null); g.setColor(Color.BLACK); /* Kill the pacman */ if (board.dying == 4) g.fillRect(board.player.x, boa...
0684b598-3b36-475a-987b-9c2e84de90d2
5
public void writeBlock(int id, int[] values) { cacheMetaData.put(id, values.length); Int2ObjectMap<int[]> storage = getOrLoadStorage(); storage.put(id, values); OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(file)); for (Entry metaEntr...
73506fb5-6579-4d27-b657-839de8d44e70
0
public String getTipo() { return tipo; }
e4459c44-5be9-43b3-9aaa-4f0d3edc6891
2
public boolean alterar(){ EntityManager em = conexao(); try { Paciente paciente = em.find(Paciente.class, id); paciente.setNome(nome); paciente.setDataNasc(dataNasc); paciente.setLogradouro(logradouro); paciente.setNumero(numero); p...
4f01e8e1-3947-4e6b-87aa-f2cf38491fb2
4
@EventHandler(priority = EventPriority.HIGHEST) public void onCommandPreprocess(PlayerCommandPreprocessEvent event) { if (event.getMessage().toLowerCase().startsWith("/eg leave")) return; Player player = event.getPlayer(); for (Map.Entry<Integer, Game> en : plugin.getRunningGames().entrySet()) { if (en.getVal...
e51f6be2-cf54-4795-9cb0-3cda23766bfe
2
public boolean markFinal() { LocalInfo li = getLocalInfo(); Enumeration enum_ = li.operators.elements(); int writes = 0; while (enum_.hasMoreElements()) { if (((LocalVarOperator) enum_.nextElement()).isWrite()) writes++; } /* FIXME: Check if declaring final is okay */ li.isFinal = true; return tr...
8f616d0e-f33b-4c52-b2e5-9f690a3918ed
9
public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } Object[] attachedObjects = (Object[]) state; if (attachedObjects.length > 0 && attachedObject...
e734d80b-cc8d-4376-8c12-1f4d5bd7ed21
2
public void write() { try { OutputStream out = null; try { try { String temp = Paths.get(getClass().getResource(path).toURI()).toFile().toString(); int x = temp.indexOf("\\GridGame\\"); ...
37796117-b829-4ad1-b2ae-79703699799f
8
public Boolean addPlayer( Player player ) { if(this.currNumPlayers < Room.MaxNumPlayer) { boolean alreadyConnected = false; for( Player p : this.playerList ){ // nuevo player que no es el game master if( player.equals(p) ){ alreadyConnected = true; this.logger.debug("Player " + player.getUser...
4ac27ed1-2d6e-46d5-a53e-0b97c7cc11fc
0
@Basic @Column(name = "FUN_FECMOD") public Date getFunFecmod() { return funFecmod; }
97f33f7e-6a4b-42c8-81a9-98ac9e4c6aec
3
private void validateName(String nam) { if(!Character.isLetter(nam.charAt(0)) ) { throw new IllegalArgumentException("Names for constants, variables and functions must start with a letter" ); } if(nam.indexOf('(')!=-1 || nam.indexOf(')')!=-1) { throw new IllegalArgumentException("Names for constant...
2056afa7-a246-4ba1-bb46-998c2619bb77
3
public void read_main_variable (SimpleNode declarations, Symbol_table symbol_table, Variable_table variable_table, Type_table type_table) throws SemanticErr{ int declaration_num = declarations.jjtGetNumChildren(); for (int i = 0; i < declaration_num; i++) { SimpleNode var_declar...
1d96b3da-91aa-4657-819f-5c9b300300b2
2
public Ejercicio buscarEjercicio(int idEjercicio){ for (int i = 0; i < ejercicios.size(); i++) if (((Ejercicio) ejercicios.get(i)).getIdEjercicio() == idEjercicio) return ((Ejercicio) ejercicios.get(i)); return null; }
0698f2ba-7327-4c2e-b3a2-a95b7e69edcc
2
@Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { try { login(); } catch (Throwable e1) { e1.printStackTrace(); } } }
99968965-fa85-4bfe-98bc-b766d93e35ae
6
public static void main(String[] args) { configuration config = inputAnalyzer.initializeConfig(args); if (protocol.TCP == config.getSocketType()) { // TCP Server code ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(6789); System.out.println("Opened socket at port 6789"); ...
4428078d-5d7f-46c0-8657-d92a50c40b7e
7
public String toString() { StringBuilder sb = new StringBuilder(); for( int r=0; r<height; ++r ) { if( r != 0 ) sb.append("\n"); sb.append( r == 0 ? "/" : r == height-1 ? "\\" : "|"); for( int c=0; c<width; ++c ) { sb.append( String.format(" % 5.2f",get(r,c)) ); } sb.append(" "); sb.append( r ...
2e5893ed-e361-4efe-864d-0f19f5ddddd8
5
private boolean yaExiste(Partido p){ for (Partido part: listado){ if ((part.dameLocal().equalsIgnoreCase(p.dameLocal()) && part.dameVisitante().equalsIgnoreCase(p.dameVisitante())) || (part.dameLocal().equalsIgnoreCase(p.dameVisitante()) && part.dameVisitante().equalsIgnoreCase(p.dameLocal()))) ...
6ee1274a-4f83-4be2-8a2b-a331a23ea649
7
protected void readImage() { ix = readShort(); // (sub)image position & size iy = readShort(); iw = readShort(); ih = readShort(); int packed = read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - inte...
d658a660-6a65-419f-bc29-af29bb7b79bc
5
public void keyPressed(int k) { if(k == KeyEvent.VK_ENTER){ select(); } if(k == KeyEvent.VK_UP) { currentChoice--; if(currentChoice == -1) { currentChoice = options.length - 1; } } if(k == KeyEvent.VK_DOWN) { currentChoice++; if(currentChoice == options.length) { currentChoice = 0; ...
0e564656-379c-4a38-bee5-7170589c7c0d
6
private boolean method320(int arg0, int arg1, int arg2) { int l = anIntArrayArrayArray445[arg0][arg1][arg2]; if (l == -SceneGraph.anInt448) { return false; } if (l == SceneGraph.anInt448) { return true; } int i1 = arg1 << 7; int j1 = arg2 << 7; if (method324(i1 + 1, heightMap[arg0][arg1][arg2], j1...
1c139b59-7bc8-403e-be5e-f365072a9561
2
@Override public void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes) throws SAXException { tag = Tags.fromString(qName); if (tag == null) { return; } switch (tag) { case USER: String m = attributes.getValue("id").trim(); int id = Integer.parseInt(m); ...
2f44921b-23ed-4d3e-bb95-adebb7460205
9
public boolean validateMap(AerospikeClient client, String filename,int nrecords,int setMod,int range,int seed, HashMap<String, String> binMap, String dstType) { boolean valid = false; Random r = new Random(seed); int rint; String key = null; String set = null; Key key1 = null; Bin bin1 = null; Stri...
5122b600-94f7-48ab-98ce-1d437666d993
7
@Override public void unInvoke() { MOB M=null; if(affected instanceof MOB) M=(MOB)affected; final MOB invoker = invoker(); super.unInvoke(); if(M!=null) { if(!M.isMonster()) CMLib.commands().postStand(M,true); M.tell(L("You are no longer off stage.")); if(M.isMonster()) CMLib.tracking(...
cd3e429b-e590-4089-846a-5f0c6cd91a9c
6
public Complex weightedHarmonicMean_as_Complex() { if (!weightsSupplied) { System.out.println("weightedHarmonicMean_as_Complex: no weights supplied - unweighted mean returned"); return this.harmonicMean_as_Complex(); } else { boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weighting...
2d697670-ab46-461d-b340-1d1c18cafbc5
4
private void write (int address, byte buf [], int off, int len) throws IOException { int val; if ((len % BLOCKSIZE) != 0) throw new IllegalArgumentException (); if ((val = get (RIO_UNKNOWN_4C, address, 0)) == 0 || (val = get (RIO_UNKNOWN_4F, address, 0)) == 0 || (val = get (RIO_WRITE, len / IO_...
417bbddc-2a43-464b-88b7-ba8ad953e53f
0
public int getTypeId() { return this.typeId; }
b865d43d-7190-4683-93a3-18a9fde98f6e
1
public void insertarFinal(E pData) { Nodo<E> nuevo = new Nodo<>(pData); if( talla == 0){ cabeza = nuevo; } else{ cola.siguiente = nuevo; } nuevo.previo = cola; nuevo.siguiente = null; cola = nuevo; talla++; }
81428060-5f2e-4c53-bf9c-447d397dc3a1
7
public static String executeCommand(String inputCommand) { String command = inputCommand.trim().split(" ")[0]; COMMAND_TYPE commandType = determineCommand(command.toLowerCase()); switch (commandType) { case ADD_EVENT: return addEvent(inputCommand); case DELETE_EVENT: return deleteEvent(inputCommand); ...
e8839afc-a48b-44d6-868f-ed7e52a458db
8
@Override public Class<?> getCommonPropertyType(ELContext context, Object base) { Class<?> result = null; for (int i = 0, l = resolvers.size(); i < l; i++) { Class<?> type = resolvers.get(i).getCommonPropertyType(context, base); if (type != null) { if (result == null || type.isAssignableFrom(result)) { ...
979c14f4-cede-491e-8021-fbff68aad5b0
8
public static int splitbyLetter3(ReceiveBuffer text, CharSeqBufView[] fillArr){ //list.clear(); int arrnumber=0; int pos = 0; int pos2=0; int len = text.length(); boolean first=true; for (int i = 0; i < len; i++) { char c = text.charAt(i...
7026f264-82e4-4c2b-b4dc-3d02190653dd
1
public void mostrarClientes(){ DefaultTableModel modelo = (DefaultTableModel)tabla.getModel(); GestionarCliente bd = new GestionarCliente(); clientes = bd.selectAllCliente(); for(int i =0;i<clientes.size();i++){ modelo.addRow(new Object[]{i+1,clientes.get(i).getIdCliente(),cl...
deff7733-4965-4859-ab84-c72eedda6f60
8
public final void gen_iter() throws RecognitionException { try { // Python.g:429:9: ( gen_for | gen_if ) int alt123=2; int LA123_0 = input.LA(1); if ( (LA123_0==82) ) { alt123=1; } else if ( (LA123_0==85) ) { alt123=2; } else { if (state.backtracking>0) {state.failed=true; return;...
e27235ab-c9e6-41bd-8058-6cb5e5caec58
3
@Override public boolean containsAll(Collection<?> list) { for (Object o: list) if (contains(o) == false) return false; return true; }
d5326508-54a6-4be7-82ca-3cc1836825c2
8
@Override public synchronized void onEvent(Event event, Socket socket) { switch(event.getType()) { case Protocol.REGISTER_REQUEST: RegisterRequest registerRequest = (RegisterRequest)event; //create connection? try { //Socket socket = new Socket(request.getIP(), request.getPort()); //need to ...
543a0d2a-3cda-424b-bfff-096f58ab8588
6
@EventHandler public void onSignChange(SignChangeEvent event) { String header = Utils.stripColor(event.getLine(0)); Player player = event.getPlayer(); if (header.equalsIgnoreCase(Config.getRawSellSignHeader())) { event.setLine(0, player.hasPermission("cyclonesell.sign.create.sell") ? Config.getSellSignHead...
26c43883-cc19-439a-b91f-17a2438bc752
0
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new ProBotGame(); } }); }
0eb2e4ed-e3de-46c8-8736-94c21f50ec10
6
public static String unescape(String s) { int len = s.length(); StringBuffer b = new StringBuffer(); for (int i = 0; i < len; ++i) { char c = s.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < len) { int d = JS...
a319d2da-8d65-489b-b0ba-aa73402c8b94
2
public ShopItem getItemBySlot(int slot) { return slot >= 0 && slot < MAXIMUM_SLOT_AMOUNT ? this.items[slot] : null; }
0859ed4e-1e5e-429e-80bb-e14a0204c1c5
0
@Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub }
9b36febc-48cf-4a7b-82c9-d978d98bffc1
8
public List<CourseListing> getAll() { List<CourseListing> courseListing = new ArrayList<CourseListing>(); try { //Connect to database conn = DriverManager.getConnection(url, userName, password); stmt = conn.createStatement(); ResultSet rset = null, rse...
40980fe2-3a96-46a2-b0a1-2e63ce766727
3
public boolean loadVault() { Plugin vault = plugin.getServer().getPluginManager().getPlugin("Vault"); if (vault == null) { plugin.getLogger().info("Vault has not been found. Disabling buy system!"); return false; } if (!vault.isEnabled()) { plugin.getLogger().info("Vault has been found but is not...
840a4e74-4744-4e5c-ab7a-d9fdc6c3fc61
6
public void method361(int i, int k) { i += anInt1454; k += anInt1455; int l = i + k * DrawingArea.width; int i1 = 0; int j1 = anInt1453; int k1 = anInt1452; int l1 = DrawingArea.width - k1; int i2 = 0; if(k < DrawingArea.topY) { int j2 = DrawingArea.topY - k; j1 -= j2; k = DrawingArea.topY...
4c723537-cb67-48fc-9a0c-88a9d67f90a0
5
@MethodInformation(author="Alex", date="09.12.2012", description="Gives back a double that describes the minimum number of swords to plowshare of all BioTraktor") protected double minSwordsBio() { MyIterator it = (MyIterator) traktoren.iterator(); double min = 0; while(it.hasNext()) { Traktor obj = (Trak...
890dfbcc-577e-448f-b0e9-d2d2b7eeac34
2
public boolean hasStringArg() { String s = peek(); return (!s.isEmpty() && s.charAt(0) == '\"' && s.charAt(s.length() - 1) == '\"'); }
fbc4a07f-59d7-43ea-9c44-1c3c17d3ad5e
2
public boolean pari(){ for(int i=0; i<4; i++){ if(nopat[i].getValue()==nopat[i+1].getValue()){ return true; } } return false; }
28be2ef4-35b6-437e-a985-76a60f0903a1
5
public String engineGetCertificateAlias(Certificate cert) { if (!loaded) { throw NOT_LOADED; } if (keyring == null) { return null; } if (!(keyring instanceof IPublicKeyring)) { throw new IllegalStateException("not a public keyring"); } Enumeration ali...
f76786cb-332a-4132-af6c-5b527938ff4d
8
private void calcTransitWeight_NoGamma(TreeQualifier qualifier) { candidateMapAddRemove = new HashMap<Node, Integer>(); candidateArrayAdd = new Node[addableList.size()]; candidateArrayRemove = new Node[removableList.size()]; addWeight = new double[addableList.size()]; removeWeigh...
66648ffb-461b-4924-b3ef-b06c4223623c
8
public JSONObject listFollowings(String email, Integer limit,String order,Integer since_id) { JSONObject result = new JSONObject(); JSONArray response = new JSONArray(); try { StringBuilder querry = new StringBuilder("SELECT id, username, about, name, email, isAnonymous FROM followers JOIN users ON ...
832f9ce9-4f64-4d7d-81b1-7bc9c9a9452f
2
public void visit_iinc(final Instruction inst) { final IncOperand operand = (IncOperand) inst.operand(); int incr = operand.incr(); if (incr < 0) { final Expr right = new ConstantExpr(new Integer(-incr), Type.INTEGER); final Expr left = new LocalExpr(operand.var().index(), Type.INTEGER); final Exp...
f0cf4ddc-4020-4b4e-9a52-d22aea87c73f
8
private JPanel toolbar() { JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); alt = new JRadioButton("Alt"); alt.setMnemonic(KeyEvent.VK_A); ctlrShiftU = new JRadioButton("Ctrl-Shift-U"); ctlrShiftU.setMnemonic(KeyEvent.VK_C); ButtonGroup group = new ButtonGroup(); group.add(alt); grou...
72668e21-c059-40a8-adb0-98d2093e1928
5
public void testAllPairs(File file){ try { Scanner scan = new Scanner(file); while(scan.hasNextLine()){ String[] line = scan.nextLine().split("\t"); if(line.length != 2) continue; int ip = stringToIP(line[0].trim()); String host = line[1].trim(); if(!testPair(ip, host)){ System.out.prin...
aa612af1-c60a-4f04-8194-853803c23373
1
@Override public void actionPerformed(ActionEvent e) { if ( ((JButton)e.getSource()).getText().equals("Add player") ) { ((MenuModel)model).addPlayer( ((MenuView)view).getPlayerName(), ((MenuView)view).getPlayerColor()); ((MenuView)view).cle...
39cfe294-fe6f-4244-b955-5a56a3ac563a
1
private void clearAllButtons() { while(removeButton()); }
62530468-9e39-4e0f-89e8-8261dae1303c
3
@Test public void testUpdateSimple() throws Exception { PersistenceManager persist = new PersistenceManager(driver, database, login, password); persist.dropTable(Object.class); // create a simple object SimpleObject object = new SimpleObject(); object.setAge(500L); // save it persist.saveObject(object)...
f4f01df4-3606-4c32-a2c5-b2b186247a49
9
public double findMedianSortedArrays(int[] nums1, int[] nums2) { if (nums1 == null || nums1.length == 0) { if (nums2 == null || nums2.length == 0) { return 0; } else { return nums2.length % 2 == 0 ? ((nums2[nums2.length / 2] + nums2[nums2.length / 2 - 1]) ...
7d49b442-616e-4065-a4ec-6d7ba1aa4357
7
public int firstMissingPositive(int[] A) { for (int i=0;i < A.length ;i++ ) { int index = A[i]; if(index >0 && index <= A.length && i != index-1 && A[index-1] != index){ int val = A[index-1]; A[index-1] = A[i]; A[i] = val; i...
7da1e78d-3544-4465-8f8b-59a8d2f4abd6
6
private String getPicture(BufferedReader reader) { String s = null; do { //go to the text passage in the html-code try { s = reader.readLine(); } catch (Exception e) { } } while (s != null && !s.contains(DHBW_PICTURE_TAG)); if (s == nu...