de.tubs.cs.sc.casim
Class CAStatistics

java.lang.Object
  |
  +--de.tubs.cs.sc.casim.CAStatistics

public class CAStatistics
extends java.lang.Object

A class to analyse a CA using an internal Hashtable. State frequency will be counted and stored in a hastable to calculate different statistical values.


Constructor Summary
CAStatistics(de.tubs.cs.sc.casim.CellularAutomaton ca)
          Constructor creates the hashtable call analyse to count the states
CAStatistics(de.tubs.cs.sc.casim.CellularAutomaton ca, boolean pairwise)
          Constructor creates the hashtable call analyse to count the states
 
Method Summary
 void analyse()
          Clears the internal hash table and counts all states.
 int getNrOfAppearances(de.tubs.cs.sc.casim.State s)
           
 int getNrOfAppearances(java.lang.String s)
           
 int getNrOfCells()
           
 int getNrOfStates()
           
 java.util.Enumeration getStates()
           
 boolean isPairAnalysis()
          check if this object does pair analysis.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CAStatistics

public CAStatistics(de.tubs.cs.sc.casim.CellularAutomaton ca)
Constructor creates the hashtable call analyse to count the states

See Also:
CellularAutomaton, analyse()

CAStatistics

public CAStatistics(de.tubs.cs.sc.casim.CellularAutomaton ca,
                    boolean pairwise)
Constructor creates the hashtable call analyse to count the states

See Also:
CellularAutomaton, analyse()
Method Detail

isPairAnalysis

public boolean isPairAnalysis()
check if this object does pair analysis.


analyse

public void analyse()
Clears the internal hash table and counts all states.


getNrOfStates

public int getNrOfStates()
Returns:
the nr of different states in the statistics of the CA
See Also:
State

getNrOfCells

public int getNrOfCells()
Returns:
the nr of cells of the CA
See Also:
CALocal

getStates

public java.util.Enumeration getStates()
Returns:
a enumeration of different states of the CA Can be used with getNrOfAppearances.
See Also:
getNrOfAppearances(de.tubs.cs.sc.casim.State)

getNrOfAppearances

public int getNrOfAppearances(de.tubs.cs.sc.casim.State s)
Returns:
the count of appearance of state s in the statistics

getNrOfAppearances

public int getNrOfAppearances(java.lang.String s)
Returns:
the count of appearance of pair s in the statistics

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the statistics in the following format:
{Name of State, Nr of Appearances}
{Name of State, Nr of Appearances}
... {Name of State, Nr of Appearances}