diva.sketch.parser2d
Class GrammarWriter

java.lang.Object
  |
  +--diva.sketch.parser2d.GrammarWriter

public class GrammarWriter
extends java.lang.Object

Reads in an XML file and parses it into an array of rules that make up a grammar.

Version:
$Revision: 1.1 $

Field Summary
static java.lang.String ANGLE_TAG
           
static java.lang.String CONSTRAINT_TAG
           
static double DEFAULT_ANGLE_TOLERANCE
          FIXME ??? this parser is smart
static java.lang.String DIRECTION_TAG
           
static java.lang.String DISTANCE_TAG
           
static java.lang.String GRAMMAR_TAG
           
static java.lang.String MAX_TAG
           
static java.lang.String MIN_TAG
           
static java.lang.String NAME_TAG
           
static java.lang.String OVERLAP_TAG
           
static java.lang.String RELATIVE_SITE_TAG
           
static java.lang.String RELATIVE_TAG
           
static java.lang.String ROOT_SITE_TAG
           
static java.lang.String ROOT_TAG
           
static java.lang.String RULE_TAG
           
static java.lang.String SIZE_TAG
           
static java.lang.String TITLE_TAG
           
static java.lang.String TYPE_TAG
           
static java.lang.String VERSION_TAG
           
static java.lang.String WHICH_TAG
           
 
Constructor Summary
GrammarWriter()
           
 
Method Summary
 void attribute(java.lang.String name, java.lang.String value, boolean isSpecified)
          Handle an attribute value assignment.
 void endElement(java.lang.String name)
          Handle the end of an element.
 void error(java.lang.String message)
          Handle a parsing error by throwing an exception with the given error message prepended with the line number and column number.
 Rule[] getRules()
          Return the resulting document from the parser.
static void main(java.lang.String[] args)
          Test this puppy out!
 Rule[] parse(java.lang.String url)
          Create the full path string for the url and parses the file into a Document object.
 void resetConstraintState()
          Reset the parsing state from the previous constraint that was parsed.
 void resetParseState()
          Reset the parsing state from the previous rule that was parsed.
 void resetRelativeState()
          Reset the parsing state from the previous rule that was parsed.
 void resetRuleState()
          Reset the parsing state from the previous rule that was parsed.
 void startElement(java.lang.String name)
          Handle the start of an element.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ANGLE_TOLERANCE

public static final double DEFAULT_ANGLE_TOLERANCE
FIXME ??? this parser is smart

GRAMMAR_TAG

public static final java.lang.String GRAMMAR_TAG

VERSION_TAG

public static final java.lang.String VERSION_TAG

TITLE_TAG

public static final java.lang.String TITLE_TAG

RULE_TAG

public static final java.lang.String RULE_TAG

TYPE_TAG

public static final java.lang.String TYPE_TAG

ROOT_TAG

public static final java.lang.String ROOT_TAG

NAME_TAG

public static final java.lang.String NAME_TAG

RELATIVE_TAG

public static final java.lang.String RELATIVE_TAG

DISTANCE_TAG

public static final java.lang.String DISTANCE_TAG

ROOT_SITE_TAG

public static final java.lang.String ROOT_SITE_TAG

RELATIVE_SITE_TAG

public static final java.lang.String RELATIVE_SITE_TAG

MIN_TAG

public static final java.lang.String MIN_TAG

MAX_TAG

public static final java.lang.String MAX_TAG

OVERLAP_TAG

public static final java.lang.String OVERLAP_TAG

CONSTRAINT_TAG

public static final java.lang.String CONSTRAINT_TAG

WHICH_TAG

public static final java.lang.String WHICH_TAG

ANGLE_TAG

public static final java.lang.String ANGLE_TAG

DIRECTION_TAG

public static final java.lang.String DIRECTION_TAG

SIZE_TAG

public static final java.lang.String SIZE_TAG
Constructor Detail

GrammarWriter

public GrammarWriter()
Method Detail

resetParseState

public void resetParseState()
Reset the parsing state from the previous rule that was parsed.

resetRuleState

public void resetRuleState()
Reset the parsing state from the previous rule that was parsed.

resetRelativeState

public void resetRelativeState()
Reset the parsing state from the previous rule that was parsed.

resetConstraintState

public void resetConstraintState()
Reset the parsing state from the previous constraint that was parsed.

attribute

public void attribute(java.lang.String name,
                      java.lang.String value,
                      boolean isSpecified)
Handle an attribute value assignment.
See Also:
XmlHandler.attribute(java.lang.String, java.lang.String, boolean)

startElement

public void startElement(java.lang.String name)
Handle the start of an element.

endElement

public void endElement(java.lang.String name)
Handle the end of an element.

error

public void error(java.lang.String message)
Handle a parsing error by throwing an exception with the given error message prepended with the line number and column number.

getRules

public Rule[] getRules()
Return the resulting document from the parser.

parse

public Rule[] parse(java.lang.String url)
             throws java.lang.Exception
Create the full path string for the url and parses the file into a Document object.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test this puppy out!