com.oakgrovesystems.mediation
Class AbstractConditionalChange

java.lang.Object
  |
  +--com.oakgrovesystems.mediation.AbstractConditionalChange
All Implemented Interfaces:
Change, ConditionalChange, java.io.Serializable
Direct Known Subclasses:
ProcessConditionalChange

public abstract class AbstractConditionalChange
extends java.lang.Object
implements ConditionalChange, java.io.Serializable

An implementation of the ConditionalChange interface. Subclasses need not implement any additional methods to be useful. They only need to initialize the precondition and resultingChange fields.

Author:
Craig Vieregg
See Also:
Serialized Form

Field Summary
protected  com.oakgrovesystems.mediation.Condition precondition
          The Condition that must be true for the Change to be applicable.
protected  com.oakgrovesystems.mediation.Change resultingChange
          The Change that is applied when applyTo() is called and the precondition is true.
 
Constructor Summary
AbstractConditionalChange()
           
 
Method Summary
 void applyTo(java.lang.Object o)
          Applies this Change to the specified Object.
 boolean isApplicable()
          Tests the applicability of this ConditionalChange.
 boolean isMadeApplicableBy(com.oakgrovesystems.mediation.Change triggeringChange, java.lang.Object changee)
          Determines whether the ConditionalChange would become applicable if the specified Change was applied to the specified object.
 boolean isMadeInapplicableBy(com.oakgrovesystems.mediation.Change untriggeringChange, java.lang.Object changee)
          Determines whether the ConditionalChange would become inapplicable if the specified Change was applied to the specified object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

precondition

protected com.oakgrovesystems.mediation.Condition precondition
The Condition that must be true for the Change to be applicable.


resultingChange

protected com.oakgrovesystems.mediation.Change resultingChange
The Change that is applied when applyTo() is called and the precondition is true.

Constructor Detail

AbstractConditionalChange

public AbstractConditionalChange()
Method Detail

isApplicable

public boolean isApplicable()
                     throws CanNotEvaluateConditionException
Tests the applicability of this ConditionalChange. If the isApplicable() method of a ConditionalChange returns false, attempts to call the applyTo() method should throw a ChangeNotApplicableException.

Specified by:
isApplicable in interface ConditionalChange
Returns:
True if the change can be applied. False if the change can not be applied.
Throws:
CanNotEvaluateConditionException - thrown if the contingency Condition can not be evaluated.

isMadeApplicableBy

public boolean isMadeApplicableBy(com.oakgrovesystems.mediation.Change triggeringChange,
                                  java.lang.Object changee)
                           throws CanNotEvaluateConditionException
Determines whether the ConditionalChange would become applicable if the specified Change was applied to the specified object.

Specified by:
isMadeApplicableBy in interface ConditionalChange
Parameters:
changee - the object to which the triggering change would be applied
triggeringChange - the Change that would be applied to trigger the applicability of this ConditionalChange
Returns:
False if this ConditionalChange is already applicable or if it is currently inapplicable and would remain inapplicable despite the application of the specified Change. True if the Change is not currently applicable but would be applicable if the specified Change were applied to the specified Object.
Throws:
CanNotEvaluateConditionException

isMadeInapplicableBy

public boolean isMadeInapplicableBy(com.oakgrovesystems.mediation.Change untriggeringChange,
                                    java.lang.Object changee)
                             throws CanNotEvaluateConditionException
Determines whether the ConditionalChange would become inapplicable if the specified Change was applied to the specified object.

Specified by:
isMadeInapplicableBy in interface ConditionalChange
Parameters:
changee - the object to which the specified change would be applied to make this ConditionalChange inapplicable
untriggeringChange - the Change that would be applied to cause the inapplicability of this ConditionalChange
Returns:
False if this ConditionalChange is already inapplicable or if it is currently applicable and would remain applicable despite the application of the specified Change. True if the Change is currently applicable but would be inapplicable if the specified Change were applied to the specified Object.
Throws:
CanNotEvaluateConditionException

applyTo

public void applyTo(java.lang.Object o)
             throws ChangeNotApplicableException
Applies this Change to the specified Object.

Specified by:
applyTo in interface Change
Parameters:
o -
Throws:
ChangeNotApplicableException - If isApplicable returns false or the change can not be applied or can not be applied to the object specified.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright (c) 1999-2004 Oak Grove Systems. All Rights Reserved.