Spring Data Core

org.springframework.data.geo
Class GeoResults<T>

java.lang.Object
  extended by org.springframework.data.geo.GeoResults<T>
All Implemented Interfaces:
Serializable, Iterable<GeoResult<T>>

public class GeoResults<T>
extends Object
implements Iterable<GeoResult<T>>, Serializable

Value object to capture GeoResults as well as the average distance they have.

Since:
1.8
Author:
Oliver Gierke, Thomas Darimont
See Also:
Serialized Form

Constructor Summary
GeoResults(List<? extends GeoResult<T>> results)
          Creates a new GeoResults instance manually calculating the average distance from the distance values of the given GeoResults.
GeoResults(List<? extends GeoResult<T>> results, Distance averageDistance)
          Creates a new GeoResults instance from the given GeoResults and average distance.
GeoResults(List<? extends GeoResult<T>> results, Metric metric)
          Creates a new GeoResults instance manually calculating the average distance in the given Metric from the distance values of the given GeoResults.
 
Method Summary
 boolean equals(Object obj)
           
 Distance getAverageDistance()
          Returns the average distance of all GeoResults in this list.
 List<GeoResult<T>> getContent()
          Returns the actual content of the GeoResults.
 int hashCode()
           
 Iterator<GeoResult<T>> iterator()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeoResults

public GeoResults(List<? extends GeoResult<T>> results)
Creates a new GeoResults instance manually calculating the average distance from the distance values of the given GeoResults.

Parameters:
results - must not be null.

GeoResults

public GeoResults(List<? extends GeoResult<T>> results,
                  Metric metric)
Creates a new GeoResults instance manually calculating the average distance in the given Metric from the distance values of the given GeoResults.

Parameters:
results - must not be null.
metric - must not be null.

GeoResults

public GeoResults(List<? extends GeoResult<T>> results,
                  Distance averageDistance)
Creates a new GeoResults instance from the given GeoResults and average distance.

Parameters:
results - must not be null.
averageDistance - can be null.
Method Detail

getAverageDistance

public Distance getAverageDistance()
Returns the average distance of all GeoResults in this list.

Returns:
the averageDistance

getContent

public List<GeoResult<T>> getContent()
Returns the actual content of the GeoResults.

Returns:

iterator

public Iterator<GeoResult<T>> iterator()
Specified by:
iterator in interface Iterable<GeoResult<T>>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Spring Data Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.