Abstract Class UML 2.3::Classifier

Description:

Classifier is defined to be a kind of templateable element so that a classifier
can be parameterized. It is also defined to be a kind of parameterable
element so that a classifier can be a formal template parameter.

Constraints:

Signature: non_final_parents() : Boolean;Description: The parents of a classifier must be non-final.Expression: self.parents()->forAll(not isFinalSpecialization)

Signature: no_cycles_in_generalization() : Boolean;Description: Generalization hierarchies must be directed and acyclical. A classifier
can not be both a transitively general and transitively specific classifier
of the same classifier.Expression: not self.allParents()->includes(self)

Signature: maps_to_generalization_set() : Boolean;Description: The Classifier that maps to a GeneralizationSet may neither be a specific
nor a general Classifier in any of the Generalization relationships defined
for that GeneralizationSet. In other words, a power type may not be an
instance of itself nor may its instances also be its subclasses.Expression: true

Signature: generalization_hierarchies() : Boolean;Description: Generalization hierarchies must be directed and acyclical. A classifier
can not be both a transitively general and transitively specific classifier
of the same classifier.Expression: not self.allParents()->includes(self)

Operations:

Signature: parents() : Classifier;Description: The query parents() gives all of the immediate ancestors of a generalized Classifier.The OCL used here is not normative.Editor's notes: self.generalization is a Set, we want the general of each of its elements.Expression: result = generalization->collect(general)Original: result = generalization.general

Signature: maySpecializeType(c : Classifier; ) : Boolean;Description: The query maySpecializeType() determines whether this classifier may have a generalization relationship to classifiers of the specified type. By default a classifier may specialize classifiers of the same or a more general type. It is intended to be redefined by classifiers that have different specialization constraints.The OCL used here is not normative.Editor's notes: oclType() not oclType. No such operator in OCL AFAIK. But I have one for this purpose.Expression: result = self.oclIsKindOf(c.oclType())Original: result = self.oclIsKindOf(c.oclType)

Signature: isTemplate() : Boolean;Description: The query isTemplate() returns whether this templateable element is actually a template.The OCL used here is not normative.Editor's notes: Templateable not Templatable.Expression: result = oclAsType(TemplateableElement).isTemplate() or general->exists(g | g.isTemplate())Original: result = oclAsType(TemplatableElement).isTemplate() or general->exists(g | g.isTemplate())

Signature: hasVisibilityOf(n : NamedElement; ) : Boolean;Description: The query hasVisibilityOf() determines whether a named element is visible in the classifier. By default all are visible. It is only called when the argument is something owned by a parent.The OCL used here is not normative.Editor's notes: I rewrote inheritedMember to not use inheritableMembers and hasVisibilityOf.
These produce an non-progressing recursion (calling each other with no change in arguments).Expression: Set {}Original: result = if (self.inheritedMember->includes(n)) then (n.visibility <> #private) else true

Signature: inheritedMember.1() : NamedElement;Description: The inheritedMember association is derived by inheriting the inheritable members of the parents.The OCL used here is not normative.Editor's notes: I rewrote inheritedMember to not use inheritableMembers and hasVisibilityOf.
These produce an non-progressing recursion (calling each other with no change in arguments).Expression: result = self.inheritedMemberAux()->asSet()Original: result = self.inherit(self.parents()->collect(p | p.inheritableMembers(self))

Signature: inheritedMemberAux() : NamedElement;Description: The inheritedMember association is derived by inheriting the inheritable members of the parents.Editor's notes: This is a new function defined to correct the problem of non-progressing recursion
of the normative inheritedMember.1Expression: result = let directs = self.parents()->reject(x | x.visibility = #private) in
if directs->isEmpty()
then directs
else directs->collect(x | x.inheritedMemberAux())->union(directs) endif

Signature: inheritableMembers(c : Classifier; ) : NamedElement;Description: The query inheritableMembers() gives all of the members of a classifier that may be inherited in one of its descendants, subject to whatever visibility restrictions apply.The OCL used here is not normative.Editor's notes: I rewrote inheritedMember to not use inheritableMembers and hasVisibilityOf.
These produce an non-progressing recursion (calling each other with no change in arguments).Expression: Set{}Original: result = member->select(m | c.hasVisibilityOf(m))

Signature: inherit(inhs : NamedElement; ) : NamedElement;Description: The query inherit() defines how to inherit a set of elements. Here the operation is defined to inherit them all. It is intended to be redefined in circumstances where inheritance is affected by redefinition.Expression: result = inhs

Signature: general.1() : Classifier;Description: The general classifiers are the classifiers referenced by the generalization relationships.Expression: result = self.parents()

Signature: conformsTo(other : Classifier; ) : Boolean;Description: The query conformsTo() gives true for a classifier that defines a type that conforms to another. This is used, for example, in the specification of signature conformance for operations.Expression: result = (self=other) or (self.allParents()->includes(other))

Signature: allParents() : Classifier;Description: The query allParents() gives all of the direct and indirect ancestors of a generalized Classifier.The OCL used here is not normative.Editor's notes: Missing close paren.Expression: result = self.parents()->union(self.parents()->collect(p | p.allParents()))Original: result = self.parents()->union(self.parents()->collect(p | p.allParents())

Signature: allFeatures() : Feature;Description: The query allFeatures() gives all of the features in the namespace of the classifier. In general, through mechanisms such as inheritance, this will be a larger set than feature.Expression: result = member->select(oclIsKindOf(Feature))