text
stringlengths
14
410k
label
int32
0
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final DateTime other = (DateTime) obj; if (date == null) { if (other.date...
9
private void submitContactForm() { driver.findElement(By.name("submit")).click(); }
0
public Shape createStrokedShape(Shape shape) { GeneralPath result = new GeneralPath(); PathIterator it = new FlatteningPathIterator(shape.getPathIterator(null), FLATNESS); float points[] = new float[6]; float moveX = 0, moveY = 0; float lastX = 0, lastY = 0; ...
8
public VectorProxy(Object obj) { this.Proxyobject = obj; }
0
private static void resetLocalPRNG() { if (DEBUG && debuglevel > 8) debug(">>> resetLocalPRNG()"); HashMap attributes = new HashMap(); attributes.put(ICMGenerator.CIPHER, Registry.AES_CIPHER); byte[] key = new byte[128 / 8]; // AES default key size Random rand = new Random(System.currentTi...
6
@Override public void execute(Object parent) { mxGraphView view = graph.getView(); mxIGraphModel model = graph.getModel(); // Gets all vertices and edges inside the parent List<Object> edges = new ArrayList<Object>(); List<Object> vertices = new ArrayList<Object>(); int childCount = model.getChildCount(p...
4
@EventHandler(priority = EventPriority.MONITOR) public void onClick(InventoryClickEvent event) { if(event.getWhoClicked() instanceof Player == false) return; int slot = event.getView().convertSlot(event.getRawSlot()); if(slot == 8 && event.getInventory().getType() != InventoryType.PLAYER...
4
@ManyToOne @JsonIgnore private Event getEvent1() { return event; }
0
public void connectToDatabase() throws Exception { if (m_Debug) { System.err.println("Connecting to " + m_DatabaseURL); } if (m_Connection == null) { if (m_userName.equals("")) { try { m_Connection = DriverManager.getConnection(m_DatabaseURL); } catch (java.sql.SQLException e) { // T...
9
public void initReader(Class<? extends SyntaxGraphReader> syntaxGraphReader, String inputFile, String inputCharSet, String readerOptions, int iterations) throws MaltChainedException { try { final URLFinder f = new URLFinder(); reader = syntaxGraphReader.newInstance(); if (inputFile == null || inputFile.lengt...
7
public void backToMenu() { int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?"); if(reply == JOptionPane.YES_OPTION) { timer.stop(); reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?"); if(reply == JOptionPane.YES_...
6
static final void method3534(boolean bool, int i, int i_5_, boolean bool_6_, int i_7_, Widget[] class46s) { anInt7279++; if (bool == false) { for (int i_8_ = 0; (class46s.length ^ 0xffffffff) < (i_8_ ^ 0xffffffff); i_8_++) { Widget class46 = class46s[i_8_]; if (class46 != null && i == ((Widge...
9
private static short mag2gray(long mag) { short intensity = (short) (30.0 * Math.log(1.0 + (double) mag) - 256.0); // Make sure the returned intensity is in the range 0...255, regardless // of // the input value. if (intensity < 0) { intensity = 0; } else if (intensity > 255) { intensity = 255; } ...
2
public boolean renderBlockRepeater(Block par1Block, int par2, int par3, int par4) { int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); int var6 = var5 & 3; int var7 = (var5 & 12) >> 2; this.renderStandardBlock(par1Block, par2, par3, par4); Tessellator var8 = Tess...
7
private void playRound() throws BadInput, AntiAircraftGun.BadCoordinate, GameEnd { for (int d=0; d<3; d++) { System.out.format("Enter a coordinate %s: ", "XYZ".charAt(d)); target_coords[d] = IOGeneric.getInteger(); } Result r = gun.fire(target_coords[0], target_c...
2
public void setPhrases() { List<TermPos> temp = new ArrayList<TermPos>(); int i = 0; int size = this.terms.size(); while (i < size) { PhraseType p; while (i < size && ((p = getType(i)) != PhraseType.OTHER)) { if (p == PhraseType.NOUN) { temp.add(new TermPos(terms.get(i), posTags.get(i), "BNP")); ...
7
public int get(int symbol) { if (symbol < 0 || symbol >= numSymbols) throw new IllegalArgumentException("Symbol out of range"); return 1; }
2
public static void updateEvents (EventsBean event){ PreparedStatement pst = null; Connection conn=null; boolean result = false; try { conn=ConnectionPool.getConnectionFromPool(); pst = conn .prepareStatement("UPDATE EVENTS SET NAME=?, DESCRIPTION=?, EVENT_DATE=?, VENUE=?, TOTAL_SEATS=?, BOOKED_...
4
public void InsertaFinal(int ElemInser) { if ( VaciaLista()) { PrimerNodo = new NodosProcesos (ElemInser); PrimerNodo.siguiente = PrimerNodo; } else { NodosProcesos Aux = PrimerNodo; while (Aux.siguiente != PrimerNodo) Aux = Aux.siguiente; NodosProcesos Nuevo=new NodosProces...
2
public static List<String> anagrams(String[] strs) { List<String> res = new ArrayList<String>(); Map<String, Integer> anamap = new HashMap<String, Integer>(); for (int i = 0; i < strs.length; i++) { char[] c = strs[i].toCharArray(); Arrays.sort(c); String str = String....
3
public Map<Player, Player> Commands_tp(Map<Player, Player> Map) { tpMap = Map; if (args.length == 1) { Player p1 = plugin.getServer().getPlayer(args[0]); if (p1 == null) { player.sendMessage(ChatColor.RED + args[0] + " n'est pas en ligne actuellement."); ...
9
public Map<Integer,Integer> sssp(Node source, Graph g){ int sID=source.id; Map<Integer,Integer> nextNodeInPath = new HashMap<Integer,Integer>(); double[] dist = new double[g.numNodes]; List<NodeIDDistPair> pairs = new ArrayList<NodeIDDistPair>(1); PriorityQueue<NodeIDDistPair> distances= new PriorityQueue<...
7
private void compareVersions(){ // update GUI and modsArray based on new information from user update.setIcon(mcmods); int temp = webReader.readFileFromServer(onlineLocation.getText()); if(temp == -1){ //error getting file details.setText("ERROR CONNECTING TO SERVER"); notice.showNotice("ERROR", "COULD N...
4
public static void copyTo(Object source, File output) throws IllegalArgumentException, IOException { InputStream in = getInputStream(source); FileOutputStream fos = new FileOutputStream(output); byte [] buf = new byte[1024]; int len; while((len = in.read(buf)) > 0) { ...
1
@Test public void testIsHoliday() { System.out.println("isHoliday"); GregorianCalendar date = new GregorianCalendar(2000, 0, 1); for (int i = 0; i < 10000; i++) { Holiday<GregorianCalendar> instance = this._mayNinth2k; boolean expResult = date.get(GregorianCalendar.YE...
7
protected void doPadding(byte[] output, int outputOffset) { int ptr = flush(); int bitLen = ptr << 3; long th = t1; long tl = t0 + bitLen; tmpBuf[ptr] = (byte)0x80; if (ptr == 0) { t0 = 0xFFFFFFFFFFFFFC00L; t1 = 0xFFFFFFFFFFFFFFFFL; } else if (t0 == 0) { t0 = (int)0xFFFFFFFFFFFFFC00L + bitLen; ...
9
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 void update(Observable arg0, Object arg1) { // TODO Auto-generated method stub // state determines who (tweetzAnalysis.TweetsProvider or tweetzAnalysis.Timer-Thread) invoked that // method int state; MySqlAccess.connectToDatabase(); state = (Integer) arg1; ...
9
boolean subtractResourcesForWeaponUpgrade(String weapon, int currentLevel){ int resourcesToSubtract = 4; if(currentLevel == 2) resourcesToSubtract = 5; if(currentLevel == 3){ Debug.warn(username + " tried to upgrade his " + weapon + ", but it is already level 3."); return false; } if(weapon.equ...
8
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, ...
8
public static int translate(int unicode) { if ((unicode >= 0x20 && unicode <= 0x7e) || (unicode >= 0xa0 && unicode <= 0xff)) return unicode; int min = 0; int max = table.length - 1; int mid; while (max >= min) { mid = (min + max) / 2; if (table[mid][1] < unicode) ...
7
public long sumPrimesBelow(int num) { long sum = 2l; // Make sum a long - integer limit is ~2 billion, not enough for (int i = 3; i < num; i++) { if (isPrime(i)) { sum += (long) i; } } return sum; }
2
public 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://download.or...
6
public static void setRace(String race) { race = race.trim(); if (race.compareToIgnoreCase("Meck.-Vorp.") == 0) { setRaceSecondary("Mecklenburg-Vorpommern"); } else if (race.compareToIgnoreCase("Bad.Württ.") == 0) { setRaceSecondary("Baden-Württemberg"); } else if (race.compareToIgnoreCase("Rheinl-Pfalz...
6
public void renderParticles(int xPos, int yPos, Sprite p) { xPos -= cameraXCoord; yPos -= cameraYCoord; for(int y = 0; y < p.getSizeY(); y++) { int yAbs = y + yPos; for(int x = 0; x < p.getSizeX(); x++) { int xAbs = x + xPos; if(xAbs < 0 || xAbs > width - 1 || yAbs < 0 || yAbs > height - 1) break; ...
7
final void renumber(final Map<Integer, Integer> indexMap, final Map<Integer, String> numberMap, final Map<Integer, Boolean> mapOpt) { if ((indexMap == null) || (numberMap == null)) { this.idxMap = null; this.numMap = null; return; } this.idxMap = indexMap; this.numMap = numberMap; this.total.cl...
4
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession mensaje = request.getSession(true); PrintWriter out = response.getWriter(); //Declaro variables boolean esVillano...
7
private boolean hasVisitedNeighbours(Point p){ int c = 0; if (this.maze[p.x - 1][p.y] == false) {c++;} if (this.maze[p.x + 1][p.y] == false) {c++;} if (this.maze[p.x][p.y - 1] == false) {c++;} if (this.maze[p.x][p.y + 1] == false) {c++;} return c > 1; }
4
public static void main(String[] args) { System.out.println("Mettbällchen!"); System.out.println("CWD: " + System.getProperty("user.dir")); System.out.println(); BlueprintList BPL = new BlueprintList(); BPL.LoadData(); System.out.println("Loading completed"); Syst...
0
@Override public Cell<V> cell(int row, int column) { if (exists(row, column)) { for (Cell<V> cell : cells()) { if (cell.getRow() == row && cell.getColumn() == column) { return cell; } } } return null; }
4
public synchronized void ValidarChoque() { int y = jFlappy.getLocation().y; if (y == 448) { if (Sonido.terminochoque) { Sonido.choque(); } GamerOver gamerover = new GamerOver(this, true); try { Thread hilo = new Thread() { ...
3
public String toString() { String result = ""; /* for (int y= ySize-1; y>=0; y--) { for(int x = 0; x<xSize; x++) {*/ for (int y= ySize; y>0; y--) { for(int x = 0; x<=xSize; x++) { result += squareContentSprite(x,y); } result+="\n"; ...
2
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
9
public ArrayList<Booking> getBooking(int cabin_id) { ArrayList<Booking> ab = new ArrayList<Booking>(); ResultSet rs = null; try{ statement = connection.createStatement(); String sql = "select * from bookings where cabin_id = " + cabin_id + " order by date_from asc"; rs = statement.executeQuery(sql); w...
6
public void lookAt(String object, ArrayList<String> inv) { if (object.equalsIgnoreCase("floor")) { System.out.println("It is a cold and hard stone floor.\n"); } else if (object.equalsIgnoreCase("wall") || object.equalsIgnoreCase("walls")) { System.out.println("The walls are made ...
7
private void readLoop() throws IOException { String s; do { System.out.print("[DCnet] $ "); s = br.readLine(); if(s == null) return; controller.handle(new ArgSet(s)); } while(!stopped); }
2
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((components == null) ? 0 : components.hashCode()); return result; }
1
public List findByExample(Problem instance) { log.debug("finding Problem instance by example"); try { List results = getSession().createCriteria( "com.oj.hibernate.daoNdo.Problem").add( Example.create(instance)).list(); log.debug("find by example successful, result size: " + results.size()); ...
1
public void leeArchivo() throws IOException{ BufferedReader fileIn; System.out.println("Entra leerArchivo"); try{ fileIn = new BufferedReader(new FileReader(nombreArchivo)); } catch (FileNotFoundException e){ File puntos = new File(nombreArchivo); PrintWriter fileOut = new Print...
4
public void fitToBounds(int padding) { Rectangle viewBounds = getVisibleRect(); Rectangle automatonBounds; if(drawer != null && drawer.getBounds() != null) automatonBounds = new Rectangle(drawer.getBounds()); else automatonBounds = new Rectangle(0, 0); automatonBounds.grow(padding, padding);...
3
public void visit( int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, remapper.mapType(name), remapper.map...
1
@Override public ValueType returnedType(ValueType... types) throws Exception { // Check the number of argument if (types.length == 1) { // if array if (types[0] == ValueType.NONE) { return ValueType.NONE; } // If numerical if (types[0].isNumeric()) { return ValueType.DOUBLE; } // if ...
4
public int getAlstromeria() { return alstromeria; }
0
public Form getConfirmationPage() { submit = new PCommand("Submit", PCommand.SCREEN, PCommand.TRAFFIC_MENU_SUBMIT_DETAILS, 2); Form confirmationPage = new Form("Confirm details"); if (capturedImage != null) { confirmationPage.append(createThumbnail(capturedImage)); } ...
1
public int compareTo(Datum other) { if(this.godina == other.godina) { if(this.mjesec == other.mjesec) { if(this.dan == other.dan) { return 0; } else if(this.dan > other.dan) return 1; else return -1; } if(this.mjesec == other.mjesec) { return 0; } else if(this....
7
static void printTreeRecursive(Tree tree, String indent) { TreeNode root = tree.getRoot(); Object rootDatum = root.getDatum(); System.out.println(indent + rootDatum); List children = root.getChildren(); for (Iterator iter = children.iterator(); iter.hasNext(); ) { Tree nextTree = ...
1
@Override public long[] run(String query) { FUNCTION_NAME = "SGM"; query = query.toUpperCase(); boolean state = true; SQLParser parser = new SQLParser(); state &= parser.parse(query + ".txt"); // file name wrieteGlobalInfoToHDFS(parser); long[] time = new long[4]; Long startTime = new Date().getTime();...
5
public void eliminarMaterialImproprioCompartilhado(Artigo art) { String palavra = " RR "; List<Artigo> artigosRemover = new LinkedList<Artigo>(); for (int i = 0; i < artigo.size(); i++) { if ((artigo.get(i).getResumo().contains(palavra) || artigo.get(i) .getResumo().equals("RR")) || (artigo.get(i).g...
8
private long handleRequestNotifications(String authType, String controller, String id, String passcode) { long timestamp = System.currentTimeMillis(); String accessPoint = findAssociation(controller).accessPoint.id; NotificationToken token; if (id != null && passcode != null) { token = new NotificationToken(...
6
public boolean isInLambdaSet(String variable, Set lambdaSet) { return lambdaSet.contains(variable); }
0
private void discover(){ if(currentState == STATE_DISCOVER || currentState == STATE_DEFEND || currentState == STATE_FOLLOW || currentState == STATE_GATHER || currentState == STATE_SEARCH){ //We are not doing anything else to superscede a normal discover operation. normalDiscover(); }else if(c...
7
private static String replaceMultipleCharactersInString(String original_str, int index, char replace_value) { StringBuilder myString = new StringBuilder(); for(int i = 0; i < original_str.length(); i++) { myString = (i % index == 0) ? myString.append(replace_value) : m...
2
public int print(Graphics _g, PageFormat pf, int pageIndex) throws PrinterException { if (pageIndex != 0) return Printable.NO_SUCH_PAGE; MapDraw mapDraw = new MapDraw(); mapDraw.setMain(main); mapDraw.setShowRover(main.showRover); mapDraw.setShowRoverPath(t...
8
@Override public void mousePressed(MouseEvent e) { JButton pressedButton = (JButton) e.getSource(); System.out.println("Click"); if(pressedButton == newGame) gameStart = true; else if(pressedButton == editor) editorStart = true; else if(pressedButton == quit) close = true; ...
3
@Override public void cleanUp() { // Call the clean up of all our items, so that GC can come visit. Then // clear our list of items for (IHudItem item : hudItemQueue) { item.cleanUp(); } hudItemQueue.clear(); }
1
public void redrawAction(){ Graphics g = getGraphics(); ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); for(int i = 0; i < pktList.size(); i++){ PointPacket pkt = pktList.get(i); if(pkt.get_drawType() != DrawType.ERASE) { g.setColor(pkt.get_colour(...
3
public boolean verifyDeadEnd() { int deadCount = 0; if(this.checkerObject.getUp()==0) { deadCount++; } if(this.checkerObject.getLeft()==0) { deadCount++; } if(this.checkerObject.getDown()==0) { deadCount++; } if(this.che...
5
@Override public TicketPoolQueryArgs toTicketPoolQueryArgs(TicketQueryArgs args) throws Exception { TicketPoolQueryArgs rs = new TicketPoolQueryArgs(); rs.setDepartureStop(this.getStationSequence(args.getDepartureStation())); rs.setDestinationStop(this.getStationSequence(args.getDestinationStation())); i...
1
private static synchronized Map<Class<? extends Object>, List<String>> initConfig(String path) throws NoConfigException { Map<Class<? extends Object>, List<String>> ret = configs.get(path); if (null != ret) return ret; ret = new HashMap<>(); Properties props = new Properties(); try { ...
5
public Matrix add(Matrix m) { if(numRows != m.numRows || numColumns != m.numColumns) throw new IllegalArgumentException("Incompatible dimensions"); Matrix sum = new Matrix(numRows, numColumns); for(int i = 0; i < numRows; i++) for(int j = 0; j < numColumns; j++) sum.elements[i][j] = elements[i][j] + ...
4
public void processResourceUpdate(UpdateResource ur) { if (ur != null) { if (resources.containsKey(ur.id)) { Resource resource = resources.get(ur.id); if (resource != null) { EIError.debugMsg(ur.id + " (" + ur.action + ")"); if ...
4
public int[][] getGrayLevels() { if (image == null) return new int[0][0]; int[][] grayLevels = new int[getHeight()][getWidth()]; for (int i = 0; i < grayLevels.length; i++) for (int j = 0; j < grayLevels[i].length; j++) { int rgb = image.getRGB(...
3
@Override public String toString() { String output = "Edge [Nodes="; for (Node n : adjacentNodes) { output = output + n.getCoordinates(); } output = output + ", " + edgeState + "]"; return output; ...
1
public void visit_astore(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
1
protected Object resolveContainerStore(String key) { Object value = getProperty(key); if (value != null) { if (value instanceof Collection) { Collection collection = (Collection)value; value = collection.isEmpty() ? null : collection.it...
5
public void updateFeedback(){ ImageIcon icon; String tekst; //tekst en icon bepalen if((spel.isVijandGeraakt() || spel.isZelfGeraakt()) && !spel.isSpelBezig()){ icon = new ImageIcon(Constanten.ICOON_SKULL.getImage()); String naamWinnaar = ""; try{ ...
7
Parser(String uri) { try { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); ConfigHandler handler = new ConfigHandler(); parser.getXMLReader().setFeature( "http://xml.org/sax/features/validation", true); ...
3
void findPossibleMoves(Vector<Move> lMoves) { lMoves.clear(); if (mLastMove.isEOG()) { return; } // End if if (mMovesUntilDraw <= 0) { lMoves.add(new Move(Move.MoveType.MOVE_DRAW)); return; } // End if // Normal moves are forbidden if any jump is found ...
9
@EventHandler public void EndermanMiningFatigue(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.getEndermanConfig().getDouble("Ende...
6
public void setDay(int d) { if (d < 1) { d = 1; } Calendar tmpCalendar = (Calendar) calendar.clone(); tmpCalendar.set(Calendar.DAY_OF_MONTH, 1); tmpCalendar.add(Calendar.MONTH, 1); tmpCalendar.add(Calendar.DATE, -1); int maxDaysInMonth = tmpCalendar.g...
6
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); Edmons_karp f; int nNet = 1; while ((line = in.readLine()) != null) { int nNodes = Integer.parseInt(line.trim())...
4
public void play(Sequence sequence, boolean loop) { if (sequencer != null && sequence != null && sequencer.isOpen()) { try { sequencer.setSequence(sequence); sequencer.start(); this.loop = loop; } catch (InvalidMidiDataException...
4
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String[] words = value.toString().split("\\,"); if (key.get() != 0) { for (int i = 2; i < 11; i++) { context.write(new Text(headers[i]), new Text(words[i])); } } }
2
public boolean insert(Integer data){ if(root == null) root = new Node(data); Node n = root; while(true){ if(data == n.data) return false;//already there else if(data > n.data){ if(n.right != null) n = n.right; else { n.right = new Node(data); return true; } } else { if(n.left...
6
int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) { int[] var3 = new int[] {0, 0, 0}; byte var4 = 0; byte var5; for (var5 = 0; var4 < 3; ++var4) { var3[var4] = par2ArrayOfInteger[var4] - par1ArrayOfInteger[var4]; if (Math.abs(var...
8
void createVarTypes(int ins, int outs) { assert ins > 0 && outs > 0; inVarTypes = new Class[ins]; outVarTypes = new Class[outs]; for (int i = 0; i < ins; i++) { inVarTypes[i] = parameterTypes[INPUT_FIX_PARAMETERS + i]; } int offset = INPUT_FIX_PARAMETERS + ins + op...
3
private void updateStats(Message msg, short direction) { int length; HashMap map; boolean mcast; Address dest, src; if(msg == null) return; length=msg.getLength(); dest=msg.getDest(); src=msg.getSrc(); mcast=dest == null; if(direction...
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please, input arithmetic expression: "); String equation = in.nextLine(); int counter = 0; int place = 0; for (int i = 0; i < equation.length(); i++) { if (equation.charAt(i) == '(') { counter++; } el...
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } Image other = (Image) obj; if (source == n...
9
public Rules() { String[] pictures = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "jack", "queen", "king", "ace"}; String[] types = {"clubs", "spades", "hearts", "diamonds"}; for (String picture : pictures) { validPictures.add(picture); } for (String pi...
2
@Override public boolean equals(Object _pair) { if(_pair instanceof Pair){ Pair<?> pair = (Pair<?>) _pair; if(this.first().equals(pair.first()) == false) return false; if(this.second() == null & pair.second() == null){ return true; } if(this.second() == null ^ pair.second() == null){ re...
7
public PortfolioTotalStatus[] getPortfolioTotalStatus() { Portfolio portfolio = getPortfolio(); Map<Date, Float> map = new HashMap<>(); // get stock status from db. Stock[] stocks = portfolio.getStocks(); for (int i = 0; i < stocks.length; i++) { Stock stock = stocks[i]; if (stock != null) { List...
5
public static int findPreviousPrimeNumber(int number) { int previous = 0; int next = 0; for (int i = 0; i < 10; i++) { previous = i; next = i + 1; if (PRIME_NUMBERS[0] == number) break; if (PRIME_NUMBERS[previous] == number) previous--; if (PRIME_NUMBERS[next] == number) next++; ...
7
public VistaVentanaCliente(ControladorCliente c) { controlador = c; this.setTitle("Modo Cliente"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); ...
1
public void run(){ this.partida.reset(); String opcion = ""; while(!opcion.equalsIgnoreCase("SALIR") && !this.partida.terminada()){ System.out.println(this.partida.toString()); System.out.println("Que quieres hacer? "); opcion = this.in.next(); if(opcion.equalsIgnoreCase("PONER")){ System.out.prin...
9
@Override public void paint(Graphics2D graphics) { if (objectTron != null) { renderEmptyGrid(graphics); renderBeginPositions(graphics); renderGrid(graphics); renderCurrentPlayerInfo(graphics); } }
1
public Object getValueAt(int rowIndex, int columnIndex) { PaidVo paidVo = paidVoList.get(rowIndex); switch (columnIndex) { case 0: return paidVo.getName(); case 1: return paidVo.getFruitName(); case 2: return paidVo.getC...
6
private void deleteObject(Tile temp) { if (temp.getObject() != null) { boolean road = false; if (temp.getObject() instanceof Road) { road = true; } mapObjects.remove(temp.getObject()); Point start = new Point (temp.getObject().getStartPos().x, temp.getObject().getStartPos().y); Point end =...
9
public Player getPlayer(int index){ if (index!=PLAYER_ID_P1 && index!=PLAYER_ID_P2) return null; return players[index]; }
2
public void clearSocket(Object index){ Client client = this.localClients.remove(index);// 从本地连接中清除 if(client != null){ return; } client = this.clustersClients.remove(index);// 从集群连接中清除 if(client != null){ return; } client = this.clients.remove(index);// 从客户端连接中清除 if(client != null){ ret...
3