method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fe7fc57f-e024-4446-8812-33154113959c
5
private void flushResponse() { try { if (!ctx.getChannel().isOpen()) { System.err.println("channel is closed, channel: " + ctx.getChannel()); ctx.getChannel().disconnect(); ctx.getChannel().close(); return; } // mymod. WebbitException: cannot send more responses than re...
02824ede-d838-499b-a651-406d167caad8
3
public <T extends Component> void addComponent(UUID entity, T component) { if (frozen) { return; } synchronized (componentStores) { HashMap<UUID, ? extends Component> store = componentStores .get(component.getClass()); if (store == null) ...
37c389b9-5e51-4076-b157-b2d35a705032
8
public boolean executeLine(String line) { if (first && (line.equals("ditaa") || line.startsWith("ditaa("))) { data = new StringBuilder(); if (line.contains("-E") || line.contains("--no-separation")) { performSeparationOfCommonEdges = false; } if (line.contains("-S") || line.contains("--no-shadows")) {...
19991be5-fdd3-4abb-a562-efc25a0bf559
2
public static String classDescriptor(String name) { // The name of the class may arrive as the name of the class file // in which in resides. In this case, we should remove the .class // file extension. if (name.endsWith(".class")) { name = name.substring(0, name.lastIndexOf('.')); } name = name.replace...
a401a6ac-600d-44b6-93d2-c691c0770f47
3
public static String vectorCaddieToHTML(Vector<Caddie> rs){ if (rs.isEmpty()) return "<p class=\"plusbas\">Le caddie est vide.</p>"; String toReturn = "<TABLE BORDER='1' width=\"1000\">"; toReturn+="<CAPTION>Le caddie :</CAPTION>"; toReturn+="<TR>"; toReturn+="<TH> <i>Reservation n°</i></TH>"; toRet...
555caef5-e542-4b93-a4d8-b54de8b07451
6
@Override public boolean modificarCliente(TCliente cliente) { boolean correcto = false; TransactionManager.obtenerInstanacia().nuevaTransaccion(); try { TransactionManager.obtenerInstanacia().getTransaccion().start(); TCliente tCliente = Factor...
076f17f1-95b9-45c9-9166-9f367e517a2f
3
@Override public void setEntityManager(IEntityManager<? extends IEntityTracker> entityManager) { if(!this.finalized) { if(entityManager instanceof IPluggable) this.entityManager = entityManager; else throw new UnsupportedOperationException("The EntityManager does not implement IPluggable!"); } else throw n...
65e71307-f3f8-45bb-a29b-7ddbaa7e6509
2
public Image getImage() { if(image == null) { try { image = new Image("res/sprites/items/" + getItemID() + ".png"); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return image; }
b52ce13f-c338-4dc2-962f-44968828e5b4
1
public int saveBook(Book bookToSave) { try { // Erforderlicher SQL-Befehl String sqlStatement = "INSERT INTO bookworm_database.books (isbn, title, author, " + "publicationDate, formatb, shortDescription, category, " + "commentb, readb) VALUES ('" + bookToSave.getIsbn() + "', '" + bookT...
f2830229-fb1b-4603-9694-6ca48aa491bd
0
public String[] getLastSenders() { return previousSenders; }
7ab87d9d-afed-4328-b2d9-2a585baeeb91
8
private void checkForWhite(int i, int j) { gameBoard.step(blockBoard[i][j]); // Checks that block is blank & 0 n if (blockBoard[i][j] instanceof Blank) { boardButtons[i][j].setVisible(false); blockBoard[i][j].setAlreadyChecked(true); for (int a = i - 1; a <= i + 1; a++) { for (int b = j - 1; b <=...
dbd4dda0-2308-4dcb-abe4-fb0699bd6757
4
public void doAnswer(AnswerSide answerSide) { if (this.answerSide == answerSide || isRunning) return; isRunning = true; AnswerSideManager answerSideManager = AnswerSideManager.getInstance(); answerSideManager.setAnswerSide(answerSide); PriceManager priceManager =...
d92c625b-20c0-4751-8e98-f95cafd2c92e
3
@Override public void tickServer() { super.tickServer(); if (needsInit) { needsInit = false; for (WorldCoordinate pair : getPairs()) { SignalController controller = getControllerAt(pair); if (controller != null) { onControll...
f4b62f45-4a62-4705-9041-04523be27cca
5
@Override public boolean generateClientSettings(final File settingsFile) { LOG.log(Level.FINE, "Generating client settings."); final SimpleXMLSettingsFile xml = new SimpleXMLSettingsFile(); boolean result = false; try { final Enumeration<NetworkInterface> ne...
001e95d3-eb5b-42d8-8ee3-af3f2dbacc8e
9
public RenderTable wrapper(final GraphReportExtension mr) { GraphModelIterator it; if (!gens.equals(GeneratorFilters.NoGenerator)) { it = new GraphGeneratorIterator(gens); } else { it = new AllGraphIterator(type,size,part); } ToCall f = new ToCall() { ...
cc3c1d13-09c5-49b5-9c44-bb797c4efb97
6
public static void main(String[] args) { try { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile()); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConf...
e0730e84-d6f9-43ec-9433-5d2e6bb34913
2
public Builder name(String receivedName) { if (receivedName == null || receivedName.equals("")) { log.warn("Wrong Name. receivedName ={}", name); throw new IllegalArgumentException("name must be not null. Received value = " + receivedName); } this.nam...
b19fe5c3-bbdc-453d-be82-7c113ad49df1
8
private List<Area> createAreas(CodelTableModel model) { List<Segment> segments = getSegmentsAtRow(model, 0); if (segments == null) { return null; } List<Area> areas = new ArrayList<Area>(); for (Segment segment : segments) { Area area = n...
ce7b5d6f-364c-41f6-a063-6fef4fe71c82
2
@Override public List<String> getSuggestions(CommandInvocation invocation) { List<String> result = new ArrayList<>(); Class completerClass = parameter.getProperty(Properties.COMPLETER); if (completerClass == null) { completerClass = parameter.getType(); } ...
fa715158-fa35-4ffa-a8c8-8f45fd927861
6
public void shootshing() { if (waitforshoot <= 0 && shoottwice == 30) { getWorld().addObject(new sting(), getX(), getY()); shoottwice--; } else if (shoottwice != 30 && shoottwice > 0) { shoottwice--; } else if (shoottwice <= 0) { ge...
06cb8f17-ea07-4cce-be6c-dbbe88aac7ed
6
public static double ValueCoherentNoise3D (double x, double y, double z, int seed, NoiseQuality noiseQuality) { // Create a unit-length cube aligned along an integer boundary. This cube // surrounds the input point. int x0 = (x > 0.0? (int)x: (int)x - 1); int x1 = x0 + 1; int ...
2aba7902-a941-48fe-8b4c-8589532066b3
4
@Override public void mousePressed(MouseEvent m) { Wall newWall; if(m.getButton() == 1){//front click newWall = new Wall(new Point2D.Double(m.getX(), m.getY()), Wall.Orientation.HORIZONTAL); } else{ newWall = new Wall(new Point2D.Double(m.getX(), m.getY()), Wall.Orientation.VERTICAL); } for(Wall wall...
5a9cacc4-9620-4796-a266-e98c14a27d47
3
public CategorieMotClef findCategorieOf(MotClef mot) { for (CategorieMotClef c : categories) { for (MotClef m : c.getMotClefs()) { if (m.equals(mot)) { return c; } } } return null; }
342982c9-c80a-4509-b802-c58b63c264d7
2
private double[] getMinMax() { double[] minmax = new double[4]; double minX; double maxX; double minY; double maxY; try { String sql = "SELECT (\n" + " SELECT MIN([start-x-coord])\n" + " FROM correctedCo...
3060bdc5-a03f-4a67-9200-b14a8760c279
2
@Override public boolean extensionExists(String ext) { Iterator it = getExtensions(); while (it.hasNext()) { String key = (String) it.next(); if (ext.equals(key)) { return true; } } return false; }
07122c4e-88eb-423b-b22d-bd6c5a4d1552
0
public void setDayStored (Day d) { dayStored = new Day (d); }
e6b6e920-70a6-4a94-91ed-2d71b1b31f37
8
public static boolean checkStatementExceptions(List<Statement> lst) { Set<Statement> all = new HashSet<>(lst); Set<Statement> handlers = new HashSet<>(); Set<Statement> intersection = null; for (Statement stat : lst) { Set<Statement> setNew = stat.getNeighboursSet(StatEdge.TYPE_EXCEPTION, State...
50dc4fa9-5dc1-4cc4-9cfa-661ccbec776d
0
public VuePraticiens getVue() { return vue; }
9119825f-c434-4d07-80b6-2dccb4ea62c6
6
static public void main(String args[]) { double x, y; Random rand = new Random(); String prefixletter = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; double sumx, sumx2; int nsum; OSNI osni = new OSNI(); osni.setErrorTolerance(0.0001); nsum = 0; sumx = sumx2 = 0.0; for (int i = 0; i < 10000; i++) { x = 100000...
41234039-e1dc-499e-a853-64fef8b098ab
8
static void runParser(String inPath, String outPath) { String cs; try { // open a star file, read it in cs = readFile(inPath); } catch (IOException e) { print("sorry, unable to read file. aborting"); System.exit(2); return; // what? why do I need a return here? why isn't System.exit enough? }...
704fe161-7e94-4e34-9295-a2a3d04cc44d
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhpposPermissionsEntityPK that = (PhpposPermissionsEntityPK) o; if (personId != that.personId) return false; if (moduleId != null ? !moduleId.e...
571648d9-e925-4ba8-a56b-57e6055e68af
6
public void edit(Applicant applicant) throws NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); applicant = em.merge(applicant); utx.commit(); } catch (Exception ex...
5e8698f4-f98f-4397-bfb1-63cd8a5b1e92
6
public void updateGame() { //System.out.println(gameWorld.getDrawableActorGroup().getBulletGroup().getList().size()); PlaneGroup planeGroup = gameWorld.getDrawableActorGroup().getPlaneGroup(); UserPlane up = planeGroup.getUserPlane(); if(up == null) { //you have lost the game, restart? } else { g...
1b4d5c13-a267-4d68-933b-0d860be75ee8
4
public List<Recipe> search(String search){ Document doc = null; try { doc = Jsoup.connect("http://www.recept.nu/search?searchtext="+search+"&orderby=relevance").get(); } catch (IOException ex) { Logger.getLogger(RecipeSearch.class.getName()).log(Level.SEVERE, null, ex); ...
35daf61c-8ab3-4c03-bf93-c0e9ab9af041
6
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { Rectangle alloc = bounds.getBounds(); // Set up translucency if necessary. Graphics2D g2d = (Graphics2D)g; Composite originalComposite = null; if (getAlpha()<1.0f) { originalComposite = g2d.getComposite(); g2d.s...
1edc7950-4b00-466c-bed3-0087c949820b
6
public StackSentence( StackSentence parent, int newWord, int[] sourceSentence, Dictionary dict, LanguageModel langMod, LengthModel lenMod) { if(parent == null){ words = new int[1]; } else { words = new int[parent.words.length + 1]; System.arraycopy(parent.words, 0, words, 0, parent.words.length); ...
7d0581e2-363f-45c7-946d-3aa7d320d60a
5
public void waitForPeersToPopulate() { while (!peersPopulated) { while (manager.peers.size() < 1) try { Thread.sleep(10L); } catch (InterruptedException e) {} for (Peer p : manager.peers) { if (p.availablePieces.size() > 0) { this.peersPopulated = true; break; } } } }
cfa838df-f1e2-4a81-a10f-f5c7aaf0b932
6
private boolean isBlocked(int x, int y, int i, int j) { int delta[] = {x, y}; int next[] = {i, j}; int block[] = new int[2]; int k; for(k = 0; k < 2; k++) { delta[k] -= next[k]; block[k] = next[k]-delta[k]; } // it is blocked if it is ...
bc365ce0-c3c9-4bbb-a485-812e62096d38
6
@EventHandler public void MagmaCubeSpeed(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.getMagmaCubeConfig().getDouble("MagmaCube....
321b2d01-a890-496f-895c-d91ea9657976
6
private Combo findChunk(int index) { boolean b = true; boolean startFirst = startFirst(index); int count; Chunk current; // This isn't 100% optimal, because the size of the chunks can be different, but it's not bad anyway if (startFirst) { count = 0; current = firstChunk; } else { cou...
fe8f3f37-51d6-457e-884a-ab5a7892a72e
0
public void debug(String s) { getConnectionProcessor().get_logger().debug(StringUtils.shortName(getClass()) + s); }
91f4355e-e41d-4d5d-92a9-8e1f5b79215b
3
public void sendState(int currentState, int activeDrum) { //System.out.println("STATE:" + currentState); long milliTime = (long)(parent.getCurrentUnixTime()); for(Observer o : StateListeners) { o.update("STATE;"+String.valueOf(currentState)+";"+String.valueOf(milliTime));...
5dd3e724-aa15-4931-8541-61cd5064d6cc
0
public void setZugZuende(Boolean b) { zugZuende = b; }
c14eaa08-1f49-480f-9d13-98a8baf41864
1
public void agregarEntidad(final Long cantidad, final String nombre, final Double precioUnitario) { if (DAO.listarEntidades() == null) { //Si no hay entidades se creará una arreglo que las contendrá DAO.setEntidades(new ArrayList<Entidad>()); } DAO.agregarEntidad(new Entidad(canti...
02a91512-8eaa-4b5f-bfe3-10c12f055853
1
@Before public void setUp() { try { clientProxy = AqWsFactory.newAqAcqClient(TestContext.AcquisitionServiceUrl, TestContext.User, TestContext.Pwd); } catch(Exception ex) { fail("setUp failed: " + ex.toString()); } }
36289509-21ce-4ed7-b9ee-d311500f74c7
9
public int compareTo(HotTestDetails comp) { int result = 0; if (m_minimize) { if (m_merit == comp.m_merit) { // larger support is better if (m_support == comp.m_support) { } else if (m_support > comp.m_support) { result = -1; } else...
2f448220-49f2-4e11-8413-63ba30b5cff2
6
public static void main(String[] args) { int[][] arr = {{59},{73,41},{52,40,9},{26,53,6,34},{10,51,87,86,81},{61,5,66,57,25,68},{90,81,80,38,92,67,73},{30,28,51,76,81,18,75,44},{84,14,95,87,62,81,17,78,58},{21,46,71,58,2,79,62,39,31,9},{56,34,35,53,78,31,81,18,90,93,15},{78,53,4,21,84,93,32,13,97,11,37,51},{45,3,8...
817222d4-b98a-4a2a-af40-10030525d343
6
public void rotate(double angle, int axis) { if (axis != X_AXIS && axis != Y_AXIS && axis != Z_AXIS) return; double cosAngle = Math.cos(angle); double sinAngle = Math.sin(angle); double xNew, yNew, zNew; switch (axis) { case X_AXIS: yNew = y * cosAngle + z * sinAngle; zNew = -y * sinAngle ...
b74fd2ff-e002-4704-957c-b3f505650def
2
public void clearHalt () throws IOException { if ("bulk" != getType ()) throw new IllegalArgumentException (); // this affects the USB data toggle and other HCD state, // otherwise we could issue control requests directly if (spi == null) spi = iface.getDevice ().getSPI (); spi.clearHalt ((byte) (0...
525f9b81-6d5a-4a31-9365-9481a38494eb
2
public static List<String> getStringListValue(String nodeValue) { List<String> values = new ArrayList<String>(); for(String part : nodeValue.split(",")) { String value = part.trim(); if(value.isEmpty()) continue; values.add(value); } return Collections.unmodifiableList(values); }
a2fc1020-0d3a-4e9a-a52f-e25d52df3061
9
static double log2ScaleExp(double[] xs) { if (xs.length == 0) return 0.0; double max = xs[0]; for (int i = 1; i < xs.length; ++i) if (max < xs[i]) max = xs[i]; if (max < 0.0 || max > 1.0) { String msg = "Max must be >= 0 and <= 1." + " Found max=" ...
b13840ce-c97b-42e9-9e49-071b48472b72
7
protected static Item possibleContainer(MOB mob, List<String> commands, boolean withStuff, Filterer<Environmental> filter) { if((commands==null)||(commands.size()<2)) return null; final String possibleContainerID=commands.get(commands.size()-1); final Environmental thisThang=mob.location().fetchFromMOBRoomFa...
ef05019f-f2b1-4051-8825-473dd6ef44ef
3
private void readyForTermination() { addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { currentState.processKeyPressed(e); int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ESCAPE ...
f4019a18-5866-44cb-8223-31bbe6fc669c
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...
967764ee-c254-48fd-adc9-a551c78a0aac
8
public static int longestValidParentheses(String s) { String[] parts = s.split(""); int len = parts.length; int[] position = new int[len-1]; int left = 0; Stack<Integer> right = new Stack<Integer>(); for(int i=1;i<len;i++) { position[i-1] = -1; if(parts[i].equals("(")) { left++; ri...
abb7ee76-b088-4e9b-a3ae-7b3f478d9ac9
7
public void paintComponent(Graphics g) { BufferedImage spriteSheet = null,engine; BufferedImageLoader loader = new BufferedImageLoader(); try { spriteSheet = loader.loadImage("images/Ship_Shop/shipshopparts.png"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(...
15076a5d-01c1-4d4d-984a-4ebcb4ccf7c0
5
private void handleInput(){ camera.doKeyboardControl(); camera.doMouseControl(); while (Keyboard.next()){ if (Keyboard.getEventKey() == Keyboard.KEY_Q){ System.exit(0); } } while (Mouse.next()){ if (Mouse.getEventButtonState() && Mouse.getEventButton() == 2){ Mouse.setGrabbed(!Mouse.isGr...
f33369f5-6b46-4bcf-b0eb-57c3e2c59bd2
1
protected void setList(List list) throws IteratorException { this.list = list; if (list != null) { listIterator = list.listIterator(); } else { throw new IteratorException(); } }
588e1809-b98c-4158-899d-f47220c88610
6
public void setMinValue(double minValue, boolean filterArchivedValues) throws IOException, RrdException { double maxValue = this.maxValue.get(); if(!Double.isNaN(minValue) && !Double.isNaN(maxValue) && minValue >= maxValue) { throw new RrdException("Invalid min/max values: " + minValue + "/" + maxValue); } ...
bafb8ae2-ef9b-4791-ac44-cf5026ba1e09
7
private static void renameAndTrimBackups() { File directory = new File(DatabaseWrapper.storagePath + "Backup/"); ArrayList<Path> paths = new ArrayList<>(); if (!directory.exists()) { try { Files.createDirectory(directory.toPath()); } catch (IOException ex) { Logger.getLogger(AwanaDatabase.class.getN...
aec30a59-40b9-4d62-8481-96a40a3fff85
4
public static HashMap<String, Profile> loadProfiles() { LOGGER.log(Level.INFO, "Loading player profiles.."); HashMap<String, Profile> profiles = new HashMap<String, Profile>(); File[] proFiles = new File("profiles").listFiles(); for (File file : proFiles) { try { ...
f777609d-26c0-496c-9c6f-a6fca38b463b
3
@Override public Iterator<T> iterator() { return new Iterator<T>(){ private int pos = 0; public boolean hasNext() { return pos < size; } @SuppressWarnings("unchecked") public T next() { if(hasNext()) return (T)array[pos++]; else throw new NoSuchElementException("Pas de suivant"...
2b17dbb7-9b08-460d-9faf-94196b411983
5
public void populateTasks(File tasks) { try { Scanner fileInput = new Scanner(tasks); int level = 0; char group = 0; String name = ""; String token = ""; while (fileInput.hasNextLine()) { token = fileInput.next(); if (!token.equals("")) name = token; ...
d00a501a-d91c-45a2-9912-5c41e3373202
0
private void printBuffersStatus() { System.out.println("{sendBuffer:" + sendBuffer.size() + " receiveBuffer:" + receiveBuffer.size() + " inputQueue:" + inputQueue.size() + "}"); System.out.println("------------------------------------------------"); }
a17d10af-e0ee-47bd-aa77-5d3b20de0c36
9
protected boolean checkCDATA(StringBuffer buf) throws IOException { char ch = this.readChar(); if (ch != '[') { this.unreadChar(ch); this.skipSpecialTag(0); return false; } else if (! this.checkLiteral("CDATA[")) { //$NON-NLS-1$ this.sk...
cc542aa7-68e4-4c3e-87cf-f4f7e7fe2c8d
0
public Integer getId() { return id; }
6e6cd8aa-d371-4fe3-a52e-2ae384046f24
6
public boolean isValidKill(Player p){ String pName = p.getName().toLowerCase(); if(this.recentKills.containsKey(pName)){ long lastKill = recentKills.get(pName); if(lastKill + 60000 > System.currentTimeMillis()){ //Killed them in the last 60 seconds. return false; } } Player m = this.getPl...
e640b90b-8c45-4b26-aff7-da2794a89080
0
public JTextField getjTextFieldNom() { return jTextFieldNom; }
6ae1b465-7f9a-4e95-a954-64be94ae9736
6
public void update(float delta) { System.out.println(x+" "+y); if(moving) { progress=Math.min(1, progress+speed*delta); } if(progress==1) { progress=0; moving=false; switch(dir) { case NORTH: y--; break; case SOUTH: y++; break; case WEST: x--; break; case ...
15a0fee2-2f4c-403c-8921-852cb64bf471
8
private void BroadcastAddMember(final DataPacket<AddMember> dp) { //TODO delete after test System.out.println("BroadCast AddMember begin"); String peopleOnline = ""; String peopleOffline = ""; String senderIdentity = dp.getLog().getidentity(); AddMember newMember = dp.getContent(); ArrayList<String> membe...
7293d802-d770-45eb-90cb-3e28a384b3b4
7
public final char[] signature() /* (ILjava/lang/Thread;)Ljava/lang/Object; */ { if (signature != null) return signature; StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20); buffer.append('('); TypeBinding[] targetParameters = this.parameters; boolean isConstructor = isConstructor(); // if (isCo...
99c1d40e-dd7f-4c80-a3d7-00e79f64158b
4
public static void unjar(File jarFile, File directory) { JarFile jfile; try { jfile = new JarFile(jarFile); final Enumeration<? extends JarEntry> entries = jfile.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); final File file = new File(directory...
68b0edd6-df8b-4281-89ee-b22854d53e73
5
public boolean equals(Object o) { if (!(o instanceof ContactImpl)) { return false; } else { ContactImpl contact = (ContactImpl) o; if (firstName.equals(contact.firstName) && lastName.equals(contact.lastName) && organization.equa...
c7c33d10-e9b9-45a6-9b9f-88f1b4af4e79
9
public boolean allowMove(int dx, int dy) { int nx = x + dx; int ny = y + dy; int nx2 = x2 + dx; int ny2 = y2 + dy; int i; for (i = 0; i != sim.elmList.size(); i++) { CircuitElm ce = sim.getElm(i); if (ce.x == nx && ce.y == ny && ce.x2 == nx2 && ce....
0e6a43e5-7785-40fb-9b61-327418927350
1
public EssenceOfDeath(boolean isFullscreen, int newWidth, int newHeight) { try { add(new Board(this, isFullscreen, newWidth, newHeight, 32)); } catch (IOException e) { System.out.println("Error loading Board - " + e); } setDefaultCloseOperation(JFrame.EX...
0c794231-0c63-4829-8317-d1ce16fbe505
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Borrower)) { return false; } Borrower other = (Borrower) obj; if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(othe...
10d01c74-d49e-4f9a-b5af-27056ca1a8b0
1
private GenericDAO<Project> getCustomersDAO() { if (_customersDAO == null) { _customersDAO = new GenericDAO<Project>(Project.class); } return _customersDAO; }
50709db0-e870-49e9-b60a-a73a5007181e
3
public void actionPerformed(ActionEvent e){ if (e.getSource() == newButton){ newButtonClicked(e); } if (e.getSource() == showButton){ showButtonClicked(e); } if (e.getSource() == timeButton){ timeButtonClicked(e); } }
8a99ad2d-0f37-46e2-90a9-dd9cefd197a6
0
public TuringToGrammarConverter() { myAllReadableString=new HashSet <String>(); myAllWritableString=new HashSet <String>(); }
58f4e4b2-d088-4753-bebb-c2b36e05754a
3
private void submitOrder(String label, OrderCommand orderCmd) throws JFException { this.order = engine.submitOrder(label, this.instrument, orderCmd, this.amount); while (order.getState() == IOrder.State.CREATED || order.getState() == IOrder.State.OPENED) { order.waitForUpdate(2, TimeUnit.SE...
1279488c-f8bb-4cc2-9ea5-bf35a3fbccbe
4
private void handlePingResponse(Packet pingResponse) { //ignore if the ping response is null if(pingResponse == null) return; //if the ping response doesn't have a sequence number of the ping it's responding to then we can't do anything if(pingResponse.getLastReceivedSequenceNumber() == Packet.SEQUENCE_NUMB...
09428d20-d16f-49c5-ad18-8845d36eedaa
8
public static Image generateImage(Dataset dataset, BitSet selected, String infoString) { List<Point> points = dataset.getPoints(); float distance = dataset.getMaxDistance(); //If no bitset is provided, show all connections if(selected==null) { selected = new BitSet(points.size()); selected.set(0, point...
4f2910c9-8254-4e5e-a8f0-10c14566f1fb
5
public void invalidatePacketEventsForThisEdge(Edge toDelFor){ boolean changed = false; Iterator<Event> eventIter = iterator(); while(eventIter.hasNext()){ Event eventInQueue = eventIter.next(); if(eventInQueue instanceof PacketEvent){ PacketEvent pe = (PacketEvent) eventInQueue; if(pe.packet.edge...
f25d77cc-2bb3-4cda-8d3e-42fdb4595bf9
3
public void setScheme(int scheme) { if ((scheme == SIMPLE) || (scheme == NUMBERED) || (scheme == TIME)) { this.scheme = scheme; } else { throw new IllegalArgumentException("Invalid output strategy scheme."); } }
fc2d5934-c78a-412c-991a-92ca7ef5047f
3
private static void setDefaults() { List<String> check = Announcements.announcements.getSubNodes( "Announcements" ); if ( !check.contains( "Global" ) ) { Announcements.announcements.setInt( "Announcements.Global.Interval", 300 ); List<String> l = new ArrayList<String>(); ...
619c6b91-813a-43d0-a0da-30e37de90c6a
8
public static void main(String[] args) throws IOException { final String method = CLASS_NAME + ".main()"; boolean start = Peer.start(args); if(!start) { LogUtil.log(method, "Peer not initialized properly"); return; } Set<String> filenames = FileStore.getInstance().getFilenames(); if(filenames == null...
be256eff-a122-4782-8304-b3c3f8e0c132
9
public boolean execute(ChatClient sender, String[] args) { if (args.length < 2) { sender.serverChat(usage()); return true; } ChatAccount account = AccountManager.getAccount(args[1]); if (account == null) { sender.serverChat("There is no account by that name"); } StringBuilder strBuf = ne...
01e4c9cb-25d6-44ee-b0f8-ee6d4c8e52ce
9
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == saveButton) { Dimension size = this.getSize(); BufferedImage image = (BufferedImage) this.createImage(size.width, size.height); Graphics g = imag...
5da28807-3ba0-448b-b3a8-3b2b73a81565
2
public static void clear() { for(Stack<Edge> s : stacks.values()) { s.clear(); } stacks.clear(); if(lastStack != null) { lastStack.clear(); } lastStack = null; }
8646a4d2-c15d-4844-9d2d-a60120330ba3
3
public void printCombs(ArrayList<ArrayList<Integer>> comb) { System.out.println("["); for (int i = 0; i < comb.size(); i++) { ArrayList<Integer> curComb = comb.get(i); System.out.print("["); for (int j = 0; j < curComb.size(); j++) { if (j == curComb.size() - 1) System.out.print(curComb.get(j)); ...
84d0abc2-91f9-4798-be68-9f088bfb00c3
0
private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed this.anadirCliente(); }//GEN-LAST:event_btnNuevoActionPerformed
d748f65d-edab-4300-853d-fa61672d67d8
3
public boolean collide_static() { for(int i = 0; i < Fenetre._list_static_items.size(); i++) { //Ici on verifie que le rectangle de l'objet dans lequel on est collide avec un des objets de la liste static if (Fenetre._list_static_items.get(i).getSolid() && _r.intersects(Fenetre._list_static_items.get(i).getRect...
d65adf00-a812-485f-8667-708b2768c8e1
3
public static ArrayList<Vector2D> getTriangleTriangleIntersects(Triangle A, Triangle B) { ArrayList<Vector2D> intersects = new ArrayList<Vector2D>(); for (Vector2D intersect : getTriangleLineIntersects(A, B.getAB())) { intersects.add(intersect); } for (Vector2D intersect : g...
65f5cd52-4c67-4a51-8eca-30c12fb0f9a5
7
protected void doPrintHeader() { if (m_Header.classAttribute().isNominal()) if (m_OutputDistribution) append(" inst# actual predicted error distribution"); else append(" inst# actual predicted error prediction"); else append(" inst# actual predicted error"); if (...
df251317-4b12-4052-b65e-616de9115b17
2
public static Customer getCustomer(String name) { for (String s : names) { if (s.equalsIgnoreCase(name)) return new RealCustomer(name); } return new NullCustomer(); }
bfd4cb14-9ccf-405d-83b3-97b9cd24fb16
4
public void runToNextWalkFrame(int excuseFrames) throws CapturedByRotatoException { int startSteps = curGb.stepCount; // forward to first possible input frame while(true) { Util.runToFirstDifference(0, dir, Metric.DOWN_JOY); State s = curGb.newState(); int add2 = Util.runToAddressNoLimit(0, dir, curGb.p...
feaadbb2-54db-4f6a-89cc-9e98d45eb258
5
@Override public void applyComponent(Mat inputMat, ProcessInfo info) { Integer dilateSize = (Integer) dilateSizeSpinner.getValue(); Integer erodeSize = (Integer) erodeSizeSpinner.getValue(); int shape = Imgproc.MORPH_ELLIPSE; switch ((Shape)comboBox.getSelectedItem()) { case CIRCLE: shape = Imgproc...
0b169ead-e1dd-4407-a12d-6133652cb9c0
7
public float abSearch(ABNode node, int depth, float a, float b, Boolean maximizingPlayer) { if(depth == 0 || node.isTerminal()) { return node.getHVal(); } if (maximizingPlayer) { for(ABNode child : node.getChildNodes(1)) { //Each child node a = Math.max(a, abSearch(child, depth -1, a, b, false)); ...
da4cfcee-5be7-4228-8ad5-c9f2d4874a52
4
protected int findGridlet(Collection obj, int gridletId, int userId) { ResGridlet rgl = null; int found = -1; // means the Gridlet is not in the list try { // Search through the list to find the given Gridlet object int i = 0; Iterator iter = ...
f4bd5e07-e05d-4cda-b72c-37e2dbaa1388
0
public static Pet[] createArray(int size) { return creator.createArray(size); }