Twease

edu.cornell.med.icb.synonyms.entities
Class Synonym

java.lang.Object
  extended by edu.cornell.med.icb.synonyms.entities.Synonym
All Implemented Interfaces:
Serializable

public class Synonym
extends Object
implements Serializable

The Synonym object, for persistence via JPA. Defining the Table-name annotation is important because Oracle cannot create a table named "Synonym".

Author:
Kevin Dorff
See Also:
Serialized Form

Field Summary
static String APPLIES_TO_ALL
          AppliesTo field value when a synonym applies to all.
static String[] CREATE_INDEX_COMMANDS
          Commands required to index this data.
static String[] DROP_INDEX_COMMANDS
          Commands required to remove the indexes for this data.
 
Constructor Summary
Synonym(String dictionaryWordVal, String synonymWordVal, double scoreVal, String appliesToVal, String sourceVal)
          General constructor for creating a new synonym.
 
Method Summary
 String getAppliesTo()
          Getter for AppliesTo.
 String getDictionaryWord()
          Getter for DictionaryWord.
 Long getId()
          Getter for Id.
 Date getImportDate()
          Getter for ImportDate.
 double getScore()
          Getter for Score.
 String getSource()
          Getter for Source.
 String getSynonymWord()
          Getter for SynonymWord.
 boolean isEquivalent(Synonym synonym)
          Returns true if this synonym and the suggested on are the same, ignoring the id and the import date.
static boolean listContainsSynonym(List<Synonym> synonyms, Synonym toFind)
          Searches a list of synonyms.
 String toString()
          Human readable version of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

APPLIES_TO_ALL

public static final String APPLIES_TO_ALL
AppliesTo field value when a synonym applies to all.

See Also:
Constant Field Values

DROP_INDEX_COMMANDS

public static final String[] DROP_INDEX_COMMANDS
Commands required to remove the indexes for this data.


CREATE_INDEX_COMMANDS

public static final String[] CREATE_INDEX_COMMANDS
Commands required to index this data.

Constructor Detail

Synonym

public Synonym(String dictionaryWordVal,
               String synonymWordVal,
               double scoreVal,
               String appliesToVal,
               String sourceVal)
General constructor for creating a new synonym.

Parameters:
dictionaryWordVal - the dictionary word it applies to
synonymWordVal - the sysnonym for the dictionary word
scoreVal - the scoring (how well the synonym applies)
appliesToVal - which application this synonym applies to, or "*" if it apples to any application
sourceVal - the source of the synonym
Method Detail

getId

public Long getId()
Getter for Id.

Returns:
Long the id of this synonym (this will be populated after the synonym is peristed).

getDictionaryWord

public String getDictionaryWord()
Getter for DictionaryWord.

Returns:
String the DictionaryWord.

getSynonymWord

public String getSynonymWord()
Getter for SynonymWord.

Returns:
String the SynonymWord.

getScore

public double getScore()
Getter for Score.

Returns:
double the Score.

getAppliesTo

public String getAppliesTo()
Getter for AppliesTo.

Returns:
String the AppliesTo value.

getSource

public String getSource()
Getter for Source.

Returns:
String the Source value.

getImportDate

public Date getImportDate()
Getter for ImportDate.

Returns:
Date the ImportDate value.

isEquivalent

public boolean isEquivalent(Synonym synonym)
Returns true if this synonym and the suggested on are the same, ignoring the id and the import date.

Parameters:
synonym - the Synonym to compare to
Returns:
true if this synonym and the suggested one are equivalent

listContainsSynonym

public static boolean listContainsSynonym(List<Synonym> synonyms,
                                          Synonym toFind)
Searches a list of synonyms. Returns true if the specified synonym is in the list. Note: The isEquivalent function ignores the importDate and id fields otherwise the comparison might not hold up.

Parameters:
synonyms - the list of synonyms to search
toFind - the synonym to look for in the list
Returns:
boolean true if toFind was found in synonyms

toString

public String toString()
Human readable version of this object.

Overrides:
toString in class Object
Returns:
String the Human readable version of this object

Twease

Copyright © 2006-2007 Institute for Computational Biomedicine, All Rights Reserved.