gov.nasa.pds.tools.dict
Class Dictionary

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

public class Dictionary
extends Object
implements Serializable

This class represents a PDS data dictionary.

Version:
$Revision: 7288 $
Author:
pramirez, jagander
See Also:
Serialized Form

Field Summary
static Pattern VERSION_REGEX
           
 
Constructor Summary
Dictionary()
           
Dictionary(File dictionaryFile)
           
Dictionary(URI dictionaryURI)
           
 
Method Summary
 void addDefinition(Definition definition)
          Adds a definition to this dictionary.
 void addDefinitions(Collection<Definition> defs)
          Adds a list of definitions to this dictionary.
 void addProblem(LabelParserException exception)
           
 void addProblems(List<LabelParserException> exceptions)
           
 void clearProblems()
           
 boolean containsDefinition(DictIdentifier identifier)
          Tests to see whether or not a definition exists
 boolean containsElementDefinition(DictIdentifier identifier)
          Tests to see whether or not an element is defined
 boolean containsElementDefinition(String objectContext, DictIdentifier identifier)
           
 boolean containsGroupDefinition(DictIdentifier identifier)
          Tests to see whether or not a group is defined
 boolean containsObjectDefinition(DictIdentifier identifier)
          Tests to see whether or not an object is defined
 GroupDefinition findGroupClassDefinition(DictIdentifier identifier)
          Retrieves the class definition for a group with the given identifier.
 ObjectDefinition findObjectClassDefinition(DictIdentifier identifier)
          Retrieves the class definition for an object with the given identifier.
 Definition getDefinition(DictIdentifier identifier)
          Retrieves the definition from the dictionary or null if not found
protected  Map<DictIdentifier,Definition> getDefinitions()
          Retrieves the map of definitions
 File getDictionaryFile()
           
 URI getDictionaryURI()
           
 ElementDefinition getElementDefinition(DictIdentifier identifier)
          Retrieves the element definition from the dictionary or null if not found.
 ElementDefinition getElementDefinition(String objectContext, DictIdentifier identifier)
           
 GroupDefinition getGroupDefinition(DictIdentifier identifier)
          Retrieves the group definition from the dictionary or null if not found
 String getInformation()
          Return the dictionary's descriptive information.
 List<SimpleDictionaryChange> getMergeChanges()
           
 ObjectDefinition getObjectDefinition(DictIdentifier identifier)
          Retrieves the object definition from the dictionary or null if not found
 List<LabelParserException> getProblems()
           
 String getSourceString()
           
 Map<String,String> getUnits()
           
 String getVersion()
           
 void merge(Dictionary dictionary)
          Merges the definitions in the dictionaries
 void setInformation(String information)
          Sets the description information for a dictionary.
 void setUnits(Map<String,String> units)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_REGEX

public static final Pattern VERSION_REGEX
Constructor Detail

Dictionary

public Dictionary()

Dictionary

public Dictionary(URI dictionaryURI)

Dictionary

public Dictionary(File dictionaryFile)
Method Detail

getDictionaryURI

public URI getDictionaryURI()

getDictionaryFile

public File getDictionaryFile()

getSourceString

public String getSourceString()

getVersion

public String getVersion()

merge

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

Parameters:
dictionary - to be merged into this dictionary. dictionary merged in will override values in this dictionary if scalars or be added if lists

containsDefinition

public boolean containsDefinition(DictIdentifier identifier)
Tests to see whether or not a definition exists

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

containsObjectDefinition

public boolean containsObjectDefinition(DictIdentifier identifier)
Tests to see whether or not an object is defined

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

containsGroupDefinition

public boolean containsGroupDefinition(DictIdentifier 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(DictIdentifier identifier)
Tests to see whether or not an element is defined

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

containsElementDefinition

public boolean containsElementDefinition(String objectContext,
                                         DictIdentifier identifier)

getDefinition

public Definition getDefinition(DictIdentifier identifier)
Retrieves the definition from the dictionary or null if not found

Parameters:
identifier - of the definition
Returns:
the definition

getObjectDefinition

public ObjectDefinition getObjectDefinition(DictIdentifier 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(DictIdentifier 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(DictIdentifier 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(String objectContext,
                                              DictIdentifier identifier)

addDefinition

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

Parameters:
definition - to be added to the dictionary

setInformation

public void setInformation(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 String getInformation()
Return the dictionary's descriptive information.

Returns:
the information

addDefinitions

public void addDefinitions(Collection<Definition> defs)
Adds a list of definitions to this dictionary. The flag indicates whether the definitions should be overwritten.

Parameters:
defs - to be added to the dictionary

findObjectClassDefinition

public ObjectDefinition findObjectClassDefinition(DictIdentifier 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.

getDefinitions

protected Map<DictIdentifier,Definition> getDefinitions()
Retrieves the map of definitions

Returns:
the map of definitions.

findGroupClassDefinition

public GroupDefinition findGroupClassDefinition(DictIdentifier 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.

getMergeChanges

public List<SimpleDictionaryChange> getMergeChanges()

addProblem

public void addProblem(LabelParserException exception)

addProblems

public void addProblems(List<LabelParserException> exceptions)

getProblems

public List<LabelParserException> getProblems()

clearProblems

public void clearProblems()

getUnits

public Map<String,String> getUnits()

setUnits

public void setUnits(Map<String,String> units)


Copyright © 2005-2011 Planetary Data System. All Rights Reserved.