com.simonstl.common
Class StackableComponent

java.lang.Object
  |
  +--com.simonstl.common.Name
        |
        +--com.simonstl.common.NamedComponent
              |
              +--com.simonstl.common.StackableComponent
All Implemented Interfaces:
NamedComponentI, NamingI, StackableComponentI

public class StackableComponent
extends NamedComponent
implements StackableComponentI

Created by IntelliJ IDEA. User: simon Date: Mar 8, 2003 Time: 11:49:54 AM To change this template use Options | File Templates.


Field Summary
protected  java.util.HashMap attributes
           
protected  java.util.ArrayList children
           
protected  StackableComponentI parent
           
 
Fields inherited from class com.simonstl.common.NamedComponent
diagValue, type
 
Fields inherited from class com.simonstl.common.Name
localName, nsURI, prefix
 
Constructor Summary
StackableComponent()
           
StackableComponent(NodeType _type)
           
 
Method Summary
 void addAtt(StackableComponentI att)
          Adds an attribute to this component.
 void addChild(StackableComponentI child)
          Adds a child component to this component.
 StackableComponentI getAtt(NamingI name)
          Returns an attribute, identified by anything conforming to NamingI
 StackableComponentI getAtt(java.lang.String NSUri, java.lang.String localName)
          Returns an attribute, identified by namespace URI and localName
 java.util.ArrayList getAttsAsList()
          Not yet implemented
 StackableComponentI getChild(int which)
          Returns the child - identified by number - of the current element.
 int getNumAtts()
          Returns the number of attributes contained by this component.
 int getNumChildren()
          Returns the number of children (not attributes) contained by this component.
 StackableComponentI getParent()
          Returns the parent of this component
 void setParent(StackableComponentI parent)
          Sets the parent component for this component
 
Methods inherited from class com.simonstl.common.NamedComponent
getDiagValue, getType, setDiagValue, setType
 
Methods inherited from class com.simonstl.common.Name
breakQName, equals, getLocalName, getPrefix, getQName, getUri, hashCode, setLocalName, setPrefix, setQName, setUri, toHashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.simonstl.common.NamedComponentI
getDiagValue, getType, setDiagValue, setType
 
Methods inherited from interface com.simonstl.common.NamingI
equals, getLocalName, getPrefix, getQName, getUri, hashCode, setLocalName, setPrefix, setQName, setUri
 

Field Detail

parent

protected StackableComponentI parent

attributes

protected java.util.HashMap attributes

children

protected java.util.ArrayList children
Constructor Detail

StackableComponent

public StackableComponent()

StackableComponent

public StackableComponent(NodeType _type)
Method Detail

setParent

public void setParent(StackableComponentI parent)
Sets the parent component for this component

Specified by:
setParent in interface StackableComponentI
Parameters:
parent - the component you want to serve as the parent

getParent

public StackableComponentI getParent()
Returns the parent of this component

Specified by:
getParent in interface StackableComponentI
Returns:
the parent component of this component

addChild

public void addChild(StackableComponentI child)
Adds a child component to this component. Not sure if I'll coerce attributes into being atts.

Specified by:
addChild in interface StackableComponentI
Parameters:
child - the component to add as a child

addAtt

public void addAtt(StackableComponentI att)
Adds an attribute to this component. The type of the component will be coerced to attribute.

Specified by:
addAtt in interface StackableComponentI
Parameters:
att - the attribute

getNumChildren

public int getNumChildren()
Returns the number of children (not attributes) contained by this component.

Specified by:
getNumChildren in interface StackableComponentI
Returns:
the number of non-attribute children.

getNumAtts

public int getNumAtts()
Returns the number of attributes contained by this component.

Specified by:
getNumAtts in interface StackableComponentI
Returns:
the number of attributes

getChild

public StackableComponentI getChild(int which)
Returns the child - identified by number - of the current element.

Specified by:
getChild in interface StackableComponentI
Parameters:
which - the position of the component in question
Returns:
the child component or null if which is out of range.

getAtt

public StackableComponentI getAtt(java.lang.String NSUri,
                                  java.lang.String localName)
Returns an attribute, identified by namespace URI and localName

Specified by:
getAtt in interface StackableComponentI
Parameters:
NSUri - the namespace URI of the attribute
localName - the local name of the attribute
Returns:
the attribute matching the URI and local name

getAtt

public StackableComponentI getAtt(NamingI name)
Returns an attribute, identified by anything conforming to NamingI

Specified by:
getAtt in interface StackableComponentI
Parameters:
name - A NamingI with the same namespace URI and local name as the attribute desired.
Returns:
the attribute matching the NamingI

getAttsAsList

public java.util.ArrayList getAttsAsList()
Not yet implemented

Specified by:
getAttsAsList in interface StackableComponentI
Returns:
an ArrayList containing the atts as StackableComponentI