Package com.cognifide.sling.query.iterator

Examples of com.cognifide.sling.query.iterator.ArrayIterator


  @Override
  public Iterator<Resource> apply(Resource resource) {
    Resource current = resource;
    while (current != null) {
      Iterator<Resource> iterator = new ArrayIterator(current);
      iterator = selector.apply(iterator);
      if (iterator.hasNext()) {
        return iterator;
      }
      current = current.getParent();
    }
    return EmptyIterator.INSTANCE;
View Full Code Here


  public Iterator<Resource> apply(Iterator<Resource> input) {
    Resource lastElement = null;
    while (input.hasNext()) {
      lastElement = input.next();
    }
    return new ArrayIterator(lastElement);
  }
View Full Code Here

  @Override
  public Iterator<Resource> apply(Resource resource) {
    Resource parent = resource.getParent();
    if (parent == null) {
      return new ArrayIterator(resource);
    } else {
      return parent.listChildren();
    }
  }
View Full Code Here

    this.function = function;
  }

  @Override
  public boolean accepts(Resource resource) {
    return function.apply(new ArrayIterator(resource)).hasNext();
  }
View Full Code Here

  public Iterator<Resource> apply(Resource input) {
    Resource result = wrappedFunction.apply(input);
    if (result == null) {
      return EmptyIterator.INSTANCE;
    } else {
      return new ArrayIterator(result);
    }
  }
View Full Code Here

    if (prevSiblings.isEmpty()) {
      return EmptyIterator.INSTANCE;
    }
    if (until == null) {
      Resource prev = prevSiblings.get(prevSiblings.size() - 1);
      return new ArrayIterator(prev);
    } else {
      return prevSiblings.iterator();
    }
  }
View Full Code Here

TOP

Related Classes of com.cognifide.sling.query.iterator.ArrayIterator

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.