|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rafa.math.gen.SerialStrategy
public class SerialStrategy
Generates a series of values. The values returned come from the series, be it in an ordered, random or random without repeats way.
Nested Class Summary | |
---|---|
static class |
SerialStrategy.Output
Mechanism for choosing values from the series. |
Field Summary | |
---|---|
protected java.util.List<java.lang.Number> |
noRepeatsSeries
A copy of the series , from which values are withdrawn
when the output is random without repeats. |
protected SerialStrategy.Output |
outputType
Output type. |
protected java.util.List<java.lang.Number> |
series
The series of candidate values for output by this generator. |
Constructor Summary | |
---|---|
SerialStrategy(java.util.List<? extends java.lang.Number> series)
Constructor for a serial generator which will use a series passed as a parameter. |
|
SerialStrategy(NumberGeneratorFragment providerGeneratorFragment)
Constructor for a serial generator which will use a series taken from other generator's values. |
Method Summary | |
---|---|
protected Dependency |
buildDependency()
Builds a dependency on the underlying provider generator. |
java.util.List<? extends java.lang.Number> |
generate(int index)
Generates new numbers. |
java.util.Collection<Dependency> |
getDependencies(java.lang.Object dep)
Gets detailed information about the dependencies of this object on a given one. |
SerialStrategy.Output |
getOutputType()
|
NumberGeneratorFragment |
getProviderFragment()
|
java.util.List<java.lang.Number> |
getSeries()
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
This strategy reacts to RESET events from the provider
generator (if any), and the series is updated accordingly with new
values. |
void |
reset()
This method does not clear the series. |
void |
setOutputType(SerialStrategy.Output o)
|
void |
setSeries(java.util.List<java.lang.Number> list)
|
void |
setSeries(NumberGeneratorFragment ngf)
Take the series of values from a number generator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.List<java.lang.Number> series
protected java.util.List<java.lang.Number> noRepeatsSeries
series
, from which values are withdrawn
when the output is random without repeats.
protected SerialStrategy.Output outputType
Constructor Detail |
---|
public SerialStrategy(java.util.List<? extends java.lang.Number> series) throws EmptySeriesException
series
-
EmptySeriesException
public SerialStrategy(NumberGeneratorFragment providerGeneratorFragment) throws java.lang.Exception
providerGeneratorFragment
-
java.lang.Exception
- if any problems during number generation.Method Detail |
---|
public java.util.List<? extends java.lang.Number> generate(int index) throws java.lang.Exception
GeneratorStrategy
generate
in interface GeneratorStrategy
index
- the index of the value within the strategy output. Note that
it can be ignored by the implementation, if not needed.
null
if none was generated.
java.lang.Exception
public void reset()
reset
in interface GeneratorStrategy
public SerialStrategy.Output getOutputType()
public java.util.List<java.lang.Number> getSeries()
public NumberGeneratorFragment getProviderFragment()
public void setOutputType(SerialStrategy.Output o)
o
- protected Dependency buildDependency()
public void setSeries(java.util.List<java.lang.Number> list) throws EmptySeriesException
list
-
EmptySeriesException
public void setSeries(NumberGeneratorFragment ngf)
ngf
-
java.lang.Exception
public void propertyChange(java.beans.PropertyChangeEvent event)
RESET
events from the provider
generator (if any), and the series is updated accordingly with new
values.
propertyChange
in interface java.beans.PropertyChangeListener
public java.util.Collection<Dependency> getDependencies(java.lang.Object dep)
Dependent
getDependencies
in interface Dependent
dep
- the required object. If null
, all of the
dependencies will be returned.
Dependency
objects pointing to the same
object (target
), or null
if there is no
dependency on that object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |