All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.basex.api.xmldb.BXResourceIterator Maven / Gradle / Ivy

The newest version!
package org.basex.api.xmldb;

import static org.basex.api.xmldb.BXXMLDBText.*;
import java.util.*;

import org.xmldb.api.base.*;

/**
 * Implementation of the ResourceIterator Interface for the XMLDB:API.
 *
 * @author BaseX Team 2005-24, BSD License
 * @author Christian Gruen
 */
public final class BXResourceIterator implements ResourceIterator, Iterable {
  /** Resources. */
  private final Iterator iter;

  /**
   * Standard constructor with result.
   * @param resources resource iterator
   */
  BXResourceIterator(final ArrayList resources) {
    iter = resources.iterator();
  }

  @Override
  public boolean hasMoreResources() {
    return iter.hasNext();
  }

  @Override
  public Resource nextResource() throws XMLDBException {
    if(!iter.hasNext()) throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, ERR_ITER);
    return iter.next();
  }

  @Override
  public Iterator iterator() {
    return iter;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy