org.geotools.feature.visitor
Class AverageVisitor

Object
  extended by AverageVisitor
All Implemented Interfaces:
FeatureCalc, FeatureVisitor

public class AverageVisitor
extends Object
implements FeatureCalc

Calculates the Average

Since:
2.2.M2
Author:
Cory Horner, Refractions
Module:
modules/library/main (gt-main.jar)

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()
           
 CalcResult getResult()
          Returns a CalcResult object (containing the Average)
 void init(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
           
 void reset()
          Resets the "Average" strategy pattern
 void setValue(int newCount, Object newSum)
           
 void setValue(Object newAverage)
           
 void visit(Feature 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(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)

visit

public void visit(SimpleFeature feature)

visit

public void visit(Feature feature)
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-2009 Geotools. All Rights Reserved.