Package org.geotools.feature.visitor
Interface CalcResult
- All Known Implementing Classes:
AbstractCalcResult
,AverageVisitor.AverageResult
,BoundsVisitor.BoundsResult
,CountVisitor.CountResult
,GroupByVisitor.GroupByResult
,MaxVisitor.MaxResult
,MedianVisitor.MedianResult
,MinVisitor.MinResult
,StandardDeviationVisitor.Result
,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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CalcResult
The result obtained when a FeatureCalc found no features to visit. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
Actual answerboolean
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.merge
(CalcResult resultsToAdd) Returns the merged results of two CalcResult.Object[]
toArray()
Access getValue as an arraydouble
toDouble()
Access getValue as a doubleAccess getValue as an envelopefloat
toFloat()
Access getValue as a floatAccess getValue as a geometryint
toInt()
Access getValue as an inttoList()
Access getValue as a listlong
toLong()
Access getValue as a longtoMap()
Access getValue as a maptoPoint()
Access getValue as a pointtoSet()
Access getValue as a settoString()
Access getValue as a string
-
Field Details
-
NULL_RESULT
The result obtained when a FeatureCalc found no features to visit. It lets itself merge with any other result by just returning the other result as the output of the merge
-
-
Method Details
-
isCompatible
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
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.
- 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)
-
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 -
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)
-