MetaTF API

MetaTF.Parser
Class Record

java.lang.Object
  |
  +--MetaTF.Parser.Record
All Implemented Interfaces:
java.lang.Comparable, HasFields, HasProperties

public class Record
extends java.lang.Object
implements HasFields, HasProperties, java.lang.Comparable

Record

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

Fields inherited from interface MetaTF.Parser.HasFields
cvsheader
 
Fields inherited from interface MetaTF.Parser.HasProperties
cvsheader
 
Constructor Summary
(package private) Record(java.lang.String s)
          Allocate a new object representing a record
  Record(java.lang.String s, int l)
          Allocate a new object representing a record
 
Method Summary
 java.lang.Object accept(DTDVisitor visitor, java.lang.Object data)
          Accept the visitor
 void addField(Field f)
          Add a field to this section, record or field
 void addProperty(java.lang.String t, java.lang.String f, java.lang.String p, Value v, int l)
          Add a property to this section or record
(package private)  void checkFields()
          Check that the field is well formed i.e.
 int compareTo(java.lang.Object r)
          Compare the name of this record
 java.lang.String dump(java.lang.String prefix)
          Dump a representation of this object
 Field getField()
           
 java.lang.String getName()
           
 int getNumNamedFields()
           
 Section getSection()
           
 int getTag()
          Get the tag of this field
 boolean isTagged()
          Is this field tagged
(package private)  void replaceFields(java.util.Map inheritedFields0, java.util.Map inheritedRecords, java.util.Map inheritedFields)
          Do a macro replacement of any fields that do not have properties defined locally.
(package private)  void setSection(Section s)
          Set the section that this record is defined in
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Record

public Record(java.lang.String s,
              int l)
Allocate a new object representing a record
Parameters:
s - the name of the record
l - the line in the DTD where this record's definition started

Record

Record(java.lang.String s)
Allocate a new object representing a record
Parameters:
s - the name of the record
Method Detail

replaceFields

void replaceFields(java.util.Map inheritedFields0,
                   java.util.Map inheritedRecords,
                   java.util.Map inheritedFields)
Do a macro replacement of any fields that do not have properties defined locally.
Parameters:
inheritedRecords0 - Map of records inherited from section 0
inheritedRecords - Map of records inherited from this section
inheritedFields - Map of inherited fields

checkFields

void checkFields()
           throws DTDException
Check that the field is well formed i.e. has a type and an encoding. All macro substition must be done before checkFields is called
Throws:
DTDException - IF this field is not well-formed
See Also:
replaceFields(java.util.Map, java.util.Map, java.util.Map)

getTag

public int getTag()
           throws NoTagException
Get the tag of this field
Returns:
the tag, if any
Throws:
NoTagException - IF this field does not contain a tag

isTagged

public boolean isTagged()
Is this field tagged
Returns:
whether the field is tagged

getName

public java.lang.String getName()
Returns:
the name of this record

getField

public Field getField()
Returns:
this record's field

getNumNamedFields

public int getNumNamedFields()
Returns:
the number of named fields in this record

addField

public void addField(Field f)
Description copied from interface: HasFields
Add a field to this section, record or field
Specified by:
addField in interface HasFields
Following copied from interface: MetaTF.Parser.HasFields
Parameters:
f - the field
Throws:
DTDException - IF this action is improper

addProperty

public void addProperty(java.lang.String t,
                        java.lang.String f,
                        java.lang.String p,
                        Value v,
                        int l)
                 throws DTDException
Description copied from interface: HasProperties
Add a property to this section or record
Specified by:
addProperty in interface HasProperties
Following copied from interface: MetaTF.Parser.HasProperties
Parameters:
type - the type
field - the name of the field. The property is only added if the field names match
property - the property
value - the value of the property
beginLine - the line in the DTD at which this property was defined
Throws:
DTDException -  

getSection

public Section getSection()
Returns:
the section that this record is defined in

setSection

void setSection(Section s)
Set the section that this record is defined in
Parameters:
the - name of the section

compareTo

public int compareTo(java.lang.Object r)
Compare the name of this record
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
the - record to be compared

dump

public java.lang.String dump(java.lang.String prefix)
Dump a representation of this object
Parameters:
prefix - an indentiyfing prefix
Returns:
a prettified representation of this object

accept

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

MetaTF API

Copyright © 2001 - Richard Jones     MetaTF