constraints
Class InheritanceConstraint

java.lang.Object
  extended byconstraints.InheritanceConstraint
All Implemented Interfaces:
Constraint

public class InheritanceConstraint
extends java.lang.Object
implements Constraint

Constraint class for use as correctness or completeness constraint. Enforces single inheritance for Java classes.

Version:
0.1.18, 24 November 2003
Author:
Dennis Wagelaar

Constructor Summary
InheritanceConstraint()
           
 
Method Summary
 void check(AbstractConcept concept)
          Checks whether this constraint holds for the given concept.
protected  void checkComposite(Composite composite)
          Checks whether this constraint holds for the given composite.
protected  void checkParents(Concept child, java.util.Collection parents)
          Checks whether the given child concept doesn't inherit from multiple Class form concepts.
protected  java.util.Set getParents(CompositeRole parent)
          Retrieves all parent concepts given the parent role.
protected  java.util.Set getParents(Concept child)
          Retrieves all parent concepts given the child concept.
protected  boolean isClass(java.lang.String form)
          Checks whether the given form can be interpreted as a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InheritanceConstraint

public InheritanceConstraint()
Method Detail

isClass

protected boolean isClass(java.lang.String form)
Checks whether the given form can be interpreted as a class.

Parameters:
form - The concept form.
Returns:
True if form can be interpreted as a class.

checkParents

protected void checkParents(Concept child,
                            java.util.Collection parents)
                     throws CoComposeException
Checks whether the given child concept doesn't inherit from multiple Class form concepts.

Parameters:
child - the child concept to check
parents - the parent concepts to check
Throws:
CoComposeException - if child inherits from multiple Classes

getParents

protected java.util.Set getParents(Concept child)
Retrieves all parent concepts given the child concept.

Parameters:
child - the child concept
Returns:
the Set<Concept> of parents

getParents

protected java.util.Set getParents(CompositeRole parent)
Retrieves all parent concepts given the parent role.

Parameters:
parent - the parent role
Returns:
the Set<Concept> of parents

checkComposite

protected void checkComposite(Composite composite)
                       throws CoComposeException
Checks whether this constraint holds for the given composite.

Parameters:
composite - The composite to check the constraint for.
Throws:
CoComposeException - if and only if the constraint doesn't hold.

check

public void check(AbstractConcept concept)
           throws CoComposeException
Checks whether this constraint holds for the given concept.

Specified by:
check in interface Constraint
Parameters:
concept - The concept to check the constraint for.
Throws:
CoComposeException - if and only if the constraint doesn't hold.