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
-
drawableHelp
-
-
generalTOC
-
-
lines
-
-
node
-
-
treeTOC
-
-
SGMLTree()
-
-
SGMLTree(ESISStream, String)
- construct SGMLTree from ESIS file, which has been read into an ESISStream
ClassNotFoundException (cannot find *.class for the DTD) is trapped
-
SGMLTree(SGMLStream)
- read an SGML document (including the DOCTYPE, of course)
ClassNotFoundException cannot find *.class for the DTD - is trapped
-
SGMLTree(SGMLTree)
- copy constructor (shallow copy - only copies references
-
SGMLTree(String)
- construct null SGMLTree from dtdName.
-
addNode(int, SGMLNode)
-
-
addPELNode(int, String)
- add a PEL node (see CoST documentation if you really care).
-
addTree(Vector, SGMLNode)
- add an SGMLTree at a given node
-
createGeneralTOC(int)
- generalTOC has icons for editing
-
createTOC(int)
- to be used after the tree has been created
-
debug()
-
-
destroy()
- frees memory in this tree (hopefully)
-
displayNodeAsChild(int)
-
-
getDescendantsOf(int)
- extract all descendants (excluding node) as SGMLNodeIndexSet (depth-first?)
-
getDTD()
-
-
getInputName()
-
-
getNode(int)
-
-
getNodeArray()
- get the node array in the tree - use carefully
-
getNodeCount()
-
-
getRoot()
- synonym for getRoot(0)
-
getTOC()
-
-
getTreeName()
- returns a string describing the type of tree (usually from a subclass)
-
hasAttname(String)
- extract all nodes with given Attribute name and cache them
-
hasAttval(String, String)
- extract all nodes with given Attribute name and value and cache for future use
-
hasGI(String)
- extract all nodes with given GI name and cache them
-
init()
- when an applet
-
initialiseTree(String)
-
-
readFile(String)
- read a file ready for processing into a SGMLTree - could also be a URL
-
readFile(String, StringList)
- read a file (via a filename) or its contents (if lines != null); calls
readFile(String);
-
setInputName(String)
- every tree needs to know its origin - name is a filename or URL at present
-
setTitle(String)
- set title
-
showHelp()
- display Help
-
toString()
- output the whole tree (as SGML)
-
traverse()
- extract all nodes (as SGMLNodeIndexSet) in traversal order (depth-first?)
including node 0
-
traverse(int)
- get all descendants and node ; if silly node, return empty set
-
withNode(int)
- make the starting point for a CoST-like query (NB returns SGMLNodeIndexSet
even though there is only one element)
node
protected SGMLNode node[]
treeTOC
protected SGMLTOC treeTOC
generalTOC
protected GeneralTOC generalTOC
lines
protected StringList lines
drawableHelp
protected DrawableHelp drawableHelp
SGMLTree
public SGMLTree()
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
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
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
SGMLTree
public SGMLTree(SGMLTree t)
- copy constructor (shallow copy - only copies references
initialiseTree
public void initialiseTree(String dtdName)
init
public void init()
- when an applet
- Overrides:
- init in class SGMLApplet
showHelp
public void showHelp()
- display Help
- Overrides:
- showHelp in class SGMLApplet
getTreeName
public String getTreeName()
- returns a string describing the type of tree (usually from a subclass)
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.
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.
setTitle
public void setTitle(String t)
- set title
- Overrides:
- setTitle in class SimpleApplet
setInputName
public void setInputName(String name)
- every tree needs to know its origin - name is a filename or URL at present
getInputName
public String getInputName()
getDTD
public DTD getDTD()
createTOC
public SGMLTOC createTOC(int depth)
- to be used after the tree has been created
createGeneralTOC
public GeneralTOC createGeneralTOC(int depth)
- generalTOC has icons for editing
getNodeArray
public SGMLNode[] getNodeArray()
- get the node array in the tree - use carefully
getTOC
public SGMLTOC getTOC()
destroy
public void destroy()
- frees memory in this tree (hopefully)
- Overrides:
- destroy in class Applet
getNode
public SGMLNode getNode(int i)
getRoot
public SGMLNode getRoot()
- synonym for getRoot(0)
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)
getNodeCount
public int getNodeCount()
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
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
addNode
public int addNode(int parent,
SGMLNode n)
hasGI
public SGMLNodeIndexSet hasGI(String name)
- extract all nodes with given GI name and cache them
hasAttname
public SGMLNodeIndexSet hasAttname(String name)
- extract all nodes with given Attribute name and cache them
hasAttval
public SGMLNodeIndexSet hasAttval(String name,
String value)
- extract all nodes with given Attribute name and value and cache for future use
traverse
public SGMLNodeIndexSet traverse()
- extract all nodes (as SGMLNodeIndexSet) in traversal order (depth-first?)
including node 0
getDescendantsOf
public SGMLNodeIndexSet getDescendantsOf(int nodeIndex)
- extract all descendants (excluding node) as SGMLNodeIndexSet (depth-first?)
traverse
public SGMLNodeIndexSet traverse(int nodeIndex)
- get all descendants and node ; if silly node, return empty set
displayNodeAsChild
public void displayNodeAsChild(int nodeIndex)
debug
public void debug()
toString
public String toString()
- output the whole tree (as SGML)
- Overrides:
- toString in class Component
All Packages Class Hierarchy This Package Previous Next Index