CAR (Context-Aware Retrieval) v1.0

Class Field

java.lang.Object
  |
  +--Field
All Implemented Interfaces:
CarFace, java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Action, Process

public class Field
extends java.lang.Object
implements java.io.Serializable, CarFace, java.lang.Cloneable

A Field is a container class for a tag (field name), an AttributeTuple, a ValueTuple, aand a CommentTuple. As it name suggest a CommentTuple contains a vector of comments associated with the field.

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

See Also:
Serialized Form

Field Summary
protected  ValueTuple valueTuple
          the field's valueTuple
protected  ValueTupleVector valueTupleVector
          for system programmer's use only
 
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
protected Field(java.lang.String fn)
          constructs a Field named with the input.
  Field(java.lang.String fn, AttributeTuple at, ValueTuple vt, CommentTuple ct)
          constructs a Field with the inputs.
  Field(java.lang.String fn, AttributeTuple at, ValueTupleVector vtv, CommentTuple ct)
          for system programmer's use only
protected Field(java.lang.String fn, AttributeTuple at, ValueTupleVector vtv, ValueTuple vt, CommentTuple ct)
          for system programmer's use only
  Field(java.lang.String fn, double value)
          constructs a Field with the inputs.
  Field(java.lang.String fn, java.lang.String value)
          constructs a Field with the inputs.
 
Method Summary
 java.lang.Object clone()
          creates a clone of the field object
 AttributeTuple getAttributeTuple()
          returns the attributeTuple of the field
 java.lang.String getAttributeValue(java.lang.String name)
          gets the field's attribute value for the given attribute name.
 CommentTuple getCommentTuple()
          returns the commentTuple of the field
 java.lang.String getFieldName()
          returns the name of the field
 java.lang.String[] getLabelledStringValues(java.lang.String label)
          for system programmer's use only
 double getNumericValue()
          gets the numeric value of the first Value of the field's valuetuple.
 ValueTuple getValueTuple()
          returns the valueTuple of the field
 ValueTupleVector getValueTupleVector()
          for system programmer's use only
 boolean hasAttribute(java.lang.String name)
          indicate whether the provided name is the name of an attribute in the field's attributeTuple
 boolean hasValue()
          indicates whether the valueTuple of the field contains a Value (returns false if Value has 0 elements).
 void removeAttribute(java.lang.String name)
          remove the attribute with the provided name from the field's attributeTuple.
 void removeValue()
          sets the valueTuple to be empty (zero elements)
 boolean sameAttributeTuple(Field f)
          indicates whether this field contains the same attributeTuple (same name=value pairs - order insignificant) as the provided field
 boolean sameValue(Field f)
          returns true if this field has the same valueTuple (values are same) as the one provided, else returns false
 double score(Field queryField)
          use the default scoring mechanism to score this target field value against the value of the provided queryField argument.
 void setAttribute(java.lang.String name, java.lang.String value)
          overwrite the existing attributeTuple with a new one consisting of a single Attribute made from the provided attribute pair.
 void setFieldName(java.lang.String name)
          set the field's name to the one provided
 void setNumericValue(double value)
          sets the field's valueTuple to a single Value of type DOUBLE_LITERAL, overwriting the previous valueTuple
 void setValue(Value val)
          sets the field's valueTuple to the single Value provided, overwriting the previous valueTuple
 void setValueTuple(ValueTuple vt)
          overwrite the existing valueTuple with the one provided
protected  void sleep(int millisecs)
          for system programmer's use only
 void t(java.lang.String s)
          Provides trace output of string if -dField on command line of CAR run
 java.lang.String toString()
          converts the field to a string.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

valueTuple

protected ValueTuple valueTuple
the field's valueTuple

valueTupleVector

protected ValueTupleVector valueTupleVector
for system programmer's use only
Constructor Detail

Field

public Field(java.lang.String fn,
             AttributeTuple at,
             ValueTuple vt,
             CommentTuple ct)
constructs a Field with the inputs.
Parameters:
fn - field name
at - attributeTuple
vt - valueTuple
ct - commentTuple

Field

public Field(java.lang.String fn,
             AttributeTuple at,
             ValueTupleVector vtv,
             CommentTuple ct)
for system programmer's use only

Field

public Field(java.lang.String fn,
             java.lang.String value)
constructs a Field with the inputs. All tuples are set to zero length - except the ValueTuple which is given a single Value of type STRINGVALUE_LITERAL.
Parameters:
fn - field name
value - the STRINGVALUE_LITERAL Value to be put in the ValueTuple

Field

public Field(java.lang.String fn,
             double value)
constructs a Field with the inputs. All tuples are set to zero length - except the ValueTuple which is given a single Value of type DOUBLE_LITERAL.
Parameters:
fn - field name
value - the DOUBLE_LITERAL Value to be put in the ValueTuple

Field

protected Field(java.lang.String fn,
                AttributeTuple at,
                ValueTupleVector vtv,
                ValueTuple vt,
                CommentTuple ct)
for system programmer's use only

Field

protected Field(java.lang.String fn)
constructs a Field named with the input. All tuples are set to zero length.
Method Detail

t

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

clone

public java.lang.Object clone()
creates a clone of the field object
Overrides:
clone in class java.lang.Object

getFieldName

public java.lang.String getFieldName()
returns the name of the field

getAttributeTuple

public AttributeTuple getAttributeTuple()
returns the attributeTuple of the field

getValueTuple

public ValueTuple getValueTuple()
returns the valueTuple of the field

getValueTupleVector

public ValueTupleVector getValueTupleVector()
for system programmer's use only

getCommentTuple

public CommentTuple getCommentTuple()
returns the commentTuple of the field

setFieldName

public void setFieldName(java.lang.String name)
set the field's name to the one provided

hasValue

public boolean hasValue()
indicates whether the valueTuple of the field contains a Value (returns false if Value has 0 elements).

getNumericValue

public double getNumericValue()
gets the numeric value of the first Value of the field's valuetuple.
Returns:
the double value (if there is one) otherwise 0.0 is returned (no exception thrown)

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
gets the field's attribute value for the given attribute name.
Parameters:
name - the name of the attribute
Returns:
the string value part of the attribute's name="value" pair (null if the attribute name does not exist for the field).

setNumericValue

public void setNumericValue(double value)
sets the field's valueTuple to a single Value of type DOUBLE_LITERAL, overwriting the previous valueTuple

setValue

public void setValue(Value val)
sets the field's valueTuple to the single Value provided, overwriting the previous valueTuple

setValueTuple

public void setValueTuple(ValueTuple vt)
overwrite the existing valueTuple with the one provided

removeValue

public void removeValue()
sets the valueTuple to be empty (zero elements)

sameValue

public boolean sameValue(Field f)
returns true if this field has the same valueTuple (values are same) as the one provided, else returns false

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
overwrite the existing attributeTuple with a new one consisting of a single Attribute made from the provided attribute pair.
Parameters:
name - name of the attribute
value - value of the attribute

removeAttribute

public void removeAttribute(java.lang.String name)
remove the attribute with the provided name from the field's attributeTuple. No action if the attribute doesn't exist.

hasAttribute

public boolean hasAttribute(java.lang.String name)
indicate whether the provided name is the name of an attribute in the field's attributeTuple

getLabelledStringValues

public java.lang.String[] getLabelledStringValues(java.lang.String label)
for system programmer's use only

sameAttributeTuple

public boolean sameAttributeTuple(Field f)
indicates whether this field contains the same attributeTuple (same name=value pairs - order insignificant) as the provided field

score

public double score(Field queryField)
use the default scoring mechanism to score this target field value against the value of the provided queryField argument.
Returns:
the double score for the field
See Also:
ValueTuple.score(ValueTuple), Value.score(Value)

sleep

protected void sleep(int millisecs)
for system programmer's use only

toString

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

CAR (Context-Aware Retrieval) v1.0

Submit bugs to Lindsey