|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataGenerator
Interface that represents something that generates data, in the form of an array of doubles; this is a copy of the internal data and can be modified at will. The same number of output data are generated at each pass This is a natural to put in an independent Thread, so an implementation should (but I can't find anyway to enforce this) call Thread.yield at least once through every pass, and check for Thread.isInterrupted and stop generating data, and call done on each listener if true. An implementation may support getting a Memento of its internal state (See Design Patterns) to restart the data generator or watch it working if it also exposes the format of the Memento
Nested Class Summary | |
---|---|
static interface |
DataGenerator.Listener
a class that listens for data being generated |
Method Summary | |
---|---|
void |
addListener(DataGenerator.Listener listener)
add a DataGenerator.Listener to this DataGenerator's list |
java.lang.Object |
getMemento()
|
java.util.List |
getNames()
|
void |
removeListener(DataGenerator.Listener listener)
remove a given DataGenerator.Listener from this DataGenerator's list |
void |
start(java.lang.Object memento)
starts (or restarts) the data generator |
Methods inherited from interface java.lang.Runnable |
---|
run |
Method Detail |
---|
void start(java.lang.Object memento)
memento
- a Memento of the internal state of the data generator, or null
to start afresh. Calls startingUp on each listener either way
a Memento returned by getMemento()
for the same DataGenerator is guarranteed
not to throw and will continue the data generation from "close" to where it was
generated. "close" is implementation-specific
java.lang.UnsupportedOperationException
- if a non-null Memento is passed and
this implementation does not support Mementos
java.lang.IllegalArgumentException
- if the Memento is not supported by this DataGeneratorjava.util.List getNames()
java.lang.Object getMemento()
start(Object)
java.lang.UnsupportedOperationException
- if this implementation does not support Mementosvoid addListener(DataGenerator.Listener listener)
void removeListener(DataGenerator.Listener listener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |