method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
101d9576-b25c-4735-a063-d2f2abc6c0dc
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
fe00fd19-5793-45ad-948b-580cccc6915f
1
public int insert(ModelCRLV crlv) throws ClassNotFoundException, SQLException{ int result; con = abrirBanco(con); String sql = "insert into crlv" + "(via, cod_renavam, rntrc, exercicio, nome, cpf_cnpj, placa," + "uf_placa, placa_ant, uf_placa_ant, ch...
bffa8ccc-11a3-478a-9315-0286f8e850ad
8
void maxSlidingWindow(int A[], int n, int w, int B[]) { LinkedList<Integer> Q = new LinkedList<Integer>(); for (int i = 0; i < w; i++) { while (!Q.isEmpty() && A[i] >= A[Q.getLast()]) Q.removeLast(); Q.addLast(i); } for (int i = w; i < n; i++) { B[i-w] = A[Q.getFirst()]; ...
f63583fc-2624-4241-8109-e6b9697a6695
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { KundeDTO kunde = kundeList.get(rowIndex); Object value = null; switch (columnIndex) { case 0: value = kunde.getKundeId(); break; case 1: value = kunde.getFirmaNavn(); break; case 2: value = kunde.getKontaktNavn(); break; ...
26f83bf8-8fc8-4774-b361-654eeb5aed63
5
public void doStatsOnList(ArrayList<Float> data) { ArrayList<Float> medianFinder = new ArrayList<Float>(); for (float dataPoint : data) { if (dataPoint != dataPoint) continue; n++; sum += dataPoint; sumOfSquares += dataPoint * dataPoint; medianFinder.add(dataPoint); } mean = sum / n; if (...
26044c03-8628-468f-bfa1-20aab01d054a
9
private void hookListener(final ColumnViewer viewer) { Listener listener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.MouseDown: handleMouseDown(event); break; case SWT.KeyDown: handleKeyDown(event); break; case SWT.Selection: ha...
2723de04-c134-4b7d-bcef-810564c9f528
0
public void getSysRunDate() { date = gregorianCalendar.getTime(); sysRunTime = (date.toString()).split(" "); }
10c39057-0a52-43fe-8e8b-a276e1d5714e
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { try { if (!(sender instanceof Player)) { return true; } Player player = (Player)sender; if (HyperPVP.getSpectators().contains(player.getName())) { player.teleport(HyperPVP.getMa...
bb9ac7be-eadc-4708-817a-03f1aa27f57b
8
public synchronized void finishEntropyProcessing(int num_msgs, int otherID, Socket sock) { // Write nextWrite; // Write committedWrite; entropy_size = num_msgs; while(entropy_writes.size() != entropy_size) { try { wait(); } catch(InterruptedException e) {} } for(int i = 1; i<=num_msgs; i++...
51adce82-d045-4768-93f2-52297c4ed8f7
0
public int getPoints() { return points; }
82bb4bed-15e0-4ffe-9c39-4b1d0ad68a58
9
public CombatScreen(TurnBasedGame _game, Battle battle, CombatEntity player, CombatEntity monster, MapScreen parent) { this.game = _game; this.battle = battle; this.player = player; this.monster = monster; this.mapScreen = parent; rng = new Random(); battle.addBattleEndListener(new BattleEndListener() ...
da10989e-9008-4ff6-8726-bc4edf636d50
6
static String getMessageName(StringBuilder sb, Class<?> type, boolean includeScope) { // Crosstown does not support complex generated names since they won't // translate to // dotNet if (includeScope) { String scope = null; if (ExternallyNamespaced.class.isAssignableFrom(type)) { // Use dotNet Nam...
e6ab9fe3-f046-4f19-aae7-68188e7ccf47
9
public void actionPerformed(ActionEvent e) { if(e.getSource() == trainSelector) { redraw(); } else if(e.getSource() == engine) { int currTrain = Integer.parseInt((String) trainSelector.getSelectedItem()); if(trainModelWrapper.isInFailure(currTrain)) { trainModelWrapper.resolveF...
106b916a-31b3-48ca-a4a6-e3ac6e267822
6
private int compareHandsLo(String hand1, String hand2) { if (hand1.equals("0")) { return hand2.equals("0") ? 0 : 2; } else if (hand2.equals("0")) { return 1; } for (int i = 0; i < 5; i++) { if (Card.getRank(hand1.charAt(i)) > Card.getRank(...
7410027b-b62f-4d22-b724-4addef0694b1
9
public static void main(String[] args) throws Exception { String env = null; if (args != null && args.length > 0) { env = args[0]; } if (! "dev".equals(env)) if (! "prod".equals(env)) { System.out.println("Usage: $0 (dev|prod)\n"); ...
6fffd8ec-4d34-4a31-84a9-58293676d78a
8
public void testKeepLastNDeletionPolicy() throws IOException { final int N = 5; for(int pass=0;pass<2;pass++) { boolean useCompoundFile = (pass % 2) != 0; Directory dir = new RAMDirectory(); KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N); for(int j=0;j<N+1;j++) { ...
dcc0085d-0bd7-43be-bbd4-4ab7f79fa3e2
4
@Override public void addCallback(IJeTTEventCallback callback) { // Create adapters // Create an adapter for each type of callback here CallbackAdapter<?>[] adapters = new CallbackAdapter[] { new EventCallbackAdapter(callback), new ResultCallbackAdapter(callback), }; // Add all for(CallbackAdapter<?...
4432c00d-e2f8-42f7-a6a7-79b3b91f86e6
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 Contact)) { return false; } Contact other = (Contact) object; if ((this.contactID == null && other.contactID !=...
940ec374-14d7-4ddd-a407-22510ed841d6
0
public double getAltura() { return altura; }
c687a7f6-1291-4630-a803-7ea0218650b8
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 Cidade)) { return false; } Cidade other = (Cidade) object; if ((this.codcidade == null && other.codcidade != nu...
f2a39503-2044-4df5-ac4b-49b07d36bfd6
2
@Override public void actionPerformed(GUIComponent source) { if (source == newGameButton) { Game.linkedGet().newGame(); this.deactivate(); Game.linkedGet().resumePlay(); } else if (source == quitButton) { Game.linkedGet().quit(); th...
c88baff5-32d7-42d6-8efa-aadd8da7121f
4
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return listReclamation.get(rowIndex).getIdReclamation(); case 1: return listReclamation.get(rowIndex).getDateReclamation(); case 2: ...
5ad06357-6f72-458d-9e6c-5622975a629f
2
private synchronized String getSelection() { while (selection == null) { try { this.wait(); } catch (InterruptedException e) { throw (new RuntimeException(e)); //Seriously when is it ever correct to actually handle this error } } return selection; }
73ea96e2-64ba-476e-bf51-293ebe8246dc
5
private static <AnyType extends Comparable<? super AnyType>> void percDown( AnyType [ ] a, int i, int n ) { int child; AnyType tmp; for( tmp = a[ i ]; leftChild( i ) < n; i = child ) { child = leftChild( i ); if( child != n - 1 && a[ child ].compareTo( a[...
ac68caf8-392e-416a-b223-aebe52acb607
5
private void getStringFiles(File[] valuesFolder) { for (File valuesVersion : valuesFolder) { System.out.println("Parsing xml from " + valuesVersion.getName() + "\n"); String columnName = valuesVersion.getName().substring( "values".length()); if (ConstantMethods.isEmptyString(columnName)) { col...
27660017-2aa0-4ab3-93de-731a97314ce3
8
public Object getConfig(int i, String name) { String str = ""; int in = 0; long lng = 0; double dbl = 0; boolean bln = false; try { Transaction trans=new JDBCTransaction(createConnection()); Connection connection = ((JDBCTransaction)trans).getConnection(); Statement stmt=connection.createState...
3f0213b1-92a9-4651-8506-3861e24ad425
2
public E get(int id) { try { selectId.setInt(1, id); ResultSet rs = selectId.executeQuery(); while(rs.next()){ return build(rs); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
8326f9cc-ee6a-42e7-90bb-c0b86dfac664
6
@Override public void mouseDown(Point mousePoint, boolean shiftDown, boolean ctrlDown) { // if ctrl is down deselect all selected objects if (!ctrlDown) { for (Object go : model.list()) { ((GraphicalObject) go).setSelected(false); } } Graphica...
93af4ab3-9738-406a-97de-a500ffb6d142
9
public void addPageHeader(List<String> whereTo, String head) { whereTo.add("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); whereTo.add("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >\n"); whereTo.add("<head>\n"); whereTo.add...
11b3403a-9111-40ad-97b0-ade391cf7a76
4
public final void handlePlace(PlayerInteractEvent event, BlockAPI plugin) { Player player = event.getPlayer(); ItemStack item = event.getItem(); Block block = event.getClickedBlock().getRelative(event.getBlockFace()); BlockState state = block.getState(); if ((!block.isEmpty()) && (!block.isLiquid())) { r...
936e6796-bfaa-4c1c-844b-4f9aa3e1d9ff
2
private void btn_generate_tokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_generate_tokenActionPerformed // TODO add your handling code here: String cadToken = this.val_token.getText(); if (cadToken.length() > 0) { while (modelTable.getRowCount() > 0) { ...
5814d5b1-86df-40c5-a02a-1a66818bea10
3
@Override public void mouseReleased(MouseEvent e) { if (this.isMovingToolBar) this.isMovingToolBar = false; if (this.isDrawing) this.isDrawing = false; if (this.isSelecting) { this.isSelecting = false; } System.out.println("mouseReleased: "+e.getX()+","+e.getY()); }
281b0c6c-cb8e-485c-af9c-7e7381d7ed0e
3
public void setCaso(TCaso node) { if(this._caso_ != null) { this._caso_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
4172a50b-2c49-41f6-952f-e27612b143b5
5
public static void deleteWorlds() { if (!containsLoadedWorlds()) { if (ChristmasCrashers.isDebugModeEnabled()) System.out.println("Cancelling DeleteWorldsTask - there are no loaded worlds."); return; } ArrayList<World> worldsToDelete = new ArrayList<World>(); for (World w : worlds) if (w != null...
68d9fc76-edbe-47d3-a866-a22bcb4f2bae
0
public Object getValue() { return this.value; }
f86b1cb4-cf39-4e52-b164-12a10b7de7da
6
private FriendsStatusListener makeFriendsStatusListener() { return new FriendsStatusListener() { @Override public void statusChange(Long friendId, SkypeStatus newStatus) { System.out.println(" !! Status msg receiv: userID:"+friendId+" newStatus:"+newStatus.name()); switch (newStatus) { case O...
21f453a7-d35d-418b-b5f5-1c911e4dba24
4
public ReportServer() { try { server = new Server(); Network.register(server.getKryo()); server.start(); server.bind(Network.PORT, Network.PORT); database = new ReportDB(); server.addListener(new Listener() { @Override public void received(Connection con, Object o) { if(o instanceo...
8eb500ab-1080-4f2e-912f-bb62874dabbc
8
private boolean execMakeCollaborativeProfiles(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) { int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt"); String clientName = (String) queryParam.getVal(clntIdx); int threasholdIdx = queryParam.qpIndexOfKeyNoCase("th"); if (thre...
78960148-0190-4cc5-95a9-db7b0787ae8c
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
01a16a97-3370-4481-99ab-accceb2c5546
8
public Process getNextProcess(Integer processor) { Process currentProcess = runningProcesses.get(processor); if(currentProcess != null && preemption == false) { return currentProcess; } if(waitingProcesses.size() == 0) { return null; } ...
9d318a28-29c4-4835-a499-a848e925f09a
3
public List<Message> getAllChildrenMessages(int parentId) { List<Message> list = new LinkedList<>(); Connection connection = ConnectionManager.getConnection(); if (connection == null) { logger.log(Level.SEVERE, "Couln't establish a connection to database"); return list; ...
c28f3816-57ee-4d71-9f6d-b7d4b6881862
7
private void downloadCover (String coverName){ File f=new File(downloadPath+File.separator+coverName); InputStream is = null; try { is = new URL("http://beta.grooveshark.com/static/amazonart/"+coverName).openStream(); } catch (MalformedURLException e1) { showMessage(("Cover Download Failed")); e1.prin...
ab96f13a-4272-4381-b316-1c5bf2f6e4ac
5
public Library addNative(OperatingSystem operatingSystem, String name) { if ((operatingSystem == null) || (!operatingSystem.isSupported())) throw new IllegalArgumentException("Cannot add native for unsupported OS"); if ((name == null) || (name.length() == 0)) throw new IllegalArgumentException("Cannot add nativ...
4bf03ce8-7119-4e81-83b4-223a9111321b
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StageDirection other = (StageDirection) obj; if (direction == null) { if (other.direction != null) return false; } else if (!direction.e...
4b797ecc-bac6-4c86-948a-95e248cbc1cd
4
public int longestConsecutive(int[] num){ Map<Integer,Integer> mapStart = new HashMap<Integer,Integer>(); Map<Integer,Integer> mapEnd = new HashMap<Integer,Integer>(); int maxLength = 0; for(int i = 0 ;i < num.length;i++){ if(mapStart.containsKey(num[i])) con...
672aeddf-2e97-4654-8e7a-07f1195d2ab7
8
public boolean parseStr(String str){ Pattern pattern = Pattern.compile("[,;]"); String[] strs = pattern.split(str); x1=Integer.valueOf(strs[0]); y1=Integer.valueOf(strs[1]); x2=Integer.valueOf(strs[2]); y2=Integer.valueOf(strs[3]); if(cb.getX()<=x1||x1<0||cb.getX()<=x2||x2<0||cb.getY()<=y1||y1<0||cb.getY(...
22c73afe-e249-4f38-b03d-75ba446f78c8
1
public int sumNumbers(TreeNode root) { int result = 0 ; if(root == null) return result; String s =""; saveNumber(s,root); return total; }
1d6929db-1870-4232-ac02-920d1d612ff3
2
public static int getIndexOfPS(Stock u, ArrayList<Stock> stocks) { int counter = 0; for(Stock e:stocks) { if(e.getTickername().equalsIgnoreCase(u.getTickername())) { return counter; } counter++; } return -1; }
11c2d287-ac90-445c-87ab-40b6c9fdb91a
6
private String nextQuotedValue(char quote) throws IOException { // Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access. char[] buffer = this.buffer; StringBuilder builder = new StringBuilder(); while (true) { int p = pos; int l = limit; /* the index of ...
301545a7-e254-46ce-bc84-5925aea81632
4
@Override public double[][] solve(double[] T_0, int n, double k, double u, double dt, double dx) { double[][] ans = new double[n][]; int m = T_0.length; ans[0] = T_0; for (int layer = 1; layer < 2; layer++) { double[] T = ans[layer - 1]; double[] curLayer = new double[m]; for (int i =...
e136d434-22fc-4acb-861c-9a63ed1b4ed8
7
@SuppressWarnings("unchecked") public void tabulateSurvey(Survey s) throws IOException{ //Takes a Survey given by the user and shows all response results for the Survey. Survey surv = s; ArrayList<ArrayList<Response>> resp = new ArrayList<ArrayList<Response>>(); final File dir = new File("responses"); if (!...
2ed58b66-3f9b-4c05-9947-bcdb6844abb8
7
public boolean containsValue( Object value ) { final int num = mBuckets.length; if( value != null ) { for( int i = 0; i < num; i++ ) { Node<V> entry = mBuckets[i]; while( entry != null ) { if( value.equals( entry.mValue ) ) { ...
9cd3540b-c703-4c74-8af9-c641611876ed
0
public List<RoomEvent> getRoomEventList() { return roomEventList; }
c53b425f-f6d4-4266-a8cf-f68072779665
5
public GeneralConfigurationPanel() { super(); setLayout(new BorderLayout()); contents = new GeneralData(); PropertySet ps = new PropertySet(); final TextProperty tpName = new TextProperty("Game name", null); final FileProperty fpMenuBackgroundImage = new FileProperty( "Menu background image (800 \u00...
11072f12-27d7-4fe6-849c-8fb91958ab3c
2
public void start() throws BITalinoException { int bit = 1; for (int channel : analogChannels) bit = bit | 1 << (2 + channel); try { socket.write(bit); } catch (Exception e) { throw new BITalinoException(BITalinoErrorTypes.BT_DEVICE_NOT_CONNECTED); ...
780a5354-c839-49e2-9075-be372543b490
2
public void saveYMLFile(String fileName) { if (!FileConfigs.containsKey(fileName)) { FileConfigs.put(fileName, new YamlConfiguration()); } try { FileConfigs.get(fileName).save(Files.get(fileName)); } catch (IOException e) {e.printStackTrace(); } }
8595ad74-4b46-4e45-b35a-919bc1d1f8eb
2
public String toString() { String str = paintNo+"|"+manu+"|"; for(String man : manus) { str = str + man + ","; } str = str.substring(0, str.length()-1); for(String num : numbers) { str = str + num + ","; } str = str.substring(0, str.length()-1); return str; }
107324c6-40d3-4da2-bafc-e09702c58230
3
public PlanMinuten(JSONObject object, Object min) throws FatalError { super("Minuten"); if (min != null && min instanceof Integer) { count = (Integer) min; } else { throw new ConfigError("Minuten"); } if (count < 0) { Output.println("Config: Minuten is set to 0.", 0); count = 0; } }
f900286c-df66-47b8-9d98-3bff87ead15c
9
public void keyTyped(KeyEvent e) { debug("keyTyped("+e+")"); char c=e.getKeyChar(); if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f'))) { char[] str=new char[2]; String n="00"+Integer.toHexString((int)he.buff[he.cursor]); if(n.len...
a11eb3e4-d581-462a-be1a-fb4503caface
9
private static void convertRGBtoHSL(final int r, final int g, final int b, final float[] hsl) { final float varR = (r / 255f); final float varG = (g / 255f); final float varB = (b / 255f); float varMin; float varMax; float delMax; if ...
c64fd50e-4918-4e16-910d-68848aed1b05
5
public boolean login(String inUsername){ String sql = "select username " + "from Users " + "where username LIKE ?"; PreparedStatement ps = null; try { ps = conn.prepareStatement(sql); ps.setString(1, inUsername); ResultSet rs = ps.executeQuery(); while(rs.next()) { String username = rs.getStri...
0591b57f-552f-43e2-9dfd-fb628794f634
1
public void die(){ alive = false; respawnX = x; respawnY = y; respawnColX = colOffsetX; respawnColY = colOffsetY; respawnWidth = width; respawnHeight = height; respawnTexture = texture; if(loot.size() > 0){ setBounds(x + colOffsetX + width/2 - 16, y + colOffsetY + height/2 - 16,32,32); setCollis...
9998c864-ce45-4d29-90a2-017c747fde0e
4
public static String getLocalHostName() throws SocketException, UnknownHostException { try { final String canonicalHostName = InetAddress.getLocalHost().getCanonicalHostName(); if (isFQDN(canonicalHostName)) { return canonicalHostName; } else { ...
17d4d6b6-3624-4be8-a074-58a0207e0b78
6
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { //metodo de impresion anterior por JTable /**try { MessageFormat headerFormat = new MessageFormat(jLabel1.getText()); MessageFormat footer...
38e78675-9ca6-4a35-8a13-d070e14e79c6
3
public Double relativePrime(Double x) { ArrayList<Double> primes = new ArrayList<Double>(); Double relativePrime = BigInteger.probablePrime(9, new Random()).doubleValue(); while (relativePrime<x) { if (BigInteger.valueOf(x.longValue()).gcd(BigInteger.valueOf(relativePrime.longValue()...
ad359892-df84-4ef9-a795-8473175b3b69
0
@Override public void finishPopulate() { }
b5d8ad41-f9a3-4a80-bc4e-860ae06214b4
2
public void deleteObject(ChunkyObject chunkyObject) { if (isLoaded()) { query(QueryGen.deleteAllOwnership(chunkyObject)); query(QueryGen.deleteAllPermissions(chunkyObject)); query(QueryGen.deleteObject(chunkyObject)); if (chunkyObject instanceof ChunkyGroup) ...
1d68ffde-4ea4-4e4f-9899-f459ff2f1b86
9
public void receiveMsg(){ try { InputStream is = socket.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); Object newObj = ois.readObject(); if (newObj instanceof ClientModel) { // Always perform add when ClientModel receive to update client information ClientModel client = (Clie...
6cb15bf5-c0ee-447c-b33b-e7cd397db274
1
@Override public void addToEnd(String value) throws AlreadyExist { if (!exists(value)) { super.addToEnd(value); } else { throw new AlreadyExist("Alredy exist in List"); } }
7f0b6c1d-4525-4c7a-8d02-77db0cf852de
2
public String process(String wikiText) { String[] linesArray = arrayOfBloks(wikiText); String HalfBaked = ""; for (String line : linesArray) { // For each bloke of text: // if it free text Wrap with P tag. // Otherwise append it as is. i...
182d1371-6c60-4edf-8997-2714c2856e59
5
public void printProblem() { System.out.println("Number of meetings: " + this.NumMeetings); System.out.println("Number of employees: " + this.NumEmployees); System.out.println("Number of time slots: " + this.NumTimeSlots); System.out.println("Meetings each employee must attend:"); for(Integer e : this.Emp...
2ce75a80-2c09-4bd9-b06b-48c13e098ec6
8
public GuideUserAction predict(DependencyStructure gold, ParserConfiguration configuration) throws MaltChainedException { StackConfig config = (StackConfig)configuration; Stack<DependencyNode> stack = config.getStack(); if (!swapArrayActive) { createSwapArray(gold); swapArrayActive = true; } GuideUserA...
fa8693b3-cee8-40bf-9585-540f7fb36390
0
public IrcListenerThread(AprilonIrc plugin, IrcClient hostclient) { this.Parent = plugin; this.HostClient = hostclient; this.HostReader = hostclient.getReader(); thread = new Thread(this); }
ae8df545-3ca4-41e2-8a12-03b2d9e97337
6
public static void validateHotel(Hotel hotel) throws TechnicalException { if (hotel == null) { throw new TechnicalException(MSG_ERR_NULL_ENTITY); } if ( ! isStringValid(hotel.getName(), NAME_SIZE)) { throw new TechnicalException(NAME_ERROR_MSG); } if ( ! i...
cd300fc4-60d0-4924-b7fe-46fb827547e8
0
@Basic @Column(name = "description") public String getDescription() { return description; }
41a7c774-5fb7-45cf-a60a-a3e3018e8b6f
1
public static void main(String args[]) { SynchronizedSrc target = new SynchronizedSrc(); Caller ob1 = new Caller(target, "Hello"); Caller ob2 = new Caller(target, "Synchronized"); Caller ob3 = new Caller(target, "World"); // wait for threads to end try { ob1.t.join(); ob2.t.join(); o...
8de71728-d1e5-4287-8c91-fba640ca414a
1
@Override public V get(K key) throws InvalidKeyException, InvalidPositionException, BoundaryViolationException, EmptyTreeException { checkKey(key); Position<Entry<K, V>> currentP = treeSearch(key, root()); actionP = currentP; if (isInternal(currentP)) return value(currentP); return null; }
ac37c1c4-062b-4080-8731-e69a2edbb2d5
9
public RGBColor pathShade(ShadeRec rec, int depth) { RGBColor L=new RGBColor(RGBColor.black); int lightnum=rec.w.ls.size(); Light cur; for(int i=0;i<lightnum;i++){ cur=rec.w.ls.get(i); if(cur instanceof AreaLight){ AreaLight arealight=(AreaLight)cur; boolean shadowed=false; arealight.randsam()...
2328bf4c-aa48-4ce3-92ad-727834d04af6
7
@Override public boolean execute(final CommandSender sender, final String[] split) { if (sender instanceof Player) { if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) { if (!MonsterIRC.getHandleManager().getPermissionsHandler() .hasCommand...
016c2e57-4588-4ff9-ac87-a2d2f4439b5d
1
@Override public void validate(ProcessingEnvironment procEnv, RoundEnvironment roundEnv, TypeElement annotationType, AnnotationMirror annotation, ExecutableElement e) { AnnotationValue expectedReturnType = AnnotationProcessingUtils .getAnnotationElementValue(procEnv, annotation, "expectedReturnType")...
a7213fe5-d37c-49fe-bfa9-dbf69495c3b5
2
public static Double parseTimestamp(String data) { String[] lines = data.split("\n"); for (String line : lines) { String[] parts = line.split(":", 2); if (parts[0].equals("t")) { return Double.parseDouble( parts[1].replace(",",".") ); } } return null; }
917abc17-d275-4848-80de-a3cb7dc68918
0
public void func() { System.out.println(this + ".func() : " + data); }
fcde6a74-da33-4363-b26b-fc82aeae96c4
2
public Collection<Label> getLabels() { try { if (labels.size() == 0) execute(); } catch (SQLException e) { e.printStackTrace(); } return labels.values(); }
3f521858-47b3-499f-8a20-fa9802c728b4
2
public int dividir(int a, int b) throws MiExcepcion{ if (a==5){ throw new MiExcepcion("No vale el número 5"); } if (b==0){ throw new MiExcepcion("Oh por DIOS!?!? ¿qué hiciste?"); } return a / b; }
487cd5a8-45b4-4251-870b-d02a0fc68f30
9
public boolean qualifies(MOB mob, Room R) { if((mob==affected)||(mob==null)) return false; if(mob.fetchEffect(ID())!=null) return false; if(mob.isMonster()) { if(matchPlayersFollowersOnly) { final MOB folM=mob.amUltimatelyFollowing(); return (folM!=null)&& (!folM.isMonster()); } retur...
7bfb94ca-2d6f-4e08-9226-265d815f0d2e
7
public String getPermutation(int n, int k) { // Start typing your Java solution below // DO NOT write main() function if (k > factorial(n) || k <= 0 || n <= 0) { return new String(); } StringBuilder sb = new StringBuilder(); ArrayList<Integer> num = new ArrayList<Integer>(); for (int i = 1; i <= n; i++...
aded1510-70fa-48ff-b137-efc88d716e00
0
private void nombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nombreActionPerformed nombre.setText(cliente.getNombre()); }//GEN-LAST:event_nombreActionPerformed
16921c7d-cd37-492c-bc40-03e717de7123
3
public Object copyColorData() { // Note: This is a fudge. The data about defaultColor, // groutingColor, and alwaysDrawGrouting is added to the // last row of the grid. If alwaysDrawGrouting is true, // this is recorded by adding an extra empty space to // that row. Color[][] copy...
eb896d35-f3b2-4f51-a826-2340d3de0767
4
public boolean validateUserName(String userName) throws IllegalAccessError, SocketTimeoutException { boolean answer = false; try { clientSocket.Escribir("USUARIO " + userName + '\n'); serverAnswer = clientSocket.Leer(); } catch (IOException e) { throw new SocketTimeoutException(); } if(serverAnswer !...
a6b7ab7e-b571-4afc-9519-e10a74c7fcf1
9
public void paint(Graphics g) { if(mElementDimension == null) { mElementDimension = new Dimension(); FontMetrics fm = g.getFontMetrics(mFonts[0]); mElementDimension.width = fm.charWidth('_')+1; mElementDimension.height = fm.getHeight()+1; } Stack<AffineTransform> transforms = new Stack...
c5e77301-ad01-41b2-9a85-e69ce1dfe125
4
@Test public void treeMapRetrievesIndexes() { Random r = new Random(); for (int i = 0; i < 1000; i++) { MyInteger m = new MyInteger(r.nextInt(10000)); if (!tree.contains(m)) treeHeap.insert(m); } Object[] array = treeHeap.getArray()...
87f8546c-a258-4f14-9145-c58724d75757
9
public static Rectangle2D getBounds(CellView[] views) { if (views != null && views.length > 0) { Rectangle2D r = (views[0] != null) ? views[0].getBounds() : null; Rectangle2D ret = (r != null) ? (Rectangle2D) r.clone() : null; for (int i = 1; i < views.length; i++) { r = (views[i] != null) ? views[i].get...
a09de5c9-8f2d-4d80-a250-b185f7354c0f
0
private void about() { JOptionPane .showMessageDialog( this, "Mit Hilfe von diesem Programm k\u00F6nnen Sie Ihre Kontakte verwalten.\n" + "Es besitzt Aktionen zum Erstellen, L\u00F6schen und Editieren\n" + "Ihrer Kontakte und hat Felder wie Vorname, Nachname und eMail."); }
b99c69e5-7366-4ecf-9e38-5354aef3a506
0
public CLC() { commandMap = new HashMap<String, Action>(); abbrMap = new HashMap<Character, Action>(); optionMap = new HashMap<String, Action>(); contextMap = new HashMap<String, CLC>(); defaultAction = unknownCommandAction; rootAction = defaultRootAction; }
5cb7cd21-8462-4c7c-8e47-07dc0f42f52c
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); QuizService quizService = new QuizService(); int quizId = Integer.parseInt(request.getParameter("quizId")); Quiz quiz = null; //deleteQuiz cas...
fdf7e876-8c2e-49e3-9cdc-2a564d88f3d8
3
@Override public void actionPerformed(GuiButton button) { if(button.id == 0) holder.closeWindow(this); else if(button.id == 1) { try { Entity e = ((GuiEditor)holder).getMap().getEntityList().getEntityWithUUID(entity); R2DFileManager manager = new R2DFileManager(textField.text,null); Map.sav...
34b41718-ddfa-4d85-b591-53b3b6a40959
5
void notifyConnected () { if (INFO) { SocketChannel socketChannel = tcp.socketChannel; if (socketChannel != null) { Socket socket = tcp.socketChannel.socket(); if (socket != null) { InetSocketAddress remoteSocketAddress = (InetSocketAddress)socket.getRemoteSocketAddress(); if (remoteSocketAddr...
873035f2-59d9-4e08-9c3e-97dfa51dd0bb
9
private void calcMode(ArrayList<Double> values) { int maxCount = 0; /* Tallies each value to determine the max count */ for (int i = 0; i < values.size(); i++) { int count = 0; // count resets to 0 for (int j = 0; j < values.size(); j++) { if (values.get(j...
c594b627-3aee-4dd4-9fc2-f87747e1ff8b
3
public static boolean inCWars() { int x = Players.getLocal().getLocation().getX(); int y = Players.getLocal().getLocation().getY(); return (y >= 3072 && y < 3135 && x > 2368 && x < 2431); }
c4a702d0-3233-41a5-8ddb-221f6c9fb07b
0
public final DccFileTransfer dccSendFile(File file, String nick, int timeout) { DccFileTransfer transfer = new DccFileTransfer(this, _dccManager, file, nick, timeout); transfer.doSend(true); return transfer; }