text
stringlengths
14
410k
label
int32
0
9
@EventHandler public void MagmaCubeStrength(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("MagmaCu...
6
private WatcherValues(Object... obj) { for (int i = 0; i < obj.length; i += 2) { if (!values.containsKey(obj)) values.put((Integer) obj[i], obj[i + 1]); else try { throw new Exception("Values in WatcherValues already contains " + obj + ...
3
public void cargarCasillas() { int num; for(char c='A';c<='J';c++) { for (Entry<Character, List<Definicion>> e: CatalogoDefiniciones.getCatalogoDefiniciones().buscarPorLetra(c).entrySet()) { num=(int)(Math.random()*e.getValue().size()); listaCasillas.add(new Casilla(e.getKey(),e.getValue().get...
6
public mjDate Djcal(double djm) throws palError { double fd, df, f, d; long jd, n4, nd10; int yr, mn, dy; Status = 0; TRACE("Djcal"); /* Validate */ if ((djm <= -2395520.0) || (djm >= 1.0e9)) { Status = -1; throw new palError(Status, "Djca...
4
public void initScacchiera(Giocatore pGiocatore1, Giocatore pGiocatore2){ //pedine bianche int pb=0; for (i = 0; i < 8; i++) { for (j = 7; j > 4; j--) { if(pb<12){ if (isCasellaNera(this.scacchiera[i][j])==true){ this.sc...
8
public double getMoney(){ return this.money; }
0
@Override public void execute(VirtualMachine vm) { if (vm.popRunTimeStack() == 0) { vm.setPc(address - 1); } }
1
public int minCut(String s) { if (s == null || s.length() == 0 || s.length() == 1) { return 0; } int[][] palindrome = new int[s.length()][s.length()]; int[] cut_num = new int[s.length() + 1]; for (int i = s.length() - 1; i >= 0; i--) { cut_num[i] = s.length() - i; for (int j = i; j < s.lengt...
8
private boolean setupChat() { if (getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class); chat = rsp.getProvider(); return chat != null; }
1
private void consumer(String[] subscriptions) { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); try { Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.exchangeDeclare(EXC...
8
public JScrollPane getjScrollPane1() { return jScrollPane1; }
0
public int findNearest(int[] num, int target){ int i = 0; int j = num.length - 1; int mid = 0; while(i <= j){ mid = (i + j) >> 1; if(num[mid] == target){ return mid; }else if(num[mid] > target){ j = mid - 1; }else{ i = mid + 1; } } return mid; }
3
public static void main(String[] args) { Stack<String> stack = new Stack<String>(); for (String s : "My dog has fleas".split(" ")) stack.push(s); while (!stack.empty()) System.out.print(stack.pop() + " "); }
2
@Override public void invoke(final ChatSocket socket) throws InvalidCommandException { // The user with address zero is reserved if (dest.equals(new LongInteger())) { throw new InvalidCommandException("Cannot send to user with address zero"); } // Bump the seq number ...
7
@SuppressWarnings("serial") BodyPanel(Model model, ModelControl mControl) { super(true); this.control = mControl; model.addBodiesChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // if the state change is the one we're interested in... if (evt.getPr...
7
public Scriptable construct(Context cx, Scriptable scope, Object[] args) throws RhinoException { if (args.length == 2) { Class<?> clazz = null; Object obj1 = args[0]; if (obj1 instanceof Wrapper) { Object o = ((Wrapper)obj1).unwrap(); if (o...
8
public static Set<Property> getRelevantPropertiesOfClass(Resource cls, SPINModuleRegistry registry) { Set<Property> results = new HashSet<Property>(); StmtIterator it = cls.getModel().listStatements(null, RDFS.domain, cls); while (it.hasNext()) { Resource subject = it.next().getSubject(); if (subject.isU...
7
private void acao172() throws SemanticError{ if(tipoVariavelIndexada == Tipo.CADEIA){ if(tipoExpressao == Tipo.INTEIRO){ tipoVariavel = Tipo.CARACTERE; } else { throw new SemanticError("Índice deveria ser Inteiro"); } }else if(tipoExpressao == ((IdentificadorVariavelVetor) idAtual).getTipoIndice())...
6
private int getPercentageDiscount(int customerRelationDiscount, int customerLongevityDiscount) { int pecentageDiscount = 0; String discountCalculationStrategy = ConfigurationPropertyReader.getInstance().getProperty( ConfigurationConstants.PERCENTAGE_DISCOUNT_CALCULATION_STRATEGY); ...
4
public void setMember(Member member) { this.member = member; }
0
public String scanString() throws StringScanException { int idxSave = idx; skipWhiteSpace(); try { if (buf[idx] == '"') { return scanQuotedString(); } else { return scanNonWhiteSpaceString(); } } catch (StringScanException e) { idx = idxSave; throw e; } ...
2
public void update(int delta) { Vector2f v = facing.copy().normalise().scale(this.getSpeed() * delta); if(timeAlive >= lifeTime) { if(this.target != null) { this.faceAt(target.copy()); this.lookAt(target.copy()); this.target = null; } if(!world.isEntityColliding(this, this.getBB(loc.co...
3
public boolean setSessionAndStreams() { outputBuffer = new StringBuilder(); try { Channel channel = sesConnection.openChannel("shell"); in = new DataInputStream(channel.getInputStream()); out = new DataOutputStream(channel.getOutputStream()); c...
7
public static StdImageSet getIconsForFileExtension(String extension) { if (extension != null) { extension = normalizeExtension(extension); StdImageSet icons = ICONSET_MAP.get(extension); if (icons != null) { return icons; } return StdImage.FILE; } return StdImage.FOLDER; }
2
private static String parseItemInformation(ItemStack[] items) { ItemStack[] stock = InventoryUtil.mergeSimilarStacks(items); StringBuilder message = new StringBuilder(15); Joiner joiner = Joiner.on(' '); for (ItemStack item : stock) { joiner.appendTo(message, item.getAmount...
1
public static ArrayList<String> readAllLines(File file) throws IOException { ArrayList<String> linesRead = new ArrayList<String>(); BufferedReader bufferedReader = null; FileReader fileReader = null; try { fileReader = new FileReader(file); bufferedReader = new Bu...
4
public static void moveFilesToDirectory(String hdfsUrl, String sourceDirectory, String targetDirectory) throws IOException { Configuration conf = new Configuration(); conf.set("fs.default.name", hdfsUrl); conf.set("hadoop.job.ugi", DEFAULT_UGI); FileSystem fileSystem = FileSystem.get(conf); FileStatus[] statu...
2
public synchronized void removeListener(EventListener listener) { List<Class<?>> removeKeys = new LinkedList<>(); for (Class<?> key : eventListeners.keySet()) { List<RegisteredListener> listeners = eventListeners.get(key); if (listeners == null) { removeKeys.add(key); continue; } List<Regist...
9
@Override public void runStartupChecks() throws EngineException { Engine eng = FreeForAll.getInstance().getEngineManger().getEngine("Storage"); if (eng != null) { if (eng instanceof StorageEngine) { this.SE = (StorageEngine) eng; } } eng = FreeForAll.getInstance().getEngineManger().getEngine("Invento...
6
private Elem compruebaFueraRango(String tipoResultado, Object valorResultado) throws Exception { Elem resultado = new Elem(tipoResultado,valorResultado); if (!tipoResultado.equals("boolean")&& !tipoResultado.equals("character")) { double valorR = Double.parseDouble(valorResultado.toString()) ; ...
9
OperatingSystem() { }
0
public void setState(int i) { lastState = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); allowClick = false; previousState = currentState; unloadState(previousState); changing = true; currentState = i; game.jukeBox.play(game.jukeBox.tracks.transition); if (i == F...
7
public boolean accept(File f) { if (f == null) return false; if (f.isDirectory()) return true; return extension.equals(getExtension(f)); }
2
public void updateGravity(Character ch, Character mon) { // manages gravity from black holes Character character = ch; Monster black = (Monster) mon; int chX = ch.getX(); int chY = ch.getY(); int monX = mon.getX(); int monY = mon.getY(); if (chX <= monX) { ch.changeX(2); } else { ch.changeX(-...
2
@Override protected void refreshStatus() { if (rollStatus == RollStatus.ROLL_THIRD) { status = FrameStatus.FINISHED; scoreStatus = ScoreStatus.FINAL; } if (rollStatus == RollStatus.ROLL_TWICE && status != FrameStatus.STRIKE) { status = FrameStatus.FINISHED; scoreStatus = ScoreStatus.FINAL; } ...
6
public void omniGirlSet(int a){ rover = head; while(rover!=null){ if(rover.status == 1){ rover.currgirl = a; } rover = rover.next; } }
2
private String getStringToParse(Scanner sc) { String s = sc.next(); String aux = ""; aux += s + " "; while (getMonth.get(s) == null && sc.hasNext()) { s = sc.next(); aux += s + " "; } return aux; }
2
public static void main(String args[]) { ServerSocket serverSocket; try { serverSocket = new ServerSocket(12129); } catch (Exception e) { System.err.println("Create server socket: " + e); return; } while (true) { try { ...
9
public UnificationPair(Term lhs, Term rhs) { if (lhs == null || rhs == null) { throw new IllegalArgumentException( "Both terms must not be null."); } this.lhs = lhs; this.rhs = rhs; }
2
public VueSeries() { initSerie(); }
0
public String setParametros(String host, String port, String database, String user, String password) { //<editor-fold defaultstate="collapsed" desc="setParamtros"> if (!host.isEmpty() && !port.isEmpty() && !database.isEmpty() && !user.isEmpty() && !password.isEmpty()) { FachadaB...
5
public HashMap<Integer, Double> rank_term(ArrayList<Integer> paperList) { HashMap<Integer, Double> rank = new HashMap<Integer, Double>(); for (int i = 0; i < paperList.size(); i++) { int paperid = paperList.get(i); HashMap<Integer, Double> termMap = Store.getInstance().pt .get(paperid); if (termMap =...
8
public void setPopNitProveedor(Integer popNitProveedor) { this.popNitProveedor = popNitProveedor; }
0
public Sprite create(Owner owner, Resource res, Message sdt) { int m = sdt.uint8(); GrowingPlant spr = new GrowingPlant(owner, res); spr.addnegative(); Random rnd = owner.mkrandoom(); int n = Config.simple_plants?1:num; for(int i = 0; i < n; i++) { Coord c; if(Config.simple_plants){ ...
3
public static boolean isCached(int id) { if (Model.modelHeaderCache == null) { return false; } ModelHeader modelHeader = Model.modelHeaderCache[id]; if (modelHeader == null) { Model.fileRequester.get(id); return false; } else { return true; } }
2
@Override protected byte[] getData() { byte[] imgHeader = new byte[61]; // BSE header = 36 bytes, BLIP record header = 24 bytes, then imageData bytes follow imgHeader[0] = (byte) imageType; //btWin32 imgHeader[1] = (byte) imageType; //btMac // 20071004 KSC: Unknown type of record, does not follow belo...
8
public void render(GameContainer arg0, Graphics g) throws SlickException { if(title) { titleDoor1.draw(-doorshift,0); titleDoor2.draw(doorshift,0); } else {//order of render: backgrounds -> walls -> items -> player+mobs grassMap.render(x-820, y-64,0); // background grassMap.render(x-820, y-64,1); //...
7
@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 Tuser)) { return false; } Tuser other = (Tuser) object; if ((this.idUser == null && other.idUser != null) || (t...
5
private void sentString(String sentData){ OutputStream out = null; try { out = socket.getOutputStream(); } catch (IOException e) { System.out.println("Не удалось получить поток вывода."); System.exit(-1); } BufferedWriter writer = new Buffered...
2
public static String optimizeText(String text) { char buf[] = text.toCharArray(); boolean endMarker = true; for(int i = 0; i < buf.length; i++) { char c = buf[i]; if(endMarker && c >= 'a' && c <= 'z') { buf[i] -= 0x20; endMarker = false; } if(c == '.' || c == '!' || c == '...
7
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (this.averageGroundLevel < 0) { this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); if (this.averageGroundLevel < 0...
8
private void updateHexField() { this.adjustingHexField++; try { int r = this.red.getIntValue(); int g = this.green.getIntValue(); int b = this.blue.getIntValue(); int i = (r << 16) + (g << 8) + b; String s = Integer.toHexString(i).toUpperCase(...
2
public boolean setSize(int mapSize, int numOfPlayers) { if ((mapSize < 5) || (mapSize > 50)) return false; if ((5 <= numOfPlayers) && (numOfPlayers <= 8)) { if (mapSize < 8) return false; } size = mapSize; return true; }
5
@Override public boolean tick(Tickable ticking, int tickID) { if(tickID==Tickable.TICKID_MOB) { if((affected!=null) &&(affected instanceof MOB) &&(invoker!=null)) { final MOB mob=(MOB)affected; if(((mob.amFollowing()==null) ||(mob.amDead()) ||(!mob.isInCombat()) ||((invoker!=null)&...
9
@Test public void testLetsGo() { Random rand = Mockito.mock(Random.class); // On s'assure que le terrain et toujours franchissable. Mockito.when(rand.nextInt(Land.CountLand())).thenReturn(0); Robot r = new Robot(); r.land(new Coordinates(0,0), new LandSensor(rand)); ...
5
private void drawCircles(final Graphics2D g2, final Color fillColor, final Color outlineColor, final int height) { Point upperLeft = this.getUpperLeft(); int startX = upperLeft.x + (this.getWidth() / 2); int startY = height + upperLeft.y; Point tailStart = new Point(startX, startY); Point tailEnd = this.ge...
5
public synchronized boolean removeSubscription(String clientSessionToken, Long subscriptionId) { if (clientSessionToken == null || clientSessionToken.isEmpty()) return false; if (subscriptionId == null) return false; // Clients subscriptions Map<Long, Subscription> clientSubscriptions = retrieveSubscript...
8
public State<ET> call() { try { // WARNING: Must synchronize adding listener and setting // initial state or you can miss a notification from the state // machine. synchronized (stateMachine) { stateMachine.addListener(this)...
8
public boolean has_in () { // There are subsequent parts of the partly-read message available. if (more) return true; // Note that messing with current doesn't break the fairness of fair // queueing algorithm. If there are no messages available current will //...
4
public int[] generate(int nplayers, int bowlsize) { int nfruits = nplayers * bowlsize; int sum1 = 0, sum2 = 0; int[] dist = new int[12]; Random r = new Random(); for (int i = 0; i < nfruits; i++) { // mean 6.5 stdev 3 int fruitToIncrease = (int) Math.round(r.n...
3
public int place(Piece piece, int x, int y) { // flag !committed problem if (!committed) throw new RuntimeException("place commit problem"); boolean sanityCheck = true; // get candidate squares for placement TPoint[] coordPts = getCoords(piece, x, y); // check if piece is in bounds, if square is curre...
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...
6
public static void writeToFile(){ File output = new File(".data\\nnsave"); FileWriter writer; try{ writer = new FileWriter(output); writer.write(inHid.length + "," + inHid[0].length + "\n"); for(int i = 0; i < inHid.length; i++){ for(int j = 0; j < inHid[i].length; j++){ writer.write(inHi...
5
public void setEmailId(String emailId) { this.emailId = emailId; }
0
public Participant addParticipant(int idEvent, String name){ tx.begin(); Event event = getEvent(idEvent); Participant participant = new Participant(); participant.setName(name); participant.setEvent(event); manager.persist(participant); tx.commit(); return participant; }
0
public Cell(int x, int y) { this.x = x; }
0
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { canasta.setMoveLeft(true); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { canasta.setMoveRight(true); } else if (e.getKeyCode() == KeyEvent.VK_P) { if (!pausa) { ...
7
private int[] searchForRest(ArrayList<Production> list, Production p, int[] visited) { HashSet <Production> visitedProd=new HashSet <Production>(); // System.out.println("Searching through "+list); int[] original=visited; int count=0; for (int i=0; i<myTrace.size(); i++) { if (list.contains(myTrace.get(...
5
public void insertPoint(int n, int x, int y) { if (type!=TYPE_POLY) return; Polygon pnew = new Polygon(); for (int i=0; i<poly.npoints; i++) { pnew.addPoint(poly.xpoints[i], poly.ypoints[i]); if (i==n) pnew.addPoint(x,y); } poly=pnew; }
3
int getNegative(int i){ int octaveOffset = i/ Constants.NOTES_IN_SCALE; int mod = i% Constants.NOTES_IN_SCALE; int noteOffset = 0; if(mod > 0){ switch(mod){ case 6: noteOffset += steps[1]; case 5: noteOffset += steps[2]; case 4...
7
public static void insertLigneCommandeClient(int idarticle,int idcommande,int quantite, Float prixht,Float prixttc,Float remise ) throws SQLException { String query=""; try { query = "INSERT INTO LIGNE_COMMANDE_CLIENT (ID_ARTICLE,ID_COMMANDE,LIGQTE,LIGPXHT,LIGPXTTC,LIGREMISE) VAL...
1
public static void main(String[] args) { Comparable[] arrayChar = {'S','H','E','L','L', 'S', 'O', 'R', 'T', 'E', 'X', 'A', 'M', 'P', 'L', 'E' }; int length = arrayChar.length; int h = 1; while (h < length / 3) { h = h * 3 + 1; System.out.println("top==>"+h); } while (h >= 1) { for (int i = h; ...
5
@Override public boolean okMessage(Environmental host, CMMsg msg) { if(msg.amITarget(this)) { switch(msg.targetMinor()) { case CMMsg.TYP_ACTIVATE: if(!checkActivate(msg.source(),msg.targetMessage())) return false; break; case CMMsg.TYP_DEACTIVATE: if(!checkDeactivate(msg.source(),msg....
9
public final ActionListener createButtonListener(final ToolButtons toolButton) throws IllegalArgumentException { switch (toolButton) { case MINUS: return new MinusButtonListener(); case PLUS: return new PlusButtonListener(); case RESET: return new ResetButtonListener(); case START: ret...
8
private void knightTopTopLeftPossibleMove(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if((x1 >= 1 && y1 >= 0) && (x1 < maxWidth && y1 <= 5)) { if(board.getChessBoardSquare(x1-1, y1+2).getPiece().getPieceType() != board.getBlankPiece().getPieceType...
6
public NewPaperDocumentDialog(final Domaine domaine) { setResizable(false); setTitle("Choisir un fichier papier"); setModalityType(ModalityType.APPLICATION_MODAL); setBounds(100, 100, 450, 280); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContent...
2
public ResultSet executeQuery(String sql) { ResultSet rs = null; closeConnections(); try { Class.forName(MYSQL_DRIVER); String connectionString = String.format("%s?user=%s&password=%s",MYSQL_URL + database, databaseUser, databasePassword); //String c...
3
public void placecards() { if((display[0] < Client.mo.playedcards[0] && display[1] == Client.mo.playedcards[1] || Client.mo.playedcards[0] == 0) && display[1] != 0){ int[] check = new int[13]; System.arraycopy(newhand, 0, check, 0,13); Client.mo.users.get(myRank).setHand(check); Client.mo.users.get(myRank...
4
public void loadUserData (String fileName) { try { JsonReader reader = new JsonReader(new FileReader(fileName)); JsonParser parser = new JsonParser(); JsonArray array = parser.parse(reader).getAsJsonArray(); for (JsonElement elem : array) { UserData info = gson.fromJson(elem, UserData.class); Use...
2
private static boolean dfs(Node2 currentNode, Node2 end) { currentNode.setSearched(true); if (currentNode.equals(end)) { path.add(currentNode); return true; } else { if (currentNode.getChildren() != null) { for (Node2 child : currentNode.getChildren()) { if (!child.isSearched()) { if (dfs(...
5
private static double power(double x, double y) { double value; if (y < INFINITESIMAL && y > -INFINITESIMAL) { value = 1.0; } else if (y - 0.5 < INFINITESIMAL && y - 0.5 > -INFINITESIMAL) { value = Math.sqrt(x); } else if (y - 1.0 < INFINITESIMAL && y - 1.0 > -INFINITESIMAL) { value = x; } else...
8
public Artist convertArtist(JsonObject artistObj){ if(artistObj.get("artist") != null){ JsonObject artist = artistObj.get("artist").getAsJsonObject(); ArrayList<String> similarArtistsURL = new ArrayList<String>(); ArrayList<String> tagsArray = new ArrayList<String>(); String name = artist.get("name").ge...
8
private boolean check(int pN){ boolean val = true; int[] a = toSortedIntArray(pN, false); if (a != null) { for ( int i = 2; i < 7 && val; i++) { int[] b = toSortedIntArray(pN*i, true); if (!Arrays.equals(a, b) ) val = false; } } else { val = false; } return val; }
4
public static Map<String, String> parseParams(String s) { if (s == null || s.length() == 0) return Collections.emptyMap(); Map<String, String> params = new LinkedHashMap<String, String>(8); Scanner sc = new Scanner(s).useDelimiter("&"); while (sc.hasNext()) { Stri...
7
public static boolean isEnglish(String str) { for (char c : str.toCharArray()) { if (!CharUtils.isEnglishLetter(c)) { return false; } } return true; }
2
public List<Palaute> haePalautteet() throws DAOPoikkeus { //avataan yhteys Connection yhteys = avaaYhteys(); ArrayList<Palaute> palautteet = new ArrayList<Palaute>(); try { // Haetaan palautteet tietokannasta String sql = "SELECT palauteID, kategoria, tilausID, nimi, sahkoposti, pvm,...
2
@Override public void body() { AGRSpace agrs = (AGRSpace) ((IExternalAccess) getScope().getParent()).getExtension("mundo").get(this); Group group = agrs.getGroup("agents"); IComponentIdentifier[] drivers = group.getAgentsForRole("Driver"); IComponentIdentifier[] drivers2 = group.g...
8
protected Implementor getImplementor() { return implementor; }
0
@Override public void startElement ( String uri, String localName, String qName, Attributes attr ) throws SAXException { String tag; if ( !qName.equals( "" ) ) { tag = qName; } else { tag = localName; } if ( tag.equals( Constants.xmlMenuStart ) ) { fValidFile = true; } // set to fa...
8
public void bfs(String label, Function<Vertex, Vertex> action) { int index = getVertexIndex(label); if (vertices[index].wasVisited() == false) { vertices[index].setVisited(true); action.apply(vertices[index]); } for (int cols = 0; cols < COLS; cols++) { if (graph[index][cols] == 1 && vertices[cols...
5
public static Collection<Watcher> getRegisteredWatchers() { return registeredWatchers.values(); }
0
public void setPoints(int points) { if(0 <= points && points <= 11) { this.points = points; this.repaint(); } else { throw new IllegalArgumentException("invalid points value"); } }
2
@Override public void destroy() { System.out.println("SHS Servlet: destroy()"); }
0
public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) { HashMap<Integer,char[]> m = new HashMap<Integer, char[]>(); m.put(2, new char[] {'a', 'b', 'c'}); // Note: The Solution object is instantiated only once and is reused by each test case. ...
8
public boolean equals(Object obj) { if (!(obj instanceof EllipseObject) || !super.equals(obj)) return false; EllipseObject that = (EllipseObject) obj; return this.topLeft.equals(that.topLeft) && this.width == that.width && this.height == that.height; }
4
public void setCustomParameters(String... customParameters) { StringBuilder data = new StringBuilder(); try{ for (int i = 0; i < customParameters.length; ++i) { data.append('&').append(customParameters[i]); if (++i < customParameters.length) data.append('=').append(URLEncoder.encode(customParameters...
3
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...
3
public float getMeasureFromKeysChars(String[] state, List<String> attributes, String measure){ float res = -1; String keys = ""; for(int i = 0; attributes.size() > i; i++){ if(state[i].equals("#")){ continue; } keys = keys + at...
9
@Override //FIXME make lombok work with unit tests on eclipse and use it instead! public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Location other = (Location) obj; if (x != other.x) return false; if ...
5