Fido Alpha 3.2

fido.db
Class GrammarLinkTable

java.lang.Object
  |
  +--fido.db.GrammarLinkTable

public class GrammarLinkTable
extends java.lang.Object

Holds a list of Link names and the types of each link. These links are used to join words together in the Grammar module.

Types of links are a superset of the Parts of Speech:

The link types are fixed, because the SentenceComponents module uses them to determine the structure of the sentence.

The list is stored in a database file. After each add, update, or removal of a link, the list is updated in the database.

See Also:
Grammar, LinguisticAnalysis

Field Summary
static int ADJECTIVE
          Constant value used as a link type in the methods addLink() and getLinkType()
static int ADVERB
          Constant value used as a link type in the methods addLink() and getLinkType()
static int ARTICLE
          Constant value used as a link type in the methods addLink() and getLinkType()
static int CONJUNCTION
          Constant value used as a link type in the methods addLink() and getLinkType()
static int DIRECT_OBJECT
          Constant value used as a link type in the methods addLink() and getLinkType()
static int HELPING_VERB
          Constant value used as a link type in the methods addLink() and getLinkType()
static int INDIRECT_OBJECT
          Constant value used as a link type in the methods addLink() and getLinkType()
static int INTERJECTION
          Constant value used as a link type in the methods addLink() and getLinkType()
static int NOUN_PHRASE
          Constant value used as a link type in the methods addLink() and getLinkType()
static int PREDICATE_ADJECTIVE
          Constant value used as a link type in the methods addLink() and getLinkType()
static int PREDICATE_NOUN
          Constant value used as a link type in the methods addLink() and getLinkType()
static int PREPOSITION
          Constant value used as a link type in the methods addLink() and getLinkType()
static int PREPOSITIONAL_OBJECT
          Constant value used as a link type in the methods addLink() and getLinkType()
static int QUESTION_VERB
          Constant value used as a link type in the methods addLink() and getLinkType()
static int REGULAR_VERB
          Constant value used as a link type in the methods addLink() and getLinkType()
static int SUBJECT
          Constant value used as a link type in the methods addLink() and getLinkType()
 
Constructor Summary
GrammarLinkTable()
          Constructs a new GrammarLinkList with no entries in the list.
 
Method Summary
 void add(java.lang.String name, int type)
          Adds or modifies a GrammarLinkList.
 boolean contains(java.lang.String name)
           
 void delete(java.lang.String name)
          Removes the GrammarLink referenced by the parameters name.
 int get(java.lang.String name)
          Returns the GrammarLink type referrenced by the parameter name.
 int hashCode(java.lang.String linkName)
           
 boolean isEmpty()
           
 java.util.Collection list()
          Returns the names of all GrammarLink names in the list.
 java.util.Collection listTypes()
          Returns the names of all Attribute names in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBJECT

public static final int SUBJECT
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

PREDICATE_NOUN

public static final int PREDICATE_NOUN
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

DIRECT_OBJECT

public static final int DIRECT_OBJECT
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

INDIRECT_OBJECT

public static final int INDIRECT_OBJECT
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

PREPOSITIONAL_OBJECT

public static final int PREPOSITIONAL_OBJECT
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

NOUN_PHRASE

public static final int NOUN_PHRASE
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

REGULAR_VERB

public static final int REGULAR_VERB
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

QUESTION_VERB

public static final int QUESTION_VERB
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

PREPOSITION

public static final int PREPOSITION
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

ARTICLE

public static final int ARTICLE
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

ADJECTIVE

public static final int ADJECTIVE
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

ADVERB

public static final int ADVERB
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

CONJUNCTION

public static final int CONJUNCTION
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

INTERJECTION

public static final int INTERJECTION
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

PREDICATE_ADJECTIVE

public static final int PREDICATE_ADJECTIVE
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values

HELPING_VERB

public static final int HELPING_VERB
Constant value used as a link type in the methods addLink() and getLinkType()

See Also:
Constant Field Values
Constructor Detail

GrammarLinkTable

public GrammarLinkTable()
Constructs a new GrammarLinkList with no entries in the list. The database reference is stored so any updates will store in the database. Upon creation, this class will write itself to the database. If an entry with the name GrammarLinkList already exists in the database, the object it points to is replaced.

Throws:
FidoIOException - Input / Output error on creating the GrammarLinkList object
Method Detail

add

public void add(java.lang.String name,
                int type)
         throws FidoDatabaseException
Adds or modifies a GrammarLinkList. The name parameter is the string used to reference the object in the list. If an entry with this name already is in the list, the object replaced with the type and position parameters.

Parameters:
type - the type of link (noun, verb, ...)
Throws:
java.sql.SQLException - Input / Output error saving GrammarLinkList
FidoDatabaseException

contains

public boolean contains(java.lang.String name)
                 throws FidoDatabaseException
FidoDatabaseException

delete

public void delete(java.lang.String name)
            throws FidoDatabaseException
Removes the GrammarLink referenced by the parameters name. If the list contains no entery with that name, this call does nothing. The list is only updated in the database file if the link type was acutally removed.

Parameters:
name - Name of the GrammarLink to remove
Throws:
FidoIOException - Input / Output error saving GrammarLinkList
FidoDatabaseException

get

public int get(java.lang.String name)
        throws FidoDatabaseException,
               GrammarLinkNotFoundException
Returns the GrammarLink type referrenced by the parameter name.

Returns:
type of link
Throws:
GrammarLinkNotFoundException - thrown when the name does not exist in the list
FidoDatabaseException

list

public java.util.Collection list()
                          throws FidoDatabaseException
Returns the names of all GrammarLink names in the list. The names of the links are in alphabetical order.

Returns:
list of link names
FidoDatabaseException

listTypes

public java.util.Collection listTypes()
                               throws FidoDatabaseException
Returns the names of all Attribute names in the list. The names of the links are in alphabetical order.

Returns:
list of link names
FidoDatabaseException

hashCode

public int hashCode(java.lang.String linkName)
             throws FidoDatabaseException,
                    GrammarLinkNotFoundException
FidoDatabaseException
GrammarLinkNotFoundException

isEmpty

public boolean isEmpty()
                throws FidoDatabaseException
FidoDatabaseException

Fido Alpha 3.2