org.geotools.feature.visitor
Class AverageVisitor

java.lang.Object
  extended by org.geotools.feature.visitor.AverageVisitor
All Implemented Interfaces:
FeatureCalc, org.opengis.feature.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(org.opengis.filter.expression.Expression expr)
          Constructor class for the AverageVisitor using an expression
AverageVisitor(int attributeTypeIndex, org.opengis.feature.simple.SimpleFeatureType type)
          Constructor class for the AverageVisitor using AttributeDescriptor ID
AverageVisitor(java.lang.String attrName, org.opengis.feature.simple.SimpleFeatureType type)
          Constructor class for the AverageVisitor using AttributeDescriptor Name
 
Method Summary
 java.lang.Object getAverage()
          Returns the average from the visitor's current
 org.opengis.filter.expression.Expression getExpression()
           
 CalcResult getResult()
          Returns a CalcResult object (containing the Average)
 void init(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> collection)
           
 void reset()
          Resets the "Average" strategy pattern
 void setValue(int newCount, java.lang.Object newSum)
           
 void setValue(java.lang.Object newAverage)
           
 void visit(org.opengis.feature.Feature feature)
           
 void visit(org.opengis.feature.simple.SimpleFeature 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,
                      org.opengis.feature.simple.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(java.lang.String attrName,
                      org.opengis.feature.simple.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(org.opengis.filter.expression.Expression expr)
               throws IllegalFilterException
Constructor class for the AverageVisitor using an expression

Parameters:
expr -
Throws:
IllegalFilterException
Method Detail

init

public void init(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> collection)

visit

public void visit(org.opengis.feature.simple.SimpleFeature feature)

visit

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

getExpression

public org.opengis.filter.expression.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:
the results of the calculation

setValue

public void setValue(java.lang.Object newAverage)

setValue

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


Copyright © 1996-2010 Geotools. All Rights Reserved.