Package org.geotools.feature.visitor
Class AbstractCalcResult
Object
AbstractCalcResult
- All Implemented Interfaces:
CalcResult
- Direct Known Subclasses:
AverageVisitor.AverageResult,BoundsVisitor.BoundsResult,CountVisitor.CountResult,MaxVisitor.MaxResult,MedianVisitor.MedianResult,MinVisitor.MinResult,StandardDeviationVisitor.Result,SumVisitor.SumResult,UniqueVisitor.UniqueResult
An abstract implementation for CalcResults. Each subclass should implement its own getValue(), merge(), and
constructor methods.
- Since:
- 2.2.M2
- Author:
- Cory Horner, Refractions
-
Field Summary
Fields inherited from interface CalcResult
NULL_RESULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetValue()Actual answerbooleanisCompatible(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 arraydoubletoDouble()Access getValue as a doubleAccess getValue as an envelopefloattoFloat()Access getValue as a floatAccess getValue as a geometryinttoInt()Access getValue as an inttoList()Access getValue as a listlongtoLong()Access getValue as a longtoMap()Access getValue as a maptoPoint()Access getValue as a pointtoSet()Access getValue as a settoString()Access getValue as a stringString[]
-
Constructor Details
-
AbstractCalcResult
public AbstractCalcResult()
-
-
Method Details
-
isCompatible
Description copied from interface:CalcResultReturns true if the target results is a compatible type with the current results, with compatible meaning that the two results may be merged.- Specified by:
isCompatiblein interfaceCalcResult- Parameters:
targetResults- the second CalcResult Object- Returns:
- true if the targetResults can be merged with the current results
-
merge
Description copied from interface:CalcResultReturns 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.
- Specified by:
mergein interfaceCalcResult- Returns:
- the merged results
-
getValue
Description copied from interface:CalcResultActual answer- Specified by:
getValuein interfaceCalcResult- Returns:
- the calculation result as a generic object
-
toInt
public int toInt()Description copied from interface:CalcResultAccess getValue as an int- Specified by:
toIntin interfaceCalcResult- Returns:
- the calculation result as a int (or 0 if not applicable)
-
toDouble
public double toDouble()Description copied from interface:CalcResultAccess getValue as a double- Specified by:
toDoublein interfaceCalcResult- Returns:
- the calculation result as a double (or 0 if not applicable)
-
toLong
public long toLong()Description copied from interface:CalcResultAccess getValue as a long- Specified by:
toLongin interfaceCalcResult- Returns:
- the calculation result as a long (or 0 if not applicable)
-
toFloat
public float toFloat()Description copied from interface:CalcResultAccess getValue as a float- Specified by:
toFloatin interfaceCalcResult- Returns:
- the calculation result as a float (or 0 if not applicable)
-
toGeometry
Description copied from interface:CalcResultAccess getValue as a geometry- Specified by:
toGeometryin interfaceCalcResult- Returns:
- the calculation result as a geometry (or null if not applicable)
-
toEnvelope
Description copied from interface:CalcResultAccess getValue as an envelope- Specified by:
toEnvelopein interfaceCalcResult- Returns:
- the calculation result as an envelope (or null if not applicable)
-
toPoint
Description copied from interface:CalcResultAccess getValue as a point- Specified by:
toPointin interfaceCalcResult- Returns:
- the calculation result as a point (or null if not applicable)
-
toSet
Description copied from interface:CalcResultAccess getValue as a set- Specified by:
toSetin interfaceCalcResult- Returns:
- the calculation result as a set (or null if not applicable)
-
toList
Description copied from interface:CalcResultAccess getValue as a list- Specified by:
toListin interfaceCalcResult- Returns:
- the calculation result as a list (or null if not applicable)
-
toArray
Description copied from interface:CalcResultAccess getValue as an array- Specified by:
toArrayin interfaceCalcResult- Returns:
- the calculation result as an array (or null if not applicable)
-
toStringArray
-
toMap
Description copied from interface:CalcResultAccess getValue as a map- Specified by:
toMapin interfaceCalcResult- Returns:
- the calculation result as a map (or null if not applicable)
-
toString
Description copied from interface:CalcResultAccess getValue as a string- Specified by:
toStringin interfaceCalcResult- Overrides:
toStringin classObject- Returns:
- the calculation result as a string (or "" if not applicable)
-