Example usage for java.util Queue remove

List of usage examples for java.util Queue remove

Introduction

In this page you can find the example usage for java.util Queue remove.

Prototype

E remove();

Source Link

Document

Retrieves and removes the head of this queue.

Usage

From source file:edu.emory.cci.aiw.umls.UMLSDatabaseConnection.java

public List<TerminologyCode> getTermSubsumption(TerminologyCode code)
        throws UMLSQueryException, UMLSNoSuchTermException {
    validateCode(code);//from ww w .  j a  v a 2  s  .com

    if (!codeExists(code)) {
        throw new UMLSNoSuchTermException("No such terminology code: " + code);
    }

    List<TerminologyCode> result = new ArrayList<TerminologyCode>();

    // stores the unexpanded children
    Queue<TerminologyCode> descendants = new LinkedList<TerminologyCode>();

    result.add(code);
    descendants.addAll(getChildrenByCode(code));

    // loop through all children until the queue is empty, like BFS/DFS
    while (!descendants.isEmpty()) {
        // dequeue from the descendants and set as current term
        TerminologyCode current = descendants.remove();

        // add the current child under examination to the result set
        result.add(current);

        // get all of the current term's children and them to the queue
        List<TerminologyCode> curChildren = getChildrenByCode(current);

        if (!curChildren.isEmpty()) {
            descendants.addAll(curChildren);
        }
    }

    return result;
}

From source file:com.intel.ssg.dcst.panthera.parse.SkinDriver.java

private CommandProcessorResponse runInternal(String command) throws CommandNeedRetryException {
    errorMessage = null;//w  w  w .  j av a  2s.  co  m
    SQLState = null;
    downstreamError = null;

    if (!validateConfVariables()) {
        return new CommandProcessorResponse(12, errorMessage, SQLState);
    }

    HiveDriverRunHookContext hookContext = new HiveDriverRunHookContextImpl(conf, command);
    // Get all the driver run hooks and pre-execute them.
    List<HiveDriverRunHook> driverRunHooks;
    try {
        driverRunHooks = getHooks(HiveConf.ConfVars.HIVE_DRIVER_RUN_HOOKS, HiveDriverRunHook.class);
        for (HiveDriverRunHook driverRunHook : driverRunHooks) {
            driverRunHook.preDriverRun(hookContext);
        }
    } catch (Exception e) {
        errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
        SQLState = ErrorMsg.findSQLState(e.getMessage());
        downstreamError = e;
        console.printError(errorMessage + "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e));
        return new CommandProcessorResponse(12, errorMessage, SQLState);
    }

    // Reset the perf logger
    PerfLogger perfLogger = PerfLogger.getPerfLogger(true);
    perfLogger.PerfLogBegin(LOG, PerfLogger.DRIVER_RUN);
    perfLogger.PerfLogBegin(LOG, PerfLogger.TIME_TO_SUBMIT);

    int ret;
    synchronized (compileMonitor) {
        ret = compile(command);
    }
    if (ret != 0) {
        releaseLocks(ctx.getHiveLocks());
        return new CommandProcessorResponse(ret, errorMessage, SQLState);
    }

    boolean requireLock = false;
    boolean ckLock = checkLockManager();

    if (ckLock) {
        boolean lockOnlyMapred = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_LOCK_MAPRED_ONLY);
        if (lockOnlyMapred) {
            Queue<Task<? extends Serializable>> taskQueue = new LinkedList<Task<? extends Serializable>>();
            taskQueue.addAll(plan.getRootTasks());
            while (taskQueue.peek() != null) {
                Task<? extends Serializable> tsk = taskQueue.remove();
                requireLock = requireLock || tsk.requireLock();
                if (requireLock) {
                    break;
                }
                if (tsk instanceof ConditionalTask) {
                    taskQueue.addAll(((ConditionalTask) tsk).getListTasks());
                }
                if (tsk.getChildTasks() != null) {
                    taskQueue.addAll(tsk.getChildTasks());
                }
                // does not add back up task here, because back up task should be the same
                // type of the original task.
            }
        } else {
            requireLock = true;
        }
    }

    if (requireLock) {
        ret = acquireReadWriteLocks();
        if (ret != 0) {
            releaseLocks(ctx.getHiveLocks());
            return new CommandProcessorResponse(ret, errorMessage, SQLState);
        }
    }

    ret = execute();
    if (ret != 0) {
        //if needRequireLock is false, the release here will do nothing because there is no lock
        releaseLocks(ctx.getHiveLocks());
        return new CommandProcessorResponse(ret, errorMessage, SQLState);
    }

    //if needRequireLock is false, the release here will do nothing because there is no lock
    releaseLocks(ctx.getHiveLocks());

    perfLogger.PerfLogEnd(LOG, PerfLogger.DRIVER_RUN);
    perfLogger.close(LOG, plan);

    // Take all the driver run hooks and post-execute them.
    try {
        for (HiveDriverRunHook driverRunHook : driverRunHooks) {
            driverRunHook.postDriverRun(hookContext);
        }
    } catch (Exception e) {
        errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
        SQLState = ErrorMsg.findSQLState(e.getMessage());
        downstreamError = e;
        console.printError(errorMessage + "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e));
        return new CommandProcessorResponse(12, errorMessage, SQLState);
    }

    return new CommandProcessorResponse(ret);
}

From source file:playground.sergioo.ptsim2013.qnetsimengine.PTQLink.java

void makeVehicleAvailableToNextDriver(QVehicle veh, double now) {

    /*//from www .  ja v a 2  s.  com
     * Insert waiting passengers into vehicle.
     */
    Id<Vehicle> vehicleId = veh.getId();
    Set<MobsimAgent> passengers = this.passengersWaitingForCars.get(vehicleId);
    if (passengers != null) {
        // Copy set of passengers since otherwise we would modify it concurrently.
        List<MobsimAgent> passengersToHandle = new ArrayList<MobsimAgent>(passengers);
        for (MobsimAgent passenger : passengersToHandle) {
            this.unregisterPassengerAgentWaitingForCar(passenger, vehicleId);
            this.insertPassengerIntoVehicle(passenger, vehicleId, now);
        }
    }

    /*
     * If the next driver is already waiting for the vehicle, check whether
     * all passengers are also there. If not, the driver is not inserted
     * into the vehicle and the vehicle does not depart.
     */
    final Queue<MobsimDriverAgent> driversWaitingForCar = driversWaitingForCars.get(veh.getId());
    final boolean thereIsDriverWaiting = driversWaitingForCar != null && !driversWaitingForCar.isEmpty();
    if (thereIsDriverWaiting) {
        MobsimDriverAgent driverWaitingForPassengers = driversWaitingForPassengers
                .get(driversWaitingForCar.element().getId());
        if (driverWaitingForPassengers != null)
            return;
    }

    /*
     * If there is a driver waiting for its vehicle, and this car is not currently already leaving again with the
     * same vehicle, put the new driver into the vehicle and let it depart.
     */
    if (thereIsDriverWaiting && veh.getDriver() == null) {
        // set agent as driver and then let the vehicle depart
        veh.setDriver(driversWaitingForCar.remove());
        if (driversWaitingForCar.isEmpty()) {
            final Queue<MobsimDriverAgent> r = driversWaitingForCars.remove(veh.getId());
            assert r == driversWaitingForCar;
        }
        removeParkedVehicle(veh.getId());
        this.letVehicleDepart(veh, now);
    }
}

From source file:fr.inria.oak.paxquery.common.xml.navigation.NavigationTreePatternNode.java

/**
 *  Returns the descendants of this node in BFS order
 *  /*from ww w .  j av  a 2s.c o m*/
 *  @return all the descendant of the node in BFS order
 *  
 * */
public ArrayList<NavigationTreePatternNode> getBFSOrderedDescendants() {
    ArrayList<NavigationTreePatternNode> nodes = new ArrayList<NavigationTreePatternNode>();

    //BFS uses Queue data structure
    Queue<NavigationTreePatternNode> q = new LinkedList<NavigationTreePatternNode>();
    q.add(this);
    nodes.add(this);

    while (!q.isEmpty()) {
        NavigationTreePatternNode n = q.remove();

        for (NavigationTreePatternNode child : n.getChildrenList()) {
            nodes.add(child);
            q.add(child);
        }
    }

    return nodes;
}

From source file:au.org.ala.delta.intkey.directives.StandardIntkeyDirective.java

@Override
public IntkeyDirectiveInvocation doProcess(IntkeyContext context, String data) throws Exception {
    StringBuilder stringRepresentationBuilder = new StringBuilder();
    stringRepresentationBuilder.append(StringUtils.join(getControlWords(), " ").toUpperCase());

    List<String> tokens = ParsingUtils.tokenizeDirectiveCall(data);
    Queue<String> tokenQueue = new ArrayDeque<String>(tokens);

    IntkeyDirectiveInvocation invoc = buildCommandObject();

    if (_intkeyFlagsList != null && tokenQueue.size() > 0) {
        boolean matchingFlags = true;
        while (matchingFlags) {
            boolean tokenMatched = false;
            String token = tokenQueue.peek();

            if (token != null) {
                for (IntkeyDirectiveFlag flag : _intkeyFlagsList) {
                    if (flag.takesStringValue()) {
                        // Flag can have a string value supplied with it in
                        // format "/X=string", where X is the character
                        // symbol. Note that
                        // it is acceptable to supply such a flag without a
                        // following equals sign and string value.
                        if (token.matches("^/[" + Character.toLowerCase(flag.getSymbol())
                                + Character.toUpperCase(flag.getSymbol()) + "](=.+)?")) {

                            // If string value is not supplied, it defaults
                            // to empty string
                            String flagStringValue = "";

                            String[] tokenPieces = token.split("=");

                            // There should only be 0 or 1 equals sign. If
                            // more than none is supplied, no match.
                            if (tokenPieces.length < 3) {
                                if (tokenPieces.length == 2) {
                                    flagStringValue = tokenPieces[1];
                                }//from  w  ww  .  j  av a2 s .co m

                                BeanUtils.setProperty(invoc, flag.getName(), flagStringValue);
                                tokenQueue.remove();
                                tokenMatched = true;
                                stringRepresentationBuilder.append(" ");
                                stringRepresentationBuilder.append(token);
                                break;
                            }
                        }
                    } else {
                        if (token.equalsIgnoreCase("/" + flag.getSymbol())) {

                            BeanUtils.setProperty(invoc, flag.getName(), true);
                            tokenQueue.remove();
                            tokenMatched = true;
                            stringRepresentationBuilder.append(" ");
                            stringRepresentationBuilder.append(token);
                            break;
                        }
                    }
                }

                matchingFlags = tokenMatched;
            } else {
                matchingFlags = false;
            }
        }
    }

    // The arguments list needs to be generated each time a call to the
    // directive is processed. This is
    // because most arguments need to have provided with an initial value
    // which is used when prompting the user.
    // This initial value needs to be read out of the IntkeyContext at the
    // time of parsing.
    // E.g. the integer argument for the SET TOLERANCE directive will have
    // an initial value equal to the
    // the value of the tolerance setting before the call to the directive.
    List<IntkeyDirectiveArgument<?>> intkeyArgsList = generateArgumentsList(context);

    if (intkeyArgsList != null) {
        for (IntkeyDirectiveArgument<?> arg : intkeyArgsList) {
            Object parsedArgumentValue = arg.parseInput(tokenQueue, context,
                    StringUtils.join(_controlWords, " "), stringRepresentationBuilder);
            if (parsedArgumentValue != null) {
                BeanUtils.setProperty(invoc, arg.getName(), parsedArgumentValue);
            } else {
                // No argument value supplied, user cancelled out of the
                // prompt dialog.
                return null;
            }
        }
    }

    invoc.setStringRepresentation(stringRepresentationBuilder.toString());

    return invoc;
}

From source file:org.photovault.common.SchemaUpdateAction.java

/**
 Convert folder hiearchy from old schema to the new one
 *//*from  w  w w  .  ja  v  a  2  s.  c  om*/
private void convertFolders() throws SQLException {
    SchemaUpdateOperation oper = new SchemaUpdateOperation("COnverting folders");
    log.debug("Starting to convert folders to new schema");
    Session s = HibernateUtil.getSessionFactory().openSession();
    Session sqlSess = HibernateUtil.getSessionFactory().openSession();
    Connection conn = sqlSess.connection();

    Queue<Integer> waiting = new LinkedList<Integer>();
    Map<Integer, PhotoFolder> foldersById = new HashMap<Integer, PhotoFolder>();
    waiting.add(1);
    HibernateDAOFactory df = (HibernateDAOFactory) DAOFactory.instance(HibernateDAOFactory.class);
    df.setSession(s);
    PhotoFolderDAO folderDao = df.getPhotoFolderDAO();
    DTOResolverFactory rf = df.getDTOResolverFactory();
    PhotoFolder topFolder = folderDao.findByUUID(PhotoFolder.ROOT_UUID);
    if (topFolder == null) {
        topFolder = folderDao.create(PhotoFolder.ROOT_UUID, null);
        topFolder.setName("Top");
    }
    foldersById.put(1, topFolder);

    Statement countStmt = conn.createStatement();
    ResultSet countRs = countStmt.executeQuery("select count(*) from photo_collections");
    int folderCount = -1;
    if (countRs.next()) {
        folderCount = countRs.getInt(1);
    }
    countRs.close();
    countStmt.close();

    int convertedCount = 0;
    PreparedStatement stmt = conn.prepareStatement("select * from photo_collections where parent = ?");
    while (!waiting.isEmpty()) {
        int parentId = waiting.remove();
        PhotoFolder parent = foldersById.get(parentId);
        log.debug("Querying for folders with parent " + parentId);
        stmt.setInt(1, parentId);
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
            // Create the folder

            /*
             TODO: should the UUID be created algorithmically?
             Or better, how to ensure that UUIDs for folders that are part
             of external volume will always be the same?
             */
            fireStatusChangeEvent(new SchemaUpdateEvent(oper, convertedCount * 100 / folderCount));
            String uuidStr = rs.getString("collection_uuid");
            int id = rs.getInt("collection_id");
            log.debug("Creating folder with old id " + id + ", uuid " + uuidStr);
            UUID uuid = (uuidStr != null) ? UUID.fromString(uuidStr) : UUID.randomUUID();
            if (id == 1) {
                uuid = PhotoFolder.ROOT_UUID;
            }

            PhotoFolder f = folderDao.create(uuid, parent);
            VersionedObjectEditor<PhotoFolder> e = f.editor(rf);
            FolderEditor fe = (FolderEditor) e.getProxy();
            fe.setName(rs.getString("collection_name"));
            fe.setDescription(rs.getString("collection_desc"));
            e.apply();
            /*
             TODO: how to set the create time & last modified time without 
             exposing them to others?
             */
            log.debug("folder saved");
            foldersById.put(id, f);
            folderUuids.put(id, uuid);
            waiting.add(id);
            convertedCount++;
        }
        try {
            rs.close();
        } catch (SQLException e) {
            log.error("Error closing result set", e);
        }
    }
    s.flush();
    sqlSess.close();
    s.close();
    fireStatusChangeEvent(new SchemaUpdateEvent(oper, convertedCount * 100 / folderCount));
}

From source file:it.scoppelletti.mobilepower.app.FragmentLayoutController.java

/**
 * Ripristina lo stato dell&rsquo;istanza.
 * // ww  w.j a v  a 2s . c o m
 * <P>L&rsquo;attivit&agrave; ripristina lo stato dell&rsquo;istanza
 * {@code FragmentLayoutController} all&rsquo;interno del proprio metodo
 * {@code onRestoreInstanceState}.</P>
 * 
 * @param savedInstanceState Stato dell&rsquo;istanza.
 * @param fragmentCollector  Collettore dei frammenti di dettaglio. 
 */
public void onRestoreInstanceState(Bundle savedInstanceState,
        FragmentLayoutController.FragmentCollector fragmentCollector) {
    int n, oldPanelCount, tnId;
    String tag;
    ActivitySupport activitySupport;
    FragmentSupport fragment;
    FragmentManager fragmentMgr;
    FragmentLayoutController.BackStackChangedListener backStackListener;
    Queue<FragmentSupport> fragmentQueue;
    Queue<FragmentLayoutController.FragmentEntry> clonedQueue;

    if (savedInstanceState == null) {
        throw new NullPointerException("Argument savedInstanceState is null.");
    }
    if (fragmentCollector == null) {
        throw new NullPointerException("Argument fragmentCollector is null.");
    }

    if (!(myActivity instanceof ActivitySupport)) {
        myLogger.warn("Activity not implement interface ActivitySupport.");
        return;
    }

    oldPanelCount = savedInstanceState.getInt(FragmentLayoutController.STATE_PANELCOUNT, 0);
    if (oldPanelCount < 1) {
        myLogger.warn("Unexpected {}={} in saved instance state.", FragmentLayoutController.STATE_PANELCOUNT,
                oldPanelCount);
        return;
    }

    myLogger.debug("{}: current={}, saved instance state={}.",
            new Object[] { FragmentLayoutController.STATE_PANELCOUNT, myFrameCount, oldPanelCount });
    if (oldPanelCount == myFrameCount) {
        // Il numero di pannelli non e' cambiato:
        // Il sistema ha gia' ripristinato correttamente i frammenti.
        return;
    }

    fragmentQueue = new ArrayDeque<FragmentSupport>();
    fragmentCollector.collectFragments(fragmentQueue);

    // Ad ogni frammento associo il tag con il quale &egrave; stato
    // inserito
    clonedQueue = new ArrayDeque<FragmentLayoutController.FragmentEntry>();
    while (!fragmentQueue.isEmpty()) {
        fragment = fragmentQueue.remove();
        if (fragment == null) {
            myLogger.warn("Ignoring null.");
            continue;
        }

        tag = fragment.asFragment().getTag();
        if (StringUtils.isBlank(tag)) {
            myLogger.warn("Ignoring fragment with empty tag.");
            continue;
        }

        clonedQueue.offer(new FragmentLayoutController.FragmentEntry(fragment.cloneFragment(), tag));
    }

    fragmentQueue = null; // free memory

    activitySupport = (ActivitySupport) myActivity;
    fragmentMgr = activitySupport.getSupportFragmentManager();

    // Ripristino la configurazione dei frammenti iniziale
    for (n = fragmentMgr.getBackStackEntryCount(); n > 0; n--) {
        fragmentMgr.popBackStack();
    }

    if (myFrameCount > 1) {
        tnId = arrangeFragments(fragmentMgr, clonedQueue);
    } else {
        tnId = arrangePanel(fragmentMgr, clonedQueue);
    }

    if (Build.VERSION.SDK_INT < BuildCompat.VERSION_CODES.HONEYCOMB) {
        return;
    }

    // - Android 4.1.2
    // La barra delle azioni non e' correttamente aggiornata forse perche'
    // si assume che non ce ne sia bisogno con transazioni schedulate
    // durante il ripristino dell'attivita' (o magari perche' non e' proprio
    // previsto che si schedulino transazioni durante il ripristino
    // dell'attivita'):
    // Visto che l'esecuzione delle transazioni e' asincrona, devo
    // utilizzare un gestore degli eventi di modifica del back stack che
    // gestisca l&rsquo;ultima transazione che ho schedulato.
    backStackListener = new FragmentLayoutController.BackStackChangedListener(myActivity, fragmentMgr, tnId);
    fragmentMgr.addOnBackStackChangedListener(backStackListener);
}

From source file:com.github.rinde.rinsim.core.model.road.GraphRoadModel.java

@Override
protected MoveProgress doFollowPath(MovingRoadUser object, Queue<Point> path, TimeLapse time) {
    final Loc objLoc = verifyLocation(objLocs.get(object));
    Loc tempLoc = objLoc;//from   w w w. j a va  2s . co  m
    final MoveProgress.Builder mpBuilder = MoveProgress.builder(unitConversion, time);

    boolean cont = true;
    long timeLeft = time.getTimeLeft();
    while (timeLeft > 0 && !path.isEmpty() && cont) {
        checkMoveValidity(tempLoc, path.peek());
        // speed in internal speed unit
        final double speed = getMaxSpeed(object, tempLoc, path.peek());
        checkState(speed >= 0, "Found a bug in getMaxSpeed, return value must be >= 0, but is %s.", speed);
        // distance that can be traveled in current conn with timeleft
        final double travelableDistance = computeTravelableDistance(tempLoc, path.peek(), speed, timeLeft,
                time.getTimeUnit());
        checkState(travelableDistance >= 0d,
                "Found a bug in computeTravelableDistance, return value must be >= 0," + " but is %s.",
                travelableDistance);
        final double connLength = unitConversion.toInDist(computeDistanceOnConnection(tempLoc, path.peek()));
        checkState(connLength >= 0d,
                "Found a bug in computeDistanceOnConnection, return value must be " + ">= 0, but is %s.",
                connLength);

        double traveledDistance;
        if (travelableDistance >= connLength) {
            // jump to next node in path (this may be a node or a point on a
            // connection)
            tempLoc = verifyLocation(asLoc(path.remove()));
            traveledDistance = connLength;
            mpBuilder.addNode(tempLoc);
        } else {
            // travelableDistance < connLength
            cont = false;
            traveledDistance = travelableDistance;
            final Connection<?> conn = getConnection(tempLoc, path.peek());
            tempLoc = verifyLocation(
                    newLoc(conn, tempLoc.relativePos + unitConversion.toExDist(travelableDistance)));
        }
        mpBuilder.addDistance(traveledDistance);
        final long timeSpent = DoubleMath.roundToLong(
                unitConversion.toExTime(traveledDistance / speed, time.getTimeUnit()), RoundingMode.HALF_DOWN);
        timeLeft -= timeSpent;
    }
    time.consume(time.getTimeLeft() - timeLeft);
    // update location and construct a MoveProgress object
    objLocs.put(object, tempLoc);
    return mpBuilder.build();
}

From source file:edu.northwestern.jcr.adapter.fedora.persistence.FedoraConnector.java

/**
 * Gets a list of all descendants of a given object in Fedora 
 * repository through resource index, applying the filter
 * if available./* ww w  . j  ava  2  s . c o m*/
 * The result is in CSV format as if it is generated directly
 * from resouce index.
 *
 * @param pid pid of the object
 * @param filter filter condition applied - null if there is no filter
 * @return list of pid of the descendants that satisfy the filter condition
 */
public String[] listDescendantsRI(String pid, String filter) throws Exception {
    String[] members;
    Map<String, String> pathMap;
    Queue<String> queue;
    List<String> resultList;
    String nextPID;
    String parentPath;

    pathMap = new HashMap<String, String>();
    queue = new LinkedList<String>();
    resultList = new ArrayList<String>();

    if (pid == null) {
        try {
            members = listObjectsRI(null);
        } catch (Exception e) {
            throw e;
        }
    } else {
        // to be implemented
        members = listMembers(pid, null);
    }

    for (String member : members) {
        queue.add(member);
        pathMap.put(member, member);
    }

    if (filter != null) {
        if (pid == null) {
            try {
                members = listObjectsRI(filter);
            } catch (Exception e) {
                throw e;
            }
        } else {
            // to be implemented
            members = listMembers(pid, filter);
        }
    }

    // add only those satisfying the filter to the result list
    for (String member : members) {
        resultList.add(member);
    }

    while (!queue.isEmpty()) {
        nextPID = queue.remove();
        parentPath = pathMap.get(nextPID);

        members = listMembers(nextPID, null);

        for (String member : members) {
            queue.add(member);
            pathMap.put(member, parentPath + "," + member);
        }

        if (filter != null) {
            members = listMembers(nextPID, filter);
        }

        // add only those satisfying the filter to the result list         
        for (String member : members) {
            resultList.add(parentPath + "," + member);
        }
    }

    return (String[]) resultList.toArray(new String[0]);
}

From source file:candr.yoclip.ParserTest.java

@Test
public void getParsedArgument() {
    final ParserOptions<ParserTest> mockParserOptions = createMockParserParameters();

    final Queue<String> parameters = new LinkedList<String>();

    final Parser<ParserTest> testCase = new Parser<ParserTest>(mockParserOptions,
            createMockParserHelpFactory());
    assertThat("empty queue", testCase.getParsedArgument(parameters), nullValue());

    final String expectedParameter = "argument parameter";
    parameters.add(expectedParameter);/*w  w  w. ja  v  a  2  s  . c  om*/
    ParsedOption<ParserTest> parsedOption = testCase.getParsedArgument(parameters);
    assertThat("parsed parameter error", parsedOption.isError(), is(true));
    assertThat("queue size after parsed parameter error", parameters.size(), is(0));

    final ParserOption<ParserTest> mockArguments = createMockArguments();
    when(mockParserOptions.getArguments()).thenReturn(mockArguments);

    final String remainingParameter = "remaining parameter";
    parameters.add(expectedParameter);
    parameters.add(remainingParameter);
    parsedOption = testCase.getParsedArgument(parameters);
    assertThat("parsed parameter not error", parsedOption.isError(), is(false));
    assertThat("parser parameter", parsedOption.getParserOption(), is(mockArguments));
    assertThat("value", parsedOption.getValue(), is(expectedParameter));
    assertThat("queue size", parameters.size(), is(1));
    assertThat("remaining parameter", parameters.remove(), is(remainingParameter));
}