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

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
                  extended bybe.ac.vub.cocompose.lang.impl.constraints.DefaultElementConstraint
All Implemented Interfaces:
Cloneable, Constraint, Element, ElementConstraint, ModelElement, Namespace, VisitedElement

public class DefaultElementConstraint
extends DefaultConstraint
implements ElementConstraint

Model element constraint.

Since:
0.2.0
Version:
0.2.10, 29/04/2004
Author:
Dennis Wagelaar

Constructor Summary
DefaultElementConstraint()
           
 
Method Summary
 void accept(ModelVisitor modelVisitor)
          Accepts a visitor.
 void acceptSuper(ModelVisitor modelVisitor)
          Invokes superclass accept().
 void addConstrainedElement(int index, ModelElement constrainedElement)
          Adds a constrained element.
 void addConstrainedElement(ModelElement constrainedElement)
          Adds a constrained element.
protected  void concreteCheck()
          Checks whether the constraint holds.
 List getConstrainedElements()
          Returns the constrained elements.
 void removeConstrainedElement(ModelElement constrainedElement)
          Removes a constrained element.
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.constraints.DefaultConstraint
check, getOwnerConstraint, isInverted, setInverted, setOwnerConstraint
 
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.constraints.Constraint
check, getOwnerConstraint, isInverted, setInverted, setOwnerConstraint
 
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

DefaultElementConstraint

public DefaultElementConstraint()
Method Detail

getConstrainedElements

public List getConstrainedElements()
Returns the constrained elements.

Specified by:
getConstrainedElements in interface ElementConstraint
Returns:
the constrained elements.

accept

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

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

acceptSuper

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

Overrides:
acceptSuper in class DefaultConstraint
Parameters:
modelVisitor - The visitor to accept.
Throws:
ModelElementException
See Also:
accept(ModelVisitor)

addConstrainedElement

public void addConstrainedElement(ModelElement constrainedElement)
Adds a constrained element.

Specified by:
addConstrainedElement in interface ElementConstraint
Parameters:
constrainedElement - the element to add.

addConstrainedElement

public void addConstrainedElement(int index,
                                  ModelElement constrainedElement)
Adds a constrained element.

Specified by:
addConstrainedElement in interface ElementConstraint
Parameters:
index - the index at which to add the element.
constrainedElement - the element to add.

removeConstrainedElement

public void removeConstrainedElement(ModelElement constrainedElement)
Removes a constrained element.

Specified by:
removeConstrainedElement in interface ElementConstraint
Parameters:
constrainedElement - the element to remove.

concreteCheck

protected void concreteCheck()
                      throws ModelElementException
Checks whether the constraint holds.

Specified by:
concreteCheck in class DefaultConstraint
Throws:
ModelElementException - - if the constraint doesn't hold.