JTools

org.jtools.depend
Interface DependencyElement<T_Key,T_ItemKey>

Type Parameters:
T_Key - The TargetKey type.
T_ItemKey - The ItemKey type.

public interface DependencyElement<T_Key,T_ItemKey>

Represents a dependency target.

Author:
Rainer Noack

Method Summary
 DependencyElement<T_Key,T_ItemKey> addAffects(T_Key key)
          Declares a direct dependency between this element and the one with the given key so that this element will be sequentially before the one with the given key.
 DependencyElement<T_Key,T_ItemKey> addDepends(T_Key key)
          Declares a direct dependency between this target and the one with the given key so that this target will be sequentially after the one with the given key.
 DependencyItem<T_ItemKey> addInput(T_ItemKey key)
          Declares an indirect dependency between this target and the item with the given key so that this target will be sequentially after all targets that declares item as its output.
 DependencyItem<T_ItemKey> addOutput(T_ItemKey key)
          Declares an indirect dependency between this target and the item with the given key so that this target will be sequentially before all targets that declares item as its input.
 void addPropertyChangeListener(DependencyElementProperty property, PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 boolean affects(T_Key key)
          Indicates whether this target is declared to affect the target with the given key.
 boolean depends(T_Key key)
          Indicates whether this target is declared to depend on the target with the given key.
 int getDeclarationOrder()
           
 Collection<DependencyElement<T_Key,T_ItemKey>> getImpactedTargets()
          Gets all targets that are impacted by this target.
 Integer getIndex()
          Gets the sequential index of this target.
 T_Key getKey()
          Gets the key of this target.
 Collection<DependencyElement<T_Key,T_ItemKey>> getRequiredTargets()
          Gets all targets that are required by this target by this target.
 Object getUserObject()
          Gets the associated user object.
 boolean impacts(T_Key target)
          Indicates whether this target impacts the target with the given value.
 boolean isInput(T_ItemKey key)
          Indicates whether the item with the given key is declared as input of this target.
 boolean isOutput(T_ItemKey key)
          Indicates whether the item with the given key is declared as output of this target.
 DependencyElement<T_Key,T_ItemKey> removeAffects(T_Key key)
          Removes a direct dependency declaration previously declared by addAffects(T_Key).
 DependencyElement<T_Key,T_ItemKey> removeDepends(T_Key key)
          Removes a direct dependency declaration previously declared by addDepends(T_Key).
 DependencyItem<T_ItemKey> removeInput(T_ItemKey key)
          Removes an input declaration.
 DependencyItem<T_ItemKey> removeOutput(T_ItemKey key)
          Removes an output declaration.
 void removePropertyChangeListener(DependencyElementProperty property, PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 boolean requires(T_Key target)
          Indicates whether this target requires the target with the given value.
 void setUserObject(Object userObject)
          Associates an arbitrary user object with this item.
 

Method Detail

addAffects

DependencyElement<T_Key,T_ItemKey> addAffects(T_Key key)
                                              throws DependencyException
Declares a direct dependency between this element and the one with the given key so that this element will be sequentially before the one with the given key. If no element for the given key is declared it will be created.

Parameters:
key - Key of the "other" element.
Returns:
The "other" element.
Throws:
DependencyException - If key refers to this element or a element, that is already declared to be sequentially before this element.

addDepends

DependencyElement<T_Key,T_ItemKey> addDepends(T_Key key)
                                              throws DependencyException
Declares a direct dependency between this target and the one with the given key so that this target will be sequentially after the one with the given key. If no target for the given key is declared it will be created.

Parameters:
key - Key of the "other" target.
Returns:
The "other" target.
Throws:
DependencyException - If key refers to this target or a target, that is already declared to be sequentially after this target.

addInput

DependencyItem<T_ItemKey> addInput(T_ItemKey key)
                                   throws DependencyException
Declares an indirect dependency between this target and the item with the given key so that this target will be sequentially after all targets that declares item as its output. If no item for the given key is declared it will be created.

Parameters:
key - Key of the item.
Returns:
The item.
Throws:
DependencyException - If key refers to an item, that is already declared as output of this target.

addOutput

DependencyItem<T_ItemKey> addOutput(T_ItemKey key)
                                    throws DependencyException
Declares an indirect dependency between this target and the item with the given key so that this target will be sequentially before all targets that declares item as its input. If no item for the given key is declared it will be created.

Parameters:
key - Key of the item.
Returns:
The item.
Throws:
DependencyException - If key refers to an item, that is already declared as input of this target.

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener - The PropertyChangeListener to be added

addPropertyChangeListener

void addPropertyChangeListener(DependencyElementProperty property,
                               PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property.

Parameters:
property - The property to listen on.
listener - The PropertyChangeListener to be added

affects

boolean affects(T_Key key)
Indicates whether this target is declared to affect the target with the given key.

Parameters:
key - The "other" target.
Returns:
True, if this target is declared to affect the "other" target directly, false otherwise.

depends

boolean depends(T_Key key)
Indicates whether this target is declared to depend on the target with the given key.

Parameters:
key - The "other" target.
Returns:
True, if this target is declared to depend on the "other" target directly, false otherwise.

getIndex

Integer getIndex()
Gets the sequential index of this target.

Returns:
Sequential index if available or null if the Dependencies object needs to be resorted.

getKey

T_Key getKey()
Gets the key of this target.

Returns:
The key of this target.

getUserObject

Object getUserObject()
Gets the associated user object.

Returns:
The associated user object or null if there is none.

getImpactedTargets

Collection<DependencyElement<T_Key,T_ItemKey>> getImpactedTargets()
Gets all targets that are impacted by this target. The result depends on the value of the Dependencies' object isDeepDependencyCheck property: The returned targets are ordered in the Dependency's primary order.

Returns:
Collection of the impacted targets or null if the Dependencies object needs to be resorted.

getDeclarationOrder

int getDeclarationOrder()

impacts

boolean impacts(T_Key target)
Indicates whether this target impacts the target with the given value. The result is equivalent to getImpactedTargets().contains(getTarget(target)). For two targets T and <i>T'</i>, it is guaranteed that <i>T</i>.impacts(<i>T'</i>.getKey())==<i>T'</i>.requires(<i>T</i>.getKey()) is allways true.

Parameters:
target - The "other" target.
Returns:
True if the target with the given key is declared and impacted by this target; False otherwise.
See Also:
getImpactedTargets()

isInput

boolean isInput(T_ItemKey key)
Indicates whether the item with the given key is declared as input of this target.

Parameters:
key - The item's key.
Returns:
True if the item with the given key is declared as input of this target; false otherwise.

isOutput

boolean isOutput(T_ItemKey key)
Indicates whether the item with the given key is declared as output of this target.

Parameters:
key - The item's key.
Returns:
True if the item with the given key is declared as output of this target; false otherwise.

removeAffects

DependencyElement<T_Key,T_ItemKey> removeAffects(T_Key key)
Removes a direct dependency declaration previously declared by addAffects(T_Key).

Parameters:
key - The "other" target's key.
Returns:
The "other" target or null if it was not previously declared as affected.

removeDepends

DependencyElement<T_Key,T_ItemKey> removeDepends(T_Key key)
Removes a direct dependency declaration previously declared by addDepends(T_Key).

Parameters:
key - The "other" target's key.
Returns:
The "other" target or null if it was not previously declared as affected.

removeInput

DependencyItem<T_ItemKey> removeInput(T_ItemKey key)
Removes an input declaration.

Parameters:
key - The item's key.
Returns:
The removed item or null if it was not previously declared as input.

removeOutput

DependencyItem<T_ItemKey> removeOutput(T_ItemKey key)
Removes an output declaration.

Parameters:
key - The item's key.
Returns:
The removed item or null if it was not previously declared as input.

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. If listener was added more than once to the same event source, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.

Parameters:
listener - The PropertyChangeListener to be removed

removePropertyChangeListener

void removePropertyChangeListener(DependencyElementProperty property,
                                  PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. If listener was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If listener is null, or was never added for the specified property, no exception is thrown and no action is taken.

Parameters:
property - The property that was listened on.
listener - The PropertyChangeListener to be removed

getRequiredTargets

Collection<DependencyElement<T_Key,T_ItemKey>> getRequiredTargets()
Gets all targets that are required by this target by this target. The result depends on the value of the Dependencies' object isDeepDependencyCheck property: The returned targets are ordered in the Dependency's reverse primary order.

Returns:
Collection of the required targets or null if the Dependencies object needs to be resorted.
See Also:
getImpactedTargets(), requires(T_Key)

requires

boolean requires(T_Key target)
Indicates whether this target requires the target with the given value. The result is equivalent to getRequiredTargets().contains(getTarget(target)). For two targets <i>T</i> and <i>T'</i>, it is guaranteed that <i>T</i>.impacts(<i>T'</i>.getKey())==<i>T'</i>.requires(<i>T</i>.getKey()) is allways true.

Parameters:
target - The "other" target.
Returns:
True if the target with the given key is declared and required by this target; False otherwise.
See Also:
getRequiredTargets(), getImpactedTargets(), impacts(T_Key)

setUserObject

void setUserObject(Object userObject)
Associates an arbitrary user object with this item.

Parameters:
userObject - Object to associate with this item.

JTools

© 2000-2006, JTools.org.