org.norther.tammi.acorn.lang
Class Average

java.lang.Object
  extended by java.lang.Number
      extended by org.norther.tammi.acorn.lang.Equation
          extended by org.norther.tammi.acorn.lang.Average
All Implemented Interfaces:
Serializable, Comparable

public class Average
extends Equation

An average equation.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
Average(byte[] operands)
          Constructs a new byte equation.
Average(double[] operands)
          Constructs a new double equation.
Average(double[] operands, boolean ignoreNaNs)
          Constructs a new double equation.
Average(float[] operands)
          Constructs a new float equation.
Average(float[] operands, boolean ignoreNaNs)
          Constructs a new float equation.
Average(int[] operands)
          Constructs a new int equation.
Average(long[] operands)
          Constructs a new long equation.
Average(short[] operands)
          Constructs a new short equation.
 
Method Summary
protected  Number calculate(Object operands, int length, boolean ignoreNaNs)
          Calculates the result.
 
Methods inherited from class org.norther.tammi.acorn.lang.Equation
byteValue, byteValue, compareTo, doubleValue, doubleValue, equals, floatValue, floatValue, getLength, getOperandType, getResult, intValue, intValue, isFloatingPoint, longValue, longValue, shortValue, shortValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Average

public Average(byte[] operands)
Constructs a new byte equation.

Parameters:
operands - the operands.

Average

public Average(short[] operands)
Constructs a new short equation.

Parameters:
operands - the operands.

Average

public Average(int[] operands)
Constructs a new int equation.

Parameters:
operands - the operands.

Average

public Average(long[] operands)
Constructs a new long equation.

Parameters:
operands - the operands.

Average

public Average(float[] operands)
Constructs a new float equation.

Parameters:
operands - the operands.

Average

public Average(float[] operands,
               boolean ignoreNaNs)
Constructs a new float equation.

Parameters:
operands - the operands.
ignoreNaNs - ignore NaNs if true.

Average

public Average(double[] operands)
Constructs a new double equation.

Parameters:
operands - the operands.

Average

public Average(double[] operands,
               boolean ignoreNaNs)
Constructs a new double equation.

Parameters:
operands - the operands.
ignoreNaNs - ignore NaNs if true.
Method Detail

calculate

protected Number calculate(Object operands,
                           int length,
                           boolean ignoreNaNs)
Description copied from class: Equation
Calculates the result.

Specified by:
calculate in class Equation
Parameters:
operands - an array of operands.
length - the number of operands.
ignoreNaNs - ignore NaNs if true.
Returns:
the result of the equation.


Copyright © 2004 The Norther Organization. All rights reserved.