CAR (Context-Aware Retrieval) v1.0

Class ValueTuple

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--ValueTuple
All Implemented Interfaces:
CarFace, java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class ValueTuple
extends java.util.Vector
implements java.io.Serializable, CarFace

A ValueTuple is a vector of Values. It can have an associated label (but only for use in the session file).

See the Basic Terminology section of the User Manual for a description.

See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
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
ValueTuple()
           
 
Method Summary
 void addValue(Value val)
          adds the provided Value to the end of the ValueTuple
 boolean ANY()
          If this has a single Value of string value 'ANY' then true is returned, else false.
 java.lang.Object clone()
          returns a clone (copy) of this ValueTuple
 boolean getBooleanValue(int n)
          for system programmer's use only
 java.lang.String getLabel()
          for system programmer's use only
 double getNumericValue(int n)
          gets the nth Value as a double.
 java.lang.String getStringValue(int n)
          gets the nth Value as a string.
 java.lang.String[] getStringValues()
          gets all the values of the tuple as strings.
 Value getValue(int i)
          gets the ith Value.
 boolean labelled()
          for system programmer's use only
 int numberOfValues()
          returns the number of Values in the ValueTuple
 boolean sameValue(ValueTuple vt)
          indicates whether this has the same Values as the provided ValueTuple.
 double score(ValueTuple query)
          An input query ValueTuple is 'scored' against a target ValueTuple, in the range 0.0 to 2.0.
 void setLabel(java.lang.String lab)
          for system programmer's use only
 void setLabelled(boolean b)
          for system programmer's use only
static void t(java.lang.String s)
          Provides trace output of string if -dValueTuple on command line of CAR run
 java.lang.String toString()
          converts the ValueTuple to a string.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

ValueTuple

public ValueTuple()
Method Detail

t

public static final void t(java.lang.String s)
Provides trace output of string if -dValueTuple on command line of CAR run

clone

public java.lang.Object clone()
returns a clone (copy) of this ValueTuple
Overrides:
clone in class java.util.Vector

numberOfValues

public int numberOfValues()
returns the number of Values in the ValueTuple

addValue

public void addValue(Value val)
adds the provided Value to the end of the ValueTuple

setLabel

public void setLabel(java.lang.String lab)
for system programmer's use only

setLabelled

public void setLabelled(boolean b)
for system programmer's use only

labelled

public boolean labelled()
for system programmer's use only

getLabel

public java.lang.String getLabel()
for system programmer's use only

getStringValue

public final java.lang.String getStringValue(int n)
gets the nth Value as a string. If n is invalid, or the Value can't be converted to a string, then "" is returned.
See Also:
Value.getStringValue()

getNumericValue

public final double getNumericValue(int n)
gets the nth Value as a double. If n is invalid, or the Value can't be converted to a double, then 0.0 is returned.
See Also:
Value.getNumericValue()

getValue

public final Value getValue(int i)
gets the ith Value. If i is invalid then null is returned.

sameValue

public final boolean sameValue(ValueTuple vt)
indicates whether this has the same Values as the provided ValueTuple. true is returned if the Values are the same in number and identical, else false.
See Also:
Value.sameValue(Value)

getBooleanValue

public final boolean getBooleanValue(int n)
for system programmer's use only

ANY

public final boolean ANY()
If this has a single Value of string value 'ANY' then true is returned, else false.

score

public final double score(ValueTuple query)
An input query ValueTuple is 'scored' against a target ValueTuple, in the range 0.0 to 2.0. If either the target or query tuples contain a single element of value 'ANY' a score of 2.0 is returned. If the target and query tuples have a different number of elements a score of 0.0 is returned (except in the case of 'ANY'). Scores of individual tuples range from 0.0 to 2.0. The ValueTuple's final score is a geometric mean of the individual tuple scores
See Also:
Value.score(Value)

getStringValues

public final java.lang.String[] getStringValues()
gets all the values of the tuple as strings. Numeric values are converted to their string forms. For range Values the low value is used.
Returns:
array of strings representing the values.

toString

public java.lang.String toString()
converts the ValueTuple to a string. The format of the string is consistent with the textual representation of a ValueTuple, as read from file by CAR.
Overrides:
toString in class java.util.Vector
Returns:
a string represention of the object.

CAR (Context-Aware Retrieval) v1.0

Submit bugs to Lindsey