gov.nasa.pds.tools.dict
Class Dictionary

java.lang.Object
  extended by gov.nasa.pds.tools.dict.Dictionary
All Implemented Interfaces:
Status

public class Dictionary
extends java.lang.Object
implements Status

This class represents a PDS data dictionary.

Version:
$Revision: 2897 $
Author:
pramirez

Field Summary
 
Fields inherited from interface gov.nasa.pds.tools.label.validate.Status
FAIL, PASS, SKIP, UNKNOWN
 
Constructor Summary
Dictionary()
           
 
Method Summary
 void addDefinition(Definition definition)
          Adds a definition to this dictionary to.
 void addDefinition(Definition definition, boolean overwrite)
          Adds a defintion to this dictionary.
 void addDefinitions(java.util.Collection definitions)
          Adds a list of defintions to this dictionary.
 void addDefinitions(java.util.Collection definitions, boolean overwrite)
          Adds a list of defintions to this dictionary.
 boolean containsDefinition(java.lang.String identifier)
          Tests to see whether or not a definition exists
 boolean containsElementDefinition(java.lang.String identifier)
          Tests to see whether or not an element is defined
 boolean containsElementDefinition(java.lang.String objectContext, java.lang.String identifier)
           
 boolean containsGroupDefinition(java.lang.String identifier)
          Tests to see whether or not a group is defined
 boolean containsObjectDefinition(java.lang.String identifier)
          Tests to see whether or not an object is defined
 GroupDefinition findGroupClassDefinition(java.lang.String identifier)
          Retrieves the class definition for a group with the given identifier.
 ObjectDefinition findObjectClassDefinition(java.lang.String identifier)
          Retrieves the class definition for an object with the given identifier.
 Definition getDefinition(java.lang.String identifier)
          Retrieves the definition from the dictionary or null if not found
 java.util.Map getDefinitions()
          Retrieves the map of definitions
 ElementDefinition getElementDefinition(java.lang.String identifier)
          Retrieves the element definition from the dictionary or null if not found.
 ElementDefinition getElementDefinition(java.lang.String objectContext, java.lang.String identifier)
           
 GroupDefinition getGroupDefinition(java.lang.String identifier)
          Retrieves the group definition from the dictionary or null if not found
 java.lang.String getInformation()
          Return the dictionary's descriptive information.
 ObjectDefinition getObjectDefinition(java.lang.String identifier)
          Retrieves the object definition from the dictionary or null if not found
 java.lang.String getStatus()
           
 java.util.Map getUnits()
          Retrieves map of valid units.
 void merge(Dictionary dictionary)
          Merges dictionary without overwriting
 void merge(Dictionary dictionary, boolean overwrite)
          Merges the definitions in the dictionaries
 void setInformation(java.lang.String information)
          Sets the description information for a dictionary.
 void setStatus(java.lang.String status)
           
 void setUnits(java.util.Map units)
          Sets the valid units for use when performing validation against this dictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dictionary

public Dictionary()
Method Detail

merge

public void merge(Dictionary dictionary)
Merges dictionary without overwriting

Parameters:
dictionary - to be merged

merge

public void merge(Dictionary dictionary,
                  boolean overwrite)
Merges the definitions in the dictionaries

Parameters:
dictionary - to be merged
overwrite - flag

containsDefinition

public boolean containsDefinition(java.lang.String identifier)
Tests to see whether or not a definition exists

Parameters:
identifier - of the definition
Returns:
flag indicating existence

containsObjectDefinition

public boolean containsObjectDefinition(java.lang.String identifier)
Tests to see whether or not an object is defined

Parameters:
identifier - of the object
Returns:
flag indicating existence

containsGroupDefinition

public boolean containsGroupDefinition(java.lang.String identifier)
Tests to see whether or not a group is defined

Parameters:
identifier - of the the group
Returns:
flag indicating existence

containsElementDefinition

public boolean containsElementDefinition(java.lang.String identifier)
Tests to see whether or not an element is defined

Parameters:
identifier - of the element
Returns:
flag indicating existence

containsElementDefinition

public boolean containsElementDefinition(java.lang.String objectContext,
                                         java.lang.String identifier)

getDefinition

public Definition getDefinition(java.lang.String identifier)
Retrieves the definition from the dictionary or null if not found

Parameters:
identifier - of the definition
Returns:
the definition

getObjectDefinition

public ObjectDefinition getObjectDefinition(java.lang.String identifier)
Retrieves the object definition from the dictionary or null if not found

Parameters:
identifier - of the definition
Returns:
the object definition

getGroupDefinition

public GroupDefinition getGroupDefinition(java.lang.String identifier)
Retrieves the group definition from the dictionary or null if not found

Parameters:
identifier - of the definition
Returns:
the group definition

getElementDefinition

public ElementDefinition getElementDefinition(java.lang.String identifier)
Retrieves the element definition from the dictionary or null if not found.

Parameters:
identifier - of the definition
Returns:
the element definition

getElementDefinition

public ElementDefinition getElementDefinition(java.lang.String objectContext,
                                              java.lang.String identifier)

addDefinition

public void addDefinition(Definition definition)
Adds a definition to this dictionary to. Overwrites any existing definition.

Parameters:
definition - to be added to the dictionary

addDefinition

public void addDefinition(Definition definition,
                          boolean overwrite)
Adds a defintion to this dictionary. The flag indicates whether a definition should be overwriten.

Parameters:
definition - to be added to the dictionary
overwrite - indicates if definition should be overwriten

setInformation

public void setInformation(java.lang.String information)
Sets the description information for a dictionary. This is often captured informally in comments at the top of a dictionary file.

Parameters:
information -

getInformation

public java.lang.String getInformation()
Return the dictionary's descriptive information.

Returns:
the information

addDefinitions

public void addDefinitions(java.util.Collection definitions,
                           boolean overwrite)
Adds a list of defintions to this dictionary. The flag indicates whether the definitions should be overwriten.

Parameters:
definitions - to be added to the dictionary
overwrite -

addDefinitions

public void addDefinitions(java.util.Collection definitions)
Adds a list of defintions to this dictionary. By default definitions will be overwritten.

Parameters:
definitions - to be added to the dictionary

findObjectClassDefinition

public ObjectDefinition findObjectClassDefinition(java.lang.String identifier)
Retrieves the class definition for an object with the given identifier. This method will search the dictionary for an ObjectDefinition whose identifier is the greatest length and matches the end of the given identifier

Parameters:
identifier - to lookup up class of
Returns:
ObjectDefinition of class that will constrain object with given identifier. Returns null if not found.

findGroupClassDefinition

public GroupDefinition findGroupClassDefinition(java.lang.String identifier)
Retrieves the class definition for a group with the given identifier. This method will search the dictionary for a GroupDefinition whose identifier is the greatest length and matches the end of the given identifier

Parameters:
identifier - to lookup up class of
Returns:
GroupDefinition of class that will constrain object with given identifier. Returns null if not found.

getDefinitions

public java.util.Map getDefinitions()
Retrieves the map of definitions

Returns:
map of definitions.

getUnits

public java.util.Map getUnits()
Retrieves map of valid units.

Returns:
map of UNIT_ID to list of valid units

setUnits

public void setUnits(java.util.Map units)
Sets the valid units for use when performing validation against this dictionary

Parameters:
units - mapped set of units of the form UNIT_ID to units list (A) -> ('A', 'AMPERE')

getStatus

public java.lang.String getStatus()

setStatus

public void setStatus(java.lang.String status)


Copyright © 2005-2009 NASA Jet Propulsion Laboratory, California Institute of Technology. All Rights Reserved.