All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class mathbus.Node
java.lang.Object
   |
   +----mathbus.Node
  -  public class Node
  -  extends Object
The Mathbus term structure  
 is represented by the mathbus.Node class.
    -  See Also:
    
-  Registry, Base64InputStream, Base64OutputStream, MBConvert
   
  -   label label
-  
  
-   subterms subterms
-  
   
  -   Node() Node()
-   Creates a node with MBS.Null as its label.
  
-   Node(double) Node(double)
-  Creates a node of with label MBS.IEEEFloat.
  
-   Node(int) Node(int)
-  
  
-   Node(int, int) Node(int, int)
-  Creates a node with lab as its label and with the
ability to store as many as cnt sub-terms.
  
-   Node(String) Node(String)
-  Creates a node of with label MBS.String.
  
-   Node(String, int) Node(String, int)
-  Creates a node with lab as its label and with room for
as many as cnt sub-terms.
   
  -   extractSequenceValue() extractSequenceValue()
-  Extracts the sequence value of the underlying node.
  
-   getAttribute(int) getAttribute(int)
-  Returns the Noad of the indicated StringID attribute.
  
-   getDouble() getDouble()
-  
 Returns the double value of a MBS.IEEEFloat node.
  
-   Label() Label()
-  Returns the numeric label of the node as an int.
  
-   LongInteger(String) LongInteger(String)
-  Creates a node of with label MBS.LongInteger.
  
-   nodeWithRegistryInfo() nodeWithRegistryInfo()
-  Returns the node augmented with all necessary local
registry information in RegistryStoreLocal terms.
  
-   nSubterms() nSubterms()
-  Returns the number of subterms of the node as an int.
  
-   ParsePrefix(InputStream) ParsePrefix(InputStream)
-  Create a Node from the prefix form found in istream.
  
-   primToString() primToString()
-  Returns a string representing a String, LongInteger or IEEEFloat
node without any surrounding brackets.
  
-   primToStringBuffer(StringBuffer) primToStringBuffer(StringBuffer)
-  Prints to buf the a String, LongInteger or IEEEFloat node without any
surrounding brackets.
  
-   setAttribute(int, Node) setAttribute(int, Node)
-  Add the indicate identifer, value pair to the attributes of this node.
  
-   setSubterm(int, int) setSubterm(int, int)
-  Sets the indicated subterm's value to be a 32-bit integer.
  
-   setSubterm(int, Integer) setSubterm(int, Integer)
-  Sets the indicated subterm's value to be a 32-bit integer.
  
-   setSubterm(int, Node) setSubterm(int, Node)
-  Sets the indicated subterm's value to be a Node reference.
  
-   SubInteger(int) SubInteger(int)
-  Returns the indicated subtermnumber of the node.
  
-   Subnode(int) Subnode(int)
-  Returns the indicated subtermnumber of the node.
  
-   Subterm(int) Subterm(int)
-  Returns the indicated subtermnumber of the node.
  
-   toString() toString()
-  Returns a string containing the parenthesized notation form for
the term.
  
-   toStringBuffer(StringBuffer) toStringBuffer(StringBuffer)
-  
  
-   treeShape() treeShape()
-  Returns an array of size 4 that describes the shape of the
MathBus tree.
   
 label
label
 protected int label
 subterms
subterms
 protected Object subterms[]
   
 Node
Node
 public Node()
  -  Creates a node with MBS.Null as its label.
 
 Node
Node
 public Node(int lab,
             int cnt)
  -  Creates a node with lab as its label and with the
ability to store as many as cnt sub-terms.
 
 Node
Node
 public Node(String lab,
             int cnt)
  -  Creates a node with lab as its label and with room for
as many as cnt sub-terms. The symbolic label
lab is converted to a numeric label before being
inserted in the node.
 
 Node
Node
 public Node(String data)
  -  Creates a node of with label MBS.String. The sub-terms of this
node are all 32-bit integers that are used to store the characters of
the string in accordance with the 
definition of String nodes.  
For extra flexibility, the if the input string contains a sequence
like "\\uXXXX" where XXXX is a four digit hexadecimal number, then
the sequence is treated like a single Unicode character.
 
 
 Node
Node
 public Node(int data)
 Node
Node
 public Node(double data)
  -  Creates a node of with label MBS.IEEEFloat. The two 32-bit integer 
sub-terms represent the IEEE double.accordance with the 
definition of IEEEFLoat nodes.
 
   
 LongInteger
LongInteger
 public static Node LongInteger(String data)
  -  Creates a node of with label MBS.LongInteger. The sub-terms of this
node are all 32-bit integers that are used to store the characters of
the string in accordance with the 
definition of LongInteger nodes.  
 
   
- 
    -  Parameters:
    
-  data - A string consisting of a leading + or - and a sequence
of decimal digits. The string is the decimal printed representation
of the integer.
  
 
 getDouble
getDouble
 public double getDouble() throws NodeException
  -  Returns the double value of a MBS.IEEEFloat node.
   
- 
    -  See Also:
    
-  Node
  
 
 Label
Label
 public final int Label()
  -  Returns the numeric label of the node as an int. If the node is
an Attributes node then the label of the attributed node is
returned, not that of this node itself.
 
 nSubterms
nSubterms
 public final int nSubterms()
  -  Returns the number of subterms of the node as an int. If the
node is an Attributes node then the number of subterms of the
attributed node is returned, not that of this node itself.
 
 Subterm
Subterm
 public final Object Subterm(int index)
  -  Returns the indicated subtermnumber of the node. If the node is
an Attributes node then the subterm of the attributed node is
returned, not that of this node itself.  The type of the return
value of this method is Object.
   
- 
    -  See Also:
    
-  Subnode, SubInteger
  
 
 Subnode
Subnode
 public final Node Subnode(int index)
  -  Returns the indicated subtermnumber of the node. If the node is
an Attributes node then the subterm of the attributed node is
returned, not that of this node itself.  The type of the return
value of this method is Node.  This member function should not be
used unless the type of the subterm is known to be a Node.
   
- 
    -  See Also:
    
-  Subterm, SubInteger
  
 
 SubInteger
SubInteger
 public final Integer SubInteger(int index)
  -  Returns the indicated subtermnumber of the node. If the node is
an Attributes node then the subterm of the attributed node is
returned, not that of this node itself.  The type of the return
value of this method is Integer.  This member function should not
be used unless the type of the subterm is known to be a 32-bit
integer.
   
- 
    -  See Also:
    
-  Subterm, Subnode
  
 
 setSubterm
setSubterm
 public int setSubterm(int index,
                       int value)
  -  Sets the indicated subterm's value to be a 32-bit integer.  If
this node is an Attributes node then the attributed node is modified
instead.
   
- 
    -  Parameters:
    
-  index - The index of the subterm to be modified.
    -  value - The new 32-bit integer value of the subterm.
  
 
 setSubterm
setSubterm
 public int setSubterm(int index,
                       Integer value)
  -  Sets the indicated subterm's value to be a 32-bit integer.  If
this node is an Attributes node then the attributed node is modified
instead.
   
- 
    -  Parameters:
    
-  index - The index of the subterm to be modified.
    -  value - The new 32-bit integer value of the subterm, as a
32-bit integer.
  
 
 setSubterm
setSubterm
 public Node setSubterm(int index,
                        Node value)
  -  Sets the indicated subterm's value to be a Node reference.  If
this node is an Attributes node then the attributed node is modified
instead.
   
- 
    -  Parameters:
    
-  index - The index of the subterm to be modified.
    -  value - The Node to which this subterm should refer.
  
 
 getAttribute
getAttribute
 public Node getAttribute(int ident)
  -  Returns the Noad of the indicated StringID attribute. If there 
is no such attribute then null is returned
 
 setAttribute
setAttribute
 public Node setAttribute(int ident,
                          Node value)
  -  Add the indicate identifer, value pair to the attributes of this node. 
This returns the newly modified node.  If the Node did not previously 
have attributes then it will need to be replaced by the node returned 
by this method.
 
 primToString
primToString
 public String primToString()
  -  Returns a string representing a String, LongInteger or IEEEFloat
node without any surrounding brackets.
 
 primToStringBuffer
primToStringBuffer
 public void primToStringBuffer(StringBuffer buf)
  -  Prints to buf the a String, LongInteger or IEEEFloat node without any
surrounding brackets.
 
 toString
toString
 public String toString()
  -  Returns a string containing the parenthesized notation form for
the term.
   
- 
    -  Overrides:
    
-  toString in class Object
  
 
 toStringBuffer
toStringBuffer
 public void toStringBuffer(StringBuffer buf)
 ParsePrefix
ParsePrefix
 public static Node ParsePrefix(InputStream istream)
  -  Create a Node from the prefix form found in istream.  Istream should
produce a string that is the parenthesized, prefix form of a
MathBus node.
 
 treeShape
treeShape
 public int[] treeShape()
  -  Returns an array of size 4 that describes the shape of the
MathBus tree. The maximum depth of the tree is the 0-element of the
array and the maximum width of the tree as ts 1-element.  The
number of inner nodes and the number of leaves are given as the
2-element and 3-element of the returned array.
   
- 
    -  Returns:
    
-  maximum depth, maximum width, number of inner nodes,
and number of leaves
  
 
 extractSequenceValue
extractSequenceValue
 public Node extractSequenceValue()
  -  Extracts the sequence value of the underlying node.  Thus, if
the top level node is not a MBS.Sequence, then just the node itself
will be returned.  The function works recursively through nested
sequences.
   
- 
    -  Returns:
    
-  the sequence value of the node
    
-  See Also:
    
-  Sequence
  
 
 nodeWithRegistryInfo
nodeWithRegistryInfo
 public Node nodeWithRegistryInfo()
  -  Returns the node augmented with all necessary local
registry information in RegistryStoreLocal terms.
   
- 
    -  See Also:
    
-  Sequence, RegistryStoreLocal
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index