inheritance tree
NonType Reflection FlagsMixin
| | |
`-----+--' |
| |
ScoreObject SMapping.mappingMixin
| |
`---------+---------'
|
Item
|
`+
|
Element
class definition
[abstract class] An element is a score item which does not contain items. For instance, a note and a pause (rest) are both elements.
class Element (Inheritance-free)
prop locking
feat !ScoreObjectType label
attr containers flags id info parameters
- addContainer(Container)
[aux method] Method adds Container to list of containers self is contained in. However, method does not establish bidirectional links. Method should not be called by user.
- addFlag(F)
Adds an arbitrary flag F to self. A flag must be a literal.
- addInfo(X)
[destructive method] Adds X to list in attribute info. The tail of the list at attribute info is the info that was specified before with addInfo and was give at the init method (default is nil).
- addInfos(Xs)
[destructive method] Adds every element in list Xs to list in attribute info.
- bilinkContainers(Containers)
Calling the method bilinkItems with Containers expresses that self is contained in all Containers. The method establishes bidirectional links between both self and all Containers. Method must not be called by user (only by class designer).
- bilinkParameters(Parameters)
[aux method] Method must not be called by user.
*/
!! method removed
meth addParameters(Parameters)
{@parameters addList(Parameters)}
end
/** %% [aux method] Parameters and self are bidirectional linked. Method must not be called by user (only by class designer).
- closeExtendableLists()
[aux method]
- closeScoreHierarchy(mode:Mode)
After instantiating and initialising score objects to form a score hierarchy, the hierarchy is still extendable (i.e. the user can add items to containers and containers to items). The method closeScoreHierarchy makes a score hierarchy unextendable, which is necessary to prevent various procedures/methods from blocking.
- collect(?Xs excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The collect methods collects (possibly all) score objects in a list to make them accessible for, e.g., various list mapping functions. The method collects objects related to self (an item) by the value of the item attributes containers, parameters and the container attribute items. The methods supports a few features to control the collecting.
If feature mode
is set to tree
(the default), collect recursively collects the score objects and subobjects contained in self (i.e. both the attributes items and parameters are traversed). If mode
is set to graph
, both objects contained in self and containers self is contained in are collected (i.e. all three attributes items, parameters, and containers are traversed).
If feature level
is set to all
(the default), collect collects score objects recursively into arbitrary depth. However, the depth can be controlled by specifying an integer value for level
.
The feature test
expects a unary function returning a boolean or an atom representing a boolean unary method understood by all objects in self. The method collect only collects score objects fulfilling the test function/method.
The feature excludeSelf
expects a Boolean. If true (the default), self is not included in the result.
collect visits containers in depth-first fashion from left to right which affects the order of the objects in the returned list. E.g., collecting all events in a few nested sequentials in tree mode returns a list with all events ordered by start time.
NB: collect blocks if self is not fully initialised (e.g. created by Score.makeScore2) or if Test blocks at some object in self (e.g. because the object is only partially determined).
- count(?N excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The method count counts a number of collected score objects. The method supports the features mode
, level
, test
, and excludeSelf
. These features have the same meaning as in the method collect.
- filter(?Xs Fn excludeSelf:ExcludeSelf level:Level mode:Mode)
The method filter collects a number of score objects fulfilling Fn, a the unary function returning a boolean. The method supports the features mode
, test
, and excludeSelf
. These features have the same meaning as in the method collect.
- filterContainers(Xs Fn)
Return a list of all direct containers of self for which Fn (unary function or method) returns true.
- filterParameters(Xs Fn)
Return a list of all direct parameters of self for which Fn (unary function or method) returns true.
- find(?Xs Fn excludeSelf:ExcludeSelf level:Level mode:Mode)
The method find returns the first score object in self fulfilling Fn, a the unary function returning a boolean. The method supports the features mode
, level
, and excludeSelf
. These features have the same meaning as in the method collect.
NB: this implementation is inefficient (first collects all score objects).
- findContainer(X Test)
Returns the first direct container self is contained in which fulfils the boolean function or method Test.
- findContainerRecursively(X Test)
Returns the first direct or indirect container of self, which fulfils the boolean function or method Test.
- findParameter(X Test)
Returns the first direct parameter of self which fulfils the boolean function or method Test.
- forAll(Proc excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The method forAll maps the procedure Proc to a number of collected score objects. Proc may also be an atom representing a method of no arguments and understood by all objects in self fulfilling Test. The method supports the features mode
, level
, test
, and excludeSelf
. These features have the same meaning as in the method collect.
- forAllContainers(Proc)
Applies Proc (unary procedure or method) on all direct containers in self.
- forAllParameters(Proc)
Applies Proc (unary procedure or method) on all direct parameters in self.
- forAllThreaded(Proc excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The method traverses all score objects in self (i.e. items and parameters) and applies unary procedure (or null-ary method) Proc on every object returning true for the unary function (or unary method) Test. However, the method does not effect the object self itself -- only the parameters and (if self is a container) items of self are effected recursively. Traversing happens concurrently -- the method does not suspend even if the result of getItems or getParameters is not yet fully determined.
- getAttr($ A)
Returns the value at attribute A.
- getAttrNames($)
Returns a list of all attributes (atoms) defined for self.
- getAttrSources($)
Alias for getAttrNames.
*/
meth getAttributes($) {self getAttrNames($)} end
/** %% Returns a record where the features are the attributes defined for self and the values are the classes which define these attributes.
- getClass($)
- getClassName($)
Returns the print name of the class of self as specified in its definition. The name is an atom derived from a variable and thus starting with a capital letter, e.g., 'ScoreObject'.
- getContainers(X)
- getContainersRecursively($)
Returns all direct and indirect containers of self.
- getFeat($ F)
Returns the value at feature F.
- getFeatNames($)
Returns a list of all features (atoms) defined for self.
- getFeatSources($)
Returns a record where the features are the features defined for self and the values are the classes which define these features.
- getFeatures($)
Alias for getFeatNames.
- getID(X)
- getInfo(X)
- getInfoRecord($ L)
Returns first record with label L in the list in attribute info.
- getInitArgDefaults($)
Returns a record where the features are all supported arguments of the init method of self with their default as value (_ indicates that no default exist).
NB: this method relies on the correct implementation of the method getInitArgs for its class and all its superclasses.
- getInitArgSources($)
- getInitClasses(Classes)
Collects all classes of the objects in self in the format expected by the second argument of Score.makeScore, i.e., a record of the form unit(label1:Class1 ... labelN:ClassN)
- getInitClassesVS($)
Like getInitClasses, getInitClassesVS collects all classes of the objects in self in the format expected by the second argument of Score.makeScore. However, the result record is returned as a VS (e.g., for outputting into Oz source text files). The Strasheela classes are specified by accessing them in Strasheela functors (e.g., Strasheeala.score.note). The toplevel Strasheela functors are taken from {Init.getStrasheelaEnv strasheelaFunctors}.
NB: getInitClassesVS examines every class in these functors (and their subfunctors) and requires that whenever a class defines an init method, all init method arguments must be optional.
- getInitInfo($ ...)
Returns information required to reconstruct the init method. Every newly defined ScoreObject subclass which introduces new init arguments should define its own getInitInfo. This documentation therefore explains also implementational details for this method.
The returned information hase the following form:
unit(superclass:Super
args:[Argument1#Accessor1#Default1
...
ArgumentN#AccessorN#DefaultN])
Super is a single superclass of self which defines/inherits a method getInitInfo extending the present method definition (can be nil in case of no superclass). Argument is an init method argument (an atom), Accessor is a unary accessor function or method returning the value of the object corresponding with Argument, and Default is the default value or 'noMatch' if no default value was given. Excluded is the same arg as for toInitRecord: this argument is only required if getInitInfo recuresively calls toInitRecord. A typical getInitInfo definition follows
meth getInitInfo($ ...)
unit(superclass:MySuperClass
args:[myParameter#getMyParameter#noMatch])
end
- getMethNames($)
Returns a list of all methods (atoms) defined for self.
- getMethSources($)
Returns a record where the features are the methods defined for self and the values are the classes which define these methods.
- getParameters(X)
- getPosRelatedItem(?X N Container)
Returns the item in Container which is the Nth in relation to self (i.e. self too is an item in Container). N may be a negative integer (returns an item before self) or a positive integer (returns an item after self). For example, {X positionOffset($ 1 C)} returns the item just after self in C.
- getPosition(?Pos Container)
Returns the index of self in Container.
- getPredecessor(?X Container)
Returns predecessor item of self in Container.
- getPredecessors(X N Container)
Returns a list of the N items that precede self in Container, the item closes to self first. If N goes beyond the number of items available then on the available items are returned (i.e. the returned list is shorter than N).
- getPredecessorsUpToRest($)
Returns a list of the items that precede self in its TemporalAspect up to any rest (i.e. a pause object or an item with an offset time > 0). A pause object would be excluded, but an item with an offset time > 0 would be included.
Note: method delayed until offset times are sufficienly determined.
- getSuccessor(?X Container)
Returns successor item of self in Container.
- getSuccessors(X N Container)
Returns a list of the N items that succeed self in Container. If N goes beyond the number of items available then on the available items are returned (i.e. the returned list is shorter than N).
- getSuccessorsUpToRest($)
Returns a list of the items that succeed self in its TemporalAspect up to any rest (i.e. a pause object or an item with an offset time > 0). A pause object would be excluded, and so would be an item with an offset time > 0.
Note: method delayed until offset times are sufficienly determined.
- getTemporalAspect(X)
Returns the TemporalAspect self is contained in. A score object must be contained in only a single temporal aspect.
- getTemporalContainer($)
Alias for getTemporalAspect.
- getTemporalPosition(?Pos)
Returns the index of self in its temporal container (temporal aspect).
- getTemporalPredecessor(X)
Returns the predecessor of object in its TemporalAspect. NB: method returns positional and not a temporal predecessor.
- getTemporalPredecessors(X N)
Returns a list of the N items that precede self in its TemporalAspect, the item closes to self first. If N goes beyond the number of items available then on the available items are returned (i.e. the returned list is shorter than N).
- getTemporalSuccessor(X)
Returns the successor of object in its TemporalAspect. NB: method returns positional and not a temporal successor.
- getTemporalSuccessors(X N)
Returns a list of the N items that succeed self in its TemporalAspect. If N goes beyond the number of items available then on the available items are returned (i.e. the returned list is shorter than N).
- getTemporalToplevel(Xs test:Test)
Returns the first top level of self which is a temporal item
(cf. doc to getTopLevels).
- getTopLevels(?Xs test:Test)
Returns list of all top level items in score hierarchy graph of self which fulfil the optional boolean function or method test.
NB: This method even collects top-levels which are not (indirect) container of self but only of some of its (indirect) contained items.
- hasFlag(?B F)
Tests whether self has flag F. Method returns a boolean.
- hasPosRelatedItem(B N Container)
!! doc missing
- hasPredecessor(?B Container)
Returns a boolean whether self has a predecessor in Container.
- hasSuccessor(?B Container)
Returns a boolean whether self has a successor in Container.
- hasTemporalContainer($)
- hasTemporalPredecessor(B)
- hasTemporalSuccessor(B)
Checks whether object has a successor in its TemporalAspect. NB: method checks for a positional and not a temporal successor.
!!?? Rename to hasSuccessorInTemporalAspect ?
- hasThisInfo(B Info)
Returns boolean whether the list at the attr info of self contains Info. In case some info value is a record, then it is checked whether its label is Info.
- init(addParameters:AddParams containers:Containers ...)
The optional parameter containers expects a list of containers the item instance is contained in. (Additionally, containers can be given by calling the method bilinkContainers.)
NB: the init args containers and addParameters are yet not supported by methods like toInitRecord.
- initDomains(Spec)
Initialises all parameters of item to FD variables (if still free). This method is called by MakeScore. For item subclasses it should be overwritten as necessary.
- initFlags()
[aux method] Method must not be called by user.
- isAbstractElement(B)
- isAmplitude(B)
- isAspect(B)
- isContainer(B)
- isDet($)
Are all parameter values determined? NB: isDet can return false simply because constraint propagation did not finish to determine some parameter. You may want to use the method wait instead.
- isElement(B)
- isEvent(B)
- isFirstItem(?B Container)
Returns a boolean whether self is the first item in Container.
- isItem(B)
- isLastItem(?B Container)
Returns a boolean whether self is the last item in Container.
- isModifier(B)
- isNote(B)
- isParameter(B)
- isPause(B)
- isPitch(B)
- isScoreObject(B)
- isSequential(B)
- isSimultaneous(B)
- isTemporalAspect(B)
- isTemporalElement(B)
- isTimeInterval(B)
- isTimeMixin(B)
- isTimeParameter(B)
- isTimePoint(B)
- isTopLevel(?B)
Returns boolean whether self is a top level item in the score hierarchy graph.
- makeInitRecord(X Attrs)
[aux method for toInitRecord]: returns a record intended to facilitate the init method creation of an object for archive purposes. Attrs has the form [Key1#Accessor1#Default1 ...], keys are the record features of the init record, accessors the respective accessor for some object attributes (unary function or method), defaults are the respective attribute default values (the special default value noMatch matches nothing).
- makePPrintRecord(X Features Slots Excluded functions:Fns)
[aux method for toPPrintRecord] Returns a record with the label of self (the value at the feature label of self) and the values of selected features/attributes of self at record labels. All atoms in the list Features which are member in the list Slots are features of the returned record.
Usually, the record feature is just bound to the value at the features/attributes of self. However, for certain features/attributes there are special access functions defined. The return value of these functions will be bound to the record features. These features and their functions are either given in a record to the optional method feature functions. Other features and their functions are predefined in the variable PPrintRecordFns.
- map(?Xs Fn excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The method map maps the function Fn to a number of collected score objects and returns a list with all results. Fn may also be an atom representing a unary method understood by all objects in self fulfilling Test. The method supports the features mode
, level
, test
, and excludeSelf
. These features have the same meaning as in the method collect.
- mapContainers(Xs Fn)
Maps Fn (unary function or method) over all direct containers in self.
- mapParameters(Xs Fn)
Maps Fn (unary function or method) over all direct parameters in self.
- mappend(?Xs Fn excludeSelf:ExcludeSelf level:Level mode:Mode test:Test)
The method map maps the function Fn (which must return a list) to a number of collected score objects and returns a list with all results appended. Fn may also be an atom representing a unary method understood by all objects in self fulfilling Test. The method supports the features mode
, level
, test
, and excludeSelf
. These features have the same meaning as in the method collect.
- partiallyUnify(ScoreObject Percent test:Test)
Unifies the percentage Percent of the parameter values of self with the corresponding parameter values of ScoreObject. This is useful, for example, for manually controlling the search process by saying that a given percentage of the solution of a CSP is the same as in a given previous solution (e.g., from a pickled score), and then -- given suitable continuations of this solutions -- by and by increasing this percentage.
Blocks if self or ScoreObject are not fully determined.
Args:
test (default fun {$ X} true end): a Boolean function or method which parameters to include in unification and the percentage count.
- percentageIsDet($ exclude:Exclude)
Returns a float how many percent parameters of self and its contained items are determined. The Boolean function/method Exclude can be used to exclude parameters from considering. By default, time point parameters are excluded.
- pmApply(Xs PatternMatchingExpr P)
Apply unary procedure P (expecting a list) to the sublist from Xs (a list) matching PatternMatchingExpr (a list of atoms: a single 'x' and any number of 'o' in any order). PatternMatchingExpr expresses a sublist of Xs positionally related to self (an element of Xs). The atom 'x' in PatternMatchingExpr reprents self and one or more 'o' atoms around 'x' express predecessors or successors of self in Xs. For instance, {Self patternMatchingApply([o o x] Xs P)
applies P to the list consisting in the two predecessors of Self in Xs and Self itself (in that order).
PatternMatchingApply reduces to skip in case there is no matching sublist in Xs (e.g. the PatternMatchingExpr = [o x] and self is already the first element in Xs).
An exeception is raised in case self is not contained in Xs or there is no 'x' in PatternMatchingExpr.
BTW: pmApply allows to easily apply rules across container bounderies. For instance, local MyNotes={Flatten {MyMotifSeq mapItems($ getItems)}} in {ForAll MyNotes proc {$ N} {N pmApply(MyNotes [o x] MyRule)} end} end
applies MyRule to all neighbouring notes nested in a sequence of motifs.
See also SMapping.patternMatchingApply.
- pmApply2(Xs PatternMatchingExpr P ElseP)
Generalised variant of pmApply: in case no sublist in Xs matches PatternMatchingExpr, PatternMatchingApply2 does _not_ reduce to skip (as pmApply) but instead applies the null-ary procedure ElseP.
See also SMapping.patternMatchingApply2.
- pmApplyTemporalAspect(PatternMatchingExpr P)
Variant of pmApply: applies P to the sublist of the elements of the temporal aspect of self which match PatternMatchingExpr.
- pmApplyTemporalAspect2(PatternMatchingExpr P ElseP)
Generalised variant of pmApplyTemporalAspect2: in case no sublist in Xs matches PatternMatchingExpr, PatternMatchingApply2 does _not_ reduce to skip (as pmApplyTemporalAspect2) but instead applies the null-ary procedure ElseP.
- removeAllFlags()
[aux method] Method should not be called by user (method removes all flags from self).
- removeFlag(F)
Removes flag F from self.
- setAllParameterUnits(ParameterAccessor Unit test:Test)
For all score objects in self (including self itself) which fulfil Test (a function or method name), the method sets the parameter unit accessible by ParameterAccessor (a function or method name) to Unit. Test defaults to isItem.
NB: ParameterAccessor must return the parameter, not the parameter value (e.g. use getPitchParameter instead of getPitch)
- setAttribute(A X)
[destructive method] Statefully sets attribute A to value X. The method is indented for editing a score after search, the search itself is indented to be fully stateless.
- setParameterValue(Param X)
[destructive method, for experts only] Statefully sets the value of parameter Param to value X (there must be an attribute Param). Remember that the search itself is indented to be fully stateless.
- toFullRecord(X exclude:Exclude unbind:Unbind)
Outputs the whole score object tree as a record with the the object label as record label and with all the object attributes and object features as record features. All attributes/features containing score objects themself are called recursively, dictionaries and extendable lists (see LUtils) are transformed to records resp. lists.
Args:
'exclude' (default nil): list of attribute names (list of atoms) recursively excluded in the output.
'unbind' (default nil): list of attribute names (list of atoms) which are output, but whose value is set to a free variable.
!! Temp: The attributes 'item' and 'containers' are always excluded to avoid endless loops. Therefore, score graphs with items having more then a single container can not be shown.
- toInitRecord($ clauses:Clauses exclude:Excluded)
Outputs the full init record for self which allows to re-create the score.
Excluded is a list of arguments (atoms) which must be excluded concurrently.
Clauses is a list of pairs TestI#FunI which can be used to overwrite the default init record creation (defined by the class' method getInitInfo) of specific score objects. TestI is a Boolean function or method, and FunI is a unary function expecting a score object and returning a record. For each object for which some TestI returns true, the corresponding FunI will be used for creating the init records for this object.
NB: toInitRecord depends on correct definitions of the method getInitInfo for all subclasses with specific inialisiation arguments.
NB: toInitRecord presently only works properly for tree-form score topologys (e.g. score graphs are not supported yet).
*
- toPPrintRecord(?X excluded:Excluded features:Features)
Method returns a record with essential data of self. The method is intended to view self uncluttered. The method feature features
allows to freely select a list of score object features/attributes to include.
- unify(ScoreObject derive:Derive exclude:Exclude overwrite:Overwrite)
Effectively unifies self and ScoreObject. This method is useful for constraining various forms of repetitions. Stateful data (including class instances) can not be unified in Oz. So, unify transforms self and ScoreObject to records (using toFullRecord) and unifies those records.
Args:
'exclude' (default [startTime endTime]): list of attribute names (list of atoms) to ignore, see arg 'exclude' for toFullRecord. (The internal attributes 'parameters' and 'flags' are always excluded.)
'overwrite' (default nil): list of attribute names (list of atoms) to keep as declared in self (i.e. the setting in ScoreObject is quasi overwritten).
'derive' (default nil): for unifying derived score information (e.g., exclude the pitches, but unify pitch intervals, see example below). List of unary functions expecting the full score (self or ScoreObject) and returning a data structure to unify.
Example:
{Score1 unify(Score2
exclude:[pitch]
derive:[proc {$ MyScore Intervals}
Ps = {MyScore mapItems($ getPitch)}
in
Intervals = {Pattern.map2Neighbours Ps
proc {$ P1 P2 ?Interval}
Interval = {FD.decl}
P2 - P1 + 100000 =: Interval
end}
end])}
NB: only works properly for tree-form score topologys (because of limitation of toFullRecord).
- wait(unless:Unless)
Wait (blocks) until all parameter values of self are determined. The only exception are parameters for which the optional arg Unless -- a boolean unary function -- returns true (per default, Unless always returns false).
end