Class pmr.sgml.SGMLTree
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.sgml.SGMLTree

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----pmr.simplegraph.SimpleApplet
                                           |
                                           +----pmr.sgml.SGMLApplet
                                                   |
                                                   +----pmr.sgml.SGMLTree

public class SGMLTree
extends SGMLApplet
implements Helpable
A generic SGML/Java hierarchical object. Originally conceived as being constructed from an SGML document, but increasingly being used for other purposes
Author:
(C) P. Murray-Rust, 1996

Variable Index

 o drawableHelp
 o generalTOC
 o lines
 o node
 o treeTOC

Constructor Index

 o SGMLTree()
 o SGMLTree(ESISStream, String)
construct SGMLTree from ESIS file, which has been read into an ESISStream ClassNotFoundException (cannot find *.class for the DTD) is trapped
 o SGMLTree(SGMLStream)
read an SGML document (including the DOCTYPE, of course)

ClassNotFoundException cannot find *.class for the DTD - is trapped

 o SGMLTree(SGMLTree)
copy constructor (shallow copy - only copies references
 o SGMLTree(String)
construct null SGMLTree from dtdName.

Method Index

 o addNode(int, SGMLNode)
 o addPELNode(int, String)
add a PEL node (see CoST documentation if you really care).
 o addTree(Vector, SGMLNode)
add an SGMLTree at a given node
 o createGeneralTOC(int)
generalTOC has icons for editing
 o createTOC(int)
to be used after the tree has been created
 o debug()
 o destroy()
frees memory in this tree (hopefully)
 o displayNodeAsChild(int)
 o getDescendantsOf(int)
extract all descendants (excluding node) as SGMLNodeIndexSet (depth-first?)
 o getDTD()
 o getInputName()
 o getNode(int)
 o getNodeArray()
get the node array in the tree - use carefully
 o getNodeCount()
 o getRoot()
synonym for getRoot(0)
 o getTOC()
 o getTreeName()
returns a string describing the type of tree (usually from a subclass)
 o hasAttname(String)
extract all nodes with given Attribute name and cache them
 o hasAttval(String, String)
extract all nodes with given Attribute name and value and cache for future use
 o hasGI(String)
extract all nodes with given GI name and cache them
 o init()
when an applet
 o initialiseTree(String)
 o readFile(String)
read a file ready for processing into a SGMLTree - could also be a URL
 o readFile(String, StringList)
read a file (via a filename) or its contents (if lines != null); calls readFile(String);
 o setInputName(String)
every tree needs to know its origin - name is a filename or URL at present
 o setTitle(String)
set title
 o showHelp()
display Help
 o toString()
output the whole tree (as SGML)
 o traverse()
extract all nodes (as SGMLNodeIndexSet) in traversal order (depth-first?) including node 0
 o traverse(int)
get all descendants and node ; if silly node, return empty set
 o withNode(int)
make the starting point for a CoST-like query (NB returns SGMLNodeIndexSet even though there is only one element)

Variables

 o node
  protected SGMLNode node[]
 o treeTOC
  protected SGMLTOC treeTOC
 o generalTOC
  protected GeneralTOC generalTOC
 o lines
  protected StringList lines
 o drawableHelp
  protected DrawableHelp drawableHelp

Constructors

 o SGMLTree
  public SGMLTree()
 o SGMLTree
  public SGMLTree(String dtdName)
construct null SGMLTree from dtdName. ClassNotFoundException is trapped; cannot find *.class in class hierarchy. It might be OK to proceed, but all ELEMENTS will be treated as simple generic objects.

If dtdName is "", ignore DTD

 o SGMLTree
  public SGMLTree(ESISStream e,
                  String dtdName) throws BadESISFileException, BadAttributeException
construct SGMLTree from ESIS file, which has been read into an ESISStream ClassNotFoundException (cannot find *.class for the DTD) is trapped
Throws: BadESISFileException
corrupt ESIS file
Throws: BadAttributeException
unknown type or badly structured attribute in ESIS file

If dtdName is "", ignore DTD

 o SGMLTree
  public SGMLTree(SGMLStream sgml) throws BadSGMLFileException, BadAttributeException
read an SGML document (including the DOCTYPE, of course)

ClassNotFoundException cannot find *.class for the DTD - is trapped

Throws: BadSGMLFileException
corrupt SGML file
Throws: BadAttributeException
unknown type or badly structured attribute in SGML file
 o SGMLTree
  public SGMLTree(SGMLTree t)
copy constructor (shallow copy - only copies references

Methods

 o initialiseTree
  public void initialiseTree(String dtdName)
 o init
  public void init()
when an applet
Overrides:
init in class SGMLApplet
 o showHelp
  public void showHelp()
display Help
Overrides:
showHelp in class SGMLApplet
 o getTreeName
  public String getTreeName()
returns a string describing the type of tree (usually from a subclass)
 o readFile
  public void readFile(String filename) throws BadSGMLFileException
read a file ready for processing into a SGMLTree - could also be a URL
Throws: BadSGMLFileException
File is a directory, cannot be found, etc.
 o readFile
  public void readFile(String fileName,
                       StringList lines) throws BadSGMLFileException
read a file (via a filename) or its contents (if lines != null); calls readFile(String);
Throws: BadSGMLFileException
File is a directory, cannot be found, etc.
 o setTitle
  public void setTitle(String t)
set title
Overrides:
setTitle in class SimpleApplet
 o setInputName
  public void setInputName(String name)
every tree needs to know its origin - name is a filename or URL at present
 o getInputName
  public String getInputName()
 o getDTD
  public DTD getDTD()
 o createTOC
  public SGMLTOC createTOC(int depth)
to be used after the tree has been created
 o createGeneralTOC
  public GeneralTOC createGeneralTOC(int depth)
generalTOC has icons for editing
 o getNodeArray
  public SGMLNode[] getNodeArray()
get the node array in the tree - use carefully
 o getTOC
  public SGMLTOC getTOC()
 o destroy
  public void destroy()
frees memory in this tree (hopefully)
Overrides:
destroy in class Applet
 o getNode
  public SGMLNode getNode(int i)
 o getRoot
  public SGMLNode getRoot()
synonym for getRoot(0)
 o withNode
  public SGMLNodeIndexSet withNode(int i)
make the starting point for a CoST-like query (NB returns SGMLNodeIndexSet even though there is only one element)
 o getNodeCount
  public int getNodeCount()
 o addTree
  public int addTree(Vector streamVector,
                     SGMLNode parentNode) throws BadSGMLFileException, BadAttributeException
add an SGMLTree at a given node
Throws: BadAttributeException
streamVector is corrupt or not SGML
Throws: BadSGMLFileException
streamVector is corrupt or not SGML
 o addPELNode
  public int addPELNode(int parentIndex,
                        String content)
add a PEL node (see CoST documentation if you really care). It's basically a holder for an ASCII string
 o addNode
  public int addNode(int parent,
                     SGMLNode n)
 o hasGI
  public SGMLNodeIndexSet hasGI(String name)
extract all nodes with given GI name and cache them
 o hasAttname
  public SGMLNodeIndexSet hasAttname(String name)
extract all nodes with given Attribute name and cache them
 o hasAttval
  public SGMLNodeIndexSet hasAttval(String name,
                                    String value)
extract all nodes with given Attribute name and value and cache for future use
 o traverse
  public SGMLNodeIndexSet traverse()
extract all nodes (as SGMLNodeIndexSet) in traversal order (depth-first?) including node 0
 o getDescendantsOf
  public SGMLNodeIndexSet getDescendantsOf(int nodeIndex)
extract all descendants (excluding node) as SGMLNodeIndexSet (depth-first?)
 o traverse
  public SGMLNodeIndexSet traverse(int nodeIndex)
get all descendants and node ; if silly node, return empty set
 o displayNodeAsChild
  public void displayNodeAsChild(int nodeIndex)
 o debug
  public void debug()
 o toString
  public String toString()
output the whole tree (as SGML)
Overrides:
toString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index