metaglue
Class AttributeDatabase

java.lang.Object
  |
  +--metaglue.AttributeDatabase

public class AttributeDatabase
extends Object
implements Serializable

See Also:
Serialized Form

Field Summary
 Hashtable attributeDB
           
 
Constructor Summary
AttributeDatabase()
           
 
Method Summary
 Hashtable addAgent(String society, String occupation)
          Adds new occupation under society in database if necessary; society is added if necessary.
 void addAgentStrong(String society, String occupation)
          Adds new occupation under society in database.
 void addAttribute(AgentID agentID, String attributeName)
          Adds new agent along with attribute if necessary and initializes with UNDEFINED value
 void addAttribute(AgentID agentID, String attributeName, String attributeValue)
          Adds new agent along with attribute if necessary and initializes with value If attributeName is null, then new UNDEFINED designation is made.
 void addAttribute(String society, String occupation, String attributeName)
          Adds new agent along with attribute if necessary
 void addAttributeName(String occupation, String attributeName)
           
 void addAttributeNames(String occupation, Vector attributeNames)
           
 void addAttributeStrong(AgentID agentID, String attributeName, String attributeValue)
          Adds new agent along with attribute and initializes with value
 Hashtable addSociety(String society)
          Adds new society if necessary.
 Hashtable addSociety(String society, Hashtable olevel)
          Adds new society if necessary and primes with olevel table.
 void addSocietyStrong(String society)
          Adds new society.
 void addSocietyStrong(String society, Hashtable olevel)
          Adds new society and primes with olevel.
 Hashtable cloneSociety(String society)
           
 Vector discoverAttributes(AgentLoader agentLoader, String occupation)
           
 void exportHumanReadable(String xfile)
           
 String getAttribute(AgentID agentID, String attributeName)
           
 Vector getAttributeNames(String occupation)
           
 Vector getAttributes(AgentID agentID)
           
 Hashtable getAttributes(String society)
           
 Hashtable getAttributes(String society, String occupation)
           
 Vector getOccupations(String pack)
           
 DefaultMutableTreeNode getPackageHierarchy()
           
 void importHumanReadable(String ifile)
           
static void main(String[] args)
           
 Enumeration occupations()
           
 void removeAttributeNames(String occupation, Vector attributeNames)
          Removes the names in the list of attribute names of the occupation Any names in the list that are missing are ignored
 Vector removeDesignation(AgentID agentID)
           
 Hashtable removeSociety(String society)
          removes society if necessary.
 void setAttributeNames(String occupation, Vector attributeNames)
           
 Enumeration societies()
           
 void synchronizeAgents(AgentLoader agentLoader)
           
 void synchronizeAgents(AgentLoader agentLoader, TreePath selection)
           
 void updateAttribute(AgentID agentID, String attributeName, String attributeValue)
          Value overwrites old value, adding attribute if necessary
 void updateDesignation(AgentID oldAgentID, String newDesignation)
          changes designation in old to new, adding new as UNDEFINED if old not present
 void updateSociety(String oldSociety, String newSociety)
          change society name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeDB

public Hashtable attributeDB
Constructor Detail

AttributeDatabase

public AttributeDatabase()
Method Detail

getPackageHierarchy

public DefaultMutableTreeNode getPackageHierarchy()

societies

public Enumeration societies()

occupations

public Enumeration occupations()

getOccupations

public Vector getOccupations(String pack)

getAttributeNames

public Vector getAttributeNames(String occupation)

setAttributeNames

public void setAttributeNames(String occupation,
                              Vector attributeNames)

addAttributeName

public void addAttributeName(String occupation,
                             String attributeName)
                      throws AttributeAlreadyDefinedException

addAttributeNames

public void addAttributeNames(String occupation,
                              Vector attributeNames)

removeAttributeNames

public void removeAttributeNames(String occupation,
                                 Vector attributeNames)
Removes the names in the list of attribute names of the occupation Any names in the list that are missing are ignored

synchronizeAgents

public void synchronizeAgents(AgentLoader agentLoader,
                              TreePath selection)

synchronizeAgents

public void synchronizeAgents(AgentLoader agentLoader)

discoverAttributes

public Vector discoverAttributes(AgentLoader agentLoader,
                                 String occupation)

getAttributes

public Hashtable getAttributes(String society)
                        throws MissingAgentInAttributeDBException
Returns:
olevel hashtable
Throws:
MissingAgentInAttributeDB - agent is not in attribute database

getAttributes

public Hashtable getAttributes(String society,
                               String occupation)
                        throws MissingAgentInAttributeDBException
Returns:
dlevel hashtable
Throws:
MissingAgentInAttributeDB - agent is not in attribute database

getAttributes

public Vector getAttributes(AgentID agentID)
                     throws MissingAgentInAttributeDBException
Returns:
vector of attribute values
Throws:
MissingAgentInAttributeDB - agent is not in attribute database

getAttribute

public String getAttribute(AgentID agentID,
                           String attributeName)
                    throws MissingAgentInAttributeDBException,
                           MissingAttributeException
Returns:
attribute value
Throws:
MissingAgentInAttributeDB - agent is not in attribute database
MissingAttributeException - attribute is not defined for agent

addSocietyStrong

public void addSocietyStrong(String society)
                      throws AgentAlreadyInAttributeDBException
Adds new society.
Throws:
AgentAlreadyInAttributeDBException - society is already in attribute database

addSocietyStrong

public void addSocietyStrong(String society,
                             Hashtable olevel)
                      throws AgentAlreadyInAttributeDBException
Adds new society and primes with olevel.
Throws:
AgentAlreadyInAttributeDBException - society is already in attribute database

cloneSociety

public Hashtable cloneSociety(String society)

addAgentStrong

public void addAgentStrong(String society,
                           String occupation)
                    throws AgentAlreadyInAttributeDBException,
                           MissingAgentInAttributeDBException
Adds new occupation under society in database.
Throws:
AgentAlreadyInAttributeDBException - agent is already in attribute database
MissingAgentInAttributeDBException - agent is not in attribute database

addAttributeStrong

public void addAttributeStrong(AgentID agentID,
                               String attributeName,
                               String attributeValue)
                        throws AttributeAlreadyDefinedException,
                               MissingAgentInAttributeDBException,
                               CorruptAttributeDBException
Adds new agent along with attribute and initializes with value
Throws:
AttributeAlreadyInAttributeDBException - attribute is already in attribute database
MissingAgentInAttributeDBException - agent is not in attribute database

addSociety

public Hashtable addSociety(String society)
Adds new society if necessary.
Returns:
olevel hashtable

addSociety

public Hashtable addSociety(String society,
                            Hashtable olevel)
Adds new society if necessary and primes with olevel table.
Returns:
olevel hashtable

removeSociety

public Hashtable removeSociety(String society)
removes society if necessary.
Returns:
olevel hashtable of what was under society, null if society wasn't in DB

updateSociety

public void updateSociety(String oldSociety,
                          String newSociety)
                   throws MissingAgentInAttributeDBException
change society name
Throws:
MissingAgentInAttributeDBException - society not in DB

addAgent

public Hashtable addAgent(String society,
                          String occupation)
Adds new occupation under society in database if necessary; society is added if necessary.
Returns:
dlevel hashtable

addAttribute

public void addAttribute(String society,
                         String occupation,
                         String attributeName)
                  throws CorruptAttributeDBException
Adds new agent along with attribute if necessary
Throws:
CorruptAttributeDBException - attributeDB does not contain expected data types

addAttribute

public void addAttribute(AgentID agentID,
                         String attributeName,
                         String attributeValue)
Adds new agent along with attribute if necessary and initializes with value If attributeName is null, then new UNDEFINED designation is made.

addAttribute

public void addAttribute(AgentID agentID,
                         String attributeName)
Adds new agent along with attribute if necessary and initializes with UNDEFINED value

updateAttribute

public void updateAttribute(AgentID agentID,
                            String attributeName,
                            String attributeValue)
Value overwrites old value, adding attribute if necessary

removeDesignation

public Vector removeDesignation(AgentID agentID)

updateDesignation

public void updateDesignation(AgentID oldAgentID,
                              String newDesignation)
changes designation in old to new, adding new as UNDEFINED if old not present

exportHumanReadable

public void exportHumanReadable(String xfile)
                         throws IOException

importHumanReadable

public void importHumanReadable(String ifile)
                         throws IOException

main

public static void main(String[] args)