|
CAR (Context-Aware Retrieval) v1.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Value
A Value holds a value (string, numeric etc) that can take a variety of forms, see STICK-E NOTES: the Context Matcher User Manual (Brown) for a complete list.
To access an individual value it's necessary to first determine its type - this can be done with the int method getValType() which returns one of the following types: DOUBLE_LITERAL, STRING_LITERAL, STRINGVALUE_LITERAL, BOOLEAN_LITERAL (only used in the Session File), MARKUP. A STRING_LITERAL contains a string that originated in quotes (a quoted string), while a STRINGVALUE_LITERAL originated as an unquoted non-numeric non-boolean value. A MARKUP value is also a string that originated between MARKUP start/end tags. Each of these three string types can have embedded spaces. Once the type is known then an appropriate method can be called to extract the particular value e.g. getNumericValue().
However, for numeric values only (DOUBLE_LITERAL) it's also necessary to first check whether the value is a range value. The following are valid textual expressions of range values: '1.2..3.4' '..3.4' '1.2..' '..'. So a range value can have either or both values open-ended. To check for a range use the boolean method range(). To check whether the low value is open-ended use the boolean method isLowValueOpen() and similarly isHighValueOpen() for the high value. To get the low value use the double method getLowNumericValue() and similarly getHighNumericValue() for the high value (if low value is open the double of Math.MIN_VALUE is returned, if the high value is open the double of Math.MAX_VALUE is returned).
See the Basic Terminology section of the User Manual for a description of how a value fits into CAR's data structure.
Fields inherited from interface CarFace |
BOOLEAN_LITERAL, COLLECTION, DOUBLE_LITERAL, EXTERNAL, grammarNames, INTERNAL, KEYPHRASE, LITERALcapacityIncrement, LITERALinitialCapacity, MARKUP, SERIAL, SESSION, STRING_LITERAL, STRINGVALUE_LITERAL |
Constructor Summary | |
Value(java.lang.Double val)
constructs a Value of type DOUBLE_LITERAL with the provided value double |
|
Value(int vType,
java.lang.Object val)
constructs a non-range Value of the provided type and value |
|
Value(int vType,
java.lang.Object loV,
java.lang.Object hiV)
constructs a range Value of the provided type and low and high values |
|
Value(int vType,
java.lang.Object val,
java.lang.String syval)
constructs a non-range Value for numeric type with leading zero/s. |
|
Value(java.lang.String val)
constructs a Value of type STRINGVALUE_LITERAL with the provided value string |
Method Summary | |
java.lang.Object |
clone()
gets a clone (copy) of this Value |
boolean |
getBooleanValue()
for system programmer's use only |
double |
getHighNumericValue()
returns the high numeric value of a range (Double.MAX_VALUE if high value is open) |
double |
getLowNumericValue()
returns the low numeric value of a range (Double.MIN_VALUE if low value is open) |
double |
getNumericValue()
returns the double value (low value if a range) of a numeric, else returns 0.0 |
Value |
getStringedValue()
returns the string if the Value is of type STRING_LITERAL, else returns null |
java.lang.String |
getStringValue()
returns Value as a string value (low value if a range, Double.MIN_VALUE if low value is open). |
int |
getValType()
gets the value type |
boolean |
isHighValueOpen()
indicates whether the high numeric value of a range is open |
boolean |
isLowValueOpen()
indicates whether the low numeric value of a range is open |
boolean |
range()
indicates the Value is a range |
boolean |
sameValue(Value v)
indicates whether this Value is the same value as the provided Value |
double |
score(Value query)
An input query Value is 'scored' against a target Value. |
void |
setHiMax()
set hiMax (a boolean indicating that the high value of a range is open) |
void |
setLoMin()
set loMin (a boolean indicating that the low value of a range is open) |
static void |
t(java.lang.String s)
Provides trace output of string if -dValue on command line of CAR run |
java.lang.String |
toString()
converts Value to a string. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Value(int vType, java.lang.Object loV, java.lang.Object hiV)
vType
- DOUBLE_LITERAL or BOOLEAN_LITERAL (only used in the Session File by system programmer)loV
- a Double or Boolean low valuehiV
- a Double or Boolean high valuepublic Value(int vType, java.lang.Object val)
vType
- one of the following types: DOUBLE_LITERAL, STRING_LITERAL, STRINGVALUE_LITERAL, BOOLEAN_LITERAL (only used in the Session File by system programmer), MARKUPval
- a Double, String. or Boolean valuepublic Value(int vType, java.lang.Object val, java.lang.String syval)
vType
- must be DOUBLE_LITERALval
- a Doublesyval
- a string representation of the valuepublic Value(java.lang.String val)
public Value(java.lang.Double val)
Method Detail |
public static final void t(java.lang.String s)
public java.lang.Object clone()
clone
in class java.lang.Object
public final int getValType()
public final void setLoMin()
public final void setHiMax()
public final boolean range()
public final boolean getBooleanValue()
public final double getNumericValue()
public final java.lang.String getStringValue()
public final Value getStringedValue()
public final double getLowNumericValue()
public final double getHighNumericValue()
public final boolean isLowValueOpen()
public final boolean isHighValueOpen()
public final boolean sameValue(Value v)
public final double score(Value query)
public java.lang.String toString()
toString
in class java.lang.Object
|
CAR (Context-Aware Retrieval) v1.0 | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |