inheritance tree
NonType Reflection
| |
`-----+--'
|
ScoreObject
class definition
[abstract class] The most general data type for score data is a ScoreObject.
The feature label binds an atom naming the class. The attribute info can be used for arbitrary user information.
class ScoreObject (Inheritance-free)
feat !ScoreObjectType label
attr id info
- 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.
- 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'.
- 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.
- 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(handle:H id:ID info:Info ...)
The argument handle is bound to the score object itself (cf. the handle in QTk). The argument info is either a list of infos or a single info (arbitrary value, usually is each info an atom)
- isAbstractElement(B)
- isAmplitude(B)
- isAspect(B)
- isContainer(B)
- isElement(B)
- isEvent(B)
- isItem(B)
- 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)
- 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.
- 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).
end