method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1738cf2b-ebfa-4701-a09c-78116916489b
8
private void generateClassifierForNode(Instances data, Range classes, Random rand, Classifier classifier, Hashtable table) throws Exception { // Get the indices int[] indices = classes.getSelection(); // Randomize the order of the indices for (int j = ind...
88208fe9-de0f-4031-88cc-4e3ae5ac6006
2
static int getRepeatCount(final int p, final char[] chars) { int i = 1; char opCode = chars[p]; while (p + i < chars.length && chars[p + i] == opCode) { i++; } return i; }
2d4625f8-1e1b-42a3-9f78-dad89f019efe
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace...
a56cd681-fc4f-42b9-8ba3-3b14ca94fa6b
6
public T deleteMax() { T res = array.get(0); // O(1) array.set(0, array.get(array.size() - 1)); // O(1) array.remove(array.size() - 1); // O(1) int index = 0; while (index < array.size()) { int left = index * 2 + 1; int right = index * 2 + 2; if (right > array.size()) { break; } else if (right...
32287c5b-f954-47aa-ac8a-4a6bfdf6b11a
3
public String generateName(List<String> names, int Q1, int Q2, int Q3) { int dice1 = random.nextInt(100) + 1; int dice2; if (dice1 > 75) { dice2 = random.nextInt(names.size() - Q3) + Q3; } else if (dice1 > 50) { dice2 = random.nextInt(Q3 - Q2) + Q2; } el...
de52d361-31ba-4d1a-8f9b-8dfcfe666c95
0
public FileSearchBean(File inputFile) { this.inputFile = inputFile; }
71e325af-8800-40c4-b660-eb1b4978f2f0
1
public JScrollPane getScrollPane() { if (scrollPane == null) { scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(100, 2)); scrollPane.setViewportView(getListUsuarios()); } return scrollPane; }
a131d300-82ef-4840-906c-e880c98a0b7d
0
@Override public Iterator<AbstractPlay> iterator() { return bestPlays.iterator(); }
a1d73d70-4eff-48bb-a5f5-678d2bcc32f2
3
public static void main(String[] args) { int[] one = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; int[][] two = one2two(one, 4, 3); for (int i = 0; i < two.length; i++) { for (int j = 0; j < two[i].length; j++) { System.out.print(two[i][j] + "\t"); } System.out.println(); } one = two2one(two); fo...
81e53e4b-52d5-427e-8d03-067cf4c257ab
9
public <C> C instantiate(Class<C> c) { List<Constructor<?>> constructors = new ArrayList<Constructor<?>>(); for (Constructor<?> constructor : c.getConstructors()) { constructors.add(constructor); } Collections.sort(constructors, ConstructorComparator.PARAMETER_COUNT); ...
118522c2-843f-4fca-8e77-94133ab44473
5
private boolean checkValidSubstraction(char c1, char c2) { if ((c1 != 'I') && (c1 != 'X') && (c1 != 'C') && (c1 != 'M')) { showCannotSubstractMessage(c1, c2); } float value1 = getValue(c1); float value2 = getValue(c2); if ((value2 / value1) > 10) { status...
13c109af-a206-4c89-b32b-c3f68267b560
1
@Override public int hashCode() { int hash = 0; hash += (numeroColegiado != null ? numeroColegiado.hashCode() : 0); return hash; }
6234166e-9db6-4717-87ce-1e2da039e613
3
private void doWork(int[][] aux,List<int[]> points,int[][][][] possibleFromPoints){ for(int[] point : points){ int[][] fromPoints=possibleFromPoints[point[0]][point[1]]; for(int[] fromPoint : fromPoints){ if(aux[fromPoint[0]][fromPoint[1]]+1>aux[point[0]][point[1]]){ ...
932251b4-7761-4a41-876c-bf69025da790
5
private static long readInteger(long min, long max) { // read long integer, limited to specified range long x=0; while (true) { String s = readIntegerString(); if (s == null){ errorMessage("Integer value not found in input.", "Integer in the range " + min + "...
bce59520-3798-410c-9144-5879ca55c8bb
7
@SuppressWarnings({ "rawtypes", "unchecked" }) protected synchronized Class findClass(String className) throws ClassNotFoundException { Class result; byte classData[]; // Проверяем кэш классов. Если класса в кэше нет, тогда применяются другие средства result = (Class) cache.get...
2fc6c727-92f5-4707-b3b0-1cb1b9c48700
1
public ArrayList<Course> courses(ResultSet rs) throws Exception { DBConnector db = new DBConnector(); ArrayList<Course> data = new ArrayList<>(); while (rs.next()) { data.add(new Course(db.getCourse(rs.getInt("courseid")))); } return data; }
aa90de2d-1e4f-464e-b008-ecb8946e8532
2
@EventHandler(priority=EventPriority.LOWEST) public void onPlayerJoin(final PlayerJoinEvent event) { for(String name : isPlaying) { if(Bukkit.getPlayerExact(name) != null) { Bukkit.getPlayerExact(name).hidePlayer(event.getPlayer()); } } Bukkit.getScheduler().runTaskLater(instance, new Runnable()...
a1c13c93-7889-4d9a-b678-be90d4d36273
2
public java.awt.Component prepareRenderer( javax.swing.table.TableCellRenderer renderer, int row, int col ) { final java.awt.Component c = super.prepareRenderer( renderer, row, col ); if ( drawStripes && !isCellSelected( row, col ) ) c.setBackground( rowColors[row&1] ); r...
667557c6-6874-4409-afc8-d633d9992b4d
7
public static Type parseType(String message) { String prefix = message.split(" ")[0]; if(prefix.equals(Message.ID_REQUEST_PREFIX)) return Type.ID_REQUEST; if(prefix.equals(Message.ID_RESPONSE_PREFIX)) return Type.ID_RESPONSE; if(prefix.equals(Message.SPAWN_PREFIX)) return Type.SPAWN; if(prefix.equals...
314501f1-cdf9-465a-bc2a-d92aab145ce5
1
protected float getGradosC(float gradosK) throws IllegalTemperatureException{ if(gradosK<0){ throw new IllegalTemperatureException("Los grados k no pueden ser inferiores a 0"); }else{ return gradosK-varemo; } }
164b0938-e3e2-4a17-8849-0770df1df77d
6
@Override public void mouseReleased(MouseEvent event) { Rectangle bounds = getBounds(); bounds.x = 0; bounds.y = 0; Point where = event.getPoint(); boolean inside = bounds.contains(where); mViewArea.convertPoint(this, where); if (mDragColumnDivider != -1) { mDragColumnDivider = -1; if (inside) { ...
c083cc03-d7f7-42ee-a5df-c95a538f1428
3
@Override public void addEdge(int src, int dst, int weight) { checkVectices(src, dst); if(weight == NO_EDGE) { throw new IllegalArgumentException(); } for (EdgePair pair : nodeListArray[src]) { if(pair.dst == dst) { pair.weight = weight; return; } } nodeListArray[src].add(new EdgePair(dst,...
fd2d285f-8b7a-4f6b-91d6-6c3dcde2b6c0
6
public static void connect1(TreeLinkNode root) { TreeLinkNode head = null; TreeLinkNode prev = null; TreeLinkNode cur = root; while (cur != null) { while (cur != null) { if (cur.left != null) { if (prev != null) { pr...
f559eb46-5af9-40e2-ad0c-fce0bd6202de
1
void phiRelatedUnion(final Expr a, final Expr b) { final Expr p = phiRelatedFind(a); final Expr q = phiRelatedFind(b); if (p != q) { phiRelated.put(p, q); } }
f8546e6c-6c77-4744-b2da-295b858ac187
2
public boolean isNextTo(RelationOsm relation){ for(Long wayId : relation.getIds()) if(this.ids.contains(wayId)) return true; return false; }
5ae6b06c-f3e0-43d5-a93e-b1076787d8c4
6
public void updateJunction(Venue v, Tile t, boolean isMember) { if (t == null) { return ; //I.complain("CANNOT SUPPLY NULL TILE AS JUNCTION") ; } junctions.toggleMember(t, t, isMember) ; if (isMember) { ///I.say("Updating road junction "+t) ; for (Target o : junctions.visitNear(t...
4087fbad-fad2-4e2e-942d-1626ca79cfb4
5
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerItemDrop(PlayerDropItemEvent e) { e.setCancelled(false); if(plugin.getConfig().getString("options.no-player-item-drop") != null && plugin.getConfig().getString("options.no-player-item-drop").equalsIgnoreCase("true")) { if(plugin.getConfig()....
5c85888e-017a-49d3-9ffa-180f3c4dd0a6
4
public DatabaseManager(String dbPath) { try { Class.forName("org.sqlite.JDBC"); } catch (ClassNotFoundException e) { Log.e(TAG, "DbManager Could not intialize jdbc driver", e); } boolean dbExists = new File(dbPath).exists(); if (Config.LOGD) Log.d(TAG, "D...
43cf9c77-6273-4d8b-844f-fb5d467123f5
3
public List<T> pesquisarComCondicao(List<LogicalExpression> listExpress, String ordem) throws ValidacaoException { List<T> lista = new ArrayList<T>(); try { Criteria criteria = session.createCriteria(classe); if (listExpress != null) { for (LogicalExpression e : l...
3f8693bb-66d9-4dcc-902d-72b22cff9711
5
public boolean deleteElementFieldView(ElementFieldView element) { if (element instanceof BallView) { return _ballsView.remove((BallView) element); } else if (element instanceof BoundaryView) { return _boundariesView.remove((BoundaryView) element); } else if (element insta...
095f7650-1e70-476d-b856-c052de406174
6
@EventHandler public void PlayerJump(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.getPlayerConfig().getDouble("Player.Jump.Dodge...
64232aef-1a82-47f1-ad61-942ae6391424
2
private States evaluateState(States states, Reader expressionReader) throws GeneralException, ExceptionWithPosition{ TransitionMatrix trMatrix = getTransitionMatrix(); States[] listState = trMatrix.getTransition(states); States currentState; Recognizer recognizers = getRecognizer(); ...
957f0b61-ae1c-4c0f-9565-e8ffe0e563dd
0
public William() { super("William", 7000, 300, 45, 100, as); as.setSkill(0, "Rage", 200, 50, "Cody is very calm in every situation."); as.setSkill(1, "Tantrum", 600, 100, "Cody jumps up and kicks his enemy in the face."); as.setSkill(2, "Berserk", 1200, 200, "Cody facepalms at his enemy."); as.setSkill(3, "T...
bdb0d21d-116f-4ec6-9759-ad7323ca9983
1
public void visitSwitchStmt(final SwitchStmt stmt) { final Set targets = new HashSet(); targets.add(stmt.defaultTarget()); for (int i = 0; i < stmt.targets().length; i++) { targets.add(stmt.targets()[i]); } targets.addAll(stmt.catchTargets()); verifyTargets(stmt.block(), targets); visitNode(stmt);...
19214284-ec9c-415c-8af4-bda2d8718409
1
private boolean isOperatorsHaveSamePriority(String o1, String o2) { return isLowPriorityOperator(o1) && (isMediumPriorityOperator(o2)); }
29fd501e-ce6b-4df3-a475-0f6a8c8bd44f
3
private int editarGdb(File archivo) { //tokeniza el archivo,crea la lista de pitStops y graba el nuevo archivo. int escritura = 0; String[] delimitadores = {"PitStopStrategies", "}"}; String[] cadenas = Tools.readFile(2, delimitadores, archivo); if (!cadenas[0].contains("noFile")) { ...
bea0a7f8-6caa-46f8-8710-415e3f1db2ae
3
public Boolean login(String Usuario, String Password) { for (Cliente c : clientes) { if (c.getUsuario().equals(Usuario)) { if (c.getPassword().equals(Password)) { estado = 1; cActual = c; return true; } ...
655c6839-3656-412c-bd65-fccc5ebbb201
0
@Override public boolean isConverted() { // TODO Auto-generated method stub return false; }
160b1ebb-f54b-4a06-89c8-82a234202d9f
1
private String prepareConfigFile() { StringBuffer buf = new StringBuffer(); buf.append(XMLTools.getXmlDeclaration(null)).append(PlatformCompatibility.LINE_END_DEFAULT); buf.append("<").append(E_ROOT); buf.append(" ").append(A_SELECTION_MODE).append("=\"").append(XMLTools.escapeXMLAttribute("" + getSelection...
efba1125-0a3e-4551-93e5-df5c3555eb97
0
public byte[] getContent() { return mContent; }
0591d9fc-74cf-4463-9a1a-b81fd5a2786d
5
private void preProcessQueryHelper(String fileName, HashSet<String> stopwordsSet, String outFile, int queryCol, HashSet<String> prodWords) { try { FileReader qFileReader = new FileReader(fileName); BufferedReader qBuffReader = new BufferedReader(qFileReader); FileWriter fWriter = new FileWriter(outFile...
a6f4555e-0ec3-4400-9755-7e226e9eaadc
4
public Matrix getRMatrix() { Matrix rMatrix = new Matrix(n,n); double[][] R = rMatrix.getArray(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i < j) { R[i][j] = -QR[i][j]; } else if (i > j) { ...
6dc5d2da-c009-4c06-b1a2-7efc01f5dee1
4
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof SubcategoriaId) ) return false; SubcategoriaId castOther = ( SubcategoriaId ) other; return (this.getId()==castOther.getId()) && (this.getIdcategoria(...
5580cfe7-0ac2-4fba-a6d5-cfa5db61c1e0
7
public void update(){ if(lastX == x && lastY == y) moving = false; lastX = x; lastY = y; if(attackTime > 0){ attackTime--; weaponFrame++; speed = speed / 2; } if(pathfinder.line(x + 16, y + 16, dungeon.getPlayer().getX() + 16, dungeon.getPlayer().getY() + 16)){ canSeePlayer = false; tar...
46cd34ad-43f1-440e-9831-a6d8507b61e0
7
protected Short coerceToShort(Object value) { if (value == null || "".equals(value)) { return Short.valueOf((short)0); } if (value instanceof Short) { return (Short)value; } if (value instanceof Number) { return Short.valueOf(((Number)value).shortValue()); } if (value instanceof String) { try ...
d3ad6557-9676-4fa0-9127-adc18966e5f0
0
public void reset() { }
64e1baf4-cd28-4288-86a8-dede2dd43ebc
4
@Override public double evaluate(int[][] board) { int tileCnt = 0; int blockedCnt = 0; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++) { if (board[i][j] != 0) { tileCnt++; if (blocked(i, j,...
669445cb-dc6c-4694-a7a6-27a9beacb3e8
0
@Override public void returnBomb() { bombs++; }
54e28ffb-130a-46bd-9455-339671479115
7
public int getWorldDimension(String worldName, boolean x){ if (x){ switch(worldName){ case smallcity: return smallCityXLength; case bar10: case bar11: return barXLength; default: ...
d543fb32-079c-469c-80b6-99ad9b578a1d
0
public static Visiteur selectOne(EntityManager em, String matricule) throws PersistenceException { Visiteur unVisiteur = null; unVisiteur = em.find(Visiteur.class, matricule); return unVisiteur; }
d75fc074-e0b7-49d1-8c24-788106e20a23
5
public static String nextQuestion() { boolean french = rand.nextBoolean(); Vocab v = getRandom(); // Refresh if (totalAskedCount >= vocabList.size() - rand.nextInt(vocabList.size() / 4 < 1 ? 1 : vocabList.size() / 4)) { for (Vocab voc : vocabList) voc.setAsked(false); totalAskedCount = 0; } ...
c3c64b93-bb89-4d69-8332-1e9e1bd04eb8
8
void updateMask() { //Clip the motion to the display window if (xMin + dx < 1) dx = 1 - xMin; if (xMax + dx > Width - 1) dx = Width - 1 - xMax; if (yMin + dy < 1) dy = 1 - yMin; if (yMax + dy > Height - 1) dy = Height - 1 - yMax; //Now update the mask for (int x = 0; x < Width; x++) { for (...
5ac725ce-7ae0-4149-bbaf-e39b886b6ba4
0
@Test public void test_toString(){ assertNotNull(board); board.removeAllPawns(); Pawn pawn1 = new Pawn('l', 2,2, board); board.addPawn(pawn1); Pawn pawn2 = new Pawn('m', 2,1, board); board.addPawn(pawn2); assertNotNull(board.toString()); }
169cecde-f9ae-421d-99f9-811388a74f4e
0
public void setProblemId(Integer problemId) { this.problemId = problemId; }
16289772-a32b-4a79-87e1-7a900a16ee87
5
public ArrayList<AbstractMob> findNearMobs(int x, int y, int range, int selfID){ ArrayList<AbstractMob> nearby = new ArrayList<AbstractMob>(); for (int i = 0; i < mobs.size(); i++){ AbstractMob current = mobs.get(i); double distance = PointMath.distance2Points(current.getX(), current.getY(), x, y); ...
1719a628-e898-4abd-976a-599d4e30116c
0
public static void main(String[] args) { instance = new AIMerger(); }
93a723ec-fe47-433f-b107-9b858a8333ff
6
static final int method1754(boolean bool, int i, int i_12_, int i_13_) { anInt5920++; if ((Node.anInt4290 ^ 0xffffffff) > -101) return -2; if (bool != true) method1754(false, 115, 112, -104); int i_14_ = -2; int i_15_ = 2147483647; int i_16_ = i_12_ - Class75.anInt1266; int i_17_ = i_13_ - Class75.anIn...
dc66f46f-f339-418c-ac00-838e285e3810
2
public void paint(Graphics g) { if (fm == null) { this.font = mcd.getFont(); this.fm = mcd.getFontMetrics(font); } updateSize(); Graphics2D g2d = (Graphics2D) g; g2d.setFont(font); RoundRectangle2D r = new RoundRectangle2D.Double(getX(), getY...
2735b38b-810c-4ddf-b56a-b3a23b6da2c7
9
public static void main(String[] args) { if ((args.length < 1) || (args.length > 3)) { System.err.println("usage: " + Client.class.getName() + " <white|black> [[host:]port] [strategy]"); System.exit(1); } PlayerType player = PlayerType.NONE; String host =...
ba36e3ac-d285-4461-9d0a-e6c2f261e739
5
public void dfs_2(int rev_matrix[][], int source) { explore[source] = 1; leader_node[finishing_time_map.get(source)] = leader; stack.push(source); int i = 1; int element = source; while (!stack.isEmpty()) { element = stack.peek(); i = 1...
2af3b14c-2994-4a64-924e-cbca22c34f0b
4
* @param wbh WorkBookHandle * @param sId Stream or cachid Id -- links back to SxStream set of records * @return */ public Sxview addPivotTable( String ref, WorkBookHandle wbh, int sId, String tablename ) { wkbook.addPivotCache( ref, wbh, sId ); // create the directory/storage for a pivot cache, if not alre...
4c43be87-de96-402b-8050-81a4f075f240
5
private static Move ForwardLeftCaptureForWhite(int r, int c, Board board) { Move forwardLeftCapture = null; if(r<Board.rows-2 && c>=2 && ( board.cell[r+1][c-1].equals(CellEntry.black) || board.cell[r+1][c-1].equals(CellEntry.blackKing)...
16f4bb13-b72a-4287-9978-34ea552c0c1c
6
private void checkContext(ScriptContext context) throws ScriptException { Object obj = context.getAttribute(MiniScriptLang.BINDING_RAM); if(!(obj instanceof int[])){ throw new ScriptException(MiniScriptMessages.getLocaleMessage("ram.not.intarray.or.null"));//$NON-NLS-1$ } ram = (int[])obj; obj = context.ge...
722d5c04-0453-4a09-9ffa-952610447fa1
9
private int evaluateUtilityByScore(GameState _prev, GameState _current, int _player){ int utility = 0; /// Check to find the opponent int tOpponent = 1; if(_player == tOpponent){ tOpponent = 2; } /// Try not to give opponent score utility -= _...
c570db46-7315-432e-b7e3-564a97514107
5
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent e) { ItemStack placed = e.getItemInHand(); if (placed.getType() == Material.CHEST) { ItemMeta meta = placed.getItemMeta(); if (meta.hasDisplayName() && meta.hasLore() && meta.getDisplayName().st...
a8f66124-094a-4bbf-8fd1-c41ea85c26ce
3
public void mousePressed(MouseEvent e) { if (e.getButton() == 1) { mouse.clicked = true; } if (e.getButton() == 2) { mouse.midleClicked = true; } if (e.getButton() == 3) { mouse.rightClicked = true; } }
937f7817-cfe2-4c06-9bbb-e40a802bab48
2
@Override public void init ( GameContainer cont ) throws SlickException { try { // Reference Sounds to initialize them Sounds.JUMP.getClass(); // Don't do this at home partSmoke = particles.addParticleType( Sprites.SMOKE ); partBlue = particles.addParticleType( Sprites.BLUE ); input = cont.get...
8f18266c-56ca-46d6-9587-e35aefde56c7
3
private void connectJail(Jail jail, ArrayList<FieldCircularList> fieldArrayList, Parking parking) { if(parking == null) { for(FieldCircularList next : fieldArrayList) { if(next instanceof Parking) { jail.setParking((Parking) next); break; } } } else { jail.setParking(parking); } }
859798cc-5498-4bbd-ad98-2e06fe534550
1
private void onSpeedChange(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onSpeedChange try { game.setSpeed(Integer.parseInt(JOptionPane.showInputDialog(this, "Enter speed (ms):", game.getSpeed()))); panel.resetFrames(); game.resetTicks(); } catch (NumberFormatExc...
a8a99232-40ca-4821-948c-256a701c8e92
3
private PlotWindowView build(Boolean calculateFromScratch) { firePropertyChange(DialogWindowController.INIT, 0, 1); Points points; dataModel.setMainWindowModel(mainWindowModel); if (calculateFromScratch) { dataModel.setPoints(null); dataModel.buildPoints(); ...
367a61ba-acc6-48d3-af86-3a45d9a6b5df
3
private String seperate() { String field = ""; for(int i = 1; i <= cron.temp.length(); i++) { if(cron.temp.substring(i - 1, i).equals(" ")) { cron.temp = cron.temp.substring(i, cron.temp.length()); break; } else...
ceea9264-5953-4757-9905-06187ee0df37
9
public static int countYZ(String str){ int count = 0; for (int i = 0; i < str.length(); i++){ if (!Character.isLetter(str.charAt(i)) && i > 0){ if (str.charAt(i - 1) == 'y' || str.charAt(i - 1) == 'z' || str.charAt(i - 1) == 'Y' || str.charAt(i - 1) == 'Z'){ count++; } } } if ("y".equal...
26837fee-74b0-481b-a89c-b9429ee80e7d
8
public TerrainTextureManager() { try { BufferedImage var1 = ImageIO.read(TerrainTextureManager.class.getResource("/terrain.png")); int[] var2 = new int[65536]; var1.getRGB(0, 0, 256, 256, var2, 0, 256); for (int var3 = 0; var3 < 256; ++var3) ...
a6f5ff81-fb4c-4c71-8927-a6f1634268fe
8
public void paint(Graphics g){ switch(state){ case 0: gameStart.paint(g, xMouse, yMouse); break; case 1: lvlObj1.paint(g, xMouse, yMouse); g.drawImage(menu, 0, 445, null); Player.drawCoins(g); if(xMouse>12 && xMouse<175 && yMouse>488 && yMouse<538){ g.drawImage(specButtonA, 12, 488,...
e6f9ea7b-a887-43ff-bfeb-adf2fcd19a95
9
private void jTextFieldSearchBiblioKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchBiblioKeyTyped // TODO add your handling code here: if (evt.getKeyChar() == KeyEvent.VK_ENTER) { String toSearch = jTextFieldSearchBiblio.getText(); if (jRadioButtonIdBibli...
3cc14059-f50d-4da5-978f-f6965cbb54c7
1
public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException { Universe myUniverse = new Universe(2); Universe.listShapes(); myUniverse.addShape(); myUniverse.startSim(); try { Thread.sleep(10000); } catch(InterruptedException ex) { Thre...
cab96562-0250-4670-9a90-907cf65613be
1
public List<String> getLibelleCategorie() { if (libelleCategorie == null) { libelleCategorie = new ArrayList<String>(); } return this.libelleCategorie; }
09b4dd75-4dca-4fa3-adae-2d963e487290
3
protected String removeLinkAttributes(String html) { //remove type from link tags with rel=stylesheet if(removeLinkAttributes) { Matcher matcher = linkTypeAttrPattern.matcher(html); StringBuffer sb = new StringBuffer(); while(matcher.find()) { //if rel=stylesheet if(linkRelAttrPattern.matcher(match...
93f9755a-acac-43bc-a616-e475eb5aa948
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...
ead6d00c-a643-4ba2-a0c0-c809d661584f
6
public void actionPerformed(ActionEvent e) { String a = e.getActionCommand(); if (a.equalsIgnoreCase("Random")) { RandomClient c = new RandomClient(); c.start(); } if (a.equalsIgnoreCase("Bad")) { BadClient c = new BadClien...
353a34a6-979a-43d4-8fe3-8ffd0b104790
1
public int getIndexOfChild(Object parent, Object child) { Iterator iter = ((TreeElement) parent).getChilds().iterator(); int i = 0; while (iter.next() != child) i++; return i; }
e11e1a62-85ec-450b-a7c3-7b52a9b8a1ea
9
public GenericConverter find(Class<?> sourceType, Class<?> targetType) { List<Class<?>> sourceCandidates = getTypeHierarchy(sourceType); List<Class<?>> targetCandidates = getTypeHierarchy(targetType); for (Class<?> sourceCandidate : sourceCandidates) { for (Class<?> targetCandidate : targetCandidates) { ...
0ce905e6-c397-4b28-8bab-10f53444248c
7
@EventHandler public void onBlockPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); // get player Block block = event.getBlockPlaced(); // get block placed // check config FileConfiguration config = plugin.getConfig(); String material = block.getType().toString(); // if deactivated, don't co...
042f661e-2ca2-46c3-887e-276e004a61ec
9
protected static Ptg calcBin2Oct( Ptg[] operands ) { if( operands.length < 1 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "Bin2Oct" ); String bString = operands[0].getString().trim(); int places = 0; if( operands.length > 1 ) { places = operands[1].getIntVal(); } //...
12385c0c-dcf7-46c2-9187-09080da74aa4
0
public void arcadeDrive(double speed,double turn) { _drive.arcadeDrive(-speed, turn, false); }
d416d525-9f90-4d51-b3c3-fb1fe4617ec8
2
public synchronized static void next(String table, UseId use) { Long id = cache.get(table); if (null == id) { id = new Long(1); } if (use.useId(id)) { cache.put(table, id + 1); } }
21f5044b-3708-4863-a1df-6eb941c28a9e
9
public void mouseDragged(MouseEvent e) { if (xaxis == null || yaxis == null) return; x1 = e.getX(); y1 = e.getY(); if (drag) { if (x1 < datarect.x) { x1 = datarect.x; } else { if (x1 > datarect.x + datarect.width) x1 = datarect.x + datarect.width; } if (y1 < datarect.y) { ...
893895fc-67b7-4219-b908-b4bca41c5369
8
public ArrayList<String[]> mostrarDatos(String nombreTabla, String[] campos) { int contador; String[] resultado; // Creamos el arraylist donde se guardará los resultados de la consulta ArrayList<String[]> tablaResultado = new ArrayList<String[]>(); try { ...
74c2ac7c-1fad-4fea-b1af-db73fa576005
4
public void testConstructor_int_int() throws Throwable { LocalTime test = new LocalTime(10, 20); assertEquals(ISO_UTC, test.getChronology()); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals(0, test.getSecondOfMinute()); assert...
e3fc0289-fb66-4cd8-b6b4-f93e17bfdae5
3
private int valuedIn(String flags) { int result = 0; for (char ch : flags.toCharArray()) if (this.getType(ch) == Type.STRING || this.getType(ch) == Type.OPTIONAL) ++result; return result; }
d6093171-3715-49f5-b90b-defcac41de84
7
private boolean PlayerInputValidation() { boolean validation = true; if (m_PlayInputOne.getText().equals("")){ validation = false; } if (m_PlayInputTwo.getText().equals("")){ validation = false; } if (m_PlayInputOne.getText().length() > MAX_NAME) { validation = false; } if (m_PlayInputTwo....
c419e053-f63e-4e3f-8865-828787644c52
9
public ArrayList<Task> initiateTaskList(Connection conn) throws SQLException { ArrayList<Task> tasks = new ArrayList<>(); int taskID; int parentID; int estimatedtime; int priority; Type t = null; Statuss s = null; Customer c = null; User u = null; ...
e2e16647-a0b2-4368-94c2-2750ea599823
0
public void setWRholder(String newWRholder) { WRholder = newWRholder; }
314a8204-b03d-4e76-8df5-428a77462e1d
6
@Override public ModelLoader generate(MaterialEntity entity) { Vec2[] vertices = entity.getShape(); ModelLoader model = new ModelLoader(); //front of model for (Vec2 point : vertices) model.vertices.put(point.x, point.y, 0.5f); //back of model for (Vec2 point : vertices) model.vertices.put(point.x...
c712b21a-5f2c-4b42-b8d7-b039b3534e47
1
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (pgrid.service.corba.repair.IssueStateHelper.id (), "IssueState", new String[] { "PENDING", "SOLVED", "BROADCASTED"} ); } return __typeCode; }
8f4a41ca-bd31-44c3-89ca-a6945f0c53c5
6
@SuppressWarnings("serial") private Action getUpdateAction() { if (updateAction == null) { String actionCommand = bundle.getString(UPDATE_NODE_KEY); String actionKey = bundle.getString(UPDATE_NODE_KEY + ".action"); updateAction = new AbstractAction(actionCommand) { ...
07a4fcf7-eaa7-426d-86df-868bc006bb4b
7
public void checkwin(){ // checks if all the button without bombs have been // pressed boolean allexposed = true; for (int x = 0; x < row; x++) { for (int y = 0; y < col; y++) { if (flag[x][y] == true && bomb[x][y] == false) allexposed = false; if (checkwinbool[x][y] == false) { allexpos...
b18a4da5-fbf1-4117-804c-96d652152204
6
public boolean revert(Event event, Board board) { boolean done = false; int event_type = event.getEventType(); ItemDAO item_dao = new ItemDAO(BddConnection.getInstance()); ListDAO list_dao = new ListDAO(BddConnection.getInstance()); switch (event_type) { case Event.LIST_CREATED: delete(event); ...
cab91f29-3009-4385-b76f-fe19c42d940b
1
public void stopSound() { if (soundClip != null) { soundClip.setLooping(false); } }
9653156b-6647-4c53-aaa9-15c20fdc2bd7
7
public Tilbakemelding byttPassord(PreparedStatement setning, ResultSet res, Connection forbindelse) { Tilbakemelding returverdi = Tilbakemelding.feil; try { getBrukerData(); //Finner passordet til brukeren String databasePassordet; //forbindelse = ds.getCo...