Classifier


Overview

A classifier is a name space for operations and constraints. A classifier is generalizable and has parents from which it inherits operations and constraints. A classifier can be instantiated via 'new/0' and 'new/1'. In both cases the default behaviour is to return a default value as an instance. If the classifier is a datatype then the basic value for the datatype is returned otherwise 'null' is returned as the default value. A classifier can also be applied to arguments (0 or more) in order to instantiate it. Typically you will not create a Classifier directly, but create a class or an instance of a sub-class of Class.



Parents NameSpace ,IndexedContainer ,NamedElement ,DocumentedElement ,Container ,Contained ,Object ,Element


Constructors



Attributes
constraintsSet(Constraint)No Documentation Specified
defaultElementNo Documentation Specified
grammarGrammarNo Documentation Specified
isFinalBooleanNo Documentation Specified
operationsSet(Operation)No Documentation Specified
parentsSet(Classifier)No Documentation Specified
From NameSpace: bindings, imports. From IndexedContainer: contents. From NamedElement: name. From DocumentedElement: documentation. From Contained: owner.



Operations
add(namedElement:NamedElement):ClassifierNo Documentation Specified
add(n:NamedElement):Classifier Adds a named element to a classifier. If the named element is an operation or constraint then it is added to the appropriate attributes of the classifier. Sub-classes of Classifier can exte-nd this as appropriate but should also call thi via 'super'.
addConstraint(c:Constraint):Classifier Adds a constraint to a classifier. Use 'add/1' in preference to this operation.
addGrammar(grammar:Grammar):ElementNo Documentation Specified
addOperation(o:Element):Constraint Adds an operation to a classifier. Use 'add/1' in preference to this operation. Removes any existign operation with the same name and arity.
addParent(parent:Element):Element Add the parent to the receiver. Only make the modification if the parent is legal and not already present. Otherwise dont change the receiver.
allConstraints():Set(Constraint) Get all the constraints defined and inherited by the receiver.
allOperations():Seq(Operation) Get All the operations defined and inherited by the receiver. The order of the operations is very important because this is the order in which message lookup occurs. To calculate allOperations/0 we use an Operator Precedence Ordering. This is a depth first left to right traversal of the classification type lattice up to a join. Stopping at join points means that operations that would otherwise appear multiple times in the OPO are promoted to their last occurrence.
allParents():Set(Classifier) The set of all parents of a classifier.
availableParents():Set(Classifier)No Documentation Specified
checkParents():Classifier Called when a classifier is initialised. Raises an exception if any of the parents are illegal (for example if they are final).
classify(e:Element):Set(ConstraintReport) A classifier classifies its instances by running constraints against them. The result of classification is a set of constraint reports that describe whether the classification succeeded and why the classification fails. To classify a candidate supply it to 'classify/1' to produce the set of reports.
default():Element When a classifier is used as an attribute type the corresponding slot values are initialised to the default value returned by this operation.
defaultParents():Set(Classifier) When creating a classifier it is possible to state the default parents so that if no parents are specified when creating an instance of the classifier the set returned by this operation is used. The default parent for a classifier is Element.
dependencies():Set(Element)No Documentation Specified
getConstraint(name:String):Constraint ndex a constraint by name.
getOperation(name:String):Operation Index an operation by name.
getOperation(name:String,arity:Integer):Operation Index an operation by name and arity.
grammar():GrammarNo Documentation Specified
hasOperation(name:Element,arity:Element):ElementNo Documentation Specified
inheritsFrom(c:Classifier):Boolean A classifier inherits from another if they are the same or we can ue the 'parents' relation transitively to link the two. Supply the super-classifier to this operation which will return true when the receiver inherits from the argument.
init():Classifier To initialise a classifier, initialise the operations, the parents and run super.
initConstraints():ElementNo Documentation Specified
initOperations():Element Initialise all the operations.
initParents():Element Initialise the parents of a classifier. When the compiler encounters a package of definitions it turns references into operations that return the references when they are called with no arguments. This is the mechanism by which mutual recursion is implemented. The dereferencing occurs by delaying the mutual recursion in the body of the operations; the compiler will have compiled the references in the body of the operation as an appropriate lookup in the containing namespace. It is therefore important that namespaces such as classifiers and classes, and elements that reference things in namespaces such as attributes and operations are initialised. The initialisation is fairly simple since the compiler has done all the work: initialisation just calls the operation which then performs the delayed reference.
initialized():BooleanNo Documentation Specified
invoke(target:Element,args:Seq(Element)):Element A classifier is invoked to (by default) initialise itself with respect to some arguments. This is the preferred way for classifiers to be instantiated.
javaTypeName(package:Package):StringNo Documentation Specified
mapType(type:Element,nameSpaces:Seq(NameSpace)):ElementNo Documentation Specified
new():Element 'new/0' is defined by classifiers to create a new instance. The default behaviour returns the default value.
new(args:Seq(Element)):Element 'new/1' takes a sequence of initialisation arguments. It calls 'new/0' to create the new instance and then calls 'init/1' with the initialisation arguments.
remove(n:NamedElement):Classifier 'remove/1' removes a named element from a classifier. This is the preferred way of removing an element. It causes the named element to be removed from the namespace of the element (i.e. the contents table) and also removes operations and constraints from the appropriate slots. Sub-classes of Classifier should exte-nd this as appropriate, but should call this via 'super'.
removeConstraint(c:Constraint):ClassifierNo Documentation Specified
removeOperation(o:Element):ClassifierNo Documentation Specified
removeParent(parent:Element):ElementNo Documentation Specified
repopulate(namedElement:Element):BooleanNo Documentation Specified
sendInstance(element:Element,message:Element,args:Element):Element Part of the MOP. Redefine this in sub-classes to handle special message passing protocols.
shadowOperation(op:Element):ElementNo Documentation Specified
target():Element Returns the target to be used when a classifier is invoked.
From NameSpace: writeEcore, lift, allHTMLEntries, allHTMLPackages, toHTML, toHTMLDoc, resolveNameClash, remove, putElement, newName, names, nameChanged, initBindings, init, init, getInstantiableClasses, getContents, define, getElement, hasElement, add, addBinding, hasBinding, removeBinding, redefine. From IndexedContainer: removeContentDaemon, indices, initContents, index, init, contents, contentDaemons, addContentDaemon, add, add, remove. From NamedElement: href, toString, setName, repopulate, pathSeq, path, name, getNamedElement. From DocumentedElement: setDoc, doc, ensureDoc. From Container: untraceAll, traceAll, removeContentDaemon, remove, initContents, init, includes, deleteRecursive, contentsThat, contentsOf, contents, contentDaemons, checkConstraints, checkConstraints, allContentsThat, allContentsOf, allContents, addContentDaemon, add. From Contained: owner, deleteRecursive, allOwners, addTo, setOwner, removeFromOwner. From Object: slotMissing, slotMissing, setProperty, setHotLoad, setDaemonsActive, setDaemons, set, renameSlot, removeStructuralFeature, removeDaemonsWithTarget, removeDaemonsWithId, removeDaemonNamed, removeDaemon, machineInit, initSlots, init, hotLoaded, hotLoad, hasSlot, hasProperty, getProperty, get, hasStructuralFeature, getStructuralFeatureNames, hasDaemonWithTarget, hasDaemonWithIdAndTarget, hasDaemonWithId, hasDaemonNamed, fire, destroyDaemon, daemonWithIdAndTarget, daemonWithId, daemonNamed, daemonsActive, daemons, allDaemonsWithTarget, allDaemonsWithId, compositeValues, allCompositeValuesAndSelf, allCompositeValues, addStructuralFeature, addPersistentDaemon, addMultiDaemon, addDaemon. From Element: pprint, pprint, pprint, writeXMLFile, writeXMLFile, writeXML, lift, toSnapshot, toSnapshot, allHTMLEntries, allHTMLPackages, toHTML, writeHTML, writeHTML, writeHTMLAllEntries, writeHTMLAllPackages, writeHTMLIndex, writeHTMLOverview, yield, toString, systemId, setOf, send, save2, save, removeDaemon, removeDaemon, println, print, oclIsKindOf, oclIsTypeOf, noOperationFound, isTypeOf, isReallyKindOf, init, init, of, isKindOf, addTo, checkConstraints, copy, deleteRecursive, die, edit, equals, error, ferror, hashCode.