Interface Features<T extends Feature>

Type Parameters:
T - the subtype of features (Node, Way or Relation) or `?` for any type of feature
All Superinterfaces:
Iterable<T>
All Known Implementing Classes:
FeatureLibrary, com.geodesk.feature.query.WorldView

public interface Features<T extends Feature> extends Iterable<T>
A collection of features.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Checks whether this collection contains the given object.
    default long
    Returns the number of features in this collection.
    default T
    Returns the first feature in the collection.
    in(com.geodesk.geom.Bounds bbox)
    Returns a view of this collection that contains only features whose bounding box intersects the given Bounds.
    default boolean
    Returns `true` if this collection contains no features.
    Returns a view of this collection that contains only nodes.
    nodes(String query)
    Returns a view of this collection that contains only nodes matching the given query.
    default Features<T>
    of(Feature parent)
    Returns a sub-view that contains only the features that are nodes of the given way, or members of the given relation.
    Returns a view of this collection that contains only relations.
    Returns a view of this collection that contains only relations matching the given query.
    select(Filter filter)
     
    select(String query)
    Returns a view of this collection that only contains features matching the given query.
    default Object[]
    Creates an array containing all features in this collection.
    default T[]
    toArray(T[] a)
     
    default List<T>
    Creates a List containing all features in this collection.
    Returns a view of this collection that contains only ways.
    ways(String query)
    Returns a view of this collection that contains only ways matching the given query.
    default Features<T>
    with(Feature child)
    Returns a sub-view that contains only the features that are parent elements of the given feature (ways and/or relations).

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • select

      Features<?> select(String query)
      Returns a view of this collection that only contains features matching the given query.
      Parameters:
      query - a query in GOQL format
      Returns:
      a feature collection
    • nodes

      Features<Node> nodes()
      Returns a view of this collection that contains only nodes.
      Returns:
      a collection of Node objects
    • nodes

      Features<Node> nodes(String query)
      Returns a view of this collection that contains only nodes matching the given query.
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Node objects
    • ways

      Features<Way> ways()
      Returns a view of this collection that contains only ways.
      Returns:
      a collection of Way objects
    • ways

      Features<Way> ways(String query)
      Returns a view of this collection that contains only ways matching the given query.
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Way objects
    • relations

      Features<Relation> relations()
      Returns a view of this collection that contains only relations.
      Returns:
      a collection of Relation objects
    • relations

      Features<Relation> relations(String query)
      Returns a view of this collection that contains only relations matching the given query.
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Relation objects
    • of

      default Features<T> of(Feature parent)
      Returns a sub-view that contains only the features that are nodes of the given way, or members of the given relation. If a node is passed as `parent`, an empty view is returned (as nodes cannot have child elements).
      Parameters:
      parent - a way or relation
      Returns:
      a collection of features
    • with

      default Features<T> with(Feature child)
      Returns a sub-view that contains only the features that are parent elements of the given feature (ways and/or relations).
      Parameters:
      child - a way or relation
      Returns:
      a collection of features
    • in

      Features<T> in(com.geodesk.geom.Bounds bbox)
      Returns a view of this collection that contains only features whose bounding box intersects the given Bounds.
      Parameters:
      bbox - the bounding box to use as a filter
      Returns:
      a collection of Relation objects
    • first

      default T first()
      Returns the first feature in the collection. If the collection is unordered, this method selects one of multiple features in a non-deterministic way.
      Returns:
      the first feature, or `null` if the collection is empty
    • count

      default long count()
      Returns the number of features in this collection.
      Returns:
      the number of features
    • isEmpty

      default boolean isEmpty()
      Returns `true` if this collection contains no features.
      Returns:
      `true` if this collection contains no features
    • toList

      default List<T> toList()
      Creates a List containing all features in this collection.
      Returns:
      a list containing all features
    • toArray

      default Object[] toArray()
      Creates an array containing all features in this collection.
      Returns:
      an array containing all features
    • toArray

      default T[] toArray(T[] a)
    • contains

      default boolean contains(Object f)
      Checks whether this collection contains the given object.
      Parameters:
      f - the object whose presence in this collection is to be tested
      Returns:
      `true` if this collection contains the specified object
    • select

      Features<T> select(Filter filter)