text
stringlengths
14
410k
label
int32
0
9
@Override public void serialize(ByteWriter bw) throws IOException { bw.write4bytes(size); bw.write4bytes(signature); bw.write4bytes(0x58); bw.write4bytes(0); byte[] b = netbios.getBytes(); bw.writeBytes(b); for (int i=0; i<16-b.length; i++) bw.write(0); d1.serialize(bw); d2.serialize(bw); db1.se...
1
private int buildStraight(int xo, int maxLength, boolean safe) { int length = random.nextInt(10) + 2; if (safe) length = 10 + random.nextInt(5); if (length > maxLength) length = maxLength; int floor = height - 1 - random.nextInt(4); //runs from the spe...
7
public List<Player> choosePlayersBasedOnMode() { Player playerOne; Player playerTwo; List<Player> players = new ArrayList<Player>(); if (getMode() == 1) { System.out.println("Mode 1 is selected "); playerOne = new HumanPlayer(); playerOne.setSymbol('X'...
2
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
1
public MemExpr get_local(final int vn) { final Iterator iter = LocalStore.keySet().iterator(); while (iter.hasNext()) { final MemExpr le = (MemExpr) iter.next(); if (le.valueNumber() == vn) { return le; } } return null; }
2
private void getContextNodeLongToShort() { while (_contextLength >= MIN_CONTEXT_LENGTH) { _contextNode = lookupNode(_contextLength); if (_contextNode == null || _contextNode.isChildless(_excludedBytes)) { --_contextLength; continue; } while (_contextLength > MIN_CONTEXT_LENGTH && _contextNode.isDetermi...
7
public static ArrayList<String> mergeSort(ArrayList<String> unsorted) { if (unsorted.size() <= 1) return unsorted; int mid = unsorted.size()/2; ArrayList<String> left = new ArrayList<String>(); ArrayList<String> right = new ArrayList<String>(); int m = 0; while (m < mid) { left.add(unsorted.get(m))...
8
public void determineSession(Request request, Response response){ HttpCookie cookie = request.getCookie("pts_sessionid"); SessionData session = null; if(cookie != null){ session = sessions.get(cookie.getValue()); } if(cookie == null || session ...
4
public static ChatCommand getCommand(byte cmd) { if (cmd == 1) return NAME_CHANGE; else if (cmd == 4) return TEXT_ALL; else if (cmd == 5) return TEXT_ONE; else if (cmd == 19) return VERSION; else if (cmd == 26) return PING_REQUEST; else if (cmd == 27) return PING_RESPONSE; else if (cmd =...
9
@Override public int hashCode() { int result = moduleId != null ? moduleId.hashCode() : 0; result = 31 * result + personId; return result; }
1
public ArrayList<CellStringPair> findStrings(){ ArrayList<CellStringPair> result = new ArrayList<CellStringPair>(); int width = getWidth(); int height = getHeight(); for(int y = 0; y < height; y++){ for(int x = 0; x < width; x++){ if(!isBlank(x, y)){ Cell start = new Cell(x, y); String str = St...
8
private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0); return 10; } switch(curChar) { case 99:...
4
public void verbindeZweiRaeume(String richtung, Raum nachbar, String gegenRichtung) { // Abbrechen, wenn null übergeben wird. Dies darf vorkommen, sollte aber // keinen Effekt haben. if(nachbar == null || richtung == null || gegenRichtung == null) { return; } this.setAusgang(richtung, nachbar); nac...
3
public static void main(String[] args) { Main m = new Main(); m.args(args); if (m.CLI) m.cli(); else m.batch(); }
1
public String getOptionArgument(CmdLineOption option) { if (isOptionUsed(option)) { for (CmdLineData one : mData) { if (one.isOption() && one.getOption() == option) { return one.getArgument(); } } } return null; }
4
public void receiveShipment(String shippingID) { // The replenishment of the product from the shipping notice is added // to the items current quantity // Assumes that a new product in the shipment is already inserted in the ProductDepot // table in receiveShippingNotice System.out.println("Receiving ship...
6
public void readOrderedLog (){ cleanupStructures(); HashMap<int[], String> unorderedLogMap= readLogFromTextfile(); Set<int[]> clock = unorderedLogMap.keySet(); int clocks[][] = new int[clock.size()][clock.iterator().next().length]; int index = 0; for(int[] c : clock) { clocks[index] = c; index++; ...
9
public JSONObject increment(String key) throws JSONException { Object value = opt(key); if (value == null) { put(key, 1); } else if (value instanceof Integer) { put(key, ((Integer)value).intValue() + 1); } else if (value instanceof Long) { put(key, ((L...
5
public void setKillTimer(float countdown) { addTimeListener(new TimeListener() { private float killTimer = countdown; @Override public void timeStep(TimeEvent e) { killTimer -= e.getDelta(); if(killTimer <= 0) { setState(UIElement.KILL_FLAG); } } }); }
1
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
7
String ToString() { String retVal = "**************\n" + name + ": \n"; retVal += "************** \n"; retVal += "\t " + maxLength + " the maximum length of a domain\n"; retVal += "\t " + minLength + " the minimum length of a domain\n"; retVal += "\t " + averageLength + " The ave...
8
@Override public void render() { minus.render(); plus.render(); if (enabled) glColor3f(1, 1, 1); else glColor3f(0.5f, 0.5f, 0.5f); String title = (titles[Math.round(value - min)] != null) ? titles[Math.round(value - min)] : value + ""; if (rot == GuiRotation.HORIZONTAL) { int tx = FontAssistant...
6
public void accept(final MethodVisitor mv) { Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = ((LabelNode) this.labels.get(i)).getLabel(); } mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels); }
1
public int maxPathSum(treeNode curRoot) { int maxPathNotRoot; int maxPathAsRoot; int curMax; int maxPathFinal = 0; treeNode p = curRoot; // max for left tree do { p = p.leftLeaf; maxPathNotRoot = maxPathNotRoot(p); maxPathAsRoot = maxPathAsRoot(p); curMax = maxPathNotRoot > maxPathAsRoot ? m...
8
@Override public Result run() { Result result = null; try { Equals<Double> criterion = this.getCriterion(); Function<Double, Double> function = this.getFunction(); double goalValue = this.getGoalValue(); double value = this.getInitialValue(); ...
6
public Type getSuperType() { return (this == tObject) ? tObject : tRange(tObject, this); }
1
private static boolean containedBy(DockLayoutNode node, int x, int y) { if (node != null) { int edgeX = node.getX(); if (x >= edgeX && x < edgeX + node.getWidth()) { int edgeY = node.getY(); return y >= edgeY && y < edgeY + node.getHeight(); } } return false; }
4
private void Procurar_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Procurar_ButtonActionPerformed // TODO add your handling code here:\ clearTable(Jogadores_Table); int i = 0; Escola escola = a.getDAOEscola().get(Escola_ComboBox.getSelectedItem().toString()); ...
3
public JPanelTauler( boolean partida_en_curs ) { // Inicialitzem els atributs. elements_de_control_partida = PresentacioCtrl.getInstancia().getElementsDeControlPartida(); elements_de_control_jugadors = PresentacioCtrl.getInstancia().getElementsDeControlJugadors(); ultima_pista = new Casella( 0, 0 ); pista_va...
4
public void write(long pos, byte[] buf) { file.write(pos, buf); synchronized (mutex) { if (pageTimestamps != null) { int pageNo = (int)(pos >> Page.pageSizeLog); if (pageNo >= pageTimestamps.length) { int newLength = pageNo >= pageTimest...
9
public void update(final FrameStatistics stats) { List<Long> statsThisUpdate = new ArrayList<Long>(); for (InputStatistics is : stats.getInputStats()) { InfoBox infoBox = infoBoxes.get(is.getId()); if (infoBox == null) { infoBox = new InfoBox(); infoBoxe...
8
boolean tryPlace(int i, int x1, int y1, int x2, int y2) { if (x2 < 0 || x2 >= w || y2 < 0 || y2 >= h) return false; // not empty place if (field[x1][y1] != -1 || field[x2][y2] != -1) return false; // border OK if (isValid(D[i].d1, x1, y1) && isValid(D[i].d2, x2, y2)) { // mark D D[i].x1 = x1; D...
9
@Override public void run() { //System.out.println("Client: Thread Start Send"); PrintWriter out = null; BufferedReader in = null; String servLine = null; if (sock == null) { return; } try { out = new PrintWriter(sock.getOutputStream(), true); ...
8
@Override public Object getValueAt(int row, int col) { StockItem s = info.get(row); switch (col) { case 0: return s.getChargeNo(); case 1: return s.getMaterial().getName(); case 2: return s.getCoilType().getThickness(); case 3: return s.getLength(...
6
public void setId(int id) { this.id = id; }
0
private void initColumnName(ResultSet rs) throws SQLException { if (columnNameSet.isEmpty()) { synchronized (columnNameSet) { if (columnNameSet.isEmpty()) { ResultSetMetaData metaData = rs.getMetaData(); int columnCount = metaData.getColumnCount(); for (int i = 1; i <= columnCount; i++) { ...
3
private void initPageResources() throws InterruptedException { Resources res = library.getResources(entries, "Resources"); if (res == null) { PageTree pt = getParent(); while (pt != null) { if (Thread.interrupted()) { throw new InterruptedExcep...
5
@Override public int hashCode() { int hash = 7; hash = 97 * hash + (this.car != null ? this.car.hashCode() : 0); hash = 97 * hash + (this.customer != null ? this.customer.hashCode() : 0); hash = 97 * hash + (this.from != null ? this.from.hashCode() : 0); hash = 97 * hash + (t...
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { if (!Helpers.isValidDouble(jTextField1.getText())) { JOptionPane.showMessageDialog(this, "Please enter valid number", "Number Format Error", JOptionPane.ERROR_MESSAGE...
3
public static String getName(EventObject e){ Object o=e.getSource(); //XAux.pl("source "+o); if(o instanceof JComponent){ Object v=((JComponent) o).getClientProperty("name"); if(v!=null)return (String)v; } else if(o instanceof Document){ Object v=((Document) o).getProper...
9
public CtMethod getMethod(String name, String desc) throws NotFoundException { CtMethod m = getMethod0(this, name, desc); if (m != null) return m; else throw new NotFoundException(name + "(..) is not found in " + getName...
1
public Connection findConnection(RouteLeg currentRouteLeg) { Connection foundConnection = null; for(Connection currentConnection : connections) { if (currentConnection.connects(currentRouteLeg)) { foundConnection = currentConnection; break; } } return foundConnection; }
2
public static String convertObjectToString(Object value) { if (value != null) { return value.toString(); } else { return null; } }
1
public void addElementToPosition(Element element, Position position) { if (element == null || position == null) throw new IllegalArgumentException("The given parameters are invalid!"); if (validElement(element, position)) getSquare(position).addElement(element); }
3
public static String accentManager (String word) { for (int i = word.indexOf("-a"); i != -1; i = word.indexOf("-a")) { word = word.substring(0, i) + "á" + word.substring(i+2, word.length()); } for (int i = word.indexOf("-e"); i != -1; i = word.indexOf("-e")) { word = word...
9
public String toString() { String s = ""; for (int y = plateau[0].length - 1; y >= 0; y--) { for (int x = 0; x < plateau.length; x++) { if (plateau[x][y] == 1) s += "X "; else if (plateau[x][y] == 0) s += "O "; else s += "" + plateau[x][y]; } s += "\n"; } return s; }
4
public void escribirPersonaJAXB(String rutaFichero, LinkedHashMap<Integer, Persona> personas) { rutaFichero = rutaFichero + ".xml"; try { MapPersona mp = new MapPersona(); mp.setMapPersona(personas); JAXBContext jaxbContext = JAXBContext.newInstance(MapPersona.class);...
1
public String toString() { if (length == 0) { return "code has no bits yet"; } String str = ""; for (int i = length - 1; i >= 0; i--) { str += getBit(i); } return str; }
2
private void addDirToList(S3Item item, ArrayList<S3Item> fileList) { if (item.isDir()) { Collection<S3Item> children = item.getChildren(true); if (children.size() < 750) { for (S3Item child : children) { if (!child.isDir()) { fileList.add(child); } } } else { for (S3Item c...
6
public Quadrato(Damiera dam, int r, int c) { damiera=dam; riga=r; colonna=c; attivo=false; this.setOpaque(true); if(damiera.getPosizione(riga, colonna).getSfondo()==false) //assegnamento del background. this.setBackground(Color.BLACK); else { setEnabled(false); this.setBackground(new Col...
5
public static ArrayList<Boolean> decimalToBinary(Integer integer, int n) { ArrayList<Boolean> result = new ArrayList<>(); if (integer == 0) { result.add(false); for (int i = 0; i < n - 1; i++) result.add(false); Collections.reverse(result); return result; } while (integer != 0) { if (int...
5
public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException { if ( isHasNodeIdentifier() ) { writer.write( ForesterUtil.LINE_SEPARATOR ); writer.write( indentation ); // if ( !org.forester.util.ForesterUtil.isEmpty( getNodeIden...
9
public static String longestPalindromeDP(String s) { char[] str = s.toCharArray(); int n = str.length; int longestBegin = 0; int max = 1; boolean table[][] = new boolean[1000][1000]; java.util.Arrays.fill(table[0], false); java.util.Arrays.fill(table[1], false); for (int i=0; i<n; i++) {...
7
public static void main(String[] args) { int x = 0; System.out.println((x != 0) && ((10 / x) > 1)); //false }
1
public void handleUpdateUserInfo(Packet10UpdateUserInfo packet, InetAddress address, int port) { Player player = null; if (packet.getRace().equalsIgnoreCase("human")) player = new Human(game, packet.getName(), address, port); else if (packet.getRace().equalsIgnoreCase("cyborg") && packet.getColor().equalsIgnor...
9
public int getRT() { // need to get rid of R if(!immediate) return Integer.parseInt(inst[3].substring(1)); return -1; }
1
public final Object pop() { if (sealed) throw onSeledMutation(); int N = size; --N; Object top; switch (N) { case -1: throw onEmptyStackTopRead(); case 0: top = f0; f0 = null; break; case 1: top = f1; f1 = null; break; case 2: t...
7
private static void solveEven(int n, int m, boolean switched) { System.out.println(0); for (int i = 1; i <= m; i++) { print(1, i, switched); } for (int j = 2; j <= n-1; j++) { boolean evenRow = (j % 2 == 0); int start = (evenRow ? m : 2); i...
8
protected byte[] computeSHAdigest(final byte[] value) { try { return MessageDigest.getInstance("SHA").digest(value); } catch (Exception e) { throw new UnsupportedOperationException(e.toString()); } }
1
public void run() { // TODO Auto-generated method stub try { System.out.println("hhhhhhhhhhhhhhhhhhhh"+ip_client); char ip1[]=ip_client.toCharArray(); if(ip1[0]=='/') ip_client=new String(ip1,1,ip_client.length()-1); System.out.println("hhhhhhhhhhhhhhhhhhhh"+ip_client); ...
4
@Override public void caseAIdxAcsStmt(AIdxAcsStmt node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(AssignArray"); inAIdxAcsStmt(node); if(node.getIdentifier() != null) { node.getIdentifier().apply(this); ...
9
private void multiplyAndStackUV(double[][] srcU, double[][] srcV, double[][] dst, int colNo, int widthV, int heightU) { for (int x = 0; x < widthV; x++) { double srcElemV = srcV[colNo][x]; for (int y = 0; y < heightU; y++) { // the colNoth column of U times the colNot...
2
private void sort2(int[] arr,int up,int down){ int pivot=up+(down-up)/2; int i=up; int j=down; if (up>down) while(i<=j) { if(arr[i]<arr[pivot]) {i++; } if(arr[j]>arr[pivot]) {j--; } if(i<=j) { int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--; } if (up<j) { sort2(arr,up,p...
7
@SuppressWarnings ("unchecked") protected final void remove(final BaseItem item) throws NullPointerException, IllegalStateException, IllegalArgumentException { switch (item.state()) { case Item.APPEND_STATE: case Item.UPDATE_STATE: if (!this.equals(item.pool())) throw new IllegalArgumentException(); th...
5
private int unEscapeCharData(int token) { if (token == '<') return tError; if (token != '&') return token; getNext(); String sToken = getString(); if (sToken.startsWith("gt;")) return _gt; if (sToken.startsWith("lt;")) return _lt; if (sToken.startsWith("amp;")) return _amp; if (sToken.sta...
7
public static void main(String s[] ) { key = new Scanner(System.in); System.out.println("enter the first number"); int num1=key.nextInt(); System.out.println("enter the second number"); int num2=key.nextInt(); int count=1; if(num2-num1>=100) while(count!=100) { for(int i=num1;i<=num2;i...
5
public Record getRecord() { return record; }
0
@Override public void actionPerformed(ActionEvent e) { Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().undo(); }
0
public void getTile(int x, int y){ int[] hitBox; Tile temp; Tile newTile; if(x < 0 || y < 0 || x >= w || y >= height){ System.out.println("Outside Map"); tilesPosition(new Tile(x * width, y * height, this, true, false, tile.get(1).getAnimatedSprite())); }else if(tile.containsKey(tiles[x + y * w])){ t...
7
public static void main( String args[] ) { int nbPersonnages = 0; // nombre courant de personnages // // cration du tableau de personnages // Personnage pers[] = new Personnage[ MAX_PERSONNAGES ]; // // cration des personnages // pers[ 0 ] = new Sorcier( "Kalam...
8
boolean checkedBlockIsWithinFurnaceCheckCube(int checkedX, int checkedY, int checkedZ, int furnace_x1, int furnace_x2, int furnace_y1, int furnace_y2, int furnace_z1, int furnace_z2) { boolean res = false; if((checkedX >= furnace_x1) && (checkedX <= furnace_x2) && (checkedY >= furnace_y1) &&...
6
public void affichePlateau(){ System.out.print(" "); for (int i = 0; i < g.getTaille(); i++){ System.out.print(i + " "); } System.out.println(); for (int i = 0; i < g.getTaille(); i++){ System.out.print(i+" "); for (int j = 0; j < g.getTaille...
5
public void testSetTime_int_int_int2() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.setTime(60, 6, 7, 8); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
1
public void expire() { this.expired = true; Logger.log("Expired effect: " + this.type, 1); // Un-apply effect switch (type) { case BOTTOM_WALL: break; case ENLARGE_PADDLE: App.getMainWindow().getScene().getPaddle().shrink(); break; case FIREBALL: break; case MULTIBALL: b...
9
private LinkedList <Migration> getMigrationList () { File migrationDir; try { migrationDir = new File (Tatoo.class.getResource ("/tatoo/db/migrate").toURI ()); } catch (URISyntaxException e) { e.printStackTrace (); migrationDir = null; } ...
9
public void setResourcePackages(List<ResPackage> resourcePackages) { this.resourcePackages = resourcePackages; }
0
public void setAddress(String address) { if(address == null || address.isEmpty()){ throw new IllegalArgumentException(); } this.address = address; }
2
public static void main(String[] args) { int linkedListLength = Integer.parseInt(args[0]); int kPositionFromEnd = Integer.parseInt(args[1]); Node headNode = null; if(kPositionFromEnd>linkedListLength || kPositionFromEnd<=0){ System.out.println("Please enter a valid value for Kth position from end")...
2
public static IntNode[ ] listPart(IntNode start, IntNode end) { IntNode copyHead; IntNode copyTail; IntNode cursor; IntNode[ ] answer = new IntNode[2]; // Make the first node for the newly created list. Notice that this will // cause a NullPointerException if start is null....
2
public void setGraphY(int y) { this.graphY = y; }
0
@Override public void close() { if (readMonitor != stdin) { try { in.close(); } catch (IOException e) { System.err.printf("Cannot close console input. %s: %s%n", getClass(), e.getMessage()); } } if (out != stdout) { try { out.close(); } catch (IOException e) { System.err.printf("Ca...
4
private void checkStart() { if (mapFile != null) { if ((MapInterpreter.mapchecker(mapFile.getAbsolutePath())) && listOfBrains.size() > 2) { startButton.unlock(); setButtonGreen(startButton); } else { setButtonRed(startButton); startButton.lock(); } } else if (mapMap != null) { if (l...
5
public int getScore() { int frameScore = 0; if (isStrike()) { frameScore += MAXPIN + strikeAdditionalScore(); } else if (isSpare()) { frameScore += MAXPIN + spareAdditionalScore(); } else { frameScore += getFrameScore(); } return frameScore; }
2
private void writeList() { String mapperName = table.getDomName() + "Dao"; for ( Column column : table.getColumns() ) { if ( column.isSearchId() ) { // do this to make sure the created method is properly // camelCased String fieldName = column...
2
private void actionClosePanel() { AbstractTab tab = MainWindow.getInstance().getActiveTab(); if (tab == null) return; if (tab instanceof ChannelTab) { InputHandler.handlePart(""); } else if (tab instanceof PrivateChatTab) { tab.getServerTab().removeP...
3
public static void main(String[] args) { try { sig = new SigService(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { SwingGUI.showGUI(); } }); }
1
public void PHPFileIncludes(int TARGET_PHP_FILES_ID, DatabaseAccess JavaDBAccess, PHPFileOperations PHPFile) { PreparedStatement ps = null, psUpdate = null; ResultSet rs = null; String PHPFileTextClean = ""; String RegExpText = "", host = "", HostPath = ""; Boolean CaseSensitive...
8
void reduce(String s, int a, int b) { for (int i = 0; i < validSet.length; i++) { if (!validSet[i]) { continue; } if ((getA(s, answerSet[i]) != a) || (getB(s, answerSet[i]) != b)) { validSet[i] = false; } } }
4
public static String getBanner(String playerName){ String banner = "Not Banned"; if(isBanned(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM bans WHERE username='" + playerName + "'"); // This loop checks...
4
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirect...
9
private Pair<PlayerData, PlayerData> getNearFarPlayers(ArrayList<PlayerData> players){ PlayerData closestPlayer = new PlayerData(); // make a new place to record the closest player PlayerData furthestPlayer = new PlayerData(); // make a new place to record the furthest player closestPlayer.setDi...
3
public void setSessionId(String sessionId) { this.sessionId = sessionId; }
0
public void drawFilledPolygon(double... positions) { if(positions.length == 0 || positions.length % 2 != 0){ Main.fatalError("You are trying to draw a polygon which hasn't got an even number of parameters.\n"); } for(int i = 0; i < positions.length; i++){ double paramx = positions[i]; double paramy = pos...
4
public void select(NodoGrafico n) { if (selected != null) selected.unselect(); selected = n; if (selected != null) { btnRemove.setEnabled(true); selected.select(); } else btnRemove.setEnabled(false); repaint(); }
2
public synchronized ClickstreamConfig getConfig() { if (config != null) { return config; } InputStream is = getInputStream("clickstream.xml"); if (is == null) { is = getInputStream("/clickstream.xml"); } if (is == null) { is = getInputStream("META-INF/clickstream-default.xml"); } if (is == nu...
9
public static void newGame(){ System.out.println("Starting new game..."); empireName = JOptionPane.showInputDialog(null, "Enter your empire's name:", "Empire Name", JOptionPane.QUESTION_MESSAGE); //JOptionPane.showInputDialog(parentComponent, message, title, messageType, icon, selectionValues, initialSelectionVal...
1
@Override public void drawHeader(Graphics2D gc) { super.drawHeader(gc); boolean active = isFocusOwner(); Rectangle clipBounds = gc.getClipBounds(); int left = clipBounds.x; int right = clipBounds.x + clipBounds.width; Rectangle colBounds = getHeaderViewBounds(); int dividerWidth = getColumnDividerWidth()...
9
private static int calculateFitness(String gene) { /// chromosomeSectorSize int fitness = 0, numberOfUtilities = 0, utilitieIndex; int[] numberOfR = new int[chromosomeSectorSize]; char[] arr = gene.toCharArray(); for(int i = 0; i < numberOfR.length; i++) numberOfR[i] = 0; for (int i = 0; i <...
8
private void deleteButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButActionPerformed int delete = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this Property", "Comfirm Deletion", JOptionPane.YES_NO_CANCEL_OPTION); if (delete == JOption...
6
private void checkForBodiesToDelete() { Array<Body> bodies = new Array<Body>(); this.box2DWorld.getBodies(bodies); for (Body body : bodies) { Entity data = (Entity) body.getUserData(); if (data != null && data.isFlaggedForDelete()) { this.box2DWorld.destroyBody(body); } } // for(int i = 0; i<lette...
3