|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.e1.mxdublin.core.SeqEvent
com.e1.mxdublin.evlist.EvAbstractItem
public abstract class EvAbstractItem
Basic type for any event that is added to an event list. Objects that extends this class must implement the method play() that will activate the event. If the event must be stopped (like a midi note), the extended class must initialize the field len_tm that tells event duration and implement the method stop() that will de-activate the event.
Event are design to be instanciated from a single string. First it simplify the process if the event can have mutliple arguments but only one is always used without the need of creating multiple constructors for each arguments. It also enable the event to be edited in the tracker GUI utility. setValue() is used to assign the event using a string argument. getValue() is also used to get the event content in a string format. This also enable the event to be fully serializable from XML form since the arguments is a simple string.
The character "@", "/" have special propose in event definition and they must not be used.
Properties are used to share a common value across events. For example, with EvSender, the property @sender is used to assign the destination of the event to a specific pd/max receiver. They are specified in the string event constructor argument with the character (@).
GroupProperties are used to share common properties (like senders) to multiples event items. They are specified in the event arguments by using the property name gp. For example, @gp tata, will ask the event to assign each supported properties defined in the group-properties named tata.
To be able to save the content of the event, the most simple way is to simply override getValue() method and return the string content of the event. If the event has properties, it must also append the values of the overriden properties with method appendDefineProperties(String, String). If your event cannot be simplified into a string, you can override the method toXML() to add content to the XML element. loadElement() must also be overriden to read the new content into the event.
Note: this class has a natural ordering that is inconsistent with equals.
| Field Summary | |
|---|---|
protected GroupProperties |
gp
The GroupProperties assigned to this item. |
int |
len_tm
The item length time. |
| Fields inherited from class com.e1.mxdublin.core.SeqEvent |
|---|
mandatory |
| Constructor Summary | |
|---|---|
EvAbstractItem()
|
|
EvAbstractItem(String value)
Generic event constructor with defaultProp used as properties |
|
EvAbstractItem(String value,
GroupProperties gp)
|
|
| Method Summary | |
|---|---|
protected void |
appendDefinedProperties(StringBuffer sb)
Appends the string representation of the defined properties. |
void |
bang()
Will play the event by calling play() and the wait len_tm
to call stop(). |
void |
cancel()
Cancels current task |
Object |
clone()
Clone the abstract event. |
int |
compareTo(EvAbstractItem item)
Event item position is compared with another one. |
boolean |
equals(Object comp)
Returns true if the object value and time is equal to comp. |
static EvAbstractItem |
fromXML(Element e)
Return the Event based on the XML element. |
GroupProperties |
getGroupProperties()
Returns the associated group-properties for this event. |
int |
getTm()
Returns event time in ppq. |
String |
getValue()
Returns event representation in string format. |
abstract boolean |
isLike(EvAbstractItem comp)
Returns true if the content of this event is the same than event item 'comp'. |
protected boolean |
isSameGroupProperties(String key,
String value)
Returns true if the property key assigned with value is the same of the group-properties. |
protected void |
loadElement(Element e)
Once the new class is instanciated with EvAbstractedItem.fromXML, the extended class should override this method to read extra attributes. |
abstract void |
play()
Tells this event to execute. |
String |
repr()
This will returns the complete definition of the event. |
void |
run()
Called by the internal sequencer (com.e1.mxdublin.core.Sequencer) to be stopped. |
void |
setProperties(GroupProperties values)
Set properties definition using property |
boolean |
setProperty(String name,
String value)
Set property. |
void |
setTm(float tm)
Reset event ppq time in float (1 = 480, 1.5 = 720). |
void |
setTm(int tm)
Reset event ppq time. |
void |
setValue(String value)
Sets event definition using a string. |
void |
stop()
Tells this event to stop executing. |
String |
toString()
Returns the representation of this event item. |
Element |
toXML()
Returns the XML representation of this event. |
| Methods inherited from class com.e1.mxdublin.core.SeqEvent |
|---|
eventDebug |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int len_tm
protected GroupProperties gp
| Constructor Detail |
|---|
public EvAbstractItem()
public EvAbstractItem(String value)
value - string value of this event
public EvAbstractItem(String value,
GroupProperties gp)
| Method Detail |
|---|
public abstract void play()
public void stop()
public void bang()
len_tm
to call stop().
public void setValue(String value)
value - String valuepublic String getValue()
public void setProperties(GroupProperties values)
public boolean setProperty(String name,
String value)
name - property namevalue - property value
public void setTm(float tm)
tm - new event time in ppqpublic void setTm(int tm)
tm - event ppw time.public int getTm()
public GroupProperties getGroupProperties()
protected void loadElement(Element e)
e - the original XML elementpublic static EvAbstractItem fromXML(Element e)
e - the element that defines the event
public Element toXML()
public boolean equals(Object comp)
equals in class Objectcomp - the object to compare
Object.equals(java.lang.Object)public int compareTo(EvAbstractItem item)
compareTo in interface Comparable<EvAbstractItem>public Object clone()
clone in class ObjectObject.clone()public String toString()
toString in class Objectprotected void appendDefinedProperties(StringBuffer sb)
sb - the StringBuffer to append the properties values
protected boolean isSameGroupProperties(String key,
String value)
key - the name of the propertyvalue - the value of the property
public abstract boolean isLike(EvAbstractItem comp)
comp - the event item to compare
public String repr()
public final void run()
len_tm > 1 will be sequence
by the internal sequencer and the method stop will call the stop()
method of this event.
run in interface Runnablerun in class SeqEventpublic void cancel()
SeqEvent
cancel in class SeqEvent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||