org.sandev.sandbuild
Class SandDeclTreeWrapper

java.lang.Object
  extended byorg.sandev.sandbuild.SandDeclTreeWrapper
All Implemented Interfaces:
java.lang.Comparable

public class SandDeclTreeWrapper
extends java.lang.Object
implements java.lang.Comparable

A wrapper for SandDecl that allows organization into a tree structure. While SandDecls compare on filename, these compare on unqualified name, since a primary use of these tree structures is to show inheritance across projects and the ordering gets weird otherwise.


Field Summary
protected  SandDeclTreeWrapper[] children
          Our SandDeclTreeWrapper children
protected  SandDecl decl
          The SandDecl we are wrapping
protected  SandDeclTreeWrapper parent
          Our parent SandDeclTreeWrapper
 
Constructor Summary
SandDeclTreeWrapper()
          Default ctor does nothing.
SandDeclTreeWrapper(SandDecl decl)
          Set our decl to the instance specified.
SandDeclTreeWrapper(SandDeclTreeWrapper sdtw, SandDecl decl)
          Set our parent and decl to the instances specified.
 
Method Summary
 void addChild(SandDeclTreeWrapper sdtw)
          Add a child, resorting all children to maintain order.
 int compareTo(java.lang.Object other)
          The natural ordering of SandDeclTreeWrappers is the ordering of the unqualified declaration names.
 SandDeclTreeWrapper[] getChildren()
          accessor for children
 SandDecl getDecl()
          accessor for decl
 SandDeclTreeWrapper getParent()
          accessor for parent
 SandDeclTreeWrapper removeChild(int index)
          Remove the child at the given index, returning it.
 SandDeclTreeWrapper removeChild(SandDeclTreeWrapper sdtw)
          Remove the given child.
 void setChildren(SandDeclTreeWrapper[] children)
          mutator for children
 void setDecl(SandDecl decl)
          mutator for decl
 void setParent(SandDeclTreeWrapper parent)
          mutator for parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decl

protected SandDecl decl
The SandDecl we are wrapping


parent

protected SandDeclTreeWrapper parent
Our parent SandDeclTreeWrapper


children

protected SandDeclTreeWrapper[] children
Our SandDeclTreeWrapper children

Constructor Detail

SandDeclTreeWrapper

public SandDeclTreeWrapper()
Default ctor does nothing.


SandDeclTreeWrapper

public SandDeclTreeWrapper(SandDecl decl)
Set our decl to the instance specified.


SandDeclTreeWrapper

public SandDeclTreeWrapper(SandDeclTreeWrapper sdtw,
                           SandDecl decl)
Set our parent and decl to the instances specified.

Method Detail

getDecl

public SandDecl getDecl()
accessor for decl


setDecl

public void setDecl(SandDecl decl)
mutator for decl


getParent

public SandDeclTreeWrapper getParent()
accessor for parent


setParent

public void setParent(SandDeclTreeWrapper parent)
mutator for parent


getChildren

public SandDeclTreeWrapper[] getChildren()
accessor for children


setChildren

public void setChildren(SandDeclTreeWrapper[] children)
mutator for children


compareTo

public int compareTo(java.lang.Object other)
The natural ordering of SandDeclTreeWrappers is the ordering of the unqualified declaration names.

Specified by:
compareTo in interface java.lang.Comparable

addChild

public void addChild(SandDeclTreeWrapper sdtw)
Add a child, resorting all children to maintain order. Requests to add a null child are ignored.


removeChild

public SandDeclTreeWrapper removeChild(SandDeclTreeWrapper sdtw)
Remove the given child. Returns null if the child was not found, or the instance if it was found.


removeChild

public SandDeclTreeWrapper removeChild(int index)
Remove the child at the given index, returning it.