org.geotools.feature.visitor
Class AverageVisitor

java.lang.Object
  extended byorg.geotools.feature.visitor.AverageVisitor
All Implemented Interfaces:
FeatureCalc, FeatureVisitor

public class AverageVisitor
extends java.lang.Object
implements FeatureCalc

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, FeatureType type)
          Constructor class for the AverageVisitor using AttributeType ID
AverageVisitor(java.lang.String attrName, FeatureType type)
          Constructor class for the AverageVisitor using AttributeType Name
 
Method Summary
 java.lang.Object getAverage()
          Returns the average from the visitor's current
 Expression getExpression()
           
 CalcResult getResult()
          Returns a CalcResult object (containing the Average)
 void reset()
          Resets the "Average" strategy pattern
 void setValue(int newCount, java.lang.Object newSum)
           
 void setValue(java.lang.Object newAverage)
           
 void visit(Feature feature)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageVisitor

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

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

AverageVisitor

public AverageVisitor(java.lang.String attrName,
                      FeatureType type)
               throws IllegalFilterException
Constructor class for the AverageVisitor using AttributeType Name

Parameters:
attrName - string respresenting the AttributeType
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

visit

public void visit(Feature feature)
Specified by:
visit in interface FeatureVisitor

getExpression

public Expression getExpression()

getAverage

public java.lang.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:

setValue

public void setValue(java.lang.Object newAverage)

setValue

public void setValue(int newCount,
                     java.lang.Object newSum)


Copyright © GeoTools. All Rights Reserved.