method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
39eb92a0-9fc8-4400-b806-14200722d847
6
public Double[] getData() { Component[] components = getComponents(); ArrayList<Double> data = new ArrayList<Double>(); for(int k = 0; k < components.length; k++) { //System.out.println(components[k]); if(components[k] instanceof JTextField) { fields.add((JTextField)components[k]); try{ ...
88aa5863-a887-4652-aecc-6e7a9f089d25
6
public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_RIGHT: game.turnRight(); break; case KeyEvent.VK_LEFT: game.turnLeft(); break; case KeyEvent.VK_UP: game.moveFoward(); break; case KeyEvent.VK_DOWN: game.moveBackward(); br...
909be575-2579-4f88-b6f4-8203ec9fd0b7
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Model other = (Model) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if ...
930da16b-6dcb-47f0-8aeb-6dcbb650a56b
4
protected int getKnownAttributeCount() { int count = 0; if (bytecode != null) count++; if (exceptions != null) count++; if (syntheticFlag) count++; if (deprecatedFlag) count++; return count; }
fec6211d-5115-4ab5-a865-38ca8a2e509b
9
* @param client the client sending this command */ private void cmd_list(final String arg, final Client client) { final Player player = getPlayer(client); if (player.getStatus().equals(Constants.ST_INTERACT)) { MUDObject target = player.getTarget(); // TODO a Vendor flag isn't sufficient here, because...
37cba568-5777-457c-bd0a-7e4b6e01a48e
6
public int mamaLookback( double optInFastLimit, double optInSlowLimit ) { if( optInFastLimit == (-4e+37) ) optInFastLimit = 5.000000e-1; else if( (optInFastLimit < 1.000000e-2) || (optInFastLimit > 9.900000e-1) ) return -1; if( optInSlowLimit == (-4e+37) ) optInSlow...
4e7404a3-90be-4cad-88d1-b765f541214d
0
public static void setGetQuestionsFromDatabaseStrategy(GetQuestionsFromDatabaseStrategy getQuestionsFromDatabaseStrategy) { DatabaseManager.getQuestionsFromDatabaseStrategy = getQuestionsFromDatabaseStrategy; }
86367338-fbf5-4e34-9333-baef92217c68
2
@Override public void run() { for (Player player : Bukkit.getOnlinePlayers()) { if (plugin.getNCDatabase().getAddiction(player.getName(), Column.COCAINE_ADDICTION) > 30) { EffectFactory.getInstance().applyCocaineAddictEffect(player); } } }
5f58beb9-1ca6-4e2d-8437-4c210d5df7b0
3
public Collection<Empresa> buscaPorSimilaridade(String nome) { if (nome == null) return EMPRESAS.values(); List<Empresa> similares = new ArrayList<>(); for (Empresa empresa : EMPRESAS.values()) { if (empresa.getNome().toLowerCase().contains(nome.toLowerCase())) similares.add(empresa); } return si...
53405aa5-0e9c-444c-909e-24031f122539
5
@Test public void secondMowerTest() throws MowerOutOfLawnBoundaryException { try { this.lawnMowerController = new LawnMowerController("3 3 E", "AADAADADDA",lawnConfiguration); } catch (NumberFormatException e1) { fail(); } catch (NegativeNumberException e1) { fail(); } catch (UnrecognizedCommandExce...
a480e5cd-bed8-4456-a903-ae7516464550
5
public void prepareWriting(GrowableConstantPool gcp) { gcp.putUTF8(name); gcp.putUTF8(typeSig); if (constant != null) { gcp.putUTF8("ConstantValue"); if (typeSig.charAt(0) == 'J' || typeSig.charAt(0) == 'D') gcp.putLongConstant(constant); else gcp.putConstant(constant); } if (syntheticFlag) ...
39522a99-1e9c-40e6-a22b-7f778a42c155
6
private void Run() { m_isRunning = true; int frames = 0; double frameCounter = 0; m_game.Init(); double lastTime = Time.GetTime(); double unprocessedTime = 0; while(m_isRunning) { boolean render = false; double startTime = Time.GetTime(); double passedTime = startTime - lastTime; l...
377a2e3f-3813-4cb3-aec8-b9a548645a42
2
private Opcion obtenerOpcion( int indiceGlobal[]) { SistemaMenus.Opcion opcion = this.opcionCabeza; if (indiceGlobal != null) for (int i = 0; i < indiceGlobal.length; i++) opcion = opcion.obtenerOpcionHija( indiceGlobal[i]); return opcion; }
6e580a05-30b7-40e1-be48-857c712b8a04
0
@Override public String getDesc() { return "SuicideBombing"; }
587399b7-7dd6-491b-b0be-527d09137098
6
@Override public int compareTo(LSHColor o) { /* * A distancia em L e S leva em consideracao uma escala de 0 ate 255. * Assim, garantimos que havera distribuicao levando em consideracao o * segundo e terceiro componentes da tripla LSH (sem a escala, como L � * float, existiriam "infinitos" ...
746b594c-33fc-4d70-a104-c06c2dcb3883
7
static public boolean intersect2(DwRay3D ray, float[] A, float[] B, float[] C, boolean two_sided, float[] ptr_hit_backface, float[] tuv){ DwVec3.sub_ref(B, A, E1); // edge1: v0 -> v1 DwVec3.sub_ref(C, A, E2); // edge2: v0 -> v2 DwVec3.cross_ref(E1, E2, n); // normal if( DwVec3.dot(n, ray.d) > 0...
4791412f-f81d-48ab-874b-433bd2421a38
1
private void setDequeInt(Stack stack,int a){ // Этот метод нужен для того, for (int i = 0; i<a ;i++) { // чтобы не дублировать код при проверке метода pop(). stack.add(i); } }
a1c7b534-51fa-4fcd-9ae9-a427f74a8f52
4
public void setGameWindow(GameWindow gameWindow) { boolean test = false; if (test || m_test) { System.out.println("Controls :: setGameWindow() BEGIN"); } m_gameWindow = gameWindow; if (test || m_test) { System.out.println("Controls :: setGameWindow() END"); } }
ea85058a-2e3a-4b2c-9b45-48ac63745037
6
public int[] getDegree(int dimension1, int dimension2, int numBins, boolean inDegree) { int j = 0; int[] Degree = new int[numBins + 1]; int[][] hist2D = get2DHistogram(dimension1, dimension2, numBins); convMap = new HashMap<Integer,List<Integer>>(); divMap = new HashMap<Integer,List<Integer>>(); for (in...
71bd7d23-2474-47cd-93a9-6bdc5c02d964
9
private void createMatrix() { // Current coordinates int x, y; // Current value int k = 0; // Dimensions of the sub-matrix we are working on during our spiral tracing int subMatrixLeft; int subMatrixTop; int subMatrixRight; int subMatrixBottom; int subMatrixSize = 1; // What number will trigger...
7fa70fb9-f464-4531-a97c-33d50267afcd
5
public static double[] pageRankIterations(double[][] transitions, int steps) { double[][] matrixAfterKSteps = new double[transitions.length][1]; matrixAfterKSteps[0][0] = 1.0; for(int i = 1; i < matrixAfterKSteps.length; i++){ matrixAfterKSteps[i][0] = 0.0; } for(int k = 1; k < steps; k++){ double[][] p...
25b5807a-2c0a-463b-91ca-fff1403c69d3
4
public Integer getRosterAssignmentCount (Date d, Roster r) { Integer rc = 0; for (Trip t: getAllTrips(d)) { for (Roster tr: t.getRosterList()) { if (( tr.getFamilyName().equals(r.getFamilyName()) ) && ( tr.getGivenName().equals(r.getGivenName()))){ rc += 1; } } } return rc; }
9ccae9ed-9834-4f60-b6c0-7c47ae00b110
2
private void readPage() // reads page information { attrib = (int)readNumber(0,2,false); // attribute of node 0 - index node, 1 - start page , 2 - end page LEAF = (attrib>1); key_cnt = (int)readNumber(0,2,false); // count of keys in this block left_page = readNumber(0,4,true); // left node or -1 right_pag...
b22bff23-c1b4-40c5-a328-437727b7d57d
6
private void close() { try { if(output != null) output.close(); } catch(Exception e) {} try { if(input != null) input.close(); } catch(Exception e) {}; try { if(socket != null) socket.close(); } catch (Exception e) {} }
520278c3-c6f9-41bd-8e39-0b908ff46eee
9
double isVeryEqual(MembershipFunction mf, InnerOperatorset op) { if(mf instanceof FuzzySingleton) { return op.very(isEqual( ((FuzzySingleton) mf).getValue())); } if((mf instanceof OutputMembershipFunction) && ((OutputMembershipFunction) mf).isDiscrete() ) { double[][] val = ((OutputMembershipFunctio...
6aa71dfb-cc2f-4332-81ea-1f99b5bb0dc8
4
public void fire(Tanq owner, Vector3D gunLocation, float directionInDegrees) { synchronized (this) { if (loaded && !jammed && bullets > 0) { new Bullet(owner, gunLocation, directionInDegrees); bullets--; currentTemp += heatIncreasePerShot; if (currentTemp > overheatTemp) jammed = true; loa...
d92cccfe-7d2c-4713-9262-c0590da3b05c
8
public static String retrieveProtdistResult(String dirName) throws UnexpectedErrorEx, ErrorRetrievingJob { GetAbsolutePath pt = new GetAbsolutePath(); String absolutePath = pt.getPath(); String output = ""; if (dirName == null || dirName.equals("")) ...
6da91c37-76e9-404f-b17c-0cea38d81087
1
@Override public void performAction() { if(!started) { performActionStartup(); } else { building.setBuildTime((System.nanoTime() - this.getStartTime()) / (double)time); } }
1fc49b5a-1742-4a42-be73-096485a812b3
3
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); if (ncomponents == 0) { return; } // Total parent dimensions ...
bfdbc025-9585-483e-9042-30abb924fa10
3
public Boolean execute(ICommand cmd){ Boolean val = cmd.execute() && cmd.canUndo(); if (val){ int size = this.commands.size(); for (int i = size - 1; i >= current + 1; i--){ this.commands.remove(i); } this.commands.add(cmd); this.current++; } return val; }
e708b0b5-cb6a-4bcd-aee2-65564d65b10c
0
public void update(Observable o, Object arg) { // TODO Auto-generated method stub }
faf0d975-5c17-4373-bfde-370a26179d50
2
private void drawWatermark(Graphics2D g2) { if ("hide".equals(System.getProperty("info.gridworld.gui.watermark"))) return; g2 = (Graphics2D) g2.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Rectangle rect = ...
3d6ee018-63fb-42b8-96d0-bafaa951c22c
9
private void readOP(SelectionKey key) { try { SocketChannel socketChannel = (SocketChannel) key.channel(); for (ByteBuffer byteBuffer : buffer) { if (byteBuffer != null) byteBuffer.clear(); } long numRead; numRead =...
81238637-2f19-4f9f-8c8a-ef482f572be1
4
public void initPanels(){ this.removeAll(); List<String> ids = Application.mediator.automatonTable.ids; List<Point> points = Application.mediator.automatonTable.points; List<boolean[]> codes = Application.mediator.automatonTable.codes; int x = R*2; int y = R*2; ...
9d5d4bc7-6be9-4ebf-8eac-92da2ce59439
2
public void testMonthNames_monthStart() { DateTimeFormatter printer = DateTimeFormat.forPattern("MMMM"); for (int i=0; i<ZONES.length; i++) { for (int month=1; month<=12; month++) { DateTime dt = new DateTime(2004, month, 1, 1, 20, 30, 40, ZONES[i]); String mo...
854c8765-d819-40e7-820f-9b4367afb4e8
3
public boolean equals( ChunkStateSet other ) { if ( this.states.length == other.states.length ) { ChunkState[] s = states; for ( int i=0;i<s.length;i++ ) if ( !other.containsState(s[i]) ) return false; return true; } else return false; }
6a94266c-9d91-47c0-be58-3f4446d5dc2b
2
public String[] read(){ Path p = (Paths.get(filePath)); List<String> l = new ArrayList<String>(); try{ l = Files.readAllLines(p, StandardCharsets.UTF_8); }catch(Exception e){ System.out.println("Read Fail"); } String[] returnable = new String[l.size()]; for (int i=0;i<l.size();i++) ...
5c778ef3-ac2e-4374-887d-141f0aeb661e
4
public Behaviour nextStepFor(Actor actor) { final float minRelation = relationLevelNeeded() ; Dialogue picked = null ; float maxUrgency = Float.NEGATIVE_INFINITY ; for (Actor a : talksTo()) { final float relation = a.mind.relationValue(actor) ; if (relation >= minRelation) continue ; ...
9c2e860f-0514-4f4c-a0b3-abeb4c8fab95
3
public void setExtendedDesktopSize(int reason, int result, int width, int height, ScreenSet layout) { cp.supportsSetDesktopSize = true; if ((reason == screenTypes.reasonClient) && (result != screenTypes.resultSuccess)) retu...
c6d2480a-64a2-41f6-97b2-76d26eea3bfa
7
public Complex weightedStandarError_as_Complex() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean hold2 = Stat.nEffOptionS; if (nEffReset) { if (nEffOptionI) { Stat.nEffOptionS...
338a4c47-b87c-40a7-8e90-eabb2d6c5aba
0
public Role() { }
277901e1-7fa3-4f6c-aa35-11a03282b793
1
@Override public void context( ContextSite site ) { ItemContextListener[] copy = listeners.toArray( new ItemContextListener[ listeners.size() ] ); Event event = new Event( site ); for( ItemContextListener listener : copy ){ listener.contextAction( event ); } }
779f42dc-834d-46ce-99f7-14cfa5884551
7
protected ArrayList<Object[]> getNearbyRegions(double[][] array, int x, int y, int d) { ArrayList<Object[]> a = new ArrayList<Object[]>(); for (int k = x - d; k < x + d; k++) for (int j = y - d; j < y + d; j++) if (k >= 0 && k < array.length && j >= 0 && j < array[k].length) if (distance(x, y, k, j) < d...
5c601dcd-8396-4f41-85ab-6be12df8416d
4
private Map func_27408_a(File var1) { BufferedReader var2 = null; try { var2 = new BufferedReader(new FileReader(var1)); String var3 = ""; StringBuilder var4 = new StringBuilder(); while((var3 = var2.readLine()) != null) { var4.append(var3); } ...
43e059fa-2c48-476d-b780-04e9e563230d
8
public int found_END_PROGRAM(int INDEX, String code) { log.log(4, log_key, "call found_END_PROGRAM, INDEX = ", new Integer(INDEX).toString(), "\n"); log.log(4, " [interpreter-end]: ", "end of Program Reached, Breaking for Loop, poping context_stack\n"); context_stack.pop(); INDEX ...
da36382d-0ef6-43bd-9a16-369c861ed75b
1
public void isSomethingSmoking(@Observes Boolean smoke){ if(!smoke){ System.out.println("Cool - there is no smoke"); } }
a040e179-fa50-469a-a877-870f51d32a83
6
@Override public void paintComponent(Graphics g, PanelGraph panelGraph, Crayon trace) { Rectangle2D.Double rec = new Rectangle2D.Double(p1.abscisse(), p1.ordonnee(), longueur, largeur); Graphics2D gra = (Graphics2D) g; if (dessiner) { gra.setColor(trace.getCouleur()); gra.setStroke(new BasicStroke((float)t...
cec1f2c4-e0e2-4954-a78d-16fbdeca04d0
1
JarClassPath(String pathname) throws NotFoundException { try { jarfile = new JarFile(pathname); jarfileURL = new File(pathname).getCanonicalFile() .toURL().toString(); return; } catch (IOException e) {} throw ...
3a3332be-6431-4c5e-980f-9bf90d1f59f8
7
private static Point imageMatching(Mat source, Mat template) { //TODO source greater than template -> resize? if(source.cols() < template.cols()) {} if(source.rows() < template.rows()) {} int cols = source.cols() - template.cols() + 1; int rows = sour...
d9e8ebed-cd11-4d24-9377-1d9788ba8eb5
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 56 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 56 ...
d6b71efc-35a4-4968-bb67-3b206108cc27
8
public static void main(String[] g) throws IOException { Scanner s = new Scanner(new File(g[0])); while (s.hasNextLine()) { String[] array = s.nextLine().replace("(", "").replace(")", "").replace(" ", "").split(";"); List<Integer> heights = new ArrayList<Integer>(); String[] temp; for (String a : ar...
b8cd33a0-0a66-4cdd-8302-bc96cbe52b92
2
@Override public void stateChanged(ChangeEvent event) { Object source = event.getSource(); if (source == mHSB.getModel() || source == mVSB.getModel()) { repaint(mHeaderBounds); repaint(mContentBounds); } }
4e7811e6-84e0-4e01-8a5f-ca05ec882aeb
9
public static long getTimeDiff(Date fromDate, Date toDate, int type) { fromDate = (fromDate == null) ? new Date() : fromDate; toDate = (toDate == null) ? new Date() : toDate; long diff = toDate.getTime() - fromDate.getTime(); switch(type) { case DIFF_MILLSECOND: ...
e893b7de-3a12-4f5f-84b8-309e4fadaf6f
1
@SuppressWarnings("unchecked") public List<T> findByNamedQuery(String queryName, Map<String, Object> queryParams) { String[] params = new String[queryParams.size()]; Object[] values = new Object[queryParams.size()]; int index = 0; for (String s : queryParams.keySet()) { ...
5f2cd323-ddf4-46e8-b3b4-651cc457a7bc
2
public static void addSomething(Component comp, String type, int x, int y, int width, int height){ //adds a component to the GUI ButtonActionListener bal = new ButtonActionListener(); //Button action listener if(type.equalsIgnoreCase("button")){ //If the component to be added is considered...
b3712f87-8216-44ed-9738-293c4a07b26d
3
protected void runMainLoop() { for( int i=0; i<20; i++ ){ // here be the main client thread loop try { sleep( rand.nextInt(1000) ); // now generate a block SignedBlock newBlock = null; try { newBlock = blockTree.createBestBlock(this.identity); ...
6bc1c27b-05c0-4d36-b78d-746ba56e015e
6
public GenerateInformation(){ c = new GridBagConstraints(); generateCustomers = new JButton("Generate Customers"); generateVendors = new JButton("Generate Vendors"); generateBoth = new JButton("Generate Both"); numCustomers = new JSlider(1,maxCustomers,customerSliderStart); numVendors = new JSlider...
5dd68af5-6a05-4b11-aa99-ddd6ef510348
5
public void preGameSetup() { //Re-sets the buttons and repositions the players (if any were dropped) after the first round is played. for (int i = 0; i < playerSpots.length; i++) { if (i < playerList.size()) playerSpots[i].setText(playerList.get(i).getName()); else { playerSpots[i].setText("(Empty Sea...
d9ac3074-3489-4ea1-9383-5a9314717805
1
public boolean GiveItemStack(Player player, ItemStack itemstack) { PlayerInventory inventory = player.getInventory(); HashMap<Integer, ItemStack> result = inventory.addItem(itemstack); //TODO: Check "result" to ensure all items were given if (result == null) { return false; } return true; }
45d4a684-0954-4fe5-a89b-3e86b66e0493
0
public static void main(String[] args) throws ParseException { Date date = DateUtil.parseDate("2013-11-13 11", "yyyy-MM-dd HH"); date = DateUtil.addWeeks(date, 2); System.out.println(DateFormatUtil.format(date, "MM-dd/yyyy_HH")); }
f1b1abe4-b4b8-4394-b996-1335bd713096
8
public int getSolution(TreeElement node) throws IncorrectSymbol, WrongStructure, ImpossibleAction { TreeElement left = node.getLeftSon(); TreeElement right = node.getRightSon(); if (right.isDigit() && left.isDigit()) { return computation(node.getOperation(), left.getValue(), right.g...
6c4099a4-5bdb-4caa-be1b-10cad41611f2
9
@Override public void run() { try { renderHtmlOverview(); int seconds; try { seconds = Integer.parseInt(getProperty(CHECKING_INTERVAL_IN_SECONDS)); } catch (NumberFormatException e) { throw new ServerException("checking-interval-in-seconds property must be a number"); } if(seconds < 0) ...
d79604c8-4227-49cd-b8fa-b5b6a7559c54
8
public double log_evidence_corpus_and_z(){ double log_evidence_and_z = 0.0; for(int t=0;t < T;t++){ int Nt = (int)(Nt_plus_beta[t]-beta); for(int k=0; k<Nt; k++){ double Nt_plus_beta_minus_k = Math.log(Nt+beta-k); log_evidence_and_z -= Nt_plus_beta_minus_k; } for(int v=0; v<V;v++){ ...
2dd3a7e2-a60a-4863-bd1d-508c1f660bc9
6
public static <GItem> Set<GItem> intersectionSet(final Set<? extends GItem> items1, final Set<? extends GItem> items2) throws NullPointerException { if (items1 == null) throw new NullPointerException("items1 = null"); if (items2 == null) throw new NullPointerException("items2 = null"); return new AbstractSet<GIte...
6e5dd171-03d5-4dc6-be7f-214b807cf329
0
public SpyFilter(ConnectionProcessor connectionProcessor, Properties config) { super(connectionProcessor, config); }
0749c24f-8b18-4dcf-b2b3-a6ea179feb24
6
private boolean processAdjoiningCells (Point selectedCell) { java.util.List<Point> adjoiningCells = getAdjoiningCells(selectedCell); for (Point adjoiningCell : adjoiningCells) { if (field[adjoiningCell.x][adjoiningCell.y] instanceof EndCell) { field[adjoiningCell.x][adjoining...
d0c6ba84-d68a-4266-84c4-990d74b64b5b
5
public void release() { Lib.assertTrue(isHeldByCurrentThread()); boolean intStatus = Machine.interrupt().disable(); KThread thread = lockHolder; if(useSPS) temp.printReleaseLock(lockHolder, this); if(useDonation){ updateHighestPriority(); ...
205fe430-fa28-4555-a642-e50e81a42755
3
@Test public void multipleAnnotations(){ Car newCar = new Car(); Annotation[] a = newCar.getClass().getAnnotations(); int topLevelAnnotationCount = 0; int newAnnotationCount = 0; for(Annotation annotation : a){ System.out.println(annotation); topLevelAnnotationCount++; if(annotation instanceof N...
eea51ecd-1940-4889-ab8a-f678f0f50bc1
1
public boolean hasNext() { if (modcount != modcountAtConstruction) throw new ConcurrentModificationException(); return offset < count; }
8933b185-5797-42da-9fc8-f425407bf491
0
public int getMarker() { return this.marker; }
87b2011d-1d43-457a-a585-396a66534b98
8
@Override public final void stateChanged(final ChangeEvent e) { final int value_ = ValueInt.this.slider.getValue(); if (ValueInt.this.object == null) { ValueInt.this.bruteParams.setGlobalValue(Integer .valueOf(value_)); } else { ValueInt.this.bruteParams.setLocalValue(ValueInt.this.object, ...
605a3c16-9197-4b22-bf81-651ee1b098ad
8
public void start() { if (this.applet != null) { this.applet.start(); return; } if (this.gameUpdaterStarted) { return; } Thread t = new Thread() { public void run() { Launcher.this.gameUpdater.run(); try { if (!Launcher.this.gameUpdater....
b7b3ec63-60cb-48fb-9a33-88108ced5199
9
public void CalculateMarginal() { for (int i = 0; i < n; i ++) { double sum_py = 0.0; for (int y = 0; y < num_label; y ++) { // System.out.println(var_node[i].state_factor[y]); var_node[i].marginal[y] = var_node[i].state_factor[y]; ...
7cd41723-17d3-4518-9eed-bf45338df667
7
@Override public Map<String, Integer> calcul(String[] texte) throws RemoteException, OutOfMemoryError { float u = 0; for(String s: texte) u += s.getBytes().length; if(u>capacity && rand.nextInt(100)<(u-capacity)/(9*capacity)*100) throw new OutOfMemoryError("Dépacement de capacité mémoire"); HashMap<St...
c56bbe63-6b59-4c06-ae1e-d2cf84be7f6a
5
public void removeUser(User u){ boolean exists = false; User existingUser = null; LinkedList<User> userCopy = new LinkedList<>(); for(User usr : users){ userCopy.add(usr); } for(User user : userCopy){ if(user.getIP().getHostName().equals(u.getIP()....
35c1e72b-0799-4c56-9775-09d6d3d3a3c1
7
public void toObject(String perceptionString) { perceptionString = perceptionString.substring(1, perceptionString.length()-1); String[] result = perceptionString.split(","); if (result.length != 6) throw new RuntimeException("Bloede Fehlerbehandlung, aber so gehts " + "halt nicht. Länge ist: " + result.le...
3741d952-2c16-4fab-9ac4-5f5cce02009b
7
private boolean r_postlude() { int v_1; int v_2; // (, line 203 // Boolean test Y_found, line 203 if (!(B_Y_found)) { return false; } // repeat, line 20...
91c97a3c-c6e3-4b45-bcf8-cd074aae73b0
5
public void testPeek() { Client client = new ClientImpl(TEST_HOST, TEST_PORT); Object[] tubeNames = pushWatchedTubes(client); client.useTube((String) tubeNames[1]); Job job = client.peek(-1); assertNull(job); job = client.peek(0); assertNull(job); String srcString = "testPeek-"; int nJobs = 3; ...
4927c1c3-0450-43a3-9f04-458a484eea23
0
public void setHunger(int hunger) {this.hunger = hunger;}
455e227d-1227-4d61-919c-82dc5cf50ed0
4
@Override public boolean equals( final Object obj ) { if( this == obj ) { return true; } if( obj == null ) { return false; } if( getClass() != obj.getClass() ) { return false; } final Data other = (Data) obj; if( id != other.id ) { return false; } return true; }
4c4254b3-d74d-4c0b-8b59-6703b46ee4a0
0
public int getKind() { return kind; }
08295e7d-d1f7-43db-85b3-1d2c3284998c
4
private void processForVisitor(ClientEventVisitor visitor) { if (type == 0) visitor.visitEntityCreate(entityData); else if (type == 1) visitor.visitEntityUpdate(entityData); else if (type == 2) visitor.visitEntityRemove(entityId); ...
94a6823a-78f4-49a6-9fd9-8e875d539e48
9
public List searchMatching(Connection conn, BankBranch valueObject) throws SQLException { List searchResults; boolean first = true; StringBuffer sql = new StringBuffer("SELECT * FROM bank_branch WHERE 1=1 "); if (valueObject.getBank_branch_id() != 0) { if (first)...
4e9dd8a4-ecda-4a24-9887-87df64af3281
4
public boolean makeAdjustmentsIfHit(Lovely gorgeousOne) { boolean isHit = false; for (int i = 0; i < numberOfPellets; i++){ if (gorgeousOne.getArea().intersects(pellets[i].getArea()) && gorgeousOne.getIsVisible()){ currentFunds += gorgeousOne.getValue(); ...
7784c53b-ebb2-4ff8-86e7-b85dc902b0bc
7
public static void radixSortMSD(int[] array, int numCount, int longestBit) { if(longestBit<=0) { return; } int bucketNum = 10; int[][] bucket = new int[bucketNum][array.length]; int[] bucketCount = new int[bucketNum]; for(int i=0;i<numCount;i++) { int lsd = array[i]/(int)Math.pow(10, longestBit-...
5f51b64d-c986-4c38-b1fe-07d5b658ed27
1
public static synchronized boolean addUser(User user) { boolean couldAllocate = ManagerSocketServer.allowcateUser(user, getServerSingleton().getUsers()); if (couldAllocate) currentUsers++; return couldAllocate; }
90572afd-9081-4788-965b-048c8b768cee
0
public Float getPrezzo() { return prezzo; }
937bf7b9-dae9-4f5e-8ea2-320bb3aaf532
7
private CardPower isStraight(ArrayList<Card> cards) { int count = 1; int lastCard = cards.get(0).value.ordinal(); for (int i = 1; i < cards.size(); i++) { if (cards.get(i).value.ordinal() == lastCard) { continue; } else if (cards.get(i).value.ordinal() == --lastCard) { count++; } else { cou...
7396181d-6e90-4881-a727-ad899e9633a9
0
public void setElementsLineEnder(String[] elementsLineEnder) { this.ELEMENTS_LINE_ENDER = elementsLineEnder; }
22c5b8d4-9c81-4976-b867-ea8814887304
6
@Test public void testAddAndRemove() throws Exception { final int runTimes = 100; final int threadCount = 50; for (int r=0;r<runTimes;r++) { System.out.println("RUN TIME:" + r); final CyclicBarrier barrier = new CyclicBarrier(threadCount*2); final Coun...
bc8a7960-f559-48b0-8c45-c79f797dac77
5
private boolean validarCampos (){ boolean validos = true; if (jTextField3.getText().equals("")){ jTextField3.requestFocus(); msj_Error("Ingrese una Razon Social."); validos=false; } else{ if (!control_f .isFechaValida(campoFecha.ge...
d68effe6-0573-490e-8afd-f7eaeabdaa36
1
public static void main(String[] args) throws IOException { if(args.length == 2){ // Set up a simple configuration that logs on the console. BasicConfigurator.configure(); // register directory and process its events new DirectoryMonitor(new CopyMonitor(Paths.get(args...
2828383a-b82e-4f2f-ad84-585f1116615f
8
public int largestRectangleAreaBF(int[] height) { int area; int maxarea = 0; for (int i = 0; i < height.length; i++) { if (i > 0 && height[i] == height[i-1]) continue; area = height[i]; // Expand to left for (int j = i - 1; j >= 0; j--) { ...
1cb054d4-80b1-468f-a695-3aa55828cc91
7
private static void dealSortStr(String lineTxt) { // TODO Auto-generated method stub if (null == lineTxt || "".equals(lineTxt)) return; String[] temp = lineTxt.split("[:]"); String key = temp[0]; String[] valueTmp = temp[1].split("[,]"); if (null != valueTmp && valueTmp.length > 0) { ArrayList<Hash...
ac55ceb4-887b-45e4-8afa-d02ce71dd490
9
private BackupResult sendConfigAreaBackupTask(final byte[] message, BackupProgressCallback callback) throws RequestException, ConfigurationTaskException { final int BACKUP_STATE_INITIALIZING = 0; final int BACKUP_STATE_IN_PROGRESS = 1; final int BACKUP_STATE_FINISHED = 2; int requestIndex; try { reques...
f1e3a6dd-de30-4b0d-b27e-f4bf3faa999d
2
public void updateRefDetails() { // get the selected name from combo box and store as a string String refNameSearch = (String) refComboBox.getSelectedItem(); // search through refereeProgram for the refereeClass which // matches the name stored from the combo box. When found, // create a new window to displ...
4ed5479d-2c19-4383-a812-e7b55d14b056
0
public int getProfessorId() { return professorId; }
adca556a-b92e-40f0-94b2-70565c03e169
6
@Test public void WhenUpdatingWithSmallRefMax_ExpectLevelSizeLessEqualToRefMax() throws UnknownHostException { int refMax = 1; RoutingTable localRT = new RoutingTable(); localhost_.setHostPath("0000"); localRT.setLocalhost(localhost_); Host localHost0 = new PGridHost("127.0....
f988b54b-d2d5-46d9-a66b-506b2e218ebb
5
private File[] getSortedFiles(boolean reverse) throws IOException { fileSync.lock(); try { File[] files = dir.listFiles(); List<File> cpFiles = new ArrayList<File>(files.length); long highestId = 0; for (int i = 0; i < files.length; i++) { int id = getId(files[i]); if (id != -1) { cpFiles.a...
becbeb75-f679-4d2b-a3a3-fc63147646a8
3
public void drawTo(PPMEC PPM) { // Calculate the parameters for the ellipse. int x1 = (int) (xRatio1 * PPM.getWidth()); int x2 = (int) (xRatio2 * PPM.getWidth()); int y1 = (int) (yRatio1 * PPM.getHeight()); int y2 = (int) (yRatio2 * PPM.getHeight()); int distance = (int) (distR * PPM.getWidth()); // Fill...