com.simonstl.moe.namespace
Class NamespaceContext

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--com.simonstl.moe.namespace.NamespaceContext
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, ComponentCollectionI, ComponentInputI, ComponentSetI, java.util.List, java.io.Serializable, java.util.Set

public class NamespaceContext
extends java.util.ArrayList
implements ComponentSetI, ComponentInputI

The NamespaceContext class masquerades as a ComponentSet, which actually storing namespace information in a stack. This allows the preservation of namespaces which have been overridden so that they can reappear when the override context is finished.

In many ways, this class is an illustration of the enormous nuisance Namespaces in XML has created.

This class is just getting started. Most everything about it is wrong at present.

Version 0.01 is Abstract class.

Version:
0.01 24 August 2001
Author:
Simon St.Laurent
See Also:
Serialized Form

Field Summary
protected  NamespaceSetI context
           
protected  int level
           
protected  boolean modified
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
NamespaceContext()
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 Namespace extractNamespace(CoreComponentI source)
           
 NamespaceSetI getContext()
           
 java.util.Iterator iterator()
           
 boolean listen(CoreComponentI sound)
          listen() takes components passed to it by component creators, returns true if there is a completion event.
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 void setParent(CoreComponentI _parent)
          Sets the parent objects on all the items contained in the Collection.
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toAttributes()
          Without a list of current namespaces, the collection should report itself as XML attributes with declarations for all namespaces used by those attributes.
 java.lang.String toAttributes(ComponentSet namespaceContext)
          Given a list of current namespaces, the collection should report itself as XML attributes without declarations for namespaces presently in use.
 java.lang.String toElements()
          Without a list of current namespaces, the collection should report itself as XML elements with declarations for all namespaces used by those attributes.
 java.lang.String toElements(ComponentSet namespaceContext)
          Given a list of current namespaces, the collection should report itself as XML elements without declarations for namespaces presently in use.
 java.lang.String toString()
          toString() should report as attributes for unordered content, elements for ordered.
 java.lang.String toString(ComponentSet namespaceContext)
          toString(ComponentSet namespaceContext) should report as attributes for unordered content, elements for ordered, with an understanding of the namespaces already declared.
 
Methods inherited from class java.util.ArrayList
add, addAll, clone, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, listIterator, subList
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.simonstl.moe.ComponentSetI
clone
 
Methods inherited from interface java.util.Collection
equals, hashCode, isEmpty
 
Methods inherited from interface java.util.Set
equals, hashCode, isEmpty
 
Methods inherited from interface java.util.List
equals, hashCode, listIterator, listIterator, subList
 

Field Detail

level

protected int level

modified

protected boolean modified

context

protected NamespaceSetI context
Constructor Detail

NamespaceContext

public NamespaceContext()
Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Overrides:
add in class java.util.ArrayList

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Overrides:
addAll in class java.util.ArrayList

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Overrides:
clear in class java.util.ArrayList

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Overrides:
contains in class java.util.ArrayList

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Overrides:
containsAll in class java.util.AbstractCollection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Collection
Overrides:
iterator in class java.util.AbstractList

getContext

public NamespaceSetI getContext()

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Overrides:
remove in class java.util.AbstractCollection

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Overrides:
removeAll in class java.util.AbstractCollection

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Overrides:
retainAll in class java.util.AbstractCollection

size

public int size()
Specified by:
size in interface java.util.Collection
Overrides:
size in class java.util.ArrayList

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Overrides:
toArray in class java.util.ArrayList

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Overrides:
toArray in class java.util.ArrayList

toString

public java.lang.String toString()
Description copied from interface: ComponentCollectionI
toString() should report as attributes for unordered content, elements for ordered.
Specified by:
toString in interface ComponentCollectionI
Overrides:
toString in class java.util.AbstractCollection

toString

public java.lang.String toString(ComponentSet namespaceContext)
Description copied from interface: ComponentCollectionI
toString(ComponentSet namespaceContext) should report as attributes for unordered content, elements for ordered, with an understanding of the namespaces already declared.
Specified by:
toString in interface ComponentCollectionI

toAttributes

public java.lang.String toAttributes(ComponentSet namespaceContext)
Description copied from interface: ComponentCollectionI
Given a list of current namespaces, the collection should report itself as XML attributes without declarations for namespaces presently in use.
Specified by:
toAttributes in interface ComponentCollectionI

toAttributes

public java.lang.String toAttributes()
Description copied from interface: ComponentCollectionI
Without a list of current namespaces, the collection should report itself as XML attributes with declarations for all namespaces used by those attributes.
Specified by:
toAttributes in interface ComponentCollectionI

toElements

public java.lang.String toElements(ComponentSet namespaceContext)
Description copied from interface: ComponentCollectionI
Given a list of current namespaces, the collection should report itself as XML elements without declarations for namespaces presently in use.
Specified by:
toElements in interface ComponentCollectionI

toElements

public java.lang.String toElements()
Description copied from interface: ComponentCollectionI
Without a list of current namespaces, the collection should report itself as XML elements with declarations for all namespaces used by those attributes.
Specified by:
toElements in interface ComponentCollectionI

extractNamespace

public Namespace extractNamespace(CoreComponentI source)

listen

public boolean listen(CoreComponentI sound)
Description copied from interface: ComponentInputI
listen() takes components passed to it by component creators, returns true if there is a completion event. (This can usually be ignored, except where components are the listeners.
Specified by:
listen in interface ComponentInputI

setParent

public void setParent(CoreComponentI _parent)
Description copied from interface: ComponentCollectionI
Sets the parent objects on all the items contained in the Collection.
Specified by:
setParent in interface ComponentCollectionI