org.jage.property.functions
Class AvgFunction

java.lang.Object
  extended by org.jage.property.Property
      extended by org.jage.property.functions.PropertyFunction
          extended by org.jage.property.functions.NumericFunction
              extended by org.jage.property.functions.AvgFunction

public class AvgFunction
extends NumericFunction

Average property function.

Author:
Tomek

Constructor Summary
AvgFunction(String functionName, String argumentsPattern, double defaultValue)
          Constructor.
 
Method Summary
protected  Object computeValue(List<FunctionArgument> arguments)
          Computes function's value.
protected  Class<?> getReturnType()
          Returns Double.class.
 
Methods inherited from class org.jage.property.functions.NumericFunction
getArgumentValue
 
Methods inherited from class org.jage.property.functions.PropertyFunction
getMetaProperty, getValue, setArgumentsResolver, setValue
 
Methods inherited from class org.jage.property.Property
addMonitor, getMonitoringStrategy, getSimpleProperty, initializeMonitoringStrategy, notifyMonitors, notifyMonitors, objectDeleted, removeMonitor, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AvgFunction

public AvgFunction(String functionName,
                   String argumentsPattern,
                   double defaultValue)
Constructor.

Parameters:
functionName - name of the function.
argumentsPattern - pattern for arguments.
defaultValue - default value, used when pattern is'n resolved to any arguments.
Method Detail

computeValue

protected Object computeValue(List<FunctionArgument> arguments)
                       throws InvalidFunctionArgumentException
Computes function's value. It returns average of all it's arguments.

Specified by:
computeValue in class PropertyFunction
Parameters:
arguments - arguments for the function.
Returns:
value of the function.
Throws:
InvalidFunctionArgumentException - one of arguments is not valid.

getReturnType

protected Class<?> getReturnType()
Returns Double.class.

Specified by:
getReturnType in class PropertyFunction
Returns:
class for function's return value.


Copyright © 2006-2011 AGH University of Science and Technology. All Rights Reserved.