1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
class::Class
summary::A Class describes the structure and implementation of a set objects which are its instances.
categories::Core>Kernel, Language>OOP
related:: Guides/WritingClasses, Reference/Classes
ClassMethods::
method:: allClasses
returns:: an link::Classes/Array:: of all Classes
method:: initClass
When SuperCollider starts up, just after it has compiled the library, it initializes all the classes from Object down, a depth first traversal of subclasses.
This method can be overloaded in any class that requires initialization of classvars or other resources.
note::
Each class will be initialized once, thus each class' code::initClass:: is called exactly once during the initialization phase.
::
method:: initClassTree
used in link::#*initClass:: to assure the initialisation of code::aClass:: before using it. Wherever necessary, it recursively initializes all classes required by code::aClass::.
In some cases it is required that another class and its resources are initialized before you initialize your own. This can be accomplished by
code::
YourClass {
*initClass {
// initialize OtherClass before continuing
Class.initClassTree(OtherClass);
..
// use OtherClass
..
}
..
}
::
Pre-initialized data such as link::Classes/SynthDef::s should be deferred to link::Classes/StartUp::
code::
YourClass {
*initClass {
StartUp.add {
..
}
}
..
}
::
InstanceMethods::
method::browse
Open a graphical browser for this Class. Shows methods, arguments, variables, subclasses, and has buttons for navigating to the superclass, source, helpfile, etc.
method::findMethod
Find the Method referred to by name. If not found, return nil.
method::findRespondingMethodFor
As above, but climb the class tree to see if the method is inherited from a superclass. If not found, return nil.
method::dumpAllMethods
Post all instance methods which instances of this class responds too, including inherited ones. code::this.class.dumpAllMethods:: will post all class methods which this class responds to.
method::dumpByteCodes
Dump the byte codes of the named method.
method::dumpClassSubtree
Post the tree of all Classes that inherit from this class.
method::dumpInterface
Post all the methods defined by this Class and their arguments.
method::dumpFullInterface
Post all the class and instance methods that this class responds to (i.e. those defined in this class and those inherited by it).
method::help
Opens the help file for this Class if it exists.
method::helpFilePath
Returns the path of this Class's helpfile as a String.
method::helpFileForMethod
Opens the helpfile for the class in which the responding method is implemented.
code::
Array.helpFileForMethod('select'); // This will open the Collection helpfile
::
method::asClass
Return this.
method::asString
Return the name of the class as a String.
subsection:: Accessing
method::name
A Symbol that is the name of the class.
method::nextclass
The next class in a linked list of all classes.
method::superclass
The Class from which this class directly inherits.
method::superclasses
An Array of this class's superclasses, going back to Object.
method::subclasses
An Array of the direct subclasses of this.
method::allSubclasses
An Array of all subclasses of this.
method::methods
An Array of the methods of this class.
method::instVarNames
An Array of the names of the instance variables for this class.
method::classVarNames
An Array of the names of the class variables for this class.
method::iprototype
An Array of the initial values of instance variables.
method::cprototype
An Array of the initial values of class variables.
method::filenameSymbol
A Symbol which is a path to the file which defines the Class.
|