edu.sdsc.grid.io
Class MetaDataCondition

java.lang.Object
  extended by edu.sdsc.grid.io.MetaDataCondition

public final class MetaDataCondition
extends java.lang.Object

A "meta data condition" describes a conditional expression to be used to guide a metadata query. That expression contains three components:

Legal field names depend upon the meta data group and the file server being talked to.

Operators are in the set:

Each operator is designated by an "operator code", which is a static final integer defined in this class.

A value has a "style" in the set:

There are no 'set' methods - once constructed, the object cannot be changed.


Field Summary
static int BETWEEN
          "between" where the metadata value is between the two conditional values, lexicographical compare for strings.
static int ENUM
          The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.
static int EQUAL
          "=" where the metadata value exactly equals the conditional value.
static int GREATER_OR_EQUAL
          ">=" where the metadata value is greater than or equal to the conditional value, lexicographical compare for strings.
static int GREATER_THAN
          ">" where the metadata value is greater than the conditional value, lexicographical compare for strings.
static int IN
          "in" where the metadata value exactly equals one of the conditional values in the value list.
static int LESS_OR_EQUAL
          "<=" where the metadata value is less than or equal to the conditional value, lexicographical compare for strings.
static int LESS_THAN
          "<" where the metadata value is less than the conditional value, lexicographical compare for strings.
static int LIKE
          "like" where the metadata value contains the conditional value.
static int NOT_BETWEEN
          "not between" where the metadata value is not between the two conditional values, lexicographical compare for strings.
static int NOT_EQUAL
          "!=" where the metadata value is not exactly equal to the conditional value.
static int NOT_IN
          "not in" where the metadata value does not exactly equals one of the conditional values in the value list.
static int NOT_LIKE
          "not like" where the metadata value does not contains the conditional value.
static int RANGEPAIR
          The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.
static int SCALAR
          The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.
static int SOUNDS_LIKE
          "sounds like", Implement phonetic name searches
static int SOUNDS_NOT_LIKE
          "not sounds like", Implement phonetic name searches
static int TABLE
          Table represents both a style and type.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests this MetaDataCondition object for equality with the given object.
protected  void finalize()
          Finalizes the object by explicitly letting go of each of its internally held values.
 int getCount()
          Returns the length of the value list, if the style is an enum.
 MetaDataField getField()
          Returns the MetaDataGroup's field object describing the field in the condition.
 java.lang.String getFieldName()
          Returns the field name in the condition.
 int getFieldType()
          Returns the MetaDataGroup's field data type.
 float getFloatValue()
          These methods are the same as calling the above list methods, but with an index of 0.
 float getFloatValue(int index)
          For a 'rangepair' style conditional, there are two values at indexes 0,0 and 0,1.
 int getIntValue()
          These methods are the same as calling the above list methods, but with an index of 0.
 int getIntValue(int index)
          For a 'rangepair' style conditional, there are two values at indexes 0,0 and 0,1.
 int getOperator()
          Returns the operator code for the 'rangepair', 'list' and 'scalar' style conditionals.
 java.lang.String getOperatorString()
           
static java.lang.String getOperatorString(int operator)
           
static java.lang.String[] getOperatorStrings()
           
 java.lang.String getStringValue()
          These methods are the same as calling the above list methods, but with an index of 0.
 java.lang.String getStringValue(int index)
          For a 'rangepair' style conditional, there are two values at indexes 0 and 1.
 int getStyle()
          Returns the value style for the conditional.
 MetaDataTable getTableValue()
          Returns the table stored in this conditional.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUAL

public static final int EQUAL
"=" where the metadata value exactly equals the conditional value.

See Also:
Constant Field Values

NOT_EQUAL

public static final int NOT_EQUAL
"!=" where the metadata value is not exactly equal to the conditional value.

See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
"<" where the metadata value is less than the conditional value, lexicographical compare for strings.

See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
">" where the metadata value is greater than the conditional value, lexicographical compare for strings.

See Also:
Constant Field Values

LESS_OR_EQUAL

public static final int LESS_OR_EQUAL
"<=" where the metadata value is less than or equal to the conditional value, lexicographical compare for strings.

See Also:
Constant Field Values

GREATER_OR_EQUAL

public static final int GREATER_OR_EQUAL
">=" where the metadata value is greater than or equal to the conditional value, lexicographical compare for strings.

See Also:
Constant Field Values

IN

public static final int IN
"in" where the metadata value exactly equals one of the conditional values in the value list.

See Also:
Constant Field Values

NOT_IN

public static final int NOT_IN
"not in" where the metadata value does not exactly equals one of the conditional values in the value list.

See Also:
Constant Field Values

BETWEEN

public static final int BETWEEN
"between" where the metadata value is between the two conditional values, lexicographical compare for strings.

See Also:
Constant Field Values

NOT_BETWEEN

public static final int NOT_BETWEEN
"not between" where the metadata value is not between the two conditional values, lexicographical compare for strings.

See Also:
Constant Field Values

LIKE

public static final int LIKE
"like" where the metadata value contains the conditional value. Values using LIKE should be strings with these wild-card characters, * and ?. * represents any number of characters. ? represents any single character. For example,
if you have the files with OWNER = testuser, testuser2:
The query "OWNER LIKE testuse_" will return testuser.
The query "OWNER LIKE testuse%" will return testuser, and testuser2.
Conditionals without any wildcard characters will search as a string fragment, ie. will be treated as though a % was at the beginning and end.

* is the same as %, and ? equals _
note: The characters *,?,%,_ are reserved and may not be used in the conditional value with the LIKE operator.

See Also:
Constant Field Values

NOT_LIKE

public static final int NOT_LIKE
"not like" where the metadata value does not contains the conditional value. Values using LIKE should be strings with these wild-card characters, * and ?. * represents any number of characters. ? represents any single character. For example,
if you have the files with OWNER = testuser, testuser2:
The query "OWNER LIKE testuse?" will return testuser.
The query "OWNER LIKE testuse*" will return testuser, and testuser2.
Conditionals without any wildcard characters will search as a string fragment, ie. will be treated as though a * was at the beginning and end.

* is the same as %, and ? equals _
note: The characters *,?,%,_ are reserved and may not be used in the conditional value with the LIKE operator.

See Also:
Constant Field Values

SOUNDS_LIKE

public static final int SOUNDS_LIKE
"sounds like", Implement phonetic name searches

See Also:
Constant Field Values

SOUNDS_NOT_LIKE

public static final int SOUNDS_NOT_LIKE
"not sounds like", Implement phonetic name searches

See Also:
Constant Field Values

SCALAR

public static final int SCALAR
The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.

See Also:
Constant Field Values

RANGEPAIR

public static final int RANGEPAIR
The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.

See Also:
Constant Field Values

ENUM

public static final int ENUM
The value style for the field.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.

See Also:
Constant Field Values

TABLE

public static final int TABLE
Table represents both a style and type. It can only be used with conditionals that use the MetaDataTable as a value.
Styles include: SCALAR, RANGEPAIR, ENUM, TABLE.
Types include: INT, LONG, FLOAT, STRING, DATE, TABLE.

See Also:
Constant Field Values
Method Detail

finalize

protected void finalize()
Finalizes the object by explicitly letting go of each of its internally held values.

Overrides:
finalize in class java.lang.Object

getField

public MetaDataField getField()
Returns the MetaDataGroup's field object describing the field in the condition.


getFieldName

public java.lang.String getFieldName()
Returns the field name in the condition. This is a shorthand for:
getField().getName();


getFieldType

public int getFieldType()
Returns the MetaDataGroup's field data type. This is a shorthand for:
getField().getType();


getOperator

public int getOperator()
Returns the operator code for the 'rangepair', 'list' and 'scalar' style conditionals.


getStyle

public int getStyle()
Returns the value style for the conditional. Styles include: scalar, rangepair, list.


getCount

public int getCount()
Returns the length of the value list, if the style is an enum. Returns 2 for rangepairs, and 1 otherwise (there is always at least one value).


getIntValue

public int getIntValue(int index)
For a 'rangepair' style conditional, there are two values at indexes 0,0 and 0,1. These methods return those values, or throw an IllegalArgumentException if the index is out of range.

For a 'list' style conditional, there is a list of values at indexes 0,0 to 0,n-1, where n is returned by getCount(). These methods return those values, or throw an IllegalArgumentException when the index is out of range.

For a 'scalar' style conditional, there is only one value at index 0,0. These methods return this value, or throw an IllegalArgumentException if the index is not 0,0.


getFloatValue

public float getFloatValue(int index)
For a 'rangepair' style conditional, there are two values at indexes 0,0 and 0,1. These methods return those values, or throw an exception if the index is out of range.

For a 'list' style conditional, there is a list of values at indexes 0,0 to 0,n-1, where n is returned by getCount(). These methods return those values, or throw an exception when the index is out of range.

For a 'scalar' style conditional, there is only one value at index 0,0. These methods return this value, or throw an exception if the index is not 0,0.


getStringValue

public java.lang.String getStringValue(int index)
For a 'rangepair' style conditional, there are two values at indexes 0 and 1. These methods return those values, or throw an exception if the index is out of range.

For a 'list' style conditional, there is a list of values at indexes 0 to n-1, where n is returned by getCount(). These methods return those values, or throw an exception when the index is out of range.

For a 'scalar' style conditional, there is only one value at index 0. These methods return this value, or throw an exception if the index is not 0.


getIntValue

public int getIntValue()
These methods are the same as calling the above list methods, but with an index of 0.


getFloatValue

public float getFloatValue()
These methods are the same as calling the above list methods, but with an index of 0.


getStringValue

public java.lang.String getStringValue()
These methods are the same as calling the above list methods, but with an index of 0.


getTableValue

public MetaDataTable getTableValue()
Returns the table stored in this conditional. A 'table' conditional is both a type and a style. This method returns the table value at index 0.


toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Tests this MetaDataCondition object for equality with the given object. Returns true if and only if the argument is not null and both are MetaDataCondition objects with equal field, operators and values.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to be compared with this abstract pathname
Returns:
true if and only if the objects are the same; false otherwise

getOperatorString

public static java.lang.String getOperatorString(int operator)

getOperatorStrings

public static java.lang.String[] getOperatorStrings()

getOperatorString

public java.lang.String getOperatorString()