org.geotools.feature.visitor
Class AverageVisitor

Object
  extended by AverageVisitor
All Implemented Interfaces:
FeatureAttributeVisitor, FeatureCalc, FeatureVisitor

public class AverageVisitor
extends Object
implements FeatureCalc, FeatureAttributeVisitor

Calculates the Average

Since:
2.2.M2
Author:
Cory Horner, Refractions

Nested Class Summary
static class AverageVisitor.AverageResult
           
 
Constructor Summary
AverageVisitor(Expression expr)
          Constructor class for the AverageVisitor using an expression
AverageVisitor(int attributeTypeIndex, SimpleFeatureType type)
          Constructor class for the AverageVisitor using AttributeDescriptor ID
AverageVisitor(String attrName, SimpleFeatureType type)
          Constructor class for the AverageVisitor using AttributeDescriptor Name
 
Method Summary
 Object getAverage()
          Returns the average from the visitor's current
 Expression getExpression()
           
 List<Expression> getExpressions()
          List of expressions used by visitor.
 CalcResult getResult()
          Returns a CalcResult object (containing the Average)
 void init(SimpleFeatureCollection collection)
           
 void reset()
          Resets the "Average" strategy pattern
 void setValue(int newCount, Object newSum)
           
 void setValue(Object newAverage)
           
 void visit(Feature feature)
          Visit the provided feature.
 void visit(SimpleFeature feature)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageVisitor

public AverageVisitor(int attributeTypeIndex,
                      SimpleFeatureType type)
               throws IllegalFilterException
Constructor class for the AverageVisitor using AttributeDescriptor ID

Parameters:
attributeTypeIndex - integer representing the AttributeDescriptor
type - FeatureType
Throws:
IllegalFilterException

AverageVisitor

public AverageVisitor(String attrName,
                      SimpleFeatureType type)
               throws IllegalFilterException
Constructor class for the AverageVisitor using AttributeDescriptor Name

Parameters:
attrName - string respresenting the AttributeDescriptor
type - FeatureType
Throws:
IllegalFilterException

AverageVisitor

public AverageVisitor(Expression expr)
               throws IllegalFilterException
Constructor class for the AverageVisitor using an expression

Parameters:
expr -
Throws:
IllegalFilterException
Method Detail

init

public void init(SimpleFeatureCollection collection)

getExpressions

public List<Expression> getExpressions()
Description copied from interface: FeatureAttributeVisitor
List of expressions used by visitor.

Specified by:
getExpressions in interface FeatureAttributeVisitor

visit

public void visit(SimpleFeature feature)

visit

public void visit(Feature feature)
Description copied from interface: FeatureVisitor
Visit the provided feature.

Please consult the documentation for the FeatureCollection you are visiting to learn more - the provided feature may be invalid, or read only.

Specified by:
visit in interface FeatureVisitor

getExpression

public Expression getExpression()

getAverage

public Object getAverage()
Returns the average from the visitor's current

Returns:
the average

reset

public void reset()
Resets the "Average" strategy pattern


getResult

public CalcResult getResult()
Returns a CalcResult object (containing the Average)

Specified by:
getResult in interface FeatureCalc
Returns:
the results of the calculation

setValue

public void setValue(Object newAverage)

setValue

public void setValue(int newCount,
                     Object newSum)


Copyright © 1996-2014 Geotools. All Rights Reserved.