text
stringlengths
14
410k
label
int32
0
9
public ArrayList<GameObject> createGame() { BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader(path)); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); if(sCurrentLine.indexOf("<GO>") != -1) parseG...
6
private void newGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newGameActionPerformed long pop = Long.valueOf(population.getValue().toString()); Economy e = new Economy(pop * Long.valueOf(gdpPerCapita.getValue().toString()), Double.valueOf(governmentDebt.getValue().toString())); ...
5
public void updateUI(SimulateurUI ui) { addObserver(ui); for (VoieInterne voie : voiesInternes) { ui.ajouterVoie(voie); ui.ajouterAccidentListener(voie); } for (VoieExterne voie : voiesExternes) { ui.ajouterVoie(voie); ui.ajouterAccidentListener(voie); } }
2
private void addButtonListener(JButton b) { b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { if (ev.getActionCommand().equals("Choose Source Folder")) { srcF = fileChooser(); if (srcF == null) { src.setText("no Source Folder selected"); ...
9
public boolean ColliderWithPodiumUp(){ if((x>=0 && x<=Podium.WIDTH-25) && (y<=GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp - HEIGHT/1.2 && y>= GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp - HEIGHT)){ return true; } if((x>=GameMain.GAME_WIDTH+25 - Podium.WIDTH - Charac...
8
public Graphics2D getGraphics() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); return (Graphics2D)strategy.getDrawGraphics(); } else { return null; } }
1
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vector2D vector2D = (Vector2D) o; if (Double.compare(vector2D.x, x) != 0) return false; if (Double.compare(vector2D.y, y) != 0) return false; ...
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String serverID = null; if (jComboBox1.getSelectedIndex() > -1) { serverID = ((String[]) serverMap.get((Integer) jComboBox1.getSelectedIndex()))[1]; } System.out.pr...
4
protected mxCellState[] getPreviewStates() { mxGraph graph = graphComponent.getGraph(); Collection<mxCellState> result = new LinkedList<mxCellState>(); for (Object cell : movingCells) { mxCellState cellState = graph.getView().getState(cell); if (cellState != null) { result.add(cellState); /...
8
public void startConnection() { try { if ((con == null) || (con.isClosed())) { con = DriverManager.getConnection( "jdbc:postgresql://java.is.uni-due.de/ws1011", "ws1011", "ftpw10"); System.out.println("Datenbankverbindung hergestellt"); } } catch (SQLException e) { e.printStackTrace(); ...
3
protected int setArmorModel(EntityPlayer par1EntityPlayer, int par2, float par3) { ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(3 - par2); if (itemstack != null) { Item item = itemstack.getItem(); if (item instanceof ItemArmor) { ...
8
public HantoBasePiece(HantoPlayerColor playerColor, HantoPieceType type, HantoMove moveType, int moveDistance){ color = playerColor; this.type = type; switch(type) { case BUTTERFLY: this.moveType = moveType; this.moveDistance = moveDistance; break; case CRAB: this.moveType = moveType; this.mo...
4
public int GetCLStrength(int ItemID) { if (ItemID == 10707) { return 100; } if (ItemID == 6528) { return 60; } if (ItemID == 10707) { return 100; } if (ItemID == 10709) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("G...
9
static int getNumber(char l) { l = Character.toUpperCase(l); if(l<='C') return 2; else if(l<='F') return 3; else if(l<='I') return 4; else if(l<='L') return 5; else if(l<='O') return 6; else if(l<='S') return 7; else if(l<='V') return 8; return 9; }
7
public void trim(int newSize) { if (newSize > size || newSize < 0) { throw new IndexOutOfBoundsException("Index: " + newSize + ", Size: " + size); } while (size > newSize) { attributeLists[--size] = null; } }
3
public int getLeftScore() { return leftScore; }
0
@Override public String toString(){ return super.toString()+ " in category : Axes" + " with attack " + this.attackScore; }
0
public String toString() { StringBuffer s = new StringBuffer(); if (this.vorzeichen) s.append('-'); for (int i = this.mantisse.getSize() - 1; i >= 0; i--) { if (i == this.mantisse.getSize() - 2) s.append(','); if (this.mantisse.bits[i]) s.append('1'); else s.append('0'); } s.append(" *...
4
private void initLoadingstatusFontMenu(Color bg) { this.loadingstatusPanel = new JPanel(); this.loadingstatusPanel.setBackground(bg); this.loadingstatusPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); String initFontTmp = this.skin.getLoadingStatusFont(); int initFon...
7
private void computeClusterCentroids() { HashMap<Integer, ArrayList<Double>> sumClusterCentroids = new HashMap<Integer, ArrayList<Double>>(); HashMap<Integer, Integer> memberCount = new HashMap<Integer, Integer>(); for (Map.Entry<ArrayList<Integer>, Integer> entry : gridLabel.entrySet()) { // get the grid ...
5
public DistributedQuery(Statement s, ArrayList dbList) { this.tempDB = s; this.dbList = dbList; String os = System.getProperty("os.name").toLowerCase(); if (!ServicesParser.isInitialized()) { String servicesFile; if (os.indexOf("windows"...
8
@Override public void genOperationComment(StringBuffer buff, Map<String, String> simpleToPrimitiveTypeMap, Operation o) { genBeginSeperator(buff); buff.append(String.format("#' @title %s\n", o.name)); String description = o.description.replaceAll("[\\t\\n]", " "); descrip...
9
private static Move ForwardRightForWhite(int r, int c, Board board){ Move forwardRight = null; if(r<Board.rows-1 && c<Board.cols-1 && board.cell[r+1][c+1] == CellEntry.empty ) { forwardRight = new Move(r,c, r+1, c+1); } return forwardRight; ...
3
public void close() { try { if (rs != null && !rs.isClosed()) { rs.close(); } } catch (SQLException e) { e.printStackTrace(); } try { if (pstmt != null && !pstmt.isClosed()) { pstmt.close(); } ...
9
public boolean isItemSent() { if (itemSentInt == "1") { return true; } else { return false; } }
1
@Override public void handleIt(Object... args) { Scanner inputReader = new Scanner(System.in); System.out.print("Are you sure you want to quit? (y/n): "); String userInput = inputReader.next(); if (userInput.equals("y") || userInput.equals("Y")) { Socket sock = (Socket) args[0]; try { sock.close(...
5
@Override public String getTitle() { Document doc = this.viewer.getDocument(); return (String) doc.getProperty(Document.TitleProperty); }
0
public static String getln() { StringBuffer s = new StringBuffer(100); char ch = readChar(); while (ch != '\n') { s.append(ch); ch = readChar(); } return s.toString(); }
1
@Override public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId ) { StringBuffer cooxml = new StringBuffer(); // chart type: contains chart options and series data cooxml.append( "<c:line3DChart>" ); cooxml.append( "\r\n" ); cooxml.append( "<c:grouping val=\"" ); if( is100Pe...
4
private String getFechaSQL(String fecha){//01/02/2013 if (fecha!=null) { if (fecha.length() > 8) { return fecha.replace("/", "-"); } } return "1900-01-01"; }
2
private ChatConnection getDestinationUserConnection(String destinationUser) { for (ChatConnection connection : connections.values()) { if (destinationUser.equals(connection.getUserName())) { return connection; } } return null; ...
2
public static boolean[] string2BooleanArray(@NotNull String convertable) throws IkszorConvertException { boolean[] result = new boolean[convertable.length() * 8]; try { int real = 0; for(byte b : convertable.getBytes()) { int val = b; for(int i = 0; i < 8; i++) { result[real+i] = (val &...
4
public void explicitFitness() { for (int i = 0; i < getSpecies().size(); i++) { for (int j = 0; j < getSpecies().get(i).getNumberOrganisms(); j++) { double newFitness = getSpecies().get(i).getOrganism(j).getFitness() / (double) sumSharingFunc(getSpecies().get(...
2
*/ private void recListPopup(MouseEvent e) { JTable tbl = null; JScrollPane pane = null; try { tbl = (JTable)e.getSource(); } catch (ClassCastException cce) { pane = (JScrollPane)e.getSource(); if (pane.equals(queryDbPane)) { tbl = queryDbTable; } else if (pane.equals(resultPane)) { tb...
9
public static void main(String[] args) throws IOException { File inputFile = new File("entrada"); if (inputFile.exists()) System.setIn(new FileInputStream(inputFile)); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line; HashMap<C...
7
public static void makeSimple() { removeList.clear(); for (RoadGraph i : JMaps.getRoadGraphList()) { if (!i.isImportant() && !i.isSocket()) { int curve1, curve2; curve1 = i.getList().get(0); curve2 = i.getList().get(1); for (Ro...
7
private void setHealth(int newHealth, boolean notifyListeners) { int previousHealth = health; health = newHealth; if(notifyListeners){ for (EntityHealthListener listener : healthListeners) { listener.healthChanged(this, previousHealth, newHealth); } } if (health <= 0 && alive) { die(true); ...
4
@Override public boolean onMouseDown(int mX, int mY, int button) { if(super.onMouseDown(mX, mY, button)) { return true; } for(WeaponLocationDisplay wld : weaponLocDisplays) { if(wld.onMouseDown(mX, mY, button)) { return true; } ...
3
public void FollowPlayerCB(int NPCID, int playerID) { int playerX = server.playerHandler.players[playerID].absX; int playerY = server.playerHandler.players[playerID].absY; npcs[NPCID].RandomWalk = false; if(server.playerHandler.players[playerID] != null) { if(playerY < npcs[NPCID].absY) { ...
5
protected boolean isElementoEnHechosPreguntados(String elemento) { if (null != hechosPreguntados) { for (String s : hechosPreguntados) { if (elemento.equals(s)) { return true; } } } return false; }
3
public void start() { ImageLoader.init(); Game.init(); game = Game.getInstance(); final int DELTA_TARGET_NANOS = DELTA_TARGET * 1000 * 1000; while (true) { long timeStart = System.nanoTime(); BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); continue; }...
5
private void indexFromRequests(List<Order> orders, Map<String, Product> productMap, OrderHistory history) { for (Order order : orders) { Indexed<Product> x = search.get(order.getSku()); if (x == null) { Product product = productMap.get(order.getSku()); if ...
3
private String[] getIDsToArrays(final String stringView) { StringTokenizer st = new StringTokenizer(stringView,","); int number = st.countTokens(); int i = 0; String[] strings = new String[number]; while (st.hasMoreTokens()) { strings[i] = st.nextToken(); i++; } return strings; }
1
@Override public void analyzeLine(String line, int lineNumber, RequireJsModule module) { String varName = null; String dependencyId = null; Matcher match = NAMED_REQUIRE_REGEX.matcher(line); if(match.find()) { varName = match.group(1); String tentativeDependency = match.group(2); if(!tentativeDepen...
8
public void setjTextFieldNum(JTextField jTextFieldNum) { this.jTextFieldNum = jTextFieldNum; }
0
@Override protected Integer doInBackground() { Logger.getLogger(ReportGenerator.class.getName()).entering(ReportGenerator.class.getName(), "doInBackground"); try { nbrOfAlbums = 0; nbrOfProcessedAlbums = 0; findNbrOfAlbums(); try { page...
6
public Elevator callUp(Rider r){ int startFloor = r.getFrom(); while(true) { for(Elevator e : elevators) { synchronized(e){ if(e.isGoingUp() && e.getFloor()<startFloor) { e.addRequest(r); return e; } else if(!e.isInTransit()) { e.addRequest(r); return e; } } ...
5
private void updateLights() { switch (_state) { case GreenNS_RedEW: _ewLight.setColor(LightColor.Green); _nsLight.setColor(LightColor.Red); break; case YellowNS_RedEW: _ewLight.setColor(LightColor.Yellow); _nsLight.setColor(LightColor.Red); break; case RedNS_GreenEW: _ewLight.setColor(Li...
4
private void Show() { Game.gui.removeAll(); Point size = MenuHandler.PrepMenu(260,140); Prev.setBounds(size.x+190, size.y+100, 60, 24); Next.setBounds(size.x+10, size.y+100, 60, 24); Return.setBounds(size.x+80, size.y+100, 100, 24); if (Game.edit.owner > 0) { for (int i = 0; i < Game.displayU.size(); ...
5
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
3
public void visitMethodInsn( final int opcode, final String owner, final String name, final String desc) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append(' '); appendDescriptor(INTERNAL_NAME, owner); buf.append('.').append(name).appe...
1
private static void solve_c_svc(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si, double Cp, double Cn) { int l = prob.l; double[] minus_ones = new double[l]; byte[] y = new byte[l]; int i; for(i=0;i<l;i++) { alpha[i] = 0; minus_ones[i] = -1; if(prob.y[i] >...
5
public void RemoveFront() { if (getHead() == null) { return; } if (size == 1) { setHead(tail = null); size = 0; return; } --size; setHead(getHead().next); }
2
public CheckResultMessage check19(int day) { int r1 = get(33, 5); int c1 = get(34, 5); int r2 = get(39, 5); int c2 = get(40, 5); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r1 +...
5
public static final BigInteger LCD(BigInteger... ints) { BigInteger lcd = BigInteger.ONE; for (BigInteger n : ints) { if (lcd.mod(n).equals(BigInteger.ZERO)) continue; for (BigInteger i = BigInteger.valueOf(2); i.compareTo(n) <= 0; i = i.add(BigInteger.ONE)) { ...
7
public void setOptions(String[] options) throws Exception { String tmpStr; String[] spec; String classname; tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { spec = Utils.splitOptions(tmpStr); if (spec.length == 0) throw new IllegalArgumentException...
8
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
private String convert(String[] words, int start, int end, int L) { StringBuilder sb = new StringBuilder(); // if this line only contains one word if (start == end) { sb.append(words[start]); for (int i = 0; i < L - words[start].length(); i++) { sb.append(" "); } return sb.toString(); } // if...
9
public static boolean writeFile(String[] values, String archivo) { FileWriter fichero = null; PrintWriter pw = null; try { boolean isDeleted = deleteFile(archivo); if (isDeleted) { fichero = new FileWriter(archivo, false); ...
3
public int getSize() { return nodes.size(); }
0
protected void setColorScheme(String colorScheme) { switch (colorScheme) { case "Standard": //set Standard ColorScheme this.activeColorScheme = new ColorScheme("Standard", Color.white, Color.black, new Color(100, 100, 100), Color.orange, new Color(230, 140, 0), Color.gray, new Color(90, 90, 90), Color.g...
3
@GET @Path("{food}") @Produces(MediaType.APPLICATION_JSON ) public PhotoBean getFoodPictureFromTag(@PathParam("food") String food) { Flickr f = FlickrDao.instance.getFlickr(); PhotosInterface photosInterface = f.getPhotosInterface(); Photo photo = null; Boolean visited[] = n...
6
private GroupNode<K, V> getGroupNodeInstance( G group ) { GroupNode<K, V>[] buckets = mGroupBuckets; final int hash = (group == null ? 0 : rehash( group.hashCode() )); final int idx = hash & (buckets.length - 1); GroupNode<K, V> g = buckets[idx]; while( g ...
7
public boolean tagAudioFile(boolean force) throws IOException { AudioFile theFile = fixTag(force); if (null != theFile) { try { theFile.commit(); } catch (CannotWriteException e) { throw new IOException(e); } return true; } return false; }
2
@Override public boolean equals(Object obj) { User other = (User) obj; if (getClass() == obj.getClass() && userId.equals(other.getUserId()) && firstName.equals(other.getFirstName()) && lastName.equals(other.getLastname())) return true; else return false; }
4
public void testConstructor_ObjectStringEx7() throws Throwable { try { new LocalDate("10:20:30.040+14:00"); fail(); } catch (IllegalArgumentException ex) {} }
1
public RegistrantList getRegistrantViewBy(String asViewById, String asLastModified, int aiMaxSize) { String lsParam = ""; if (aiMaxSize > 0) { lsParam += "&max_size=" + Integer.toString(aiMaxSize); } if (UtilityMethods.isValidStri...
3
public static void merge(File f, TreeMap<String, ArrayList<String>> map) { BufferedReader br = null; try { br = new BufferedReader(new FileReader(f)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { File outfile = new File(fileoutname); Buffe...
9
@Override public Class<?> getColumnClass(int columnIndex) { // Returns the class of each column if (columnIndex == columnNames.indexOf("Name")) { return String.class; } else if (columnIndex == columnNames.indexOf("Description")) { return String.class; } else {...
3
public static ArrayList<ArrayList<String>> gettopiclist() throws SQLException { String sql="select TopicName,Path from Topics"; ArrayList<ArrayList<String>> feedback = new ArrayList<ArrayList<String>>(); ArrayList<String> feed = null; try { ResultSet rs = st.executeQuery(sql); ResultSetMetaData rsm = r...
4
public void defuse() { if (bombActive && user.equals(bombHolder)) { if (wire(cmdArgs) == true) { connection.msgChannel(config.getChannel(), MircColors.WHITE + "Bomb defused."); bombActive = false; } else { connection.msgChannel(config.getChannel(), MircColors.BROWN + " ,...
3
public static byte[] loadFile(final String path) { Preconditions.checkNotNull(path); InputStream fis = null; try { System.out.println(path); fis = new FileInputStream(path); BufferedInputStream bis = new BufferedInputStream(fis); byte[] byteArra...
3
public int evalRPN(String[] tokens) { //assume the length is greater than 3 final int len = tokens.length; Integer result = new Integer(0); Stack stack = new Stack(); for(int i = 0; i < len; i++){ if(!isOperator(tokens[i])) stack.push(Integer.valueOf(tokens[i])); else{ Integer operand2 = stack.p...
6
private void openSerialPort() { Boolean foundPort = false; //Ist schon ein Port geoeffnet wird nichts gemacht if (serialPortOpen != false) { System.out.println("Serialport already opened"); return; } String selectedPort = (String) comPortComboBox.getSelectedItem(); if(!selectedPort.conte...
5
private static String GonCalculate(int[] nodes) { int gonCount = nodes.length / 2; int[] result = new int[gonCount * gonCount]; ArrayList<Integer> nodeList = new ArrayList<Integer>(); for (int i = 0; i < nodes.length; i++) { nodeList.add(nodes[i]); } for (int...
9
public void addKeyDefinition(KeyDefinition keyDef) throws XPathException { if (keyDefinitions.isEmpty()) { collationName = keyDef.getCollationName(); } else { if ((collationName == null && keyDef.getCollationName() != null) || (collationName != null && !collat...
9
public void dispose(){ for(Texture texture : name2texture.values()){ texture.dispose(); } this.spriteBatch.dispose(); }
1
public static LinkedListNode partition ( LinkedListNode head, int x ) { int listSize = getListSize(head); LinkedListNode nd = head; LinkedListNode pre = new LinkedListNode(-1); pre.next = head; LinkedListNode dum = pre; for ( int i=0; i != listSize; ++i ) { LinkedListNode cur = nd; if (...
2
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYDifferenceRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYDifferenceRenderer that = (XYDifferenceRend...
8
private void constructTree(TreeElement<TreeValue> place, TreeValue value, int id) throws AlreadyExistException{ // choose right or left way if (place.getId() > id) { // add if empty if (place.hasLeftSon()) { constructTree(place.getLeftSon(), value, id); ...
4
public void addOffset(int bhw,int p,int val,int[] encoding) { p=p-1; String o=Integer.toBinaryString(val); if(val>(Math.pow(2, p)*bhw-1) || val<-(Math.pow(2, p)*bhw)) { System.out.println("!---------- ERROR: Offset out of range ----------!"); System.exit(0); ...
4
@Override public void actionPerformed(ActionEvent actionEvent) { Object src = actionEvent.getSource(); for (JButton bt : colorButtons) { if (src == bt) { currentColorButton.setText(bt.getText()); currentColorButton.setForeground(bt.getForeground()); ...
7
@Override public StateBuffer execute(StateBuffer in) { StateBuffer curBuffer = new StateBuffer(); for(State s : in.getStates()) skipToStart(curBuffer, s); StateBuffer goalBuffer = new StateBuffer(); // boolean first = true; TreeMap<Integer, StateBuffer> next = new TreeMap<Integer, StateBuffer>(); if (...
4
private void loadAllSuitesAndCases() throws InstantiationException, IllegalAccessException { Set<Class<? extends TestCase>> caseClases = getAllTestCaseClasses(); for (Class<? extends TestCase> caseClass : caseClases) { if (isIgnore(caseClass)) { continue; } String packageName = caseClass.getPack...
7
* @return The row, or <code>null</code> if none is found. */ public Row overRow(int y) { List<Row> rows = mModel.getRows(); int pos = getInsets().top; int last = getLastRowToDisplay(); for (int i = getFirstRowToDisplay(); i <= last; i++) { Row row = rows.get(i); if (!mModel.isRowFiltered(row)) { po...
4
public void setCutOffMatrix(float cutoff) { if (cutoff <= 0) throw new IllegalArgumentException("cutoff<=0"); rCutOff = cutoff; double[] sig = new double[Element.NMAX]; sig[ID_NT] = nt.getSigma(); sig[ID_PL] = pl.getSigma(); sig[ID_WS] = ws.getSigma(); sig[ID_CK] = ck.getSigma(); sig[ID_MO] = mo.getS...
8
public static int dajTrenutniBrojGostiju() { Session session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery("from " + Boravak.class.getName()); List<Boravak> sviBoravci = (List<Boravak>)q.list(); session.close(); Date today = new Date(); int trBroj = 0; for(Borav...
3
@Override public void act() { robot.setAhead(1000); if ((new Random().nextInt(3) + 1) == 1) { robot.turnRight((new Random().nextInt(3) + 1) * 30); } if ((new Random().nextInt(5) + 1) == 1) { randomColor(); } }
2
private static boolean insertDrug(Drug bean, PreparedStatement stmt) throws SQLException{ stmt.setString(1, bean.getDrugName()); stmt.setString(2, bean.getDescription()); stmt.setInt(3, bean.getQuantity()); stmt.setBoolean(4, bean.isControlFlag()); stmt.setString(5, bean.getSideEffect()); int affected =...
1
private DefaultTableModel makeModel() { DefaultTableModel model = new DefaultTableModel(null ,columnNames){ private static final long serialVersionUID = 1L; public boolean isCellEditable(int row, int col) { if (col!=6) return false; return true; } }; return model; }
1
@FXML private void handleMenuReportItems(ActionEvent event) { File file = new File("商品情報一覧.txt"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { bw.write(String.format("%s\t%s\t%s\t%s\t%s\r\n", "バーコード", "商品名", "単価", "仕入先", "部門")); tr...
3
public boolean isBalancedNoStorage(treeNode root) { if (root == null) return true; if (!isBalancedNoStorage(root.leftLeaf)) return false; if (!isBalancedNoStorage(root.rightLeaf)) return false; int depthLeft = depthOfNodeNoStorage(root.leftLeaf); int depthRight = depthOfNodeNoStorage(root.rightLea...
5
private void equipCommand(String input, Player hero) { boolean pass = false; Equipment original = null; //The original equipment that was on the player Equipment temp = null; //The equipment found in the players inventory for (Item i : hero.getInventory()) { for (String s : ...
9
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the // container // has not yet been calculated so lets ask for the maximum. ...
7
@Override public void propertyChange(PropertyChangeEvent evt) { if(evt.getPropertyName().equals(GameModel.EVENT_ADDED_SCORE)) { if((Integer)evt.getNewValue() > 1) { addedScore = (Integer)evt.getNewValue(); timerOn = true; timerStart = Calendar.getInstance().getTimeInMillis(); } } }
2
private int opPrecedence(Operator opr, int sid) { if (opr==null) { return Integer.MIN_VALUE; } // not an operator else if(opr.unary==NO_SIDE || opr.unary!=sid) { return (sid==LEFT_SIDE ? opr.precedenceL : opr.precedenceR); } // operator is binary...
4
private DensityMap createDensityMap(int numRateBoxes, int numTimeBoxes) { double maxTreeHeight = 0; double minRate = 1; double maxRate = 1; for (RootedTree tree : treeList) { double thisHeight = tree.getHeight(tree.getRootNode()); if (thisHeight > maxTreeHeight) maxTreeHeight = thisHeight; Set<Node...
8
private void timeStep(){ for (int i = 0; i < beings.size(); i++) { fight(i); } for (int i = 0; i < beings.size(); i++){ move(i); } }
2
private void dealTag(Tag tag, WebPage srb) throws Exception { NodeList list = tag.getChildren(); if (list != null) { NodeIterator it = list.elements(); while (it.hasMoreNodes()) { parserNode(it.nextNode(), srb); } it = null; } list = null; }
2
public void render(GameContainer gc, Graphics g) throws SlickException { for (Ray r : rays) { r.render(gc, g); } }
1