com.e1.mxdublin.evlist
Class QueryItem

java.lang.Object
  extended by com.e1.mxdublin.evlist.QueryItem

public class QueryItem
extends Object

To be used to check if an item is within range or with the same definition. For example, if you want to remove all items that starts at bar 2 and finishes at bar 5 (non inclusive; item at position 5 will not be selected) use this:

 
 l = new EvList()
 ... do something ...
 
 l.remove(new QueryItem(2, 5));
 


Field Summary
static int DEFAULT_END
           
static int DEFAULT_START
           
protected  float end_tm
          List range
protected  EvAbstractItem itemComp
          The object to use with isLike()
protected  float start_tm
          List range
 
Constructor Summary
QueryItem()
           
QueryItem(EvAbstractItem item)
          Creates a query by using item.isLike() with list
QueryItem(float start, float stop)
          Creates a query within range start/stop
QueryItem(GroupProperties gp)
          Create a query that will return objects that have the specified group-properties.
QueryItem(GroupProperties[] gp)
           
QueryItem(int start, int stop)
          Creates a query within range start/stop
 
Method Summary
protected  boolean do_match(EvAbstractItem item)
          The method to override if you have a more complexe query to do.
 QueryItem invert()
          Invert the result when match() will be used.
 boolean match(EvAbstractItem item)
          Check if the item match current query.
 void resetRange()
          Resets query bound to every objects in list.
 QueryItem setGroupProperties(GroupProperties gp)
          This will filter the items that has the same group-properties.
 QueryItem setGroupProperties(GroupProperties[] gp)
          This will filter the items that has the same group-properties within array.
 QueryItem setItem(EvAbstractItem item)
          Sets the item that will be used to compare object with isLike()
 QueryItem setRange(int start, int stop)
          Sets event query range.
 QueryItem setRangef(float start, float stop)
          Sets event query range in quarter note.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_START

public static final int DEFAULT_START
See Also:
Constant Field Values

DEFAULT_END

public static final int DEFAULT_END
See Also:
Constant Field Values

start_tm

protected float start_tm
List range


end_tm

protected float end_tm
List range


itemComp

protected EvAbstractItem itemComp
The object to use with isLike()

Constructor Detail

QueryItem

public QueryItem()

QueryItem

public QueryItem(float start,
                 float stop)
Creates a query within range start/stop

Parameters:
start - starting range
stop - stopping range

QueryItem

public QueryItem(int start,
                 int stop)
Creates a query within range start/stop

Parameters:
start - starting range
stop - stopping range

QueryItem

public QueryItem(EvAbstractItem item)
Creates a query by using item.isLike() with list

Parameters:
item - the item to compare

QueryItem

public QueryItem(GroupProperties gp)
Create a query that will return objects that have the specified group-properties.

Parameters:
gp - will flag this item if it has the same group-properties

QueryItem

public QueryItem(GroupProperties[] gp)
Method Detail

setRange

public QueryItem setRange(int start,
                          int stop)
Sets event query range.

Parameters:
start - starting range
stop - stopping range
Returns:
this (for cascading)

setRangef

public QueryItem setRangef(float start,
                           float stop)
Sets event query range in quarter note.

Parameters:
start - starting range
stop - stopping range
Returns:
this (for cascading)

resetRange

public void resetRange()
Resets query bound to every objects in list.


setItem

public QueryItem setItem(EvAbstractItem item)
Sets the item that will be used to compare object with isLike()

Parameters:
item - the item to compare
Returns:
this (for cascading)

setGroupProperties

public QueryItem setGroupProperties(GroupProperties gp)
This will filter the items that has the same group-properties.

Parameters:
gp - the group-properties to check
Returns:
(for cascading)

setGroupProperties

public QueryItem setGroupProperties(GroupProperties[] gp)
This will filter the items that has the same group-properties within array.

Parameters:
gp - the list of group properties
Returns:
this (for cascading)

invert

public QueryItem invert()
Invert the result when match() will be used.

Returns:
this (for cascading)

do_match

protected boolean do_match(EvAbstractItem item)
The method to override if you have a more complexe query to do.

Parameters:
item - the item to match
Returns:
true if the item match QueryItem parameters

match

public final boolean match(EvAbstractItem item)
Check if the item match current query. If you need to override the match method, use do_match()

Parameters:
item - The EvAbstractItem to validate
Returns:
true if the item matchs query