org.eclipse.ocl.examples.domain.types
Class AbstractFragment

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.types.AbstractFragment
All Implemented Interfaces:
DomainFragment
Direct Known Subclasses:
ExecutorFragment, ReflectiveFragment

public abstract class AbstractFragment
extends java.lang.Object
implements DomainFragment


Field Summary
 DomainInheritance baseInheritance
           
 DomainInheritance derivedInheritance
           
 
Constructor Summary
AbstractFragment(DomainInheritance derivedInheritance, DomainInheritance baseInheritance)
           
 
Method Summary
 DomainFragment getBaseFragment()
          Return the unoverloaded fragment, which is getBaseInheritance().getSelfFragment().
 DomainInheritance getBaseInheritance()
          Return the inheritance that introduces the operations and properties in this fragment.
 DomainInheritance getDerivedInheritance()
          Return the inheritance that overloads the operations and properties in this fragment.
 java.lang.String toString()
          Return true if anOperation overloads an existing operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.domain.elements.DomainFragment
getImplementation, getLocalOperation, getLocalOperations, getLocalProperties
 

Field Detail

derivedInheritance

@NonNull
public final DomainInheritance derivedInheritance

baseInheritance

@NonNull
public final DomainInheritance baseInheritance
Constructor Detail

AbstractFragment

public AbstractFragment(@NonNull
                        DomainInheritance derivedInheritance,
                        @NonNull
                        DomainInheritance baseInheritance)
Method Detail

getBaseFragment

@NonNull
public final DomainFragment getBaseFragment()
Description copied from interface: DomainFragment
Return the unoverloaded fragment, which is getBaseInheritance().getSelfFragment().

Specified by:
getBaseFragment in interface DomainFragment

getBaseInheritance

@NonNull
public final DomainInheritance getBaseInheritance()
Description copied from interface: DomainFragment
Return the inheritance that introduces the operations and properties in this fragment.

Specified by:
getBaseInheritance in interface DomainFragment

getDerivedInheritance

@NonNull
public final DomainInheritance getDerivedInheritance()
Description copied from interface: DomainFragment
Return the inheritance that overloads the operations and properties in this fragment.

Specified by:
getDerivedInheritance in interface DomainFragment

toString

public java.lang.String toString()
Return true if anOperation overloads an existing operation. protected boolean isOverload(DomainOperation anOperation) { int depth = derivedInheritance.getDepth(); for (int i = 0; i <= depth-1; i++) { for (DomainInheritance superInheritance : derivedInheritance.getSuperInheritances(depth)) { DomainFragment baseFragment = superInheritance.getSelfFragment(); for (DomainOperation baseOperation : baseFragment.getOperations()) { if (isOverload(anOperation, baseOperation)) { return true; } } } } return false; }

Overrides:
toString in class java.lang.Object