gov.nist.nlpir.irf.de
Interface DataElem

All Known Subinterfaces:
DeDoubleIntrf, DeHtmlIntrf, DeIntegerIntrf, DePersonNameIntrf, DeStringIntrf
All Known Implementing Classes:
DeDouble, DeInteger, DeString, ProxyDataElem, DePersonName

public abstract interface DataElem

This interface provides the skeleton all data element classes must comply with

IRF provides several base Data Elements but developpers can write their own ones to handle specific types of information, like speech or images. DataElems must provide function to be compared to other DataElems so that indexing and retrieval can be done.
DataElems must also provide a hashCode() function based on the value they represent so that they can be indexed.

Version:
$Revision: 1.1 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.

Method Summary
 void addHTML(java.lang.StringBuffer baseString, int maxNrChar, boolean form)
          Adds the value of the DataElem to the string given in parameter.
 int compareTo(DataElem o)
          Compares the current object to the given object, which must be of the same type.
 boolean equals(java.lang.Object other)
          Extends the default definition of equals(Object) in Object.
 boolean exactMatch(DataElem de)
          Compares this DataElem to another.
 java.util.Vector getIndexingFeatures(ProxyDocument source, IndexingModalities im, DataElem sourceField)
          Returns the indexing features of this data element.
 java.lang.String getValueAsString()
          Returns the string representation of the value of the DataElem Note: may be different of getAsString(), when object embeds other ones for instance.
 int hashCode()
          Extends the default definition of hashCode() in Object.
 void HTML_ShowDoc(java.lang.StringBuffer string)
          Appends a HTML representation of the DataElem to the given string, allowing to create HTML docs from DataElems.
 float match(DataElem de)
          Matches score of this DataElem with another.
 void present()
          Each DataElem has to provide a function to present itself so that the tree of DataElems can be browsed and checked.
 void presentBrief()
          Same as present() but the presentation can be shorter.
 java.lang.String toString()
          Returns the string representation of the DataElem
 

Method Detail

present

public void present()
Each DataElem has to provide a function to present itself so that the tree of DataElems can be browsed and checked.

presentBrief

public void presentBrief()
Same as present() but the presentation can be shorter.

match

public float match(DataElem de)
Matches score of this DataElem with another.
Parameters:
de - the DataElem this is compared with.
Returns:
the score of the matching process, given a convention.

exactMatch

public boolean exactMatch(DataElem de)
Compares this DataElem to another.
Parameters:
de - the DataElem this is compared with.
Returns:
true if the DataElem are similar,
false otherwise

getIndexingFeatures

public java.util.Vector getIndexingFeatures(ProxyDocument source,
                                            IndexingModalities im,
                                            DataElem sourceField)
Returns the indexing features of this data element.
Parameters:
source - source document of data element
im - the controlling indexing modalities
sourceField - the document field from which the data element came
Returns:
collection of indexing features for data element

getValueAsString

public java.lang.String getValueAsString()
Returns the string representation of the value of the DataElem Note: may be different of getAsString(), when object embeds other ones for instance.
Returns:
the string representation of the value of the DataElem.

toString

public java.lang.String toString()
Returns the string representation of the DataElem
Returns:
the string representation of the DataElem
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(DataElem o)
Compares the current object to the given object, which must be of the same type.
Parameters:
o - the object this is compared to. Must be of the same type.
Returns:
the difference between the two objects converted to an int. A convention must be chosen, including a value for incompatible types of arguments.

hashCode

public int hashCode()
Extends the default definition of hashCode() in Object. Definition of hashCode must be based on the value of the object.
Returns:
hash code of the DataElem, used for Index, and Hashtable
Overrides:
hashCode in class java.lang.Object
See Also:
Hashtable, Object

equals

public boolean equals(java.lang.Object other)
Extends the default definition of equals(Object) in Object. Definition of equals must be based on the value of the object.
Returns:
true if objects are equals, "IRFly" speaking
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

addHTML

public void addHTML(java.lang.StringBuffer baseString,
                    int maxNrChar,
                    boolean form)
Adds the value of the DataElem to the string given in parameter.
Parameters:
baseString - the string to which the HTML value will be appended. Caution : the String is modified.
maxNrChar - maximum number of characters this function will add to the string.
form - if true, the text will be used to create a form, otherwise it won't be.
Returns:
the HTML String resulting from the addition.

HTML_ShowDoc

public void HTML_ShowDoc(java.lang.StringBuffer string)
Appends a HTML representation of the DataElem to the given string, allowing to create HTML docs from DataElems.
Parameters:
string - the HTML text the representation will be added to