com.simonstl.moe
Class Mutable

java.lang.Object
  |
  +--com.simonstl.moe.CoreComponent
        |
        +--com.simonstl.moe.Mutable
All Implemented Interfaces:
AnnotableI, java.lang.Cloneable, CoreComponentI, MutableComponentI, NamingI

public class Mutable
extends CoreComponent
implements MutableComponentI

The Mutable class provides a foundation for generic MOE objects. Mutable objects can store text, unordered content, or ordered content, and they can change personality at the flip of a setBasicType(int _type) switch.

The next step for Mutable is creating a toString() which supports calls to a visitor class identified either through setString() or a Java com.simonstl.moe.Mutable property.

version 0.01 is the initial release and contains plenty of bogus placeholder functionality.

Version:
0.01 14 September 2001
Author:
Simon St.Laurent

Field Summary
protected  int basicType
           
protected  java.lang.String textContent
           
 
Fields inherited from class com.simonstl.moe.CoreComponent
annotations, complete, componentType, content, context, name, parent, unorderedContent
 
Fields inherited from interface com.simonstl.moe.CoreComponentI
ATTRIBUTE, CDATA, CHARS, COMMENT, CONTAINER, DOCTYPE, DOCUMENT, ELEMENT, END_ATTRIBUTE, END_CDATA, END_COMMENT, END_CONTAINER, END_DOCTYPE, END_DOCUMENT, END_ELEMENT, END_NAMESPACE, END_PI, END_PROPERTY, GEN_ENTITY_END, GEN_ENTITY_REF, GEN_ENTITY_START, IG_WHITESPACE, NAMESPACE_DECL, PI, PROPERTY, UNPARSED, VALUE, XML_DECL
 
Constructor Summary
Mutable()
           
 
Method Summary
 void addContent(CoreComponentI newComponent)
          Adds content to this component.
 void clearContent()
          Clears the content for this component.
 java.lang.Object clone()
          Clone implementation uses MutableComponentI, adds text if necessary.
 int getBasicType()
          The basic type for Mutable is whatever it's been set to be.
 ComponentListI getContent()
          Returns the content for this component as a list of nodes.
 java.lang.String getTextContent()
          Returns the content for this component as a string.
 boolean listen(CoreComponentI component)
          For now, the Mutable class passes listening to its superclass.
 void print()
          Prints a representation of the component to STDOUT
 void setBasicType(int _type)
          Set the basic type of this object, per the constants defined in the CoreComponentI interface.
 void setContent(java.lang.String _content)
          Sets the content for this component as a string.
 java.lang.String toString()
          Need to force configurable ref to visitor class
 java.lang.String toString(ComponentSetI namespaceContext)
          Need to force configurable ref to visitor class
 
Methods inherited from class com.simonstl.moe.CoreComponent
add, addAll, addUnorderedContent, annotate, clearAll, clearName, clearUnorderedContent, getAllAnnotations, getAnnotations, getIsComplete, getLocalName, getName, getNsURI, getParent, getPrefix, getQName, getTypes, getUnorderedContent, hasAnnotation, hasAnnotationOfType, hasAnnotations, hashCode, removeAllAnnotations, removeAnnotation, setContent, setIsComplete, setLocalName, setName, setNsURI, setParent, setPrefix, setQName, setUnorderedContent, textComponent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.simonstl.moe.CoreComponentI
addUnorderedContent, clearAll, clearName, clearUnorderedContent, getIsComplete, getLocalName, getName, getNsURI, getParent, getPrefix, getQName, getUnorderedContent, hashCode, setContent, setIsComplete, setLocalName, setName, setNsURI, setParent, setPrefix, setQName, setUnorderedContent
 
Methods inherited from interface com.simonstl.moe.AnnotableI
addAll, annotate, getAllAnnotations, getAnnotations, getTypes, hasAnnotation, hasAnnotationOfType, hasAnnotations, removeAllAnnotations, removeAnnotation
 

Field Detail

textContent

protected java.lang.String textContent

basicType

protected int basicType
Constructor Detail

Mutable

public Mutable()
Method Detail

setContent

public void setContent(java.lang.String _content)
Description copied from interface: CoreComponentI
Sets the content for this component as a string.
Specified by:
setContent in interface CoreComponentI
Overrides:
setContent in class CoreComponent

addContent

public void addContent(CoreComponentI newComponent)
Description copied from interface: CoreComponentI
Adds content to this component.
Specified by:
addContent in interface CoreComponentI
Overrides:
addContent in class CoreComponent

clearContent

public void clearContent()
Description copied from interface: CoreComponentI
Clears the content for this component.
Specified by:
clearContent in interface CoreComponentI
Overrides:
clearContent in class CoreComponent

getTextContent

public java.lang.String getTextContent()
Description copied from interface: CoreComponentI
Returns the content for this component as a string.
Specified by:
getTextContent in interface CoreComponentI
Overrides:
getTextContent in class CoreComponent

getContent

public ComponentListI getContent()
Description copied from interface: CoreComponentI
Returns the content for this component as a list of nodes.
Specified by:
getContent in interface CoreComponentI
Overrides:
getContent in class CoreComponent

print

public void print()
Description copied from interface: CoreComponentI
Prints a representation of the component to STDOUT
Specified by:
print in interface CoreComponentI
Overrides:
print in class CoreComponent

toString

public java.lang.String toString()
Need to force configurable ref to visitor class
Specified by:
toString in interface CoreComponentI
Overrides:
toString in class CoreComponent

toString

public java.lang.String toString(ComponentSetI namespaceContext)
Need to force configurable ref to visitor class
Specified by:
toString in interface CoreComponentI

getBasicType

public int getBasicType()
The basic type for Mutable is whatever it's been set to be.
Specified by:
getBasicType in interface CoreComponentI
Overrides:
getBasicType in class CoreComponent

setBasicType

public void setBasicType(int _type)
Description copied from interface: MutableComponentI
Set the basic type of this object, per the constants defined in the CoreComponentI interface.
public static final int DOCUMENT=0;
public static final int END_DOCUMENT=1;
public static final int ELEMENT=2;
public static final int END_ELEMENT=3;
public static final int ATTRIBUTE=4;
public static final int END_ATTRIBUTE=5;
public static final int COMMENT=6;
public static final int END_COMMENT=7;
public static final int PI=8;
public static final int END_PI=9;
public static final int DOCTYPE=10;
public static final int END_DOCTYPE=11;
public static final int CDATA=12;
public static final int END_CDATA=13;


public static final int XML_DECL=18;
public static final int NAMESPACE_DECL=20;
public static final int END_NAMESPACE=21;

public static final int GENERIC=64;
public static final int END_GENERIC=65;

public static final int GEN_ENTITY_START=130;
public static final int GEN_ENTITY_END=131;

public static final int GEN_ENTITY_REF=250;
public static final int IG_WHITESPACE=252;
public static final int CHARS=254;

public static final int UNPARSED=258;
This permits the creation of classes which change type depending on context.
Specified by:
setBasicType in interface MutableComponentI

listen

public boolean listen(CoreComponentI component)
               throws MOEException
For now, the Mutable class passes listening to its superclass.
Specified by:
listen in interface CoreComponentI
Overrides:
listen in class CoreComponent

clone

public java.lang.Object clone()
Clone implementation uses MutableComponentI, adds text if necessary.
Specified by:
clone in interface CoreComponentI
Overrides:
clone in class CoreComponent