Package jsl.utilities
Class IterativeDataObservable
- java.lang.Object
-
- jsl.utilities.DataObservable
-
- jsl.utilities.IterativeDataObservable
-
- All Implemented Interfaces:
ObservableIfc
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
- Direct Known Subclasses:
DataObservableArray
public abstract class IterativeDataObservable extends DataObservable
An abstract base class for modeling data sources that users can iterate through
-
-
Field Summary
Fields Modifier and Type Field Description static int
END_SOURCE
An "enum" to indicate that this iterative data source has just reached it's end Subclasses are responsible for using notifyObservers(END_SOURCE) to let observers know that the end of the source has been reachedprotected boolean
myEndSourceFlag
Indicates that the end of the source has been reached.static int
RESET
An "enum" to indicate that this iterative data source has just been reset to observers Subclasses are responsible for using notifyObservers(RESET) to let observers know that a reset has been done.-
Fields inherited from class jsl.utilities.DataObservable
myId, myIdCounter_, myName, NEW_VALUE
-
-
Constructor Summary
Constructors Constructor Description IterativeDataObservable()
IterativeDataObservable(java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
getEndSourceFlag()
Indicates that the end of the source has been reached.abstract boolean
hasNext()
Indicates to clients whether there is another value after the current value for the data sourceabstract double
next()
Advances to the next value and returns it.abstract void
reset()
This method should reset the IterativeDataSource so that it is positioned just prior to the 1st value to be returned via the use of the next() method Implementers should ensure that observers are notified of the reset and that the end of source indicator correctly reflects the reset-
Methods inherited from class jsl.utilities.DataObservable
addObserver, checkObserverState, contains, countObservers, deleteObserver, deleteObservers, getId, getName, getObserverState, getPreviousObserverState, getPreviousValue, getValue, notifyObservers, notifyObservers, setId, setName, setObserverState, setValue
-
-
-
-
Field Detail
-
RESET
public static final int RESET
An "enum" to indicate that this iterative data source has just been reset to observers Subclasses are responsible for using notifyObservers(RESET) to let observers know that a reset has been done.
-
END_SOURCE
public static final int END_SOURCE
An "enum" to indicate that this iterative data source has just reached it's end Subclasses are responsible for using notifyObservers(END_SOURCE) to let observers know that the end of the source has been reached
-
myEndSourceFlag
protected boolean myEndSourceFlag
Indicates that the end of the source has been reached. Should be used by subclasses to indicate end of source
-
-
Method Detail
-
getEndSourceFlag
public boolean getEndSourceFlag()
Indicates that the end of the source has been reached.- Returns:
-
hasNext
public abstract boolean hasNext()
Indicates to clients whether there is another value after the current value for the data source- Returns:
-
next
public abstract double next()
Advances to the next value and returns it. Implementers must use setValue(double value) to properly set the current value. getValue() should then return this current value until advanced again Should throw a NoSuchElementException if there is no next value- Returns:
-
reset
public abstract void reset()
This method should reset the IterativeDataSource so that it is positioned just prior to the 1st value to be returned via the use of the next() method Implementers should ensure that observers are notified of the reset and that the end of source indicator correctly reflects the reset
-
-