hicosim.control.utils
Class Statistics

java.lang.Object
  extended by hicosim.control.utils.Statistics
All Implemented Interfaces:
IStatistic

public class Statistics
extends java.lang.Object
implements IStatistic

Class Statistics collects information about excecuted processor-commands. The class also provides methods to manage observers and to notify them about used commands.

Author:
Weber

Constructor Summary
Statistics()
           
 
Method Summary
 void deleteObserver(IStatisticObserver oldObserver)
          deleteObservers - deletes observer
 java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Long>> getStatistics()
          getStatistics() - return the collected statistics in an ArrayList which consists of 2 hasmaps - (1) for the comands and (2) for the type of comands (e.g.
 java.lang.String[] getTypes()
          getTypes() - return the default comand-types (e.g.
 void registerObserver(IStatisticObserver newObserver)
          registerObservers - registers new observers who want to be informed on changes of comands
 void reset()
          reset - Resets the whole statistics and also calls the method reset on all observers
 java.lang.String toString()
          String representation, e.g.
 void updateStatistics(java.lang.String comand)
          updateStatistics - This method is invoked by the class processor on every execution of a comand.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Method Detail

registerObserver

public void registerObserver(IStatisticObserver newObserver)
registerObservers - registers new observers who want to be informed on changes of comands

Specified by:
registerObserver in interface IStatistic
Parameters:
IStatisticObserver - newObserver

deleteObserver

public void deleteObserver(IStatisticObserver oldObserver)
deleteObservers - deletes observer

Specified by:
deleteObserver in interface IStatistic
Parameters:
IStatisticObserver - oldObserver

updateStatistics

public void updateStatistics(java.lang.String comand)
updateStatistics - This method is invoked by the class processor on every execution of a comand. The method manages the statistics (comand and type of comand) in 2 hashmaps. The method also calls the update-method of all its observers.

Specified by:
updateStatistics in interface IStatistic
Parameters:
String - comand - e.g. Add, Vmov etc.

reset

public void reset()
reset - Resets the whole statistics and also calls the method reset on all observers

Specified by:
reset in interface IStatistic

getStatistics

public java.util.ArrayList<java.util.HashMap<java.lang.String,java.lang.Long>> getStatistics()
getStatistics() - return the collected statistics in an ArrayList which consists of 2 hasmaps - (1) for the comands and (2) for the type of comands (e.g. "SKALARALU etc.")

Specified by:
getStatistics in interface IStatistic
Returns:
ArrayList stats

getTypes

public java.lang.String[] getTypes()
getTypes() - return the default comand-types (e.g. "SKALARALU")

Specified by:
getTypes in interface IStatistic
Returns:
String[] types

toString

public java.lang.String toString()
String representation, e.g. for console output. Commands and types are sorted by frequency.

Overrides:
toString in class java.lang.Object
Returns:
String