org.geotools.feature.visitor
Interface CalcResult

All Known Implementing Classes:
AbstractCalcResult

public interface CalcResult

Encapsulates the results from a FeatureCalc, and includes methods for obtaining and merging results.

Since:
2.2.M2
Author:
Cory Horner, Refractions
See Also:
FeatureCalc

Method Summary
 java.lang.Object getValue()
          Actual answer
 boolean isCompatible(CalcResult targetResults)
          Returns true if the target results is a compatible type with the current results, with compatible meaning that the two results may be merged.
 CalcResult merge(CalcResult resultsToAdd)
          Returns the merged results of two CalcResult.
 java.lang.Object[] toArray()
          Access getValue as an array
 double toDouble()
          Access getValue as a double
 com.vividsolutions.jts.geom.Envelope toEnvelope()
          Access getValue as an envelope
 float toFloat()
          Access getValue as a float
 com.vividsolutions.jts.geom.Geometry toGeometry()
          Access getValue as a geometry
 int toInt()
          Access getValue as an int
 java.util.List toList()
          Access getValue as a list
 long toLong()
          Access getValue as a long
 java.util.Map toMap()
          Access getValue as a map
 com.vividsolutions.jts.geom.Point toPoint()
          Access getValue as a point
 java.util.Set toSet()
          Access getValue as a set
 java.lang.String toString()
          Access getValue as a string
 

Method Detail

isCompatible

public boolean isCompatible(CalcResult targetResults)
Returns true if the target results is a compatible type with the current results, with compatible meaning that the two results may be merged.

Parameters:
targetResults - the second CalcResult Object
Returns:
true if the targetResults can be merged with the current results

merge

public CalcResult merge(CalcResult resultsToAdd)
Returns the merged results of two CalcResult. The way in which the results are merged is dependent on the type of the results added. A new instance is created containing the merged results.

For example: merging two min functions would return the smaller of the two values; merging a count and a sum would return an average.

Parameters:
resultsToAdd -
Returns:
the merged results

getValue

public java.lang.Object getValue()
Actual answer

Returns:
the calculation result as a generic object

toInt

public int toInt()
Access getValue as an int

Returns:
the calculation result as a int (or 0 if not applicable)
Throws:
java.io.IOException

toDouble

public double toDouble()
Access getValue as a double

Returns:
the calculation result as a double (or 0 if not applicable)

toString

public java.lang.String toString()
Access getValue as a string

Returns:
the calculation result as a string (or "" if not applicable)

toLong

public long toLong()
Access getValue as a long

Returns:
the calculation result as a long (or 0 if not applicable)

toFloat

public float toFloat()
Access getValue as a float

Returns:
the calculation result as a float (or 0 if not applicable)

toGeometry

public com.vividsolutions.jts.geom.Geometry toGeometry()
Access getValue as a geometry

Returns:
the calculation result as a geometry (or null if not applicable)

toEnvelope

public com.vividsolutions.jts.geom.Envelope toEnvelope()
Access getValue as an envelope

Returns:
the calculation result as an envelope (or null if not applicable)

toPoint

public com.vividsolutions.jts.geom.Point toPoint()
Access getValue as a point

Returns:
the calculation result as a point (or null if not applicable)

toSet

public java.util.Set toSet()
Access getValue as a set

Returns:
the calculation result as a set (or null if not applicable)

toList

public java.util.List toList()
Access getValue as a list

Returns:
the calculation result as a list (or null if not applicable)

toArray

public java.lang.Object[] toArray()
Access getValue as an array

Returns:
the calculation result as an array (or null if not applicable)

toMap

public java.util.Map toMap()
Access getValue as a map

Returns:
the calculation result as a map (or null if not applicable)


Copyright © GeoTools. All Rights Reserved.