com.starbase.starteam
Class QueryPart

java.lang.Object
  |
  +--com.starbase.starteam.QueryPart

public class QueryPart
extends java.lang.Object

A QueryPart object represents a boolean expression on the value of a particular property of an item. For example, it could be used to define query to match file objects whose name starts with a specific string.


Field Summary
static int REL_ENDTEXT
          Tests if a string valued property ends with the specified string.
static int REL_EQUAL
          The "equal-to" relation.
static int REL_GREATEROREQUAL
          The "greater-than-or-equal-to" relation.
static int REL_GREATERTHAN
          The "greater-than" relation.
static int REL_LASTDAYS
          True if the date falls within the last specified number of days.
static int REL_LASTWEEKS
          True if the date falls within the last specified number of week.
static int REL_LESSOREQUAL
          The "less-than-or-equal-to" relation.
static int REL_LESSTHAN
          The "less-than" relation.
static int REL_NOTEQUAL
          The "not-equal" relation.
static int REL_OLDERDAYS
          True if the date is older than the specified number of days.
static int REL_OLDERWEEKS
          True if the date is older than the specified number of weeks.
static int REL_STARTTEXT
          Tests if a string valued property starts with the specified string.
static int REL_TEXTSEARCH
          Tests if a string valued property contains the specified string.
 
Constructor Summary
QueryPart(int propertyID, int relation, byte[] value)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, double value)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, double value, boolean ignoreTime)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, int value)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, int[] value)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, OLEDate value, boolean ignoreTime)
          Creates a new QueryPart for the specified property.
QueryPart(int propertyID, int relation, java.lang.String value, boolean caseSensitive)
          Creates a new QueryPart for the specified property.
 
Method Summary
 QueryPart copyQueryPart()
          Returns a copy of this QueryPart.
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
 boolean evaluate(Item item)
          Evaluate this QueryPart with respect to the specified item.
 boolean evaluateAgainst(java.lang.Object value)
          Evaluate this QueryPart with respect to the specified value.
 int getPropertyID()
           
 int getRelation()
           
 java.lang.Object getValue()
           
 int hashCode()
          returns a unique hash for all instances of this type
 boolean isIgnoreCase()
           
 boolean isIgnoreTime()
           
 void setIgnoreCase(boolean ignore)
           
 void setIgnoreTime(boolean ignore)
           
 void setPropertyID(int propertyID)
           
 void setRelation(int relation)
           
 java.lang.String toDebugString()
          Returns a debug string representation of this QueryPart.
 java.lang.String toString()
          Returns the debug string representation of this QueryPart.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REL_LESSTHAN

public static final int REL_LESSTHAN
The "less-than" relation.

See Also:
Constant Field Values

REL_LESSOREQUAL

public static final int REL_LESSOREQUAL
The "less-than-or-equal-to" relation.

See Also:
Constant Field Values

REL_EQUAL

public static final int REL_EQUAL
The "equal-to" relation.

See Also:
Constant Field Values

REL_GREATEROREQUAL

public static final int REL_GREATEROREQUAL
The "greater-than-or-equal-to" relation.

See Also:
Constant Field Values

REL_GREATERTHAN

public static final int REL_GREATERTHAN
The "greater-than" relation.

See Also:
Constant Field Values

REL_NOTEQUAL

public static final int REL_NOTEQUAL
The "not-equal" relation.

See Also:
Constant Field Values

REL_LASTDAYS

public static final int REL_LASTDAYS
True if the date falls within the last specified number of days. Applies to date valued properties.

See Also:
Constant Field Values

REL_LASTWEEKS

public static final int REL_LASTWEEKS
True if the date falls within the last specified number of week. Applies to date valued properties.

See Also:
Constant Field Values

REL_OLDERDAYS

public static final int REL_OLDERDAYS
True if the date is older than the specified number of days. Applies to date valued properties.

See Also:
Constant Field Values

REL_OLDERWEEKS

public static final int REL_OLDERWEEKS
True if the date is older than the specified number of weeks. Applies to date valued properties.

See Also:
Constant Field Values

REL_TEXTSEARCH

public static final int REL_TEXTSEARCH
Tests if a string valued property contains the specified string.

See Also:
Constant Field Values

REL_STARTTEXT

public static final int REL_STARTTEXT
Tests if a string valued property starts with the specified string.

See Also:
Constant Field Values

REL_ENDTEXT

public static final int REL_ENDTEXT
Tests if a string valued property ends with the specified string.

See Also:
Constant Field Values
Constructor Detail

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 int value)
Creates a new QueryPart for the specified property. The test is for integer valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the integer value to compare against

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 double value)
Creates a new QueryPart for the specified property. The test is for floating point valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the floating point value to compare against

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 double value,
                 boolean ignoreTime)
Creates a new QueryPart for the specified property. This is for date valued properties and timespan tests.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the floating point value to compare against
ignoreTime - true if the comparsion should ignore the time of day (and just use the date)
See Also:
QueryPart.REL_OLDERDAYS, QueryPart.REL_OLDERWEEKS, QueryPart.REL_LASTDAYS, QueryPart.REL_LASTWEEKS

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 OLEDate value,
                 boolean ignoreTime)
Creates a new QueryPart for the specified property. The test is for date valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the date value to compare against
ignoreTime - true if the comparsion should ignore the time of day (and just use the date)

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 java.lang.String value,
                 boolean caseSensitive)
Creates a new QueryPart for the specified property. The test is for String valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the string value to compare against
caseSensitive - true if the comparison should be case-sensitive

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 byte[] value)
Creates a new QueryPart for the specified property. The test is for byte array valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the byte array value to compare against

QueryPart

public QueryPart(int propertyID,
                 int relation,
                 int[] value)
Creates a new QueryPart for the specified property. The test is for integer array valued properties.

Parameters:
propertyID - the property to test
relation - the relation operator defining the comparison test
value - the integer array value to compare against
Method Detail

copyQueryPart

public QueryPart copyQueryPart()
Returns a copy of this QueryPart. It is a deep copy so the new one may be freely modified without affecting the original. The copy will be identical but for the ID which will be -1 for the new copy.

Returns:
a copy of this QueryPart

toString

public java.lang.String toString()
Returns the debug string representation of this QueryPart.

Overrides:
toString in class java.lang.Object
Returns:
the debug string representation of this QueryPart.
See Also:
QueryPart.toDebugString()

toDebugString

public java.lang.String toDebugString()
Returns a debug string representation of this QueryPart.

Returns:
a debug string representation of this QueryPart.

evaluate

public boolean evaluate(Item item)
Evaluate this QueryPart with respect to the specified item.

Parameters:
item - the item whose specified property value to test against
Returns:
true if the item satisfies the query and false otherwise.

evaluateAgainst

public boolean evaluateAgainst(java.lang.Object value)
Evaluate this QueryPart with respect to the specified value. The value must be of the appropriate type for the relation type. The possible types are Integer, Double, OLEDate, String, byte[] and int[].

Parameters:
value - the value to test against
Returns:
true if the item satisfies the query and false otherwise.

getRelation

public int getRelation()

setRelation

public void setRelation(int relation)

isIgnoreCase

public boolean isIgnoreCase()

setIgnoreCase

public void setIgnoreCase(boolean ignore)

isIgnoreTime

public boolean isIgnoreTime()

setIgnoreTime

public void setIgnoreTime(boolean ignore)

getPropertyID

public int getPropertyID()

setPropertyID

public void setPropertyID(int propertyID)

getValue

public java.lang.Object getValue()

equals

public boolean equals(java.lang.Object source)
returns true if this object instance is equal to the source

Overrides:
equals in class java.lang.Object
Parameters:
source - Object the source to comapre with
Returns:
boolean true if this object is equal to the source

hashCode

public int hashCode()
returns a unique hash for all instances of this type

Overrides:
hashCode in class java.lang.Object
Returns:
int a unique hash for all instances of this type


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.