Package com.samskivert.util

Examples of com.samskivert.util.ArrayIntSet


        if (teams == null) {
            return null;
        }

        // compress the team indexes down
        ArrayIntSet set = new ArrayIntSet();
        int[][] newTeams = new int[teams.length][];
        Name[] plist = getPlayers();
        for (int ii=0; ii < teams.length; ii++) {
            set.clear();
            for (int jj=0; jj < teams[ii].length; jj++) {
                Name occ = players[teams[ii][jj]];
                if (occ != null) {
                    set.add(ListUtil.indexOf(plist, occ));
                }
            }
            newTeams[ii] = set.toIntArray();
        }

        return newTeams;
    }
View Full Code Here


    protected void reportWinnersAndLosers ()
    {
        int numPlayers = _playerOids.length;

        // set up 3 sets that will not need internal expanding
        ArrayIntSet winners = new ArrayIntSet(numPlayers);
        ArrayIntSet losers = new ArrayIntSet(numPlayers);
        ArrayIntSet places = new ArrayIntSet(numPlayers);

        for (int ii=0; ii < numPlayers; ii++) {
            BodyObject user = getPlayer(ii);
            if (user != null) {
                places.add(user.getPlaceOid());
                (_gameobj.isWinner(ii) ? winners : losers).add(user.getOid());
            }
        }

        Object[] args = new Object[] { winners.toIntArray(), losers.toIntArray() };

        // now send a message event to each room
        for (int ii=0, nn = places.size(); ii < nn; ii++) {
            DObject place = _omgr.getObject(places.get(ii));
            if (place != null) {
                place.postMessage(WINNERS_AND_LOSERS, args);
            }
        }
    }
View Full Code Here

     */
    public static IntSet getIntParameters (
        HttpServletRequest req, String name, String invalidDataMessage)
        throws DataValidationException
    {
        IntSet ints = new ArrayIntSet();
        String[] values = req.getParameterValues(name);
        if (values != null) {
            for (int ii = 0; ii < values.length; ii++) {
                if (!StringUtil.isBlank(values[ii])) {
                    ints.add(parseIntParameter(values[ii], invalidDataMessage));
                }
            }
        }
        return ints;
    }
View Full Code Here

TOP

Related Classes of com.samskivert.util.ArrayIntSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.