text
stringlengths
14
410k
label
int32
0
9
public void tick() { // Calculating FPS if (this.fps > 0) this.delta = 1000 / this.fps; if (!Param.isPause()) { if (!Param.isTitleScreen() && !Param.isEndScreen()) { // Update the offset location offX = (player.getX() - dimension.width / 2) + index; offY = (player.getY() - dimension.height / 2) ...
5
private void addModeConversionAndModeRuleConflict(final Theory theory, final String str) throws ParserException { int l = -1; if ((l = str.indexOf(DflTheoryConst.SYMBOL_MODE_CONVERSION)) > 0) { String o = str.substring(0, l).trim(); String c = str.substring(l + DflTheoryConst.SYMBOL_MODE_CONVERSION.length())....
5
public void flip() { Wire wire1 = ports[0].myWire; Wire wire2 = ports[1].myWire; if (wire1 != null) { if (wire1.fromPort == ports[0]) { wire1.fromPort = ports[1]; } if (wire1.toPort == ports[0]) { wire1.toPort = ports[1]; ...
8
private void growth() { for (int i = 0; i < _cities.size(); i++) { _cities.get(i).increasePopulation(); } for (int i = 0; i < _econ.size(); i++) { _econ.get(i).grow(); } }
2
private static ArrayList<String> parenthSubExpr(String expr, int splitIndex, boolean leftResult, boolean rightResult, HashMap<String, ArrayList<String>> cache) { ArrayList<String> leftSub = parenthExpr(expr.substring(0, splitIndex), leftResult, cache); ArrayList<String> rightSub = parenthExpr( expr.su...
8
public DatePane() { this.setLayout(new BorderLayout()); this.add(total, BorderLayout.NORTH); this.add(search, BorderLayout.CENTER); }
0
public void setElement(int x, int y, int value) { if (x < matrix.length && y < matrix[x].length) { matrix[x][y] = value; } }
2
private Stock fromJson(JSONObject stockJson) { try { Stock ret = new Stock(); ret.setSymbol(stockJson.getString("Symbol")); if (!stockJson.isNull("LastTradePriceOnly")) ret.setAsk((float) stockJson.getDouble("LastTradePriceOnly")); if (!stockJson.isNull("Bid")) ret.setBid((float) stockJson.getDoub...
5
public void run() { ServerSocket svrSkt = null; try { svrSkt = new ServerSocket(port+2); // Set up socket } catch (IOException e) { // IF socket cant be established System.err.println("Could not listen on port: "+(port+2)); System.exit(-1); } while (true) { try { // On new connection, create a ...
3
public static synchronized TaskManager getInstance() { if (instance == null) { instance = new TaskManager(); } return instance; }
1
@Override public void setCorrectAnswer() { answer = InputHandler.getString("Is the answer true or false?").trim().toLowerCase().indexOf("true")>=0?true:false; }
1
public static String lineEndingToPlatform(String line_ending) { if (line_ending.equals(LINE_END_MAC)) { return PLATFORM_MAC; } else if (line_ending.equals(LINE_END_WIN)) { return PLATFORM_WIN; } else if (line_ending.equals(LINE_END_UNIX)) { return PLATFORM_UNIX; } else { System.out.println("Unknown ...
3
public double getHeight() { return height; }
0
@Override public int compareTo(Card arg0) { if(this.equals(arg0)) { return 0; } if(this.value > arg0.value) { return 1; } else if(this.value < arg0.value) { return -1; } else { if(this.silverNum > arg0.silverNum) { return 1; } else if(this.silverNum < arg0.silverNum) ...
5
private boolean performerIsInOhterDropZone(AbstractComponent performer) { if (performer instanceof Agent) { try { for (AbstractInteractionComponent comp : SimulationEngine .getInstance().getWorld().getInteractionComponents()) { if (comp instanceof DropZone) { if (((DropZone) comp).contains((Ag...
5
private boolean isMinimal (Description description, Document document, Object... optionalArguments) { if (description instanceof AttributeHolder && ((AttributeHolder) description).hasAttributes ()) { return false; } if (description instanceof InstantaneousEvent) { if (((I...
9
public static boolean isDigit(int c) { return c >= '0' && c <= '9'; }
1
@Override public void actionPerformed(ActionEvent evt) { System.out.println("VueNouvelleLocation::actionPerformed()") ; Object sourceEvt = evt.getSource() ; if(sourceEvt == this.bEnregistrer){ int indiceClient = cbClients.getSelectedIndex(); int numeroClient = numClients.get(indiceClient).intValue() ; S...
2
@Override public Article insert(Article obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("INSERT INTO Article (titre, resume, date, id) VALUES (?,?,?,?);"); pst.setString(1, obj.getTitlre()); ...
3
public void okGezinInvoer(Event evt) { Persoon ouder1 = (Persoon) cbOuder1Invoer.getSelectionModel().getSelectedItem(); if (ouder1 == null) { showDialog("Warning", "eerste ouder is niet ingevoerd"); return; } Persoon ouder2 = (Persoon) cbOuder2Invoer.getSelectionM...
8
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { ArrayList<Integer> subtypes = game.getSubTypes(ispawn); for (Integer i: subtypes) { Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(i); if (spriteIt != null) while (spriteIt.hasNext()) ...
4
@Override public List<String> getPermissions(String world) { List<String> perms = super.getPermissions(world); TotalPermissions plugin = (TotalPermissions) Bukkit.getPluginManager().getPlugin("TotalPermissions"); for (String group : inheritence) { try { Permissio...
3
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public void testForOffsetHoursMinutes_int_int() { assertEquals(DateTimeZone.UTC, DateTimeZone.forOffsetHoursMinutes(0, 0)); assertEquals(DateTimeZone.forID("+23:59"), DateTimeZone.forOffsetHoursMinutes(23, 59)); assertEquals(DateTimeZone.forID("+02:15"), DateTimeZone.forOffsetHoursMinut...
5
void solve1() { NHL nhl = new NHL(in); double win = 0; int count = 0; double predicts = 0; for (int i = 0; i < nhl.getAmountMatches(); i++) { double predict = nhl.makeTotalPredict(nhl.getMatch(i)); // out.println(predict); if (predict <= 0) { ...
4
public static Object getListener(Object bag, int index) { if (index == 0) { if (bag == null) return null; if (!(bag instanceof Object[])) return bag; Object[] array = (Object[])bag; // bag has at least 2 elements if it is array ...
9
public void method290(int y, int arg1, int x, int z) { GroundTile groundTile = groundTiles[z][x][y]; if (groundTile == null) { return; } WallDecoration wallDecoration = groundTile.wallDecoration; if (wallDecoration != null) { int offX = x * 128 + 64; int offY = y * 128 + 64; wallDecoration.x = off...
2
public void habilitarFunciones(int perfil){ String consulta="select per_id_perfil,per_id_modulo,per_id_tarea from permiso where per_id_perfil="+perfil; r_con.Connection(); ResultSet rs=r_con.Consultar(consulta); Vector<Vector<Integer>>modulosTarea=new Vector();...
5
@EventHandler public void SkeletonResistance(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.getZombieConfig().getDouble("Skeleton....
7
public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); String binN = Integer.toBinaryString(n); int first = 0; int second = 1; int count = 0; for (int i = 0; i < binN.length() - 1; i++) { int nRigh...
2
private final int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1, long old2, long active2) { if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjStartNfa_0(9, old0, old1, old2); try { curChar = input_stream.readChar(); } catch(java.io.IOException ...
9
@FXML private void handleBtnCancelAction(ActionEvent event) { clearFields(); }
0
protected void processReport() { try { log.info("Started the thread"); String error = checkFolder(reportFolder.getText()); if (!Utils.isEmpty(error)) { log.info("Error: " + error); Run.showErrorDialog(getSelfRef(), error); return; } boolean doMusic = allMusicCheckBox.isSelected(...
5
public static void Command(CommandSender sender) { if(!(sender instanceof Player)) me.Vinceguy1.ChangeGameMode.Functions.Message.Function(me.Vinceguy1.ChangeGameMode.ConfigClass.config.get("Messages.Errors.In-game Player").toString(), sender, null, null, true, false, false, null); else { Player player = (P...
7
@Override public void doPivot(Integer pivotHoriz, Integer pivotVert) { // { Preconditions assert (this.model.getConstraints().size() > 0) : "Cannot do pivot without constraints"; assert (this.model.getObjfuncVariables().size() > 0) : "Cannot do pivot with an empty objective-function"; assert (...
8
public void setMatch(String match) {this.match = match;}
0
public boolean isElement() { if(elements.length == 1) return true; return false; }
1
private void myListMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_myListMouseReleased // TODO add your handling code here: if( myList.getSelectedIndex() != -1 && evt.isPopupTrigger() ) { UserListPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } }//GEN-LAST:e...
2
private void updateHeroDirection(Decision turn) { if(turn == Decision.TURN_LEFT) { if(heroDirection == Direction.UP) { heroDirection = Direction.LEFT; } else if(heroDirection == Direction.DOWN) { heroDirection = Direction.RIGHT; } else if(heroDirection == Direction.LEFT) ...
7
private void paySalary(String[] data){ int salarySize; long id; GregorianCalendar date = null; try { salarySize = Integer.parseInt(data[1]); id = Long.parseLong(data[2]); if(data.length == 4) date = parseDate(data[3]); Employee em = container.find(id); if(date == null){ em.paySalary(sala...
7
public void update(){ if(alunoTurma != null){ Turma t = this.alunoTurma.getTurma(); if(t != null){ this.lblNumTurma.setText(Integer.toString(t.getNumeroTurma())); this.lblPeriodo.setText(t.getPeriodoLetivo()); this.lblDisciplina.setText( ...
3
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Telefone)) { return false; } Telefone other = (Telefone) object; if ((this.idTelefone == null && other.idTelefo...
5
@Override public void caseAVetorVariavel(AVetorVariavel node) { inAVetorVariavel(node); if(node.getFechaColchete() != null) { node.getFechaColchete().apply(this); } if(node.getNumInt() != null) { node.getNumInt().apply(this); } ...
4
public static void stopTest(){ /*try{ if (threadExamineAlgorythm.isAlive()) threadExamineAlgorythm.stop(); }catch(NullPointerException ex){ *//* NOP *//* }*/ interruptedProcess = true; }
0
protected boolean validateNode(Node<T> node) { Node<T> lesser = node.lesser; Node<T> greater = node.greater; boolean lesserCheck = true; if (lesser != null && lesser.id != null) { lesserCheck = (lesser.id.compareTo(node.id) <= 0); if (lesserCheck) ...
7
private static void addButtonChoosePanelBuilderListener(final CustomButton a) { a.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (!Database.loaded) return; final JFrame jf = new JFrame(a.getText()); jf.setSize(1300, 650); jf.setVisible...
3
public void printAllEdges() { for(Edge e : edges) System.out.println(e); }
1
public static IntTreeBag union(IntTreeBag b1, IntTreeBag b2){ IntTreeBag newBag = new IntTreeBag();//creates a new bag if((b1 == null) || (b2 == null)){ throw new IllegalArgumentException(" at least one bag is empty"); }else{ newBag = (IntTreeBag) b1.clone(); } newBag.addAll(b2)...
2
private void saveMCD(PrintStream out) throws IOException { out.println("<mcd>"); for (Iterator<ZElement> e = mcd.enumElements(); e.hasNext();) { MCDObjet o = (MCDObjet) e.next(); if (o instanceof MCDEntite) out.println("<entite nom=\"" + o.getName() + "\" x=\...
5
@Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (!(sender instanceof Player)) { Main.courier.send(sender, "requires-player", label); return true; } final Player player = (Player) send...
3
public SendInvoiceResponse(Map<String, String> map, String prefix) { if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) { String newPrefix = prefix + "responseEnvelope" + '.'; this.responseEnvelope = new ResponseEnvelope(map, newPrefix); } if( map.containsKey(prefix + "invoiceID") ) { th...
5
/* */ public static void main(String[] paramArrayOfString) { /* */ try { /* 159 */ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); /* */ } /* */ catch (Exception localException) { /* */ } /* 163 */ /* 164 */ System.setProperty("java.net.preferIPv...
9
public void decodeAndRender(int id, String message) throws JSONException { switch (id) { case 100: // Message.java Message chatMessage = enc.chattMessageDecode(message); lg.chatgui.chatUpdate(chatMessage.message, chatMessage.user); break; case 101: // Create session case 102: // Join session this....
4
public void setLoginpwd(String loginpwd) { this.loginpwd = loginpwd; }
0
public Item(ItemType it, int l) { itemType = it; level = l; if(level < 1) { level = 1; } if(level > 20) { level = 20; } }
2
private boolean checkFeetCollision(Tile[][] tiles) { for (int h = 0; h < tiles.length; h++) { for (int w = 0; w < tiles[0].length; w++) { if (tiles[h][w].getHitbox() != null && getFeetHitbox().collisionCheck(tiles[h][w].getHitbox())) { return true; } } } r...
4
private void connect(){ try { if(!is_secondary()){ name ="rmi://127.0.0.1:9090/server1"; Naming.rebind(name, server); System.out.println("Server 1"); connectBackupServer(); if(backupServer != null) { System.out.println("hier!!!!!!!!!"); db.refresh(); backupServer.requestInit(); ...
4
public static void main(String[] args) { //首先打开通道 try (AsynchronousServerSocketChannel serverSocketChannel = AsynchronousServerSocketChannel.open()) { //是否打开 if (serverSocketChannel.isOpen()) { //支持的optiosn Set<SocketOption<?>> socketOptions = serv...
8
public void changeSelection (int row, int column, boolean toggle, boolean extend) { super.changeSelection (row, column, toggle, extend); myMultSimAct.viewAutomaton(this); }
0
protected void configurePopupMenu(JPopupMenu popupMenu) { boolean canType = isEditable() && isEnabled(); // Since the user can customize the popup menu, these actions may not // have been created. if (undoMenuItem!=null) { undoMenuItem.setEnabled(undoAction.isEnabled() && canType); redoMenuItem.setEnabl...
7
@Override public long doRead(Master master, ReadRequest readRequest) { incrementAccessAndMaybeRecalibrate(master); long fileId = readRequest.getFileId(); Location accessLoc = readRequest.getLocation(); MasterMeta fm = master.map.get(fileId); if (fm == null || fm.instances.size() == 0) { retu...
9
private void close(Connection conn, PreparedStatement stmt, ResultSet rs) { if (rs != null) { try { rs.close(); } catch (Exception ex) { } } if (stmt != null) { try { stmt.close(); } catch (E...
6
private static void dump(char[] ram, int start, int len) throws Exception { DataOutputStream dos = new DataOutputStream(new FileOutputStream("mem.dmp")); for (int i = 0; i < len; i++) { dos.writeChar(ram[start + i]); } dos.close(); for (int i = 0; i < len; ) { String str = Integer.to...
6
public static void deleteProduct(Integer ID) { try { Database db = dbconnect(); String query = "DELETE FROM product " + "WHERE PID = ?"; db.prepare(query); db.bind_param(1, ID.toString()); db.executeUpdate(); db.close(); } catch(SQ...
1
private boolean isPartOf(Component c, Map<SLSide, List<Component>> map) { for (SLSide s : SLSide.values()) if (map.get(s).contains(c)) return true; return false; }
2
public int itemIndex(String itemName){ if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered"); int index = -1; int jj=0; boolean test = true; while(test){ if(itemName.trim().equalsIgnoreCase(this.itemNames[jj].trim())){ ind...
4
public static int getPropertyDefaultAsInt(PropertyContainer container, String key) { if (container != null) { Object value = container.getPropertyDefault(key); return convertObjectToInt(value); } else { throw new IllegalArgumentException("Provided PropertyContainer was null."); } }
1
private void updateCurrentValues(NodeList nodeList){ // Iterate through the list of values to update the xml document for (int i = 0; i < nodeList.getLength(); i++) { Node currentNode = nodeList.item(i); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { // Cre...
6
public boolean isAllEdgeVisited() { for (Edge<T> e : edges) { if (! e.visited) return false; } return true; }
2
public IAction find(String url, IContext context) { IAction action = _actions.get(url); if (null != action) return action; Pattern p; for (IAction anAction : _actions.values()) { p = Pattern.compile(anAction.getRoute()); Matcher m = p.matcher(url); if (m.find()) { String[] groupsName = anAction....
6
public LinkedList scan(ListIterator listiterator, LinkedList linkedlist, LinkedList linkedlist1) { while(listiterator.hasNext()) { XMLNode xmlnode = (XMLNode)listiterator.next(); if(xmlnode != null) switch(xmlnode.XMLType) { ca...
7
private int sink(int i) { Key t = pq[i]; // Save key for later restoring while (2 * i + 1 <= N) // while pq[i] has both the children { int j = 2 * i + 1; // rightmost child // 1st comparision: Making j point to the least of the two // children as pq[i] should sink to j if (greater(pq[j], pq[j - 1]))...
5
public static Value<?> convertMessageToBencode (Message msg) { Objects.requireNonNull(msg); if (msg instanceof ErrorMessage) { return convertErrorMessage((ErrorMessage) msg); } else if (msg instanceof QueryMessage) { return convertQueryMessage((QueryMessage) msg); ...
4
public List<String> getValidationErrors() { List<String> errors = new ArrayList<String>(); if (username == null || username.length() == 0) errors.add("Username is required"); if (button == null || button.length() == 0) errors.add("Button is required"); if (errors.size() > 0) return...
7
private void processFile(File dir) { String filepath = dir.getPath(); filepath = filepath.substring(root.length(), filepath.length()); filepath = filepath.substring(0, filepath.lastIndexOf(File.separator)); if (filepath != null && !filepath.equals("")) { filepath = File.separ...
9
public EntityManager getEntityManager() { return entityManager; }
0
public static <E> void rightShift (E[] array, int shift) { if (shift > 0) { // save items displaced off of right end ArrayList<E> temp = new ArrayList<E>(); int length = array.length; for (int i = length - shift ; i < length; i++) { temp.add(array[i]); } // copy in place for (int i = leng...
4
@Override public final void setShipInputBoard() { shipBoard.setLayout(new GridLayout(PlayerInterface.LETTERS.length, PlayerInterface.NUMBERS.length)); grid = new JButton[PlayerInterface.LETTERS.length][PlayerInterface.NUMBERS.length]; for (int y = 0; y < PlayerInterface.LETTERS.length; y++) { for (int x ...
7
private void setBalance(BigInteger balance) throws IllegalArgumentException { if (! this.canHaveAsBalance(balance)) throw new IllegalArgumentException(); this.balance = balance; }
1
private void showButtonClicked(ActionEvent e){ if (rStart.isSelected()){ sort(new StartComparator()); } else if (rName.isSelected()){ sort(new NameComparator()); } else if (rAge.isSelected()){ sort(new AgeComparator()); } else if (rTime.isSelected()){ sort(new T...
4
public static void debug(String msg) { logger.setPriority(Priority.DEBUG); if (console_write) { console(msg); } if (log_write) { logger.debug(msg); } logger.unsetPriority(); }
2
public static String readToken(InputStream in, int delim, String enc, int maxLength) throws IOException { // note: we avoid using a ByteArrayOutputStream here because it // suffers the overhead of synchronization for each byte written int buflen = maxLength < 512 ? maxLength : 512; /...
8
@Test public void getSession() { System.out.println(scraper.sessionExists(50, 4)); System.out.println(scraper.getSessionQuery(34, 1)); ArrayList<Speaker> speakers = scraper.getSession("&Session=jd41l1se"); //display the names System.out.println("=====SPEAKER...
3
public static void main(String args[]) { int gallons; // holds the number of gallons double liters; // holds the number of liters gallons=0; liters=0; for ( gallons = 0; gallons < 101; gallons++) { liters = gallons * 3.7854; System.out.println (gallons + " gallons is " + liters + " liters. "); ...
2
public final Output createCustomOutput(final String implementor, final String[] params) throws CustomOutputException { Class<Output> customClassToCreate = Output.class; Output custom = customClassToCreate.cast(createCustom(implementor, params, customClassToCreate)); if (custom == null) { throw new CustomOutput...
1
public static void main(String[] args) throws XMLStreamException, FactoryConfigurationError, IOException { String eadfile = args[0]; String identifier; String attrName=null; String attrValue=null; if (args.length >= 2) { if (args[1].equals(DID)) { id...
6
public int kSmall(int[] arrA, int start, int end, int k) { int left = start; int right = end; int pivot = start; while (left <= right) { while (left <= right && arrA[left] <= arrA[pivot]) left++; while (left <= right && arrA[right] >= arrA[pivot]) right--; if (left < right) { swap(arrA, lef...
8
public int getCorrectSize() { if (correctSize == 0) { correctSize = 72; int[] sizes = {18,27,36,45,54,63,72}; for (int size : sizes) { if (Kit.list.size() + 4 <= size && correctSize > size) { correctSize = size; } } } return correctSize; }
4
private ApplicationType(String name) { this.name = name; }
0
@Override public void run() { arr_data = Customer.showAll(); data = new Object[arr_data.size()][]; for (int i = 0; i < arr_data.size(); i++) { data[i] = arr_data.get(i).Array(); } this.fireTableDataChanged(); }
1
private void btnAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarActionPerformed Cliente editar = null; ClienteDAO dao = new ClienteDAO(); try { editar = dao.Abrir(this.idDoClienteSelecionado); } catch (ErroValidacaoException ex...
2
private void doEditJH(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException { String jhId = StringUtil.toString(request.getParameter("jhId")); if(!StringUtil.isEmpty(jhId)) { LianXiWoMen lxfs = null; try { ...
3
@Test public void test() throws SQLException { Hive hive = new Hive(); hive.createTable(); hive.loadData(); }
0
public boolean validateUserName(String userName) throws IllegalAccessError, SocketTimeoutException { boolean answer = false; try { clientSocket.Escribir("USUARIO " + userName + '\n'); serverAnswer = clientSocket.Leer(); } catch (IOException e) { throw new SocketTimeoutException(); } if(serverAnswer !...
4
@Override public void performPhysics(Matter matter, Planet nearbyPlanet) { matter.setVerticalVelocity(getNewVerticalVelocity(matter, nearbyPlanet.getGravity())); matter.setHeight(getNewHeight(matter)); boolean hasHitGround = matter.getHeight() < 0; if (hasHitGround) { performHitGroundPhysics(matter, nearby...
1
private void valitseSiirto(Kentta kentta, int syvyys, int pelinumero) { if(matintarkastaja.matti(kentta, omaPelinumero)) { nykyinenArvo += laskeMattipainotus(syvyys); return; } if(matintarkastaja.matti(kentta, vaihdaPelinumero(omaPelinumero))) { nykyinenArvo -...
8
public void refresh() { if (dataType.equals("video")) { showVideos(); } else if (dataType.equals("news")) { showNews(); } else if (dataType.equals("temperature")) { showTemperature(); } else if (dataType.equals("log")) { showLog(); } }
4
@Test public void determineHighestStraight_whenHandContainsAtoT_returnsAceHighStraight() { Hand hand = findHighestStraight(fourFlushWithStraight()); assertEquals(HandRank.Straight, hand.handRank); assertEquals(Rank.Ace, hand.ranks.get(0)); }
0
private void randomMove() { switch (random.nextInt(4)) { case 0: currentMove = MoveDir.MOVE_LEFT; break; case 1: currentMove = MoveDir.MOVE_RIGHT; break; case 2: currentMove = MoveDir.MOVE_UP; break; case 3: currentMove = MoveDir.MOVE_DOWN; break; } gameObject.setMoveDir(currentMov...
4
public static MyStack<Integer> duplicateStack(MyStack<Integer> original) { MyStack<Integer> result = new ArrayStack<Integer>(); MyQueue<Integer> temp = new ArrayQueue<Integer>(); /*reverse the order of original elements*/ while(!original.isEmpty()){ temp.enqueue(original.pop()); } while(!temp.isEmpty(...
4