Class WithinDistance<T>

java.lang.Object
repast.simphony.query.WithinDistance<T>
All Implemented Interfaces:
Query<T>
Direct Known Subclasses:
ContinuousWithin, GridWithin

public abstract class WithinDistance<T> extends Object implements Query<T>
Base class for queries whose results contains all the objects within some distance of a specified object.
Version:
$Revision$ $Date$
Author:
Nick Collier
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
     
    protected double
     
    static final List
     
    protected T
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    WithinDistance(Context<T> context, double distance, T obj)
    Creates a WithinDistance query whose results will be all the objects in all the projections of a particular type in the context within some distance of the specified object.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Iterable<T>
    Creates an iterable over all the relevant objects in a space.
    protected abstract Iterable<T>
    Creates an iterable over all the relevant objects in the context.
    Returns the result of the query.
    Returns an iterable over the objects that are the result of the query and are in the passed in iterable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY

      public static final List EMPTY
    • obj

      protected T obj
    • distanceSq

      protected double distanceSq
    • distance

      protected double distance
  • Constructor Details

    • WithinDistance

      protected WithinDistance(Context<T> context, double distance, T obj)
      Creates a WithinDistance query whose results will be all the objects in all the projections of a particular type in the context within some distance of the specified object. Subclasses will determine the projection type.
      Parameters:
      context -
      distance -
      obj -
  • Method Details

    • query

      public Iterable<T> query()
      Returns the result of the query.
      Specified by:
      query in interface Query<T>
      Returns:
      an iterable over the objects that are the result of the query.
    • createIterable

      protected abstract Iterable<T> createIterable(Context<T> context)
      Creates an iterable over all the relevant objects in the context.
      Parameters:
      context -
      Returns:
      an iterable over all the relevant objects in the context.
    • createIterable

      protected abstract Iterable<T> createIterable()
      Creates an iterable over all the relevant objects in a space. The actual space will depend on subclass implementations.
      Returns:
      an iterable over all the relevant objects in a space. The actual space will depend on subclass implementations.
    • query

      public Iterable<T> query(Iterable<T> set)
      Returns an iterable over the objects that are the result of the query and are in the passed in iterable. This allows queries to be chained together where the result of one query is passed into another.
      Specified by:
      query in interface Query<T>
      Parameters:
      set -
      Returns:
      an iterable over the objects that are the result of the query and are in the passed in iterable.