rafa.math.gen
Class NumberGenerator
java.lang.Object
rafa.NamedListened
rafa.math.gen.NumberGenerator
- All Implemented Interfaces:
- java.beans.PropertyChangeListener, java.util.EventListener, Dependent, Listened, INumberGenerator, Named
public class NumberGenerator
- extends NamedListened
- implements INumberGenerator
Generates values according to the implemented logic.
- Author:
- rafa
Field Summary |
protected java.util.List<java.lang.Number> |
values
List of generated values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
values
protected java.util.List<java.lang.Number> values
- List of generated values.
NumberGenerator
public NumberGenerator(java.lang.String name,
GeneratorStrategy strategy)
throws CircularDependencyException
- Throws:
CircularDependencyException
generate
public void generate()
throws java.lang.Exception
- Description copied from interface:
INumberGenerator
- Performs an iteration of value generation.
- Specified by:
generate
in interface INumberGenerator
- Throws:
java.lang.Exception
getValue
public java.lang.Number getValue(int index)
throws java.lang.Exception
- Specified by:
getValue
in interface INumberGenerator
- Parameters:
index
- The value index. If negative, begin at the end.
- Returns:
- The value. If
index
doesn't exist, values are
generated until it does.
- Throws:
java.lang.Exception
getValues
public java.util.List<java.lang.Number> getValues()
- Specified by:
getValues
in interface INumberGenerator
- Returns:
- Returns the values.
getStrategy
public GeneratorStrategy getStrategy()
- Returns:
setStrategy
public void setStrategy(GeneratorStrategy strategy)
throws CircularDependencyException
- Parameters:
strategy
-
- Throws:
CircularDependencyException
reset
public void reset()
- Description copied from interface:
INumberGenerator
- Resets the generator to initial values.
- Specified by:
reset
in interface INumberGenerator
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interface java.beans.PropertyChangeListener
getDependencies
public java.util.Collection<Dependency> getDependencies(java.lang.Object dep)
- Description copied from interface:
Dependent
- Gets detailed information about the dependencies of this object on a
given one.
- Specified by:
getDependencies
in interface Dependent
- Parameters:
dep
- the required object. If null
, all of the
dependencies will be returned.
- Returns:
- a collection of
Dependency
objects pointing to the same
object (target
), or null
if there is no
dependency on that object.
Copyright © 2008-2009. All Rights Reserved.