be.ac.vub.cocompose.lang.impl.constraints
Class DefaultConstraint

java.lang.Object
  extended bybe.ac.vub.cocompose.lang.impl.DefaultElement
      extended bybe.ac.vub.cocompose.lang.impl.core.DefaultModelElement
          extended bybe.ac.vub.cocompose.lang.impl.core.DefaultNamespace
              extended bybe.ac.vub.cocompose.lang.impl.constraints.DefaultConstraint
All Implemented Interfaces:
Cloneable, Constraint, Element, ModelElement, Namespace, VisitedElement
Direct Known Subclasses:
DefaultCompositeConstraint, DefaultElementConstraint

public abstract class DefaultConstraint
extends DefaultNamespace
implements Constraint

Represents a general constraint.

Since:
0.2.0
Version:
0.2.8, 19/04/2004
Author:
Dennis Wagelaar

Constructor Summary
DefaultConstraint()
           
 
Method Summary
 void accept(ModelVisitor modelVisitor)
          Accepts a visitor.
 void acceptSuper(ModelVisitor modelVisitor)
          Invokes superclass accept().
 void check()
          Checks whether the constraint holds.
protected abstract  void concreteCheck()
          Checks whether the constraint holds.
 CompositeConstraint getOwnerConstraint()
          Gets the owner constraint.
 boolean isInverted()
          Gets the inverted attribute.
 void setInverted(boolean inverted)
          Sets the inverted attribute.
 void setOwnerConstraint(CompositeConstraint ownerConstraint)
          Sets the owner constraint.
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.core.DefaultNamespace
addOwnedElement, addOwnedElement, getDeepOwnedElement, getDeepOwnedElements, getOwnedElement, getOwnedElements, getOwnedElements, getOwnedIds, getRootNamespace, isRegistered, registerNameChange, removeOwnedElement, translateIndex, translateIndex
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.core.DefaultModelElement
getId, getModel, getName, getNamespace, setId, setName, setNamespace, toString
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.DefaultElement
addPropertyChangeListener, firePropertyChange, fireStructureChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface be.ac.vub.cocompose.lang.core.Namespace
addOwnedElement, addOwnedElement, getDeepOwnedElement, getDeepOwnedElements, getOwnedElement, getOwnedElements, getOwnedElements, getOwnedIds, isRegistered, registerNameChange, removeOwnedElement
 
Methods inherited from interface be.ac.vub.cocompose.lang.core.ModelElement
getId, getModel, getName, getNamespace, getRootNamespace, setId, setName, setNamespace
 
Methods inherited from interface be.ac.vub.cocompose.lang.Element
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

DefaultConstraint

public DefaultConstraint()
Method Detail

accept

public void accept(ModelVisitor modelVisitor)
            throws ModelElementException
Accepts a visitor.

Specified by:
accept in interface VisitedElement
Overrides:
accept in class DefaultNamespace
Parameters:
modelVisitor - The visitor to accept.
Throws:
ModelElementException

acceptSuper

public void acceptSuper(ModelVisitor modelVisitor)
                 throws ModelElementException
Invokes superclass accept().

Parameters:
modelVisitor - The visitor to accept.
Throws:
ModelElementException
See Also:
accept(ModelVisitor)

check

public void check()
           throws ModelElementException
Checks whether the constraint holds. This method should not be overriden. Override the concreteCheck method instead.

Specified by:
check in interface Constraint
Throws:
ModelElementException - - if the hard constraint doesn't hold.

getOwnerConstraint

public CompositeConstraint getOwnerConstraint()
Gets the owner constraint.

Specified by:
getOwnerConstraint in interface Constraint
Returns:
the owner constraint.

setOwnerConstraint

public void setOwnerConstraint(CompositeConstraint ownerConstraint)
Sets the owner constraint.

Specified by:
setOwnerConstraint in interface Constraint
Parameters:
ownerConstraint - - the owner constraint.

isInverted

public boolean isInverted()
Gets the inverted attribute.

Specified by:
isInverted in interface Constraint
Returns:
true if and only if the constraint is inverted.

setInverted

public void setInverted(boolean inverted)
Sets the inverted attribute.

Specified by:
setInverted in interface Constraint
Parameters:
inverted - - if true, the constraint is inverted.

concreteCheck

protected abstract void concreteCheck()
                               throws ModelElementException
Checks whether the constraint holds. Subclasses should override this method to implement the actual check.

Throws:
ModelElementException - - if the constraint doesn't hold.