MetaTF API

MetaTF.Parser
Class DTD

java.lang.Object
  |
  +--MetaTF.Parser.DTD

public class DTD
extends java.lang.Object

The symbol table for the DTD The symbol table is a singleton

Version:
rel-1-2 ($Revision: 1.3 $, $Date: 2000/12/15 16:29:55 $),
Author:
Richard Jones
See Also:
The MetaTF Grammar

Method Summary
 java.lang.Object accept(DTDVisitor visitor, java.lang.Object data)
          Accept the visitor
(package private)  void addField(java.lang.String o)
          Append a field to the list of all named fields Duplicate names are not added.
(package private)  void addFields(java.util.List fs)
          Append a list of field to the list of all named fields.
(package private)  void addSection(int sectionNumber, Section section)
          Add a new section to the symbol table
(package private)  void builtins()
          Construct the built-ins by hand 1.
 java.lang.String dump(java.lang.String prefix)
          Dump the symbol table
 java.util.List getFields()
          Return a a list of all field names defined in the DTD: List
 int getMaxSectionNumber()
          Get the number of the highest numbered section.
 int getNumSections()
           
 Section getSection(int n)
          Return the section
 java.util.Map getSections()
           
 boolean hasSection(int n)
          Does the DTD have a section of a given number
 boolean hasSection(java.lang.String s)
          Does the DTD have a section of a given name
static DTD instance()
          The only way to get the symbol table
 int sectionNameToNumber(java.lang.String s)
          Get section number from its name
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static DTD instance()
                    throws DTDException
The only way to get the symbol table
Returns:
the symbol table

hasSection

public boolean hasSection(int n)
Does the DTD have a section of a given number
Parameters:
n - the section number
Returns:
whether the DTD has a section n

hasSection

public boolean hasSection(java.lang.String s)
Does the DTD have a section of a given name
Parameters:
s - the section name
Returns:
whether the DTD has a section n

getNumSections

public int getNumSections()
Returns:
the number of sections in the DTD

getMaxSectionNumber

public int getMaxSectionNumber()
Get the number of the highest numbered section. Section numbers need not be contiguous. This value is needed by code generators.

getSection

public Section getSection(int n)
                   throws DTDException
Return the section
Parameters:
n - the section number WHERE hasSection(n)
Returns:
the section
Throws:
DTDException - IF !hasSection(n)
See Also:
hasSection(int)

getSections

public java.util.Map getSections()
Returns:
the sections

sectionNameToNumber

public int sectionNameToNumber(java.lang.String s)
                        throws DTDException
Get section number from its name
Parameters:
s - the section name
Returns:
the section number
Throws:
DTDException - IF the DTD does not have section s

addSection

void addSection(int sectionNumber,
                Section section)
          throws DTDException
Add a new section to the symbol table
Parameters:
sectionNumber - the section number
section - the section
Throws:
DTDException - IF sectionNumber<0 || hasSection(sectionNumber)
See Also:
hasSection(int)

builtins

void builtins()
        throws DTDException
Construct the built-ins by hand 1. Create a new section Global 0 2. Add it to the symbol table (from rel-1-2, we no longer create entries in the symbol table for buitl-in records)

addField

void addField(java.lang.String o)
Append a field to the list of all named fields Duplicate names are not added.
Parameters:
o - the name of the field

addFields

void addFields(java.util.List fs)
Append a list of field to the list of all named fields. Duplicate names are not added.
Parameters:
fs - the list of fields to be appended

getFields

public java.util.List getFields()
Return a a list of all field names defined in the DTD: List
Returns:
the list of field names

dump

public java.lang.String dump(java.lang.String prefix)
Dump the symbol table
Parameters:
prefix - an identifying prefix to prepend to each line of the dump
Returns:
a prettified representation of the symbol table

accept

public java.lang.Object accept(DTDVisitor visitor,
                               java.lang.Object data)
Accept the visitor

MetaTF API

Copyright © 2001 - Richard Jones     MetaTF