|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.java.dev.moskito.core.stats.impl.IntervalImpl
class IntervalImpl
This class implements an Inveral with a name and an unique id that is furthermore a registry for primary and secondary update listeners. On calling the update() method it will notify the primary listener first and afterwards the secondary listeners.
| Field Summary | |
|---|---|
private int |
id
This is the unique interval id. |
private int |
length
This is the length of the interval in seconds. |
private String |
name
This is the human readable name of this Interval. |
private List<IIntervalListener> |
primaryIntervalListeners
This List holds all primary listeners. |
private List<IIntervalListener> |
secondaryIntervalListeners
This List holds all secondary listeners. |
| Constructor Summary | |
|---|---|
IntervalImpl(int anId,
String aName,
int aLength)
This is the constructor. |
|
| Method Summary | |
|---|---|
void |
addPrimaryIntervalListener(IIntervalListener aListener)
This method adds a listener as primary listener. |
void |
addSecondaryIntervalListener(IIntervalListener aListener)
This method adds a listener as primary listener. |
int |
getId()
This method returns the interval id. |
int |
getLength()
This method returns the interval length in seconds. |
String |
getName()
This method returns the interval name. |
private void |
notifyListeners(List<IIntervalListener> aListeners)
This method notifies all listeners in the given List. |
void |
removePrimaryIntervalListener(IIntervalListener aListener)
This method removes the given listener from the primary listeners. |
void |
removeSecondaryIntervalListener(IIntervalListener aListener)
This method removes the given listener from the primary listeners. |
String |
toString()
|
void |
update()
This method will be called if an update occures. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private String name
private int id
private int length
private List<IIntervalListener> primaryIntervalListeners
private List<IIntervalListener> secondaryIntervalListeners
| Constructor Detail |
|---|
public IntervalImpl(int anId,
String aName,
int aLength)
anId - the idaName - the nameaLength - the interval length in seconds| Method Detail |
|---|
public void addPrimaryIntervalListener(IIntervalListener aListener)
Interval
addPrimaryIntervalListener in interface IntervalaListener - the new listenerInterval.addPrimaryIntervalListener(net.java.dev.moskito.core.stats.IIntervalListener)public void removePrimaryIntervalListener(IIntervalListener aListener)
Interval
removePrimaryIntervalListener in interface IntervalaListener - the listener to remove.Interval.removePrimaryIntervalListener(net.java.dev.moskito.core.stats.IIntervalListener)public void addSecondaryIntervalListener(IIntervalListener aListener)
Interval
addSecondaryIntervalListener in interface IntervalaListener - the new listenerInterval.addSecondaryIntervalListener(net.java.dev.moskito.core.stats.IIntervalListener)public void removeSecondaryIntervalListener(IIntervalListener aListener)
Interval
removeSecondaryIntervalListener in interface IntervalaListener - the listener to remove.Interval.removeSecondaryIntervalListener(net.java.dev.moskito.core.stats.IIntervalListener)public int getId()
Interval
getId in interface IntervalInterval.getId()public String getName()
Interval
getName in interface IntervalInterval.getName()public int getLength()
Interval
getLength in interface IntervalInterval.getLength()public void update()
IUpdateable
update in interface IUpdateableIUpdateable.update()private void notifyListeners(List<IIntervalListener> aListeners)
aListeners - the List of listenerspublic String toString()
toString in class ObjectObject.toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||