org.geotools.feature.visitor
Interface CalcResult

All Known Implementing Classes:
AbstractCalcResult, AverageVisitor.AverageResult, BoundsVisitor.BoundsResult, CountVisitor.CountResult, MaxVisitor.MaxResult, MedianVisitor.MedianResult, MinVisitor.MinResult, SumVisitor.SumResult, UniqueVisitor.UniqueResult

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
Module:
modules/library/main (gt-main.jar)

Method Summary
 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.
 Object[] toArray()
          Access getValue as an array
 double toDouble()
          Access getValue as a double
 Envelope toEnvelope()
          Access getValue as an envelope
 float toFloat()
          Access getValue as a float
 Geometry toGeometry()
          Access getValue as a geometry
 int toInt()
          Access getValue as an int
 List toList()
          Access getValue as a list
 long toLong()
          Access getValue as a long
 Map toMap()
          Access getValue as a map
 Point toPoint()
          Access getValue as a point
 Set toSet()
          Access getValue as a set
 String toString()
          Access getValue as a string
 

Method Detail

isCompatible

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

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

Object getValue()
Actual answer

Returns:
the calculation result as a generic object

toInt

int toInt()
Access getValue as an int

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

toDouble

double toDouble()
Access getValue as a double

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

toString

String toString()
Access getValue as a string

Overrides:
toString in class Object
Returns:
the calculation result as a string (or "" if not applicable)

toLong

long toLong()
Access getValue as a long

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

toFloat

float toFloat()
Access getValue as a float

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

toGeometry

Geometry toGeometry()
Access getValue as a geometry

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

toEnvelope

Envelope toEnvelope()
Access getValue as an envelope

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

toPoint

Point toPoint()
Access getValue as a point

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

toSet

Set toSet()
Access getValue as a set

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

toList

List toList()
Access getValue as a list

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

toArray

Object[] toArray()
Access getValue as an array

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

toMap

Map toMap()
Access getValue as a map

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


Copyright © 1996-2010 Geotools. All Rights Reserved.