Example usage for java.util ListIterator previous

List of usage examples for java.util ListIterator previous

Introduction

In this page you can find the example usage for java.util ListIterator previous.

Prototype

E previous();

Source Link

Document

Returns the previous element in the list and moves the cursor position backwards.

Usage

From source file:org.mycore.common.xml.MCRXMLFunctions.java

/**
 * Helper function for xslImport URI Resolver and {@link #hasNextImportStep(String)}
 * @param includePart substring after "xmlImport:"
 *///ww w.  j  a v  a  2s  . co m
public static String nextImportStep(String includePart) {
    int border = includePart.indexOf(':');
    String selfName = null;
    if (border > 0) {
        selfName = includePart.substring(border + 1);
        includePart = includePart.substring(0, border);
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("get next import step for " + includePart);
    }
    // get the parameters from mycore.properties
    List<String> importList = Collections.emptyList();
    importList = MCRConfiguration.instance().getStrings("MCR.URIResolver.xslImports." + includePart,
            importList);
    if (importList.isEmpty()) {
        LOGGER.info("MCR.URIResolver.xslImports." + includePart + " has no Stylesheets defined");
    } else {
        ListIterator<String> listIterator = importList.listIterator(importList.size());

        if (selfName == null && listIterator.hasPrevious()) {
            return listIterator.previous();
        }

        while (listIterator.hasPrevious()) {
            String currentStylesheet = listIterator.previous();
            if (currentStylesheet.equals(selfName)) {
                if (listIterator.hasPrevious()) {
                    return listIterator.previous();
                } else {
                    LOGGER.debug("xslImport reached end of chain:" + importList);
                    return "";
                }
            }
            //continue;
        }
        LOGGER.warn("xslImport could not find " + selfName + " in " + importList);
    }
    return "";
}

From source file:edu.oregonstate.eecs.mcplan.SeriesAction.java

@Override
public void undoAction(final S s) {
    assert (done_);
    final ListIterator<A> itr = actions_.listIterator(actions_.size());
    while (itr.hasPrevious()) {
        itr.previous().undoAction(s);
    }//from  w  ww.  j a  va  2s.  c om
    done_ = false;
}

From source file:org.deteter.test.deleterTest.java

@Test
public void delete() {
    lista = new ArrayList<>();
    //File dir = new File("C:\\Users\\JORGE_000\\Desktop\\nexus-oss");
    File dir = new File(
            "c:\\abcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxyabcdefghijklmnopqrssttuvwxy");
    //FileUtils.deleteDirectory(dir);
    //FileUtils.deleteDirectory(dir);
    //FileDeleteStrategy.FORCE.delete(dir);
    agregar(dir);//from w  w w .  j a va  2  s. co  m
    System.out.println(dir.isDirectory());
    /*for (File f : lista) {
    try {
        System.out.println(f.getCanonicalPath());
    } catch (Exception ex) {
        System.out.println(ex);
    }
    }*/
    ListIterator<File> i = lista.listIterator(lista.size());
    try {
        while (i.hasPrevious()) {
            File f = i.previous();
            //f.delete();
            FileDeleteStrategy.FORCE.delete(f);
            //System.out.println(f.getCanonicalPath());
        }
        FileDeleteStrategy.FORCE.delete(dir);
    } catch (Exception ex) {
        System.out.println(ex);
    }
}

From source file:org.jbpm.logging.exe.LoggingInstance.java

List getCurrentOperationReversedActionLogs() {
    List actionLogs = new ArrayList();
    ProcessLog operationLog = (ProcessLog) compositeLogStack.getFirst();
    ListIterator listIterator = logs.listIterator(logs.size());
    ProcessLog processLog = (ProcessLog) listIterator.previous();
    while ((listIterator.hasNext()) && (processLog != operationLog)) {
        if (processLog instanceof ActionLog) {
            actionLogs.add(0, processLog);
        }// ww w.  j  ava 2  s . com
    }
    return actionLogs;
}

From source file:ListOfLists.java

public int lastIndexOf(Object o) {
    ListIterator e = listIterator(size());
    if (o == null) {
        while (e.hasPrevious()) {
            if (e.previous() == null)
                return e.nextIndex();
        }//from w ww .  jav  a2  s .c o m
    } else {
        Object el;
        while (e.hasPrevious()) {
            el = e.previous();
            if (el != null && el.equals(o))
                return e.nextIndex();
        }
    }
    return -1;
}

From source file:com.skelril.nitro.point.ValueMapping.java

public Collection<KeyType> satisfy(PointType value) {
    List<KeyType> results = new ArrayList<>();
    ListIterator<PointValue<KeyType, PointType>> it = values.listIterator(values.size());

    while (it.hasPrevious()) {
        PointValue<KeyType, PointType> cur = it.previous();

        PointType amt = pointTypeDiv.apply(value, cur.getPoints());
        value = pointTypeMod.apply(value, cur.getPoints());

        results.addAll(collect(cur.getSatisfiers(), amt));
    }//w ww .jav  a 2  s.  c  o  m
    return results;
}

From source file:org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.java

@Override
public Object call(final RenderContext renderContext, Object... arguments) {
    ExtensionUtils.checkArgumentCount(RuntimeFunction.USE, arguments, 2);
    RuntimeObjectModel runtimeObjectModel = renderContext.getObjectModel();
    String identifier = runtimeObjectModel.toString(arguments[0]);
    if (StringUtils.isEmpty(identifier)) {
        throw new SightlyException("data-sly-use needs to be passed an identifier");
    }//w w  w  .jav  a  2s.c om
    Map<String, Object> useArgumentsMap = runtimeObjectModel.toMap(arguments[1]);
    Bindings useArguments = new SimpleBindings(Collections.unmodifiableMap(useArgumentsMap));
    ArrayList<UseProvider> providers = new ArrayList<>(providersMap.values());
    ListIterator<UseProvider> iterator = providers.listIterator(providers.size());
    while (iterator.hasPrevious()) {
        UseProvider provider = iterator.previous();
        ProviderOutcome outcome = provider.provide(identifier, renderContext, useArguments);
        Throwable failureCause;
        if (outcome.isSuccess()) {
            return outcome.getResult();
        } else if ((failureCause = outcome.getCause()) != null) {
            throw new SightlyException(
                    "Identifier " + identifier + " cannot be correctly instantiated by the Use API",
                    failureCause);
        }
    }
    throw new SightlyException("No use provider could resolve identifier " + identifier);
}

From source file:org.springframework.cloud.gateway.rsocket.filter.AbstractFilterChain.java

private FC initChain(List<F> filters) {
    FC chain = create(filters, null, null);
    ListIterator<? extends F> iterator = filters.listIterator(filters.size());
    while (iterator.hasPrevious()) {
        chain = create(filters, iterator.previous(), chain);
    }//from  ww w  .j a v  a  2 s.co  m
    return chain;
}

From source file:com.skelril.nitro.point.ValueMapping.java

public Collection<KeyType> getBestSatisifers(PointType value) {
    ListIterator<PointValue<KeyType, PointType>> satisfier = values.listIterator(values.size());
    while (satisfier.hasPrevious()) {
        PointValue<KeyType, PointType> curVal = satisfier.previous();
        PointType type = curVal.getPoints();
        if (type.compareTo(value) <= 0) {
            return curVal.getSatisfiers();
        }/*from   w  w w . j  av  a2 s.  co m*/
    }
    return Collections.emptyList();
}

From source file:org.springframework.xd.greenplum.support.CleanableJdbcOperations.java

public void clean() {
    ListIterator<Operation> listIterator = operations.listIterator(operations.size());
    while (listIterator.hasPrevious()) {
        Operation operation = (Operation) listIterator.previous();
        try {//from w  w w.ja  va2 s .  co  m
            log.info(operation.cleanSql);
            jdbcTemplate.execute(operation.cleanSql);
        } catch (DataAccessException e) {
            cleanException = e;
        }
    }
}