Classes | Core > Kernel | Language > OOP

Class : Object

A Class describes the structure and implementation of a set objects which are its instances.
Source: Kernel.sc
Subclasses: Meta_Object

Class Methods

Class.allClasses

Returns:

an Array of all Classes

Class.initClass

From superclass: Object

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' initClass is called exactly once during the initialization phase.

Class.initClassTree(aClass)

used in *initClass to assure the initialisation of aClass before using it. Wherever necessary, it recursively initializes all classes required by 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

YourClass {
    *initClass {
        // initialize OtherClass before continuing
        Class.initClassTree(OtherClass);

        ..

        // use OtherClass

        ..
    }

    ..

}

Pre-initialized data such as SynthDefs should be deferred to StartUp

YourClass {
    *initClass {
        StartUp.add {
            ..
        }
    }

    ..

}

Inherited class methods

Undocumented class methods

Class.classesInited

Class.classesInited = value

Class.findAllReferences(aSymbol)

Instance Methods

.browse

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/GUI/PlusGUI/Core/KernelPlusGUI.sc

Open a graphical browser for this Class. Shows methods, arguments, variables, subclasses, and has buttons for navigating to the superclass, source, helpfile, etc.

.findMethod(methodName)

Find the Method referred to by name. If not found, return nil.

.findRespondingMethodFor(methodName)

As above, but climb the class tree to see if the method is inherited from a superclass. If not found, return nil.

.dumpAllMethods

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

Post all instance methods which instances of this class responds too, including inherited ones. this.class.dumpAllMethods will post all class methods which this class responds to.

.dumpByteCodes(methodName)

Dump the byte codes of the named method.

.dumpClassSubtree

Post the tree of all Classes that inherit from this class.

.dumpInterface

Post all the methods defined by this Class and their arguments.

.dumpFullInterface

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

Post all the class and instance methods that this class responds to (i.e. those defined in this class and those inherited by it).

.help

Opens the help file for this Class if it exists.

.helpFilePath

Returns the path of this Class's helpfile as a String.

.helpFileForMethod(methodSymbol)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

Opens the helpfile for the class in which the responding method is implemented.

Array.helpFileForMethod('select'); // This will open the Collection helpfile

.asClass

Return this.

.asString

Return the name of the class as a String.

Accessing

.name

A Symbol that is the name of the class.

.nextclass

The next class in a linked list of all classes.

.superclass

The Class from which this class directly inherits.

.superclasses

An Array of this class's superclasses, going back to Object.

.subclasses

An Array of the direct subclasses of this.

.allSubclasses

An Array of all subclasses of this.

.methods

An Array of the methods of this class.

.instVarNames

An Array of the names of the instance variables for this class.

.classVarNames

An Array of the names of the class variables for this class.

.iprototype

An Array of the initial values of instance variables.

.cprototype

An Array of the initial values of class variables.

.filenameSymbol

A Symbol which is a path to the file which defines the Class.

Inherited instance methods

Undocumented instance methods

.archiveAsCompileString

.charPos

.classIndex

.classVarIndex

.classVars

.collectMethods(list)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

.constNames

.constValues

.dumpMethodList

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

.dumpSubclassList

From extension in /usr/local/share/SuperCollider/SCClassLibrary/DefaultLibrary/dumpFullInterface.sc

.findOverriddenMethod(methodName)

.findReferences(aSymbol, references)

.hasHelpFile

.inspectorClass

.isMetaClass

.maxSubclassIndex

.openCodeFile

.openHelpFile

.package

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Quarks/packages.sc

.shallowCopy

.superclassesDo(function)