org.rubato.base
Interface Rubette

All Known Implementing Classes:
AbstractRubette, AddressEvalRubette, AlterationRubette, BigBangRubette, BooleanRubette, ConstructorRubette, DisplayRubette, ImageDisplayRubette, ImageFileInRubette, ImageFileOutRubette, LatchRubette, LilyPondOutRubette, ListRubette, MacroInputRubette, MacroOutputRubette, MacroRubette, MelodyRubette, MidiFileInRubette, MidiFileOutRubette, ModuleMapRubette, MorphingRubette, MuxRubette, QuantizeRubette, RealArithRubette, ReformRubette, RegisterRubette, RhythmizeRubette, ScaleRubette, SchemeRubette, ScorePlayRubette, ScoreToCsoundRubette, Select2DRubette, SelectFormRubette, SetRubette, SimpleAbstractRubette, SimpleRubette, SourceRubette, SplitRubette, StatRubette, TexturalizeRubette, WallpaperRubette

public interface Rubette

Interface for Rubettes. Any implementation of a Rubette should derive AbstractRubette.

Author:
Gérard Milmeister
See Also:
AbstractRubette

Method Summary
 void addError(java.lang.String msg, java.lang.Object... objects)
          Adds an error string to the current error state.
 boolean applyProperties()
          Makes changes in the properties dialog permanent.
 void clearErrors()
          Removes all errors from the error list.
 Rubette duplicate()
          Creates a duplicate from this rubette instance.
 Rubette fromXML(XMLReader reader, org.w3c.dom.Element element)
          Creates a Rubette from an XML description starting with element.
 java.util.List<java.lang.String> getErrors()
          Returns a list of the current errors.
 java.lang.String getGroup()
          Returns the group this Rubette belongs to.
 javax.swing.ImageIcon getIcon()
          Returns an icon for this Rubette.
 int getInCount()
          Returns the current number of input connectors.
 java.lang.String getInfo()
          Returns the info string for the info label.
 Denotator getInput(int i)
          Returns the input denotator at input connector number i.
 java.lang.String getInTip(int i)
          Returns the tooltip for the input connector number i.
 java.lang.String getLongDescription()
          Returns a long description.
 RubetteModel getModel()
          Returns the RubetteModel, that this Rubette is attached to.
 java.lang.String getName()
          Returns the name of the Rubette.
 int getOutCount()
          Returns the current number of output connectors.
 Denotator getOutput(int i)
          Returns the output denotator of connectir number i.
 java.lang.String getOutTip(int i)
          Returns the tooltip for the output connector number i.
 javax.swing.JComponent getProperties()
          Returns the Swing component for the properties dialog.
 java.lang.String getShortDescription()
          Returns a short description.
 javax.swing.JComponent getView()
          Returns the Swing component for the view.
 boolean hasErrors()
          Returns true iff any error has occurred.
 boolean hasInfo()
          Returns true iff this Rubette has an info label.
 boolean hasProperties()
          Returns true iff this Rubette has a properties dialog.
 boolean hasView()
          Returns true iff this Rubette has a view.
 void init()
          Initializes Rubette.
 Rubette newInstance()
          Creates a new instance from a protoype.
 void revertProperties()
          Reverts values in the properties dialog to the values in the Rubette.
 void run(RunInfo runInfo)
          Runs the Rubette.
 void setInCount(int n)
          Sets the number of input connectors.
 void setModel(RubetteModel model)
          Sets the model this Rubette is attached to.
 void setOutCount(int n)
          Sets the number of output connectors.
 void setOutput(int i, Denotator d)
          Stores the output denotator d for output connector number i.
 void toXML(XMLWriter writer)
          Writes an XML description of this rubette.
 void updateView()
          Updates the view reflecting the changes of the values in the Rubette.
 

Method Detail

init

void init()
Initializes Rubette. This method is called when a Rubette is instantiated as a prototype.


run

void run(RunInfo runInfo)
Runs the Rubette. This is the heart of the Rubette and implements the actual computation. Input values are retrieved with the getInput method and output values are stored using the setOutput method. The runInfo parameter object has a method stopped() which should be called regularly, and, in the case it returns false, the run() method should exit gracefully.

Parameters:
runInfo - contains information about the Runner that executes the network

getGroup

java.lang.String getGroup()
Returns the group this Rubette belongs to.


getName

java.lang.String getName()
Returns the name of the Rubette.


newInstance

Rubette newInstance()
Creates a new instance from a protoype.


duplicate

Rubette duplicate()
Creates a duplicate from this rubette instance. All properties are copied if possible.


fromXML

Rubette fromXML(XMLReader reader,
                org.w3c.dom.Element element)
Creates a Rubette from an XML description starting with element.


toXML

void toXML(XMLWriter writer)
Writes an XML description of this rubette. This method should write XML for the configuration of this Rubette.


getIcon

javax.swing.ImageIcon getIcon()
Returns an icon for this Rubette.


hasProperties

boolean hasProperties()
Returns true iff this Rubette has a properties dialog. Properties reflect the configuration of this Rubette, any changes in the properties dialog may affect the computation.


getProperties

javax.swing.JComponent getProperties()
Returns the Swing component for the properties dialog. If this Rubette has no properties dialog, simply return null.


applyProperties

boolean applyProperties()
Makes changes in the properties dialog permanent.

Returns:
true iff the values in the properties dialog are correct

revertProperties

void revertProperties()
Reverts values in the properties dialog to the values in the Rubette.


hasView

boolean hasView()
Returns true iff this Rubette has a view. A view should provide a visual (or aural) representation of the configuration (resp. values) of the Rubette, but must never affect the computation.


getView

javax.swing.JComponent getView()
Returns the Swing component for the view. If this Rubette has no view, simply return null.


updateView

void updateView()
Updates the view reflecting the changes of the values in the Rubette. If there is no view, do nothing.


hasInfo

boolean hasInfo()
Returns true iff this Rubette has an info label. The info label is a short string that is displayed in the JRubette.


getInfo

java.lang.String getInfo()
Returns the info string for the info label. If this Rubette has no info label, simply return null.


getShortDescription

java.lang.String getShortDescription()
Returns a short description. The short description is shown as a tooltip over the JRubette.


getLongDescription

java.lang.String getLongDescription()
Returns a long description. The long description is shown in the text area below the Rubette list, if this Rubette is selected in the list.


getInTip

java.lang.String getInTip(int i)
Returns the tooltip for the input connector number i.


getOutTip

java.lang.String getOutTip(int i)
Returns the tooltip for the output connector number i.


setInCount

void setInCount(int n)
Sets the number of input connectors. This method should be called with default value in the init() method. It can be called afterwards if the number of connectors changes.


getInCount

int getInCount()
Returns the current number of input connectors.


getInput

Denotator getInput(int i)
Returns the input denotator at input connector number i. This is usually called at the beginning of the run() method to get the input values. The run() method must check the return value which may be null.


setOutCount

void setOutCount(int n)
Sets the number of output connectors. This method should be called with default value in the init() method. It can be called afterwards if the number of connectors changes.


getOutCount

int getOutCount()
Returns the current number of output connectors.


setOutput

void setOutput(int i,
               Denotator d)
Stores the output denotator d for output connector number i. This is usually called at the end of the run() method to store the result of the computation.


getOutput

Denotator getOutput(int i)
Returns the output denotator of connectir number i. This is usually called by the Runner.


getModel

RubetteModel getModel()
Returns the RubetteModel, that this Rubette is attached to. This may be useful to retrieve information about the environment.


addError

void addError(java.lang.String msg,
              java.lang.Object... objects)
Adds an error string to the current error state. If an error occurs in the run() method, this method should be called with a short description of the error.


getErrors

java.util.List<java.lang.String> getErrors()
Returns a list of the current errors. This is called by the Runner. If no error has occurred, it returns an empty list, but never null.


clearErrors

void clearErrors()
Removes all errors from the error list. This is called by the Runner, before the run() method is executed.


hasErrors

boolean hasErrors()
Returns true iff any error has occurred. This is called by the Runner, after the run() method has been executed.


setModel

void setModel(RubetteModel model)
Sets the model this Rubette is attached to. This is called by the Composer, and should, in general, never be used by a Rubette implementation.