com.e1.mxdublin.evlist
Class EvList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<EvAbstractItem>
              extended by com.e1.mxdublin.evlist.EvList
All Implemented Interfaces:
Serializable, Cloneable, Iterable<EvAbstractItem>, Collection<EvAbstractItem>, List<EvAbstractItem>, RandomAccess

public class EvList
extends ArrayList<EvAbstractItem>
implements Cloneable

EvAbstractItem array list collection.

 
 l = EvList()
 l.add("0:1:2:3", new EvSender("! @sender bd"));
 l.add("1:3",     new EvSender("! @sender sn"));
 l.addf(4,        new EvSender("! @sender ohh"));
 l.add("0:1:2:3", new EvSender("! @sender chh"));
 l.add("0:3",     new EvNote("E-2 1 @sender myvst"));
 

See Also:
Serialized Form

Field Summary
static int defaultLoopPoint
          The default EvList length.
static EvListClipboard evlistClipboard
          EvList clipboard
protected  int loopPoint
          The EvList lenght.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
EvList()
          Creates a new EvList with size of this.defaultLoopPoint.
EvList(int looptm)
          Creates a new EvList with specified length.
 
Method Summary
 EvAbstractItem __getitem__(int idx)
          (JYTHON HELPER) Return element with evlist[x].
 boolean add(EvAbstractItem item)
           
 void add(int[] tmi, EvAbstractItem item)
          Add item based on an array of int (EG: [480, 627]).
 void add(int tm, EvAbstractItem item)
          Add Event item in list that will be sorted by time.
 void add(String tms, EvAbstractItem item)
          Add item with string time format (EG: "1:2:3:4.1/2").
 void addf(float[] tm, EvAbstractItem item)
          Add item based on an array of float (EG: [1, 1.5]).
 void addf(float tm, EvAbstractItem item)
          Add Event item in list that will be sorted by time.
 void clear()
          Remove all element in list.
 Object clone()
          This will clone the EvList with a deep copy of its content.
 void extend(int from, EvList list)
          Extends the content of another list into this list.
 TrailEventList factoryTrail(String name, DublinProject project)
          Creates a new trail based on this event list.
 void filter(QueryItem query)
          Will only keep items in the list that doesn't match query.
 Collection<EvAbstractItem> find(QueryItem query)
           
static EvList fromXML(Element e)
          Instanciate a EvList from XML representation.
 EvAbstractItem getFirst(QueryItem query)
          Returns the first item that match query.
 EvAbstractItem getLast(QueryItem query)
          Returns the last item that match query.
 List<EvAbstractItem> getList()
          Return the internal list
 int getLoopPoint()
          Returns the loop point size of this list.
 int getModCount()
          Returns the number of time that this list has been modified.
 EvListIterator iteratorLoop()
          Returns the loop iterator for this list.
 void reloadProperties(GroupProperties gp)
          Will apply defined properties of gp in all item that has the same group-properties with-in the list.
 void remove(EvAbstractItem item)
          Remove the item from the list.
 void remove(QueryItem query)
          Removes all elements that match query.
 void repeat(int times)
          Will repeat list times times.
 void setLoopPoint(int looptm)
          Set the loop point in list.
 void setLoopPointf(float looptm)
           
 void stretch(float ratio)
          Will stretch event time from ratio on all events.
 EvAbstractItem[] toArray()
           
 String toString()
          Returns the list representation.
 Element toXML()
          Returns XML representation of this list.
 
Methods inherited from class java.util.ArrayList
addAll, addAll, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

defaultLoopPoint

public static int defaultLoopPoint
The default EvList length.


loopPoint

protected int loopPoint
The EvList lenght. Item can be added afterwards, but the trail will ignore them. Think of it like the logical boundaries of the list.


evlistClipboard

public static EvListClipboard evlistClipboard
EvList clipboard

Constructor Detail

EvList

public EvList(int looptm)
Creates a new EvList with specified length. The trail will play all events until the length is reach. After this, it will loop.

Parameters:
looptm - list length

EvList

public EvList()
Creates a new EvList with size of this.defaultLoopPoint.

Method Detail

add

public boolean add(EvAbstractItem item)
Specified by:
add in interface Collection<EvAbstractItem>
Specified by:
add in interface List<EvAbstractItem>
Overrides:
add in class ArrayList<EvAbstractItem>

add

public void add(int tm,
                EvAbstractItem item)
Add Event item in list that will be sorted by time. If the item to be added is already in this or an another list, it will be cloned.

Specified by:
add in interface List<EvAbstractItem>
Overrides:
add in class ArrayList<EvAbstractItem>
Parameters:
tm - time of this event
item - the EvItem to add

add

public void add(int[] tmi,
                EvAbstractItem item)
Add item based on an array of int (EG: [480, 627]).

Parameters:
tmi - event times
item - the event to add

add

public void add(String tms,
                EvAbstractItem item)
Add item with string time format (EG: "1:2:3:4.1/2").

Parameters:
tms - event times (@see DublinHelper.tm2list(String))
item - the event to add

addf

public void addf(float tm,
                 EvAbstractItem item)
Add Event item in list that will be sorted by time. If the item to be added is already in this or an another list, it will be cloned.

Parameters:
tm - time of this event, in float (1.0 = 480PPQ)
item - the EvItem to add

addf

public void addf(float[] tm,
                 EvAbstractItem item)
Add item based on an array of float (EG: [1, 1.5]).

Parameters:
tm - event times in float (1.0 = 480PPQ)
item - the event to add

clear

public void clear()
Remove all element in list.

Specified by:
clear in interface Collection<EvAbstractItem>
Specified by:
clear in interface List<EvAbstractItem>
Overrides:
clear in class ArrayList<EvAbstractItem>

remove

public void remove(EvAbstractItem item)
Remove the item from the list.

Parameters:
item - the item to remove

remove

public void remove(QueryItem query)
Removes all elements that match query.

Parameters:
query - the event specification

factoryTrail

public TrailEventList factoryTrail(String name,
                                   DublinProject project)
Creates a new trail based on this event list.

Parameters:
name - the name of the trail to create
project - the project to register this trail
Returns:
TrailEventList with the content of the current list

setLoopPoint

public void setLoopPoint(int looptm)
Set the loop point in list. Trail that reach the loop point will start over the list. Any events added after the loop point will be ignored.

Parameters:
looptm - the list time

setLoopPointf

public void setLoopPointf(float looptm)

stretch

public void stretch(float ratio)
Will stretch event time from ratio on all events. The loopPoint will also be applied to the ratio.

Parameters:
ratio - the value to stretch ( tm=2 * ratio=0.25 >> tm=0.50 )

repeat

public void repeat(int times)
Will repeat list times times.

Parameters:
times - the number of times to repeat list.

filter

public void filter(QueryItem query)
Will only keep items in the list that doesn't match query.

Parameters:
query - the items to keep

extend

public void extend(int from,
                   EvList list)
Extends the content of another list into this list. If your initial list is smaller than the new one, events in the initial will be repeated.

Parameters:
from - first element position
list - the list to extend

getList

public List<EvAbstractItem> getList()
Return the internal list

Returns:
the java.util.List representation

getFirst

public EvAbstractItem getFirst(QueryItem query)
Returns the first item that match query.

Parameters:
query - the query to use
Returns:
the first item that match query, null is not found

getLast

public EvAbstractItem getLast(QueryItem query)
Returns the last item that match query.

Parameters:
query - the query to use
Returns:
the last item that match query, null is not found

find

public Collection<EvAbstractItem> find(QueryItem query)

iteratorLoop

public EvListIterator iteratorLoop()
Returns the loop iterator for this list.

Returns:
the loopIterator for this list

getLoopPoint

public int getLoopPoint()
Returns the loop point size of this list.

Returns:
the loop point size of this list

reloadProperties

public void reloadProperties(GroupProperties gp)
Will apply defined properties of gp in all item that has the same group-properties with-in the list.


getModCount

public int getModCount()
Returns the number of time that this list has been modified.

Returns:
the number of time that this list has been modified

clone

public Object clone()
This will clone the EvList with a deep copy of its content. EG: all EvAbstractItem in the list will be cloned.

Overrides:
clone in class ArrayList<EvAbstractItem>

toArray

public EvAbstractItem[] toArray()
Specified by:
toArray in interface Collection<EvAbstractItem>
Specified by:
toArray in interface List<EvAbstractItem>
Overrides:
toArray in class ArrayList<EvAbstractItem>

toString

public String toString()
Returns the list representation.

Overrides:
toString in class AbstractCollection<EvAbstractItem>

fromXML

public static EvList fromXML(Element e)
Instanciate a EvList from XML representation.


toXML

public Element toXML()
Returns XML representation of this list.

Returns:
the XML representation

__getitem__

public EvAbstractItem __getitem__(int idx)
(JYTHON HELPER) Return element with evlist[x]. Also, this enables the list to used 'for' loops in Jython.