Package org.geotools.feature.visitor
Class GroupByVisitor.GroupByResult
- Object
-
- GroupByResult
-
- All Implemented Interfaces:
CalcResult
- Enclosing class:
- GroupByVisitor
public static class GroupByVisitor.GroupByResult extends Object implements CalcResult
This class implements the feature calculation result of the group by visitor.
-
-
Field Summary
-
Fields inherited from interface CalcResult
NULL_RESULT
-
-
Constructor Summary
Constructors Constructor Description GroupByResult(Map<List<Object>,CalcResult> results, Aggregate aggregateVisitor, List<Expression> groupByAttributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Aggregate
getAggregateVisitor()
List<Expression>
getGroupByAttributes()
Map<List<Object>,CalcResult>
getResults()
Object
getValue()
Actual answerboolean
isCompatible(CalcResult newResult)
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 newResult)
Returns the merged results of two CalcResult.Object[]
toArray()
Access getValue as an arraydouble
toDouble()
Access getValue as a doubleEnvelope
toEnvelope()
Access getValue as an envelopefloat
toFloat()
Access getValue as a floatGeometry
toGeometry()
Access getValue as a geometryint
toInt()
Access getValue as an intList
toList()
Access getValue as a listlong
toLong()
Access getValue as a longMap
toMap()
The keys of the map will be List instead of arrays, since arrays don't give a decent hash code.Point
toPoint()
Access getValue as a pointSet
toSet()
Access getValue as a setString
toString()
Access getValue as a string
-
-
-
Constructor Detail
-
GroupByResult
public GroupByResult(Map<List<Object>,CalcResult> results, Aggregate aggregateVisitor, List<Expression> groupByAttributes)
-
-
Method Detail
-
getResults
public Map<List<Object>,CalcResult> getResults()
-
getAggregateVisitor
public Aggregate getAggregateVisitor()
-
getGroupByAttributes
public List<Expression> getGroupByAttributes()
-
isCompatible
public boolean isCompatible(CalcResult newResult)
Description copied from interface:CalcResult
Returns 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:
isCompatible
in interfaceCalcResult
- Parameters:
newResult
- the second CalcResult Object- Returns:
- true if the targetResults can be merged with the current results
-
merge
public CalcResult merge(CalcResult newResult)
Description copied from interface:CalcResult
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.
- Specified by:
merge
in interfaceCalcResult
- Returns:
- the merged results
-
getValue
public Object getValue()
Description copied from interface:CalcResult
Actual answer- Specified by:
getValue
in interfaceCalcResult
- Returns:
- the calculation result as a generic object
-
toInt
public int toInt()
Description copied from interface:CalcResult
Access getValue as an int- Specified by:
toInt
in interfaceCalcResult
- Returns:
- the calculation result as a int (or 0 if not applicable)
-
toDouble
public double toDouble()
Description copied from interface:CalcResult
Access getValue as a double- Specified by:
toDouble
in interfaceCalcResult
- Returns:
- the calculation result as a double (or 0 if not applicable)
-
toString
public String toString()
Description copied from interface:CalcResult
Access getValue as a string- Specified by:
toString
in interfaceCalcResult
- Overrides:
toString
in classObject
- Returns:
- the calculation result as a string (or "" if not applicable)
-
toLong
public long toLong()
Description copied from interface:CalcResult
Access getValue as a long- Specified by:
toLong
in interfaceCalcResult
- Returns:
- the calculation result as a long (or 0 if not applicable)
-
toFloat
public float toFloat()
Description copied from interface:CalcResult
Access getValue as a float- Specified by:
toFloat
in interfaceCalcResult
- Returns:
- the calculation result as a float (or 0 if not applicable)
-
toGeometry
public Geometry toGeometry()
Description copied from interface:CalcResult
Access getValue as a geometry- Specified by:
toGeometry
in interfaceCalcResult
- Returns:
- the calculation result as a geometry (or null if not applicable)
-
toEnvelope
public Envelope toEnvelope()
Description copied from interface:CalcResult
Access getValue as an envelope- Specified by:
toEnvelope
in interfaceCalcResult
- Returns:
- the calculation result as an envelope (or null if not applicable)
-
toPoint
public Point toPoint()
Description copied from interface:CalcResult
Access getValue as a point- Specified by:
toPoint
in interfaceCalcResult
- Returns:
- the calculation result as a point (or null if not applicable)
-
toSet
public Set toSet()
Description copied from interface:CalcResult
Access getValue as a set- Specified by:
toSet
in interfaceCalcResult
- Returns:
- the calculation result as a set (or null if not applicable)
-
toList
public List toList()
Description copied from interface:CalcResult
Access getValue as a list- Specified by:
toList
in interfaceCalcResult
- Returns:
- the calculation result as a list (or null if not applicable)
-
toArray
public Object[] toArray()
Description copied from interface:CalcResult
Access getValue as an array- Specified by:
toArray
in interfaceCalcResult
- Returns:
- the calculation result as an array (or null if not applicable)
-
toMap
public Map toMap()
The keys of the map will be List instead of arrays, since arrays don't give a decent hash code.- Specified by:
toMap
in interfaceCalcResult
- Returns:
- the calculation result as a map (or null if not applicable)
-
-