text
stringlengths
14
410k
label
int32
0
9
public PooledThread() { super(ThreadPool.this, "PooledThread-" + (threadID++)); }
0
public AbstractInsnNode clone(final Map labels) { FrameNode clone = new FrameNode(); clone.type = type; if (local != null) { clone.local = new ArrayList(); for (int i = 0; i < local.size(); ++i) { Object l = local.get(i); if (l instanceof LabelNode) { l = labels.get(l); } clone.local.ad...
6
private void computeArcSlots(Digraph<SugiyamaNode<V>,SugiyamaArc<V,E>> graph) { List<SugiyamaArc<V,E>> arcs = new ArrayList<SugiyamaArc<V,E>>(graph.getEdgeCount()); // collect arcs for (SugiyamaNode<V> source : graph.vertices()) { for (SugiyamaNode<V> target : graph.targets(source)) { arcs.add(graph.get(s...
7
public void step() { parentFrame.getWorld().step(); parentFrame.repaint(); if (++numStepsSoFar == numStepsToRun) stop(); Grid<T> gr = parentFrame.getWorld().getGrid(); for (Location loc : gr.getOccupiedLocations()) addOccupant(gr.get(loc)); }
2
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 main(String[] args){ int[] fac = new int[10]; for (int i=0;i<10;i++) fac[i] = factorial(i); int sum=0; for(int i=10;i<2e7;i++){ if (i == facSum(i, fac)) sum+=i; } System.out.println(sum); }
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((assentos == null) ? 0 : assentos.hashCode()); result = prime * result + ((horarioChegada == null) ? 0 : horarioChegada.hashCode()); result = prime * result + ((horarioSaida == null) ? 0 : horarioSa...
8
@Override public void gotoDetail(GoodsStatus gs, String goodUrl) { Document doc = null; try { doc = Jsoup.connect(goodUrl).timeout(0).get(); } catch (IOException e) { logger.error(e.getMessage(), e); gs.setStatus(GoodsStatus.NOT_FOUND); gs.setResult(GoodsStatus.SEARCH_EXCEPTION); return; } Ele...
7
public static AbstractCommand createCommand(TimeBan plugin, String cmd) { AbstractCommand result = new NullCommand(plugin); TimeBanCommands command; try { command = TimeBanCommands.valueOf(cmd.toUpperCase()); } catch (IllegalArgumentException e) { return result; ...
9
public void run() { T current; while (!isInterrupted()) { /* select next thread */ current = queue.getNext(); if ((current != null) && (current.isAlive())) { /* Print Log */ reportThreadState(); current.setPriority(Thread.MAX_PRIORITY); System.err.println("**...
3
public static byte[] decrypt(byte[] encoded_message) throws Exception { if (encoded_message[0] == (byte) 0x02) { int padding; for (padding = 1; encoded_message[padding] != (byte) 0x00; padding++) ; byte[] decoded_message = new byte[encoded_message.length - 1 - padding]; ...
2
public String GetNextString(){ if (text.length() == 0) return null; int nextSeperator = text.indexOf("|"); if (nextSeperator == -1) return null; String currentString = text.substring(0, nextSeperator); text = text.substring(nextSeperator+1); if (currentString.startsWith("\n")) currentString = currentS...
4
public static void run() { final String dir = "E:\\DropBox\\DEV\\AdCleaner\\adcleaner\\~\\.adcelaner\\screens\\"; ImageSimilarityComparer comparer = new ImageSimilarityComparer(); ArrayList<File> files = new ArrayList<File>() {{ add(new File(dir + "video1_10.png")); add...
5
public static TestcaseFactory getInstance() { if (instance == null) { instance = new TestcaseFactory(); } return instance; }
1
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(commandLabel.equalsIgnoreCase("smite")) { Player target = (Bukkit.getServer().getPlayer(args[0])); if (target == null) { sender.sendMessage(args...
3
public void setTileDamage(){ for(int xx=0;xx<SIZE;xx++){ for(int yy=0;yy<SIZE;yy++){ switch(world[xx][yy]){ case STONE: worldDamage[xx][yy]=10; break; case WOOD: worldDamag...
9
public void confirmClicked(boolean par1, int par2) { if (this.deleteClicked) { this.deleteClicked = false; if (par1) { this.serverList.remove(par2); this.saveServerList(); } this.mc.displayGuiScreen(this); ...
8
public MinimapPanel(Coord c, Coord sz, Widget parent) { super(c, sz, parent, "Minimap"); mrgn = Coord.z; fbtn.visible = true; cbtn.visible = false; { vcl = new IButton(new Coord(0, -2), this, Resource.loadimg("gfx/hud/slen/dispauth"), Resource.loadimg("gfx/hud/slen/dispauthd")) { private boolean v = false; ...
2
public synchronized int getSharedCounter() { return sharedCounter; }
0
public boolean canTeach(Field aField, Group aGroup) { //System.out.println("Teacher.canTeach() : " + this + " " + aField + " " + aGroup + " " + this.maxWeekWorkedHours.substract(this.currentWeekWorkedHours) + " " + aGroup.classes.get(aField)); boolean res = false; if (aGroup.getClasses().get(aField).add(t...
3
public static void main(String... args) { String makefileName; String fileInfoName; if (args.length == 0) { usage(); } makefileName = "Makefile"; fileInfoName = "fileinfo"; int a; for (a = 0; a < args.length; a += 1) { if (args[a...
8
@Override protected void Work(double time_sec) { if (IsAlive()) { LifeCalc(time_sec); if (thirst > 0) { if(target==null) target = GetNearestObjectByMat(Enums.GMaterials.Woter); if (target instanceof LandO...
5
public boolean superClassOf(ClassInfo son) { while (son != this && son != null) { son = son.getSuperclass(); } return son == this; }
2
public static void removebAndacFromStrinInplace(char[] str) { int i = -1, j = 0; int len = str.length; while(j < len) { if(j < len-1 && str[j] == 'a' && str[j+1] == 'c') { j += 2; } else if(str[j] == 'b') { j++; } else if(i >= 0 && str[i] == 'a' && str[j] == 'c') { i--; j++; } else { ...
9
public void coeff(double[][] dct_coef, int n) { double sqrt_1 = 1.0 / Math.sqrt(2.0); for (int i = 0; i < n; i++) { dct_coef[0][i] = sqrt_1; } //Initialize coefficient for (int i = 1; i < n; i++) { for (int j = 0; j < n; j++) { dct_coef[i][j] = this.a* Math.cos(i * Math.PI * (j + 0.5) / ((double) n...
3
public boolean doTransformations() { if (instr == null) return false; /* * Do on the fly access$ transformation, since some further operations * need this. */ if (instr instanceof InvokeOperator) { Expression expr = ((InvokeOperator) instr).simplifyAccess(); if (expr != null) instr = expr; ...
9
public SQLManager(String context) { try { Context initCtx = new InitialContext(); Object obj = initCtx.lookup(context); ds = (DataSource)obj; if (ds == null) throw new Exception("PAWS-Core: Failure to Create Datasource"); } catch(SQLException ex) { while (ex != null) { System.ou...
5
public static Object escape(Object original) { if (original instanceof Character) { char u = (char) ((Character) original); int idx = "\b\t\n\f\r\"\'\\".indexOf(u); if (idx >= 0) return "\\" + "btnfr\"\'\\".charAt(idx); if (u < 32) return "\\" + Integer.toOctalString(u); if (u > 126) return...
8
public String getIpAddr(HttpServletRequest request) { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request....
9
public void handleLine(List<String> line) throws Exception { if (line.size() == 0) return; if (_trimValues) { for (int i = 0; i < line.size(); i++) line.set(i, line.get(i).trim()); } if (!_initialized) { readSchema(line); _initialized = true; } else { readEntity(line); } _line++; i...
6
public void testValues(int id) { ArrayList<Float> stats = new ArrayList<Float>(); long time = System.currentTimeMillis(); for (Entry<Float, float[][]> ent : DB_ARRAY.entrySet()) { float[][] dats = ent.getValue(); for (float[] d : dats) { stats.add(d[id]); } } StatInfo show = new StatInfo(stats, ...
2
private String read_col(char[][] trans_block,int start_pos,int end_pos) { if(start_pos>end_pos) return ""; StringBuilder sb=new StringBuilder(); int row=trans_block.length; int col=trans_block[0].length; assert(end_pos<col); for(int i=1;i<row;i++) { for(int j=start_pos;j<=end_pos;j++) { if(t...
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
4
public CellTest() { }
0
public static List<List<Intersection>> getGroups(Board board, int player) { int boardSize = board.boardSize; int[][] intersections = board.intersections; List<List<Intersection>> groups = new ArrayList<>(); for (int x = 0; x < boardSize; ++x) { for (int y = 0; y < boardSize; ++y) { if (intersections[x][...
6
@Override public Object getValueAt(int row, int column) { switch(column) { case ID : return listRdvAnciens.get(row).getId(); case MEDECIN : return listRdvAnciens.get(row).getMedecin(); case SPECIALISATION : return listRdvAnciens.get(row).getTypeRdv().g...
5
public boolean isOnPF(int marginx,int marginy) { if (!getTileBBox(temp_bbox_copy)) { temp_bbox_copy.x = (int)x; temp_bbox_copy.y = (int)y; temp_bbox_copy.width = 0; temp_bbox_copy.height = 0; } if (!pfwrapx) { if (temp_bbox_copy.x+temp_bbox_copy.width < -marginx) return false; if (temp_bbox_cop...
7
public static List<FreightBean> getFreightBeans(String firstPageHtmlString) { // TODO Auto-generated method stub List<FreightBean> retFreightBeans = new ArrayList<FreightBean>(); try { Parser divParser = new Parser(firstPageHtmlString); NodeList divNodeList = divParser.parse(new HasAttributeFilter("class"...
8
public int setLeadership(String playerName, double leadership) { String SQL = "UPDATE " + tblSkills + " SET " + "`leadership` = ? WHERE `player` LIKE ? ;"; int updateSuccessful = 0; Connection con = getSQLConnection(); PreparedStatement statement = null; try { statement = con.prepareStatement(SQL); s...
4
public void initialise(World world) throws PatternFormatException { String[] cellParts = cells.split(" "); for (int i=0;i<cellParts.length;i++) { char[] currCells = cellParts[i].toCharArray(); for (int j=0;j<currCells.length;j++) { if (currCells[j] != '1' && currCells[j] != '0') ...
5
public static void simpleExpression(Item i, Operation actOperation) { if(i.getSym() == Constants.SEMICOLON) { return; } if(i.getSym() == Constants.PLUS) { actOperation.setOperator(Constants.PLUS); Expression.simpleExpression(Scanner.get(), actOperation); } else if(i.getSym() == Constants.MINUS...
4
public synchronized void update(long elapsedTime) { if (frames.size() > 1) { animTime += elapsedTime; if (animTime >= totalDuration) { animTime = animTime % totalDuration; currFrameIndex = 0; } while (animTime > getFrame(currFrame...
3
private boolean saveAs() { FileDialog saveDialog = new FileDialog(shell, SWT.SAVE); saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"}); saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "}); saveDialog.open(); String name = saveDialog.getFileName(); if(name.equals(""...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DefaultContentRect other = (DefaultContentRect) obj; if (id != other.id) return false; return true; }
4
public void testRandomNumber() { int number = MathUtils.getRandomNumber(0, 10); assertTrue(number >= 0 && number < 10); number = MathUtils.getRandomNumber(0, 1); assertEquals(0, number); number = MathUtils.getRandomNumber(10, 11); assertEquals(10, number); }
1
public String formatWaitTimeLeft(Player p, int hour, int min, int sec){ if(p.hasPermission(DeityNether.OVERRIDE_PERMISSION)){ return cu.format(lang.getString("nether.time.wait.override").replaceAll("%header", getHeader())); }else if(p.hasPermission(DeityNether.GENERAL_PERMISSION)){ String h = ""; String m ...
5
public static SquareTag getName(char tag) { if (mapping == null) { mapping = new HashMap<Character, SquareTag>(); for (SquareTag ut : values()) { mapping.put(ut.tag, ut); } } return mapping.get(tag); }
2
public void options(int option) { switch (option) { case 1: // Getting an order for (;;) { System.out.println(); printAll(); System.out.println("GETTING AN SPECIFIC ORDER\n"); System.out.println("Order id: "); int orderId = input.nextInt(); input.nextLine(); retri...
7
public static GameModel loadFromFile(String filename) throws MapLoaderException { try (Scanner scanner = new Scanner(new File(filename))) { GameField field = parseSquares(scanner); parseBuildings(field, scanner); parseUnits(field, scanner); return new GameModel(field); } catch (IOException e) { ...
1
public static final Vector<Object> loadClassList(final String defaultPath, String requestedPathList, final String subDir, final Class<?> ancestorC1, final boolean quiet) { final Vector<Object> v=new Vector<Object>(); int x=requestedPathList.indexOf(';'); while(x>=0) { String path=requestedPathList.substring...
8
public static void main(String[] args) { int[] array = { 18, -2, 29, 66, 23, 142, -34, 0, 13 }; System.out.println("Input Array: "); for (int i = 0; i < array.length; i++) { System.out.print(array[i] + " "); } System.out.println("\n"); int n = array....
5
private void FallDown() { if (fallSpeed <= 20) fallSpeed = fallSpeed * 1.05; for (int i = 0; i < collisionRange.size(); i++) { if (getRectangle().intersects(collisionRange.get(i))) { if (collisionRange.get(i).getY() > this.getY() && collisionRange.get(i).getY() <= this.getY() + this.getHeigh...
6
public static int numberOfDoubledPawns(Board b, int color) { int doubledPawns = 0; for (int file = 0; file < b.board.length; file++) { boolean firstPawnFound = false; for (int rank = 0; rank < b.board[file].length; rank++) { if (b.board[rank][file] == 1 * color) { if (!firstPawnFound) { firstPa...
4
private void checkDiscipline() { int period = (isRude() ? 1 : 2) * DECLINEPERIOD; if (getAge() % period == 0) { if (--shittingDiscipline < 0) { shittingDiscipline = 0; } if (--excitingDiscipline < 0) { excitingDiscipline = 0; } if (--furifuriDiscipline < 0) { furifuriDiscipline = 0; } ...
6
public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source.equals(menuItemExport)) { // Menu Item "Export as CSV has been selected" if (controller.getState() == ApplicationState.INITIALIZED_WITH_DATA) { // Exportable Data is available System.out.println("Save as CVS");...
6
public TileReader(){ Properties prop= new Properties(); try{ InputStream in = getClass().getResourceAsStream("/res/tiles.txt"); prop.load(in); String stri[] = prop.getProperty("pictures").replaceAll("\\s+","").split(","); Tile.scenePics= new Image[stri.length]; for(int i=0;i<stri.length;i++){ ...
2
public void play( ) { synchronized( this ) { if( !paused ) return; double offset = ( System.currentTimeMillis( ) - pauseTime ) / 1000.0; for( Message m : waitQueue ) m.bumpReceiveTime( offset ); for( Message m : sendQueue ) m.bumpSendTime( offset ); paused = false; } ssi.statusChanged...
3
@Override public void hhhh() { hello.hhhh(); }
0
public OutputStream store(String name) throws IOException { final File nm = forres(name); File dir = nm.getParentFile(); final File tmp = new File(dir, nm.getName() + ".new"); dir.mkdirs(); tmp.delete(); OutputStream ret = new FilterOutputStream(new FileOutputStream(tmp)) { public void close() throws IOExceptio...
1
public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) throws SlickException { page.render(); land.draw(4,4,848,759); if (dragHeadingState) { arg2.setColor(Color.red); shapeRenderer.fill(shape); } Iterator i = airportList.iterator(); while (i.hasNext()) { ((Ai...
5
public ArrayList<Coche> searchCoches(String mat){ ArrayList<Coche> cList = new ArrayList(); ArrayList<Coche> res = new ArrayList(); cList.addAll(cjtCoches.values()); for(int i=0; i<cList.size(); ++i){ if(cList.get(i).getMatricula().contains(mat)) res.add(cList...
2
private Future<?> display(final boolean error) { final String msg = this.getMessage(); if (error) { getLogger().log(Level.SEVERE, null, this); } else { if (this.getCause() != null) { getLogger().log(Level.INFO, null, this); } } ...
9
public static CharSeq ApplyToAll1 (Main.AA1 fun, CharSeq s) { CharSeqIt csi = new CharSeqIt(s); //initialize iterator String NewSeq = ""; //initialize string to stick th result of fun.go into char currentval = 0; //current char while(csi.hasNext()) { try { currentval = csi.next...
2
public void addProperty(Space p) { property.add(p); // Change the property's font color to player's color if(number == 1) p.buttLabel.setForeground(GameBoard.PLAYER1); else if(number == 2) p.buttLabel.setForeground(GameBoard.PLAYER2); else if(number == 3) p.buttLabel.setForeground(GameBoard.PLAYER...
3
public Set<Being> getBeings() { return new HashSet<Being>(beings); }
0
private void addToCounts(Instance instance) { double [] countsPointer; double [] countsNoClassPointer; if(instance.classIsMissing()) return; // ignore instances with missing class int classVal = (int)instance.classValue(); double weight = instance.weight(); m_ClassCounts[classVal...
9
@Override public void actionPerformed(ActionEvent arg0) { if(arg0.getActionCommand() == "exportLogins"){ ExportFile export = new ExportFile("usuariosOnline.txt"); export.export(textlogin.getText()); } else if (arg0.getActionCommand() == "exportInfo"){ ExportFile export = new ExportFile("infoServidor.txt")...
8
@Override public void free() { try { fileChannel.truncate(0); } catch (IOException e){/**/} }
1
public static void main(String args[]){ long start = System.currentTimeMillis(); PrintWriter outputStream = null; try{ outputStream = new PrintWriter (new FileOutputStream("myIntegers.txt")); } catch(FileNotFoundException e){ System.out.println("Error opening the file."); } ...
2
@Override public String perform(HttpServletRequest request) { List<String> errors = new ArrayList<String>(); HttpSession session = request.getSession(); request.setAttribute("errors", errors); String success; try { CreateUserForm form = formBeanFactory.create(request); request.setAttribute("form", for...
7
@Test public void findsCorrectUnobstructedPoints() { VertexContainer vc = new VertexContainer(); Vertex src = vc.addVertex(0, 0); Point p1 = vc.addPoint(-1, -4); Point p2 = vc.addPoint(2, -1); Point p3 = vc.addPoint(3, 3); Point p4 = vc.addPoint(-4, -3); P...
5
public void addService(Service newService){ boolean exists = false; for (Service service : services) { if(service.getName().equalsIgnoreCase(newService.getName())){ exists = true; } } if(!exists){ services.add(newService); } ...
3
private void createAnd(String in1, String in2, String out) { AndGate and = new AndGate(); // Connect the first input // Check if the in wire is an input if (stringToInput.containsKey(in1)) { Wire inWire = new Wire(); stringToInput.get(in1).connectOutput(inWire); and.connectInput(inWire); } // C...
8
private String getFile(String link) { String download = null; try { // Open a connection to the page URL url = new URL(link); URLConnection urlConn = url.openConnection(); InputStreamReader inStream = new InputStreamReader(urlConn.getInputStrea...
6
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
4
public void matchesContainsMethodWithNoArguments() { Filter containsMethod = containsMethod( "usingDefaultClassLoader" ); assert containsMethod.matches( ClassLoaderBuilder.class ); assert !containsMethod.matches( Filter.class ); }
0
public boolean isBalanced2(BTPosition<T> current) throws InvalidPositionException { if (current == null) return true; int diff = treeHeight(current.getLeft()) - treeHeight(current.getRight()); if (Math.abs(diff) > 1) return false; else return isBalanced(current.getLeft()) && isBalanced(cu...
3
public final void addDragListeners(final Node n) { n.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { startDragX = me.getSceneX(); startDragY = me.getSceneY(); root.setStyle("-fx-opacity:.7;"); } }); n.setOnMouseReleased(new EventHandler<MouseE...
0
private ArrayList<Integer> generateUpDownDestinations( int position, int[] directions ) { ArrayList<Integer> destinations = new ArrayList<Integer>(); for ( int direction : directions ) { for ( int i = 1; isValidDestination( position + i*direction ); i++ ) { if ( enemyPieceAt( position + i*directi...
3
public void disablePlayerOneSpaces() { for (int x = 0; x < checkersSpaces.length; x++) { for (int y = 0; y < checkersSpaces.length; y++) { if(checkersSpaces[x][y].getIcon() != null && checkersSpaces[x][y].getIcon().equals(playerOneCheckerPiece)) { checkersSpaces[x][y].setDisabledIcon(playerOneChecker...
6
public int cellAt(int x, int y) { for (int i = 0; i < body.size(); i ++) { if (body.get(i).x == x && body.get(i).y == y) { return i; } } return -1; }
3
public static HereditaryProperty merge2(final HereditaryProperty a, final HereditaryProperty b) { return new HereditaryProperty() { @Override public Collection<Permutation> getBasis() { throw new UnsupportedOperationException("Not supported yet."); } ...
9
public void setLocation(int x, int y) { List l = getWorld().getObjectsAt(x, y, null); for (int i = 0; i < l.size(); i++) { Actor actor = (Actor) l.get(i); if (actor != this) {getWorld().removeObject(actor);} } super.setLocation(x,y); }
2
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : try { Date d = SBStringUtils.dateFormatShort.parse(value.toString()); myRecipe.setNoteDate(row, d); } catch (ParseException e) { System.out.println("Unable to parse " + value.toStr...
4
private static boolean modifySchedule(Schedule bean, PreparedStatement stmt, String field) throws SQLException{ String sql = "UPDATE prescriptions SET "+field+"= ? WHERE work_day = ? and username = ?"; stmt = conn.prepareStatement(sql); if(field.toLowerCase().equals("work_from")) stmt.setTime(1, bean.get...
5
@Override public void run( ) { this.running = true; while ( this.running ) { if ( this.listeners.size( ) != 0 ) { final EventType elem = this.queue.poll( ); if ( elem != null ) for (final IListener<EventType> li : this.listeners) li.handle(elem); } try { Thread.sleep(5);...
5
public void addInvalidConstantName(String constantName) { if (invalidConstantNames == null) { invalidConstantNames = new ArrayList(); } invalidConstantNames.add(constantName); }
1
private int getMaxStats(int idx){ int max = stats[PROGRESSION]+bonusStart[idx]; if(stats[PROGRESSION] <= 1) return bonusStart[idx]; else return (int)(max*coeffStats[idx]); }
1
public void actionPerformed(ActionEvent e) { if (e.getSource() == this.browse){ Chooser frame = new Chooser(); url.setText(frame.fileName); filePath = frame.fileName; } else if (e.getSource() == this.checkUrl){ new Listview("List of bad URLs", new CheckUrls(filePath).get_list(), filePath, atf,this).se...
3
public static void stop() { if (task != null && !task.isDone()) { task.cancel(true); task = null; BmLog.info("TestInfoController is stopped"); } }
2
public void handleRequest(ServerRequestEvent event) { JSONObject request = event.getRequest(); try { if(!ChunkyTransactions.getInstance().getAPI().checkAPIKey(request.getString("APIKey"))) { ChunkyTransactions.getInstance().getMessage().debug("Connection Refused!"); DataOutputStream out =...
5
private Object handleNote(Object tos, String id, String ref) { if (tos instanceof NoteContainer) { if (ref == null) { Note note = new Note(); ((NoteContainer)tos).addNote(note); return note; } else { NoteRef noteRef = new NoteRef(); ...
5
public List<String> findSubstring(String s, List<String> allKUniversals) { List<String> foundSubstrings = new ArrayList<String>(); for (String string : allKUniversals) { int length = s.length(); if (string.substring(0, length).equals(s) && !string.equals(s)) { fou...
3
@Override public void mousePressed(MouseEvent e) { if ( e.getSource() instanceof PlacementTile) { //Creation et initialisation de la tuile PlacementTile pt = (PlacementTile)e.getSource(); Tile tile = new Tile(selected.getType(), pt.getOrientation()); tile.setLocation(pt.getX(), pt.getY()); //Envoi...
5
@Override public double timeToReach(Node startNode, Node endNode, Message msg) { // TODO Auto-generated method stub double dist = startNode.getPosition().distanceTo(endNode.getPosition()); /* Link rate | time arrive mSec | dist * ---------------------------------------------------- * 11 | 2542 | 399 ...
7
public void bouwSpeelveld() throws AngryTanksException { //bouwt het speelveld op basis van level if(!isSpeelveldBouwKlaar()) throw new AngryTanksException("Speelveld kan niet gebouwd worden. Stel eerst een level in."); laatsteSchot = new Schot(Orientatie.RECHTS, 0, 0, new Positie(0,0), 0, new HashMap<...
7
@Override public Class<?> getColumnClass(int columnIndex) { return String.class; }
1
private void renderPlayerInventory(Graphics2D graphics) { for (int i = 0; i < objectTron.getActivePlayerInfo().getInventoryItems().size(); i++) { int xCoordinate = startPointXCoordinate + (i%3 * 40); int yCoordinate = startPointYCoordinate + 350 + (i/3 * 40); List<ElementInfo> item = new ArrayList<ElementInf...
1
@Test public void savenowtest() throws ClassNotFoundException, IOException{ try{ @SuppressWarnings("resource") ObjectInputStream osb = new ObjectInputStream(new FileInputStream("bookcollection.txt"));///óϾ , Ͼ׳ϴ° ҽ߰ bookcollectb.setBookCount(osb.readInt()); bookcollectb.collectionb.clear(); for( int ...
4
private boolean camposNecesarios () { boolean rta; if ((jTextField1.getText().equals(""))) { JOptionPane.showMessageDialog(null, "Complete el campo nombre!","Atención",JOptionPane.WARNING_MESSAGE); jTextField1.requestFocus(); rta = false; } else{ ...
5