gov.nist.nlpir.irf.de
Class ProxyDePersonName

java.lang.Object
  |
  +--gov.nist.nlpir.irf.proxy.VirtualProxy
        |
        +--gov.nist.nlpir.irf.de.ProxyDataElem
              |
              +--gov.nist.nlpir.irf.de.ProxyDePersonName

public class ProxyDePersonName
extends ProxyDataElem

Instances of this class represent a DePersonName by proxy

Version:
$Revision: 1.2 $
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.
See Also:
Serialized Form

Inner classes inherited from class gov.nist.nlpir.irf.proxy.VirtualProxy
VirtualProxy.IMP_Entry
 
Fields inherited from class gov.nist.nlpir.irf.proxy.VirtualProxy
broker, handles, inMemoryProxiesByOid, iS, objectIdentifier, realObject, serialVersionUID
 
Constructor Summary
ProxyDePersonName()
          No-argument constructor
ProxyDePersonName(char[] sur)
          Builds a DePersonName considering the only array of characters given as a String representing the person's surname.
ProxyDePersonName(char[] first, char[] sur)
          Treats the two arrays of characters as Strings and creates the DePersonName associated.
ProxyDePersonName(DePersonName sur)
          Builds a ProxyDePersonName given a DePersonName assumed to copntain the surname.
ProxyDePersonName(java.lang.String sur)
          Builds a DePersonName assuming the only string given is the person's surname.
ProxyDePersonName(java.lang.String first, java.lang.String sur)
          Assigns first and last name.
 
Method Summary
 void addHTML(java.lang.StringBuffer baseString, int maxNrOfChar, boolean form)
          Adds the name and surname to the HTML text given.
 int compareTo(DataElem o)
          Scores the comparison between this and the given DePersonName
 PersistenceBroker createBroker()
          Creates a broker for this proxy object and remember it
 boolean exactMatch(DataElem de)
          Compares this DePersonName to another.
 java.lang.String getFirstName()
          Retrieves the first name as a string.
 java.util.Vector getIndexingFeatures(ProxyDocument source, IndexingModalities im, DataElem field)
          Extract indexing features from this data element
 java.lang.String getSurname()
          Retrieves the surname as a string.
 java.lang.String getValueAsString()
          Gives the same result as toString().
 int hashCode()
          Overrides of Object.hashCode(), based on the hashCoding of the surname.
 void HTML_ShowDoc(java.lang.StringBuffer baseString)
          Adds the name and surname of the person to the HTML string given (in this order).
 float match(DataElem de)
          Scores the match of this DePersonName with another Object.
 void present()
          Prints a presentation of the DePersonName like this: Name: myname FirstName: myfirstName
 void presentBrief()
          Here, the presentation is briefer than with present(): myfirstName myname,
 void setValue(java.lang.String first, java.lang.String sur)
          Sets the two main variables of the DePersonName.
 java.lang.String toString()
          Returns a string representation of the DePersonName
 
Methods inherited from class gov.nist.nlpir.irf.de.ProxyDataElem
equals
 
Methods inherited from class gov.nist.nlpir.irf.proxy.VirtualProxy
addRefToInMemoryProxiesByOid, deleteRefFromInMemoryProxiesByOid, dematerializeRealObject, dematerializeRealObject, getBroker, getFirstInstance, getInMemoryProxiesByOidBinCount, getInMemoryProxiesByOidSize, getInMemoryProxyCounts, getObjectIdentifier, getPersistenceBroker, getProxyFor, getRealObject, isLightweight, makeLightweight, makePersistent, materializeRealObject, presentInMemoryProxies, readExternal, replaceRealObject, setBroker, setIS, setObjectIdentifier, setRealObject, testInMemoryProxiesByOidTable, writeExternal
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

ProxyDePersonName

public ProxyDePersonName()
No-argument constructor

ProxyDePersonName

public ProxyDePersonName(DePersonName sur)
Builds a ProxyDePersonName given a DePersonName assumed to copntain the surname. The first name will be null.
Parameters:
sur - the surname of the person.

ProxyDePersonName

public ProxyDePersonName(java.lang.String sur)
Builds a DePersonName assuming the only string given is the person's surname. The first name will be null.
Parameters:
sur - the surname of the person.

ProxyDePersonName

public ProxyDePersonName(char[] sur)
Builds a DePersonName considering the only array of characters given as a String representing the person's surname. The first name will be null.
Parameters:
sur - considered as a string, will be the last name of the person.

ProxyDePersonName

public ProxyDePersonName(java.lang.String first,
                         java.lang.String sur)
Assigns first and last name.
Parameters:
first - person's first name.
sur - person's surname.

ProxyDePersonName

public ProxyDePersonName(char[] first,
                         char[] sur)
Treats the two arrays of characters as Strings and creates the DePersonName associated.
Method Detail

getFirstName

public final java.lang.String getFirstName()
Retrieves the first name as a string.

getSurname

public final java.lang.String getSurname()
Retrieves the surname as a string.

setValue

public final void setValue(java.lang.String first,
                           java.lang.String sur)
Sets the two main variables of the DePersonName.

present

public void present()
Prints a presentation of the DePersonName like this:
 Name: myname
 FirstName: myfirstName

presentBrief

public void presentBrief()
Here, the presentation is briefer than with present():
 myfirstName myname, 

exactMatch

public boolean exactMatch(DataElem de)
Compares this DePersonName to another.
Parameters:
de - the DePersonName this is compared with.
Returns:
true if both names and first names are the same,
false otherwise or if de is not a DePersonName.

match

public float match(DataElem de)
Scores the match of this DePersonName with another Object. For the function to succeed, the object must be a DePersonName also. Actually the result is 1 if the two objects exactly match, 0 otherwise.
Parameters:
de - the DePersonName this is compared with.
Returns:
the score of the matching process.

hashCode

public int hashCode()
Overrides of Object.hashCode(), based on the hashCoding of the surname.
Returns:
hash code of DeDouble, used for Index, and Hashtable.
Overrides:
hashCode in class java.lang.Object
See Also:
Hashtable, Object

compareTo

public int compareTo(DataElem o)
Scores the comparison between this and the given DePersonName
Parameters:
o - the DePersonName this is compared to.
Returns:
the score as an int:
If surnames are not the same, returns the comparison between them.
If they are, returns the comparison between first names.
In every case, if o is not a DePersonName, returns 0.
See Also:
String.compareTo(java.lang.Object)

getIndexingFeatures

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

getValueAsString

public final java.lang.String getValueAsString()
Gives the same result as toString().
Returns:
string representation of value of object.

toString

public final java.lang.String toString()
Returns a string representation of the DePersonName
Returns:
string representation of object.
surname, firstname
Overrides:
toString in class VirtualProxy

addHTML

public void addHTML(java.lang.StringBuffer baseString,
                    int maxNrOfChar,
                    boolean form)
Adds the name and surname to the HTML text given. If it is to be read in a form, the HTML code will allow the entry of values.
Parameters:
baseString - the HTML text the value will be appended to.
maxNrOfChar - maximum number of characters added, used only if form is false.
form - true if the HTML code must be used in a form.
Returns:
the new HTML string.

HTML_ShowDoc

public void HTML_ShowDoc(java.lang.StringBuffer baseString)
Adds the name and surname of the person to the HTML string given (in this order).
Parameters:
baseString - the String the two names will be added.

createBroker

public PersistenceBroker createBroker()
Creates a broker for this proxy object and remember it
Returns:
the broker for this object
Overrides:
createBroker in class VirtualProxy