com.confusionists.mjdjApi.morph
Interface Morph

All Known Implementing Classes:
AbstractMorph

public interface Morph


Method Summary
 java.lang.String diagnose()
           
 java.util.List<java.lang.String> getInDeviceNames()
           
 java.lang.String getName()
           
 java.util.List<java.lang.String> getOutDeviceNames()
           
 java.lang.Object getSerializable()
          This is very limited: any class can be serialized, even one that doesn't implement Serializable, but the class cannot contain any reference to classes dynamically loaded in this Morph.
 void init()
          /** Call by the Mjdj system to allow for Morph initialization.
 boolean isPlayTimedTasks()
           
 boolean process(MessageWrapper message, java.lang.String from)
           
 void setInDeviceNames(java.util.List<java.lang.String> value)
          Call by Mjdj before init is called.
 void setOutDeviceNames(java.util.List<java.lang.String> value)
          Call by Mjdj before init is called.
 void setPlayTimedTasks(boolean playTimedTasks)
           
 void setSerializable(java.lang.Object serializable)
          Morph subclasses should recover state from the object passed in.
 void setService(MjdjService service)
          Mjdj will call this method to give the Morph instance access to the Mjdj system: this happens before init is called.
 void shutdown()
           
 void toggleUi()
          Subclasses can produce a UI that is as complicated as they like for each Morph.
 

Method Detail

setInDeviceNames

void setInDeviceNames(java.util.List<java.lang.String> value)
Call by Mjdj before init is called. Subclasses can generally inherit this default implementation.

Parameters:
value - is a List of the in device names.

getInDeviceNames

java.util.List<java.lang.String> getInDeviceNames()

setOutDeviceNames

void setOutDeviceNames(java.util.List<java.lang.String> value)
Call by Mjdj before init is called. Subclasses should generally inherit this default implementation.

Parameters:
value - is a List of the in device names.

getOutDeviceNames

java.util.List<java.lang.String> getOutDeviceNames()

setService

void setService(MjdjService service)
Mjdj will call this method to give the Morph instance access to the Mjdj system: this happens before init is called.

Parameters:
service - an MjdjService instance.

getName

java.lang.String getName()
Returns:
name shown on Mjdj UI.

init

void init()
          throws DeviceNotFoundException
/** Call by the Mjdj system to allow for Morph initialization. Devices and service are already set.

Throws:
DeviceNotFoundException - if the Morph cannot load because it hasn't found the devices it needs.

shutdown

void shutdown()

process

boolean process(MessageWrapper message,
                java.lang.String from)
                throws java.lang.Throwable
Parameters:
message -
from - a String with the input device: Morph can decide to process or not based on this (as well as other information).
Returns:
true if the Morph did process the message, or false if the message was not of interest
Throws:
java.lang.Exception
java.lang.Throwable

diagnose

java.lang.String diagnose()
Returns:
Any useful logging information that implementing classes wish to return when the Morph checks that it is working correctly.

toggleUi

void toggleUi()
Subclasses can produce a UI that is as complicated as they like for each Morph. It should become visible (and even always-on-top) when this method is called, or the opposite.


getSerializable

java.lang.Object getSerializable()
This is very limited: any class can be serialized, even one that doesn't implement Serializable, but the class cannot contain any reference to classes dynamically loaded in this Morph. Essentially, use Hashtable or anything in the JDK itself.

Returns:
the serializable "piece" for configuring this Morph.

setSerializable

void setSerializable(java.lang.Object serializable)
Morph subclasses should recover state from the object passed in.

Parameters:
serializable -

setPlayTimedTasks

void setPlayTimedTasks(boolean playTimedTasks)
Parameters:
playTimedTasks - Used by the default implementation of MidiTimerTask to play or not play: true by default

isPlayTimedTasks

boolean isPlayTimedTasks()
Returns:
true by default. Otherwise returns whether the morph expects timed events to play or not. used by MidiTimerTask.