org.eclipse.ocl.examples.domain.types
Class AbstractFragment
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
derivedInheritance
@NonNull
public final DomainInheritance derivedInheritance
baseInheritance
@NonNull
public final DomainInheritance baseInheritance
AbstractFragment
public AbstractFragment(@NonNull
DomainInheritance derivedInheritance,
@NonNull
DomainInheritance baseInheritance)
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