treebolic.provider.xml.fast
Class Parser

java.lang.Object
  extended by treebolic.provider.xml.fast.Parser

 class Parser
extends java.lang.Object

Light-weight XML parser for treebolic

Author:
Bernard Bou

Nested Class Summary
private static class Parser.Scope
          Scope types
 
Field Summary
private  int lookahead
          Character lookahead
private  java.util.List<IEdge> theEdges
          Edge list
private  java.util.List<MenuItem> theMenu
          Menu
private  MenuItem theMenuItem
          Menu item
private  java.util.Hashtable<java.lang.String,MutableNode> theNodesById
          Id to node map
private  Provider theProvider
          Provider
private  java.io.BufferedReader theReader
          Reader
private  MutableNode theRoot
          Root node
private  Settings theSettings
          Settings
private  java.net.URL theURL
          Source URL
 
Constructor Summary
Parser(java.net.URL thisURL, Provider thisProvider)
          Constructor
 
Method Summary
private  java.lang.String getNextTag()
          Get next tag string
private  java.lang.String getText()
          Get tag text
private  boolean hasMoreTags()
          Whether more tags are available
 boolean isValid()
          Whether reader is valid
private  Tree parse(boolean doSettings)
          Parse.
private  void parseEdgesTag(Tag thisTag)
          Parse tag
private  MutableEdge parseEdgeTag(Tag thisTag)
          Parse tag
 Model parseModel()
          Parse model
private  void parseNodesTag(Tag thisTag)
          Parse tag
 Tree parseTree()
          Parse tree
private  void parseTreebolicTag(Tag thisTag)
          Parse tag
private  void parseTreeTag(Tag thisTag)
          Parse tag
private  int read()
          Read character
private  void unread(int c)
          Unread (=push back) character
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theURL

private java.net.URL theURL
Source URL


theProvider

private Provider theProvider
Provider


theRoot

private MutableNode theRoot
Root node


theEdges

private java.util.List<IEdge> theEdges
Edge list


theNodesById

private java.util.Hashtable<java.lang.String,MutableNode> theNodesById
Id to node map


theSettings

private Settings theSettings
Settings


theMenu

private java.util.List<MenuItem> theMenu
Menu


theMenuItem

private MenuItem theMenuItem
Menu item


theReader

private java.io.BufferedReader theReader
Reader


lookahead

private int lookahead
Character lookahead

Constructor Detail

Parser

public Parser(java.net.URL thisURL,
              Provider thisProvider)
Constructor

Parameters:
thisURL - source url
thisProvider - provider
Method Detail

isValid

public boolean isValid()
Whether reader is valid

Returns:
true if reader is valid

read

private int read()
Read character

Returns:
read character

unread

private void unread(int c)
Unread (=push back) character

Parameters:
c - character

hasMoreTags

private boolean hasMoreTags()
Whether more tags are available

Returns:
true if more tags are available

getNextTag

private java.lang.String getNextTag()
Get next tag string

Returns:
next tag string

getText

private java.lang.String getText()
Get tag text

Returns:
tag text

parseTreebolicTag

private void parseTreebolicTag(Tag thisTag)
Parse tag

Parameters:
thisTag - tag string

parseTreeTag

private void parseTreeTag(Tag thisTag)
Parse tag

Parameters:
thisTag - tag string

parseNodesTag

private void parseNodesTag(Tag thisTag)
Parse tag

Parameters:
thisTag - tag string

parseEdgesTag

private void parseEdgesTag(Tag thisTag)
Parse tag

Parameters:
thisTag - tag string

parseEdgeTag

private MutableEdge parseEdgeTag(Tag thisTag)
Parse tag

Parameters:
thisTag - tag string
Returns:
edge

parseModel

public Model parseModel()
Parse model

Returns:
model, null if fail

parseTree

public Tree parseTree()
Parse tree

Returns:
tree, null if fail

parse

private Tree parse(boolean doSettings)
Parse. Settings are built as a side-effect.

Parameters:
doSettings - whether to consider or discard settings
Returns:
graph if successful