Purple Code

com.purpletech.math
Class Series

java.lang.Object
  |
  +--com.purpletech.math.Series

public class Series
extends java.lang.Object

Maintains a running average and other calculations.


Constructor Summary
Series(int len)
           
 
Method Summary
 void add(int val)
           Note: not synchronized! Use only within a single thread, or inside a single thread-safe object.
 double getAverage()
           
 int getLast()
           
 int getMax()
           
 int getMin()
           
 MinMax getMinMax()
           
 long getSum()
           
 double getVolatility()
           volatility = (sum((x[i] - a)^2))/(n-1) where x[i] = closing price at tick i a = average (mean) of all x's n = total number of ticks sum = sum for all n ticks
static void main(java.lang.String[] args)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Series

public Series(int len)
Method Detail

add

public void add(int val)

Note: not synchronized! Use only within a single thread, or inside a single thread-safe object.


getSum

public long getSum()

size

public int size()

getLast

public int getLast()

getAverage

public double getAverage()

getMin

public int getMin()

getMax

public int getMax()

getMinMax

public MinMax getMinMax()

getVolatility

public double getVolatility()
 volatility = (sum((x[i] - a)^2))/(n-1)
 where x[i] = closing price at tick i
	a = average (mean) of all x's
	n = total number of ticks
	sum = sum for all n ticks
 

Returns:
the volatility. undefined for a series of 0 or 1 size

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)

Documentation generated March 5 2003