rafa.math.gen
Class GeneratorDependency
java.lang.Object
rafa.dep.SimpleDependency
rafa.math.gen.GeneratorDependency
- All Implemented Interfaces:
- Dependency
public class GeneratorDependency
- extends SimpleDependency
Dependency of a NumberGenerator on another one.
The path does not include any strategies, as the dependency of a generator
on its strategy is taken for granted, and is absolute.
- Author:
- rafa
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GeneratorDependency
public GeneratorDependency(java.lang.Object target)
GeneratorDependency
public GeneratorDependency(java.lang.Object target,
java.util.Map<java.lang.Object,java.lang.Object> properties)
mergeWith
protected GeneratorDependency mergeWith(Dependency subDep)
- Merges this dependency with another sub-dependency on a given target.
- Overrides:
mergeWith
in class SimpleDependency
- Parameters:
subDep
- The sub-dependency.
- Returns:
- a merged
GeneratorDependency
whose target is that of the
sub-dependency, and whose properties have been adjusted, or
null
if the dependencies don't chain.
validateCircularDependency
public void validateCircularDependency()
throws CircularDependencyException
- Checks that there will be no deadlocks due to circular dependencies, i.e.
the highest index of the dependency (DEPENDENCY_INDEX +
DEPENDENCY_LENGTH) is always lower that the lowest dependent index
(DEPENDENT_INDEX). This way, only dependencies on values already
generated are allowed.
This method should be called when an object - holding this dependency -
is dependent on itself - this dependency's target -, in order to check if
the self-reference is allowed or not. Besides, it should be called for
every other dependent object in the circle.
- Specified by:
validateCircularDependency
in interface Dependency
- Overrides:
validateCircularDependency
in class SimpleDependency
- Throws:
CircularDependencyException
Copyright © 2008-2009. All Rights Reserved.