at.spardat.xma.mdl.util
Class DNode

java.lang.Object
  extended byat.spardat.xma.mdl.util.DNode

public class DNode
extends java.lang.Object

Models a descriptive node which is used to accumulate debug information. It may be used to gather a structural textural representation of this without fixing the concrete output format.


Constructor Summary
DNode()
          Constructs a root node.
DNode(DNode parent)
          Constructs a node which becomes the last child of parent
DNode(DNode parent, java.lang.String text)
          Constructs a node which becomes the last child of parent and whose inital text is set to text
DNode(java.lang.String text)
          Constructs a root node that has no parent and sets an inital text
 
Method Summary
 DNode app(boolean b)
          Appends a boolean to the text of this.
 DNode app(int i)
          Appends an int to the text of this.
 DNode app(java.lang.Object value)
          Appends the result of calling String.valueOf with parameter value.
 DNode app(java.lang.String s)
          Appends a string to the text of this.
 DNode app(java.lang.String name, boolean value)
          Appends a string of the form name=value
 DNode app(java.lang.String name, int value)
          Appends a string of the form name=value.
 DNode app(java.lang.String name, java.lang.Object value)
          Appends a string of the form name=value
 DNode app(java.lang.String name, java.lang.String value)
          Appends a string of the form name=value.
 DNode appShortClass(java.lang.Object o)
          Appends the name of the class (without package names) of the provided object.
 DNode appSons()
          Appends text which is generated by iterating over the sons.
 DNode comma()
          Appends a comma followed by a blank.
 void display()
          Shows this node in a modeless windows in a tree.
static void display(java.lang.Object o)
          If the provided object o is a Descriptive, it is displayed in a SWT shell showing its structure.
 DNode eb()
          Appends an end bracket
 java.util.Iterator getSons()
          Returns an iterator that iterates over the sons or null, if this has no sons.
 java.lang.String getText()
          Returns the text stored in this node
 DNode sb()
          Appends a start bracket
 void setDummy(boolean what)
          Sets this node to dummy which only applies to root nodes and prevent them from beeing shown in the output.
 java.lang.String toString()
          Delivers an descriptive String with one node a line and sons are indented two spaces more than their parents.
static java.lang.String toString(Descriptive d)
          Maps a Descriptive to a string and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DNode

public DNode()
Constructs a root node.


DNode

public DNode(java.lang.String text)
Constructs a root node that has no parent and sets an inital text


DNode

public DNode(DNode parent)
Constructs a node which becomes the last child of parent


DNode

public DNode(DNode parent,
             java.lang.String text)
Constructs a node which becomes the last child of parent and whose inital text is set to text

Method Detail

setDummy

public void setDummy(boolean what)
Sets this node to dummy which only applies to root nodes and prevent them from beeing shown in the output.


app

public DNode app(java.lang.String s)
Appends a string to the text of this.

Returns:
this

app

public DNode app(java.lang.String name,
                 java.lang.String value)
Appends a string of the form name=value.

Returns:
this

sb

public DNode sb()
Appends a start bracket


eb

public DNode eb()
Appends an end bracket


app

public DNode app(int i)
Appends an int to the text of this.

Returns:
this

app

public DNode app(java.lang.String name,
                 int value)
Appends a string of the form name=value.

Returns:
this

app

public DNode app(boolean b)
Appends a boolean to the text of this.


app

public DNode app(java.lang.String name,
                 boolean value)
Appends a string of the form name=value


app

public DNode app(java.lang.Object value)
Appends the result of calling String.valueOf with parameter value.

Returns:
this

app

public DNode app(java.lang.String name,
                 java.lang.Object value)
Appends a string of the form name=value


comma

public DNode comma()
Appends a comma followed by a blank.

Returns:
this

appShortClass

public DNode appShortClass(java.lang.Object o)
Appends the name of the class (without package names) of the provided object.

Returns:
this

appSons

public DNode appSons()
Appends text which is generated by iterating over the sons. Assume that there are sons s1, s2 and s3. Then the appended text looks like
 [s1, s2, s3]
 
All sons are removed in this method.

Returns:
this

toString

public java.lang.String toString()
Delivers an descriptive String with one node a line and sons are indented two spaces more than their parents.

See Also:
Object.toString()

toString

public static java.lang.String toString(Descriptive d)
Maps a Descriptive to a string and returns it.


getText

public java.lang.String getText()
Returns the text stored in this node

Returns:
String never null

getSons

public java.util.Iterator getSons()
Returns an iterator that iterates over the sons or null, if this has no sons.


display

public void display()
Shows this node in a modeless windows in a tree.


display

public static void display(java.lang.Object o)
If the provided object o is a Descriptive, it is displayed in a SWT shell showing its structure.