net.sourceforge.nite.nom.nomread.impl
Class NOMReadElement

java.lang.Object
  extended by net.sourceforge.nite.nom.nomwrite.impl.NOMWriteElement
      extended by net.sourceforge.nite.nom.nomread.impl.NOMReadElement
All Implemented Interfaces:
NOMElement
Direct Known Subclasses:
NOMReadAnnotation, NOMReadObject, NOMReadResourceElement, NOMReadTypeElement

public abstract class NOMReadElement
extends NOMWriteElement

Extends the nomread version with methods for adding & deleting elements & attributes

Author:
jonathan

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.nite.nom.nomwrite.impl.NOMWriteElement
NOMWriteElement.SharedElement, NOMWriteElement.XMLComment
 
Nested classes/interfaces inherited from interface net.sourceforge.nite.nom.nomwrite.NOMElement
NOMElement.SharedEl
 
Field Summary
 
Fields inherited from interface net.sourceforge.nite.nom.nomwrite.NOMElement
FEATURAL_LAYER, IMPLICIT_ORDER, STRUCTURAL_LAYER, TEMPORAL_ORDER, TIME_ALIGNED_LAYER, UNORDERED, UNTIMED
 
Method Summary
 void addAfterSibling(NOMElement sibling)
          add the element as a sibling of the given element.
 void addAttribute(NOMAttribute attribute)
          add an attribute to the element or if it exists already, just set it
 void addBeforeSibling(NOMElement sibling)
          add the element as a sibling of the given element.
 void addChild(NOMElement child)
          adds a child to this element.
 void addChildAfter(NOMElement oldchild, NOMElement newchild)
          adds the NOMElement newchild immediately after the given existing child, or reports an exception if the child cannot be found
 void addChildBefore(NOMElement oldchild, NOMElement newchild)
          adds the NOMElement newchild immediately before the given existing child, or reports an exception if the child cannot be found
 void addFirstChild(NOMElement child)
          adds the NOMElement as the first child
 void addLastChild(NOMElement child)
          adds the NOMElement as the last child
 void addPointer(NOMPointer pointer)
          add a pointer to the element
 void addToCorpus()
          add an element to the corpus with no information about location.
 void appendText(java.lang.String chars)
          appends to the textual content of an element.
 void deleteChild(NOMElement child)
          Delete an element.
 java.lang.String getLink()
          returns a string containing a full Link to this element including filename - we override the nomwrite version to add coder-specific path in case we're in reliability mode.
 NOMElement.SharedEl getShared()
          return a shared view of this element which simply provides utility functions for editing the element without thinking about locking and unlocking the corpus.
 void removeAttribute(java.lang.String name)
          Remove an attribute completely from an element
 void removeChild(NOMElement child)
          Remove a nite:child from an element without actually deleting the element referred to.
 void removePointer(NOMPointer pointer)
          remove a pointer from the element
 void setComment(java.lang.String comment)
          set the contents of the reserved comment attribute
 void setDoubleAttribute(java.lang.String name, java.lang.Double value)
          Set the value of a named Double attribute
 void setEndTime(double time)
          Set the end time of this element.
 void setGVM(java.lang.String name)
          sets the Graphical Visual Markup string for this element
 void setName(java.lang.String name)
          sets the name of the element - not commonly used!
 void setStartTime(double time)
          Set the start time of this element.
 void setStringAttribute(java.lang.String name, java.lang.String value)
          Set the value of a named string attribute
 void setText(java.lang.String chars)
          sets the textual content of an element.
 
Methods inherited from class net.sourceforge.nite.nom.nomwrite.impl.NOMWriteElement
addChildAboveChildren, addExternalPointer, endElementString, findAncestorInLayer, findAncestorNamed, findAncestorsInFile, findAncestorsInLayer, findAncestorsNamed, findCommonAncestorInFile, findDescendantsInLayer, findDescendantsNamed, getAgent, getAgentName, getAttribute, getAttributeComparableValue, getAttributes, getChildOrder, getChildren, getChildrenWithInterleavedComments, getColour, getComment, getCorpus, getEndTime, getExternalPointerValue, getGVM, getID, getIDLink, getKeyStroke, getLayer, getMetadataElement, getName, getNextElement, getNextSibling, getNiteChildren, getObservation, getParentInFile, getParents, getPointers, getPointersTo, getPointerWithRole, getPreviousSibling, getRecursiveDepth, getRecursiveHeight, getStartTime, getText, getTimeType, getXLink, hasNextElement, inheritTimes, insertParent, isComment, isLeaf, isStreamElement, isStreamElementOld, removeParentAndAdjust, setKeyStroke, setStreamElement, startElementString, updateTimes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setStringAttribute

public void setStringAttribute(java.lang.String name,
                               java.lang.String value)
                        throws NOMException
Set the value of a named string attribute

Specified by:
setStringAttribute in interface NOMElement
Overrides:
setStringAttribute in class NOMWriteElement
Throws:
NOMException

setDoubleAttribute

public void setDoubleAttribute(java.lang.String name,
                               java.lang.Double value)
                        throws NOMException
Set the value of a named Double attribute

Specified by:
setDoubleAttribute in interface NOMElement
Overrides:
setDoubleAttribute in class NOMWriteElement
Throws:
NOMException

addAttribute

public void addAttribute(NOMAttribute attribute)
                  throws NOMException
add an attribute to the element or if it exists already, just set it

Specified by:
addAttribute in interface NOMElement
Overrides:
addAttribute in class NOMWriteElement
Throws:
NOMException

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws NOMException
Remove an attribute completely from an element

Specified by:
removeAttribute in interface NOMElement
Overrides:
removeAttribute in class NOMWriteElement
Throws:
NOMException

addPointer

public void addPointer(NOMPointer pointer)
                throws NOMException
add a pointer to the element

Specified by:
addPointer in interface NOMElement
Overrides:
addPointer in class NOMWriteElement
Throws:
NOMException

removePointer

public void removePointer(NOMPointer pointer)
                   throws NOMException
remove a pointer from the element

Specified by:
removePointer in interface NOMElement
Overrides:
removePointer in class NOMWriteElement
Throws:
NOMException

setStartTime

public void setStartTime(double time)
                  throws NOMException
Set the start time of this element. Only elements in a timed layer can have their start and end times set directly; all structural times are strictly inherited.

Specified by:
setStartTime in interface NOMElement
Overrides:
setStartTime in class NOMWriteElement
Throws:
NOMException

setEndTime

public void setEndTime(double time)
                throws NOMException
Set the end time of this element. Only elements in a timed layer can have their start and end times set directly; all structural times are strictly inherited.

Specified by:
setEndTime in interface NOMElement
Overrides:
setEndTime in class NOMWriteElement
Throws:
NOMException

addFirstChild

public void addFirstChild(NOMElement child)
                   throws NOMException
adds the NOMElement as the first child

Specified by:
addFirstChild in interface NOMElement
Overrides:
addFirstChild in class NOMWriteElement
Throws:
NOMException

addLastChild

public void addLastChild(NOMElement child)
                  throws NOMException
adds the NOMElement as the last child

Specified by:
addLastChild in interface NOMElement
Overrides:
addLastChild in class NOMWriteElement
Throws:
NOMException

addChildBefore

public void addChildBefore(NOMElement oldchild,
                           NOMElement newchild)
                    throws NOMException
adds the NOMElement newchild immediately before the given existing child, or reports an exception if the child cannot be found

Specified by:
addChildBefore in interface NOMElement
Overrides:
addChildBefore in class NOMWriteElement
Throws:
NOMException

addChildAfter

public void addChildAfter(NOMElement oldchild,
                          NOMElement newchild)
                   throws NOMException
adds the NOMElement newchild immediately after the given existing child, or reports an exception if the child cannot be found

Specified by:
addChildAfter in interface NOMElement
Overrides:
addChildAfter in class NOMWriteElement
Throws:
NOMException

removeChild

public void removeChild(NOMElement child)
                 throws NOMException
Remove a nite:child from an element without actually deleting the element referred to. Throw an error if we're trying to remove the child from its serialized parent.

Specified by:
removeChild in interface NOMElement
Overrides:
removeChild in class NOMWriteElement
Throws:
NOMException

deleteChild

public void deleteChild(NOMElement child)
                 throws NOMException
Delete an element. Remove the child from all its parents. Ranges need to be handled separately (in a different thread?)

Specified by:
deleteChild in interface NOMElement
Overrides:
deleteChild in class NOMWriteElement
Throws:
NOMException

setText

public void setText(java.lang.String chars)
             throws NOMException
sets the textual content of an element.

Specified by:
setText in interface NOMElement
Overrides:
setText in class NOMWriteElement
Throws:
NOMException

appendText

public void appendText(java.lang.String chars)
                throws NOMException
appends to the textual content of an element.

Specified by:
appendText in interface NOMElement
Overrides:
appendText in class NOMWriteElement
Throws:
NOMException

setName

public void setName(java.lang.String name)
sets the name of the element - not commonly used!

Specified by:
setName in interface NOMElement
Overrides:
setName in class NOMWriteElement

setGVM

public void setGVM(java.lang.String name)
sets the Graphical Visual Markup string for this element

Specified by:
setGVM in interface NOMElement
Overrides:
setGVM in class NOMWriteElement

addToCorpus

public void addToCorpus()
                 throws NOMException
add an element to the corpus with no information about location. This should only be used with elements that are in the top level of a coding. If the element is in a timed layer and has start and end times, the placement of the addition in the "stream" is derived from those. Otherwise the element is added at the end of the stream.

Specified by:
addToCorpus in interface NOMElement
Overrides:
addToCorpus in class NOMWriteElement
Throws:
NOMException

addBeforeSibling

public void addBeforeSibling(NOMElement sibling)
                      throws NOMException
add the element as a sibling of the given element. Of course the siblings must be in the same layer and the ordering must not violate any of the precedence constraints

Specified by:
addBeforeSibling in interface NOMElement
Overrides:
addBeforeSibling in class NOMWriteElement
Throws:
NOMException

addAfterSibling

public void addAfterSibling(NOMElement sibling)
                     throws NOMException
add the element as a sibling of the given element. Of course the siblings must be in the same layer and the ordering must not violate any of the precedence constraints

Specified by:
addAfterSibling in interface NOMElement
Overrides:
addAfterSibling in class NOMWriteElement
Throws:
NOMException

addChild

public void addChild(NOMElement child)
              throws NOMException
adds a child to this element. Since no order is specified, add the child to the end of the list of children.

Specified by:
addChild in interface NOMElement
Overrides:
addChild in class NOMWriteElement
Throws:
NOMException

getShared

public NOMElement.SharedEl getShared()
return a shared view of this element which simply provides utility functions for editing the element without thinking about locking and unlocking the corpus.

Specified by:
getShared in interface NOMElement
Overrides:
getShared in class NOMWriteElement

setComment

public void setComment(java.lang.String comment)
set the contents of the reserved comment attribute

Specified by:
setComment in interface NOMElement
Overrides:
setComment in class NOMWriteElement

getLink

public java.lang.String getLink()
returns a string containing a full Link to this element including filename - we override the nomwrite version to add coder-specific path in case we're in reliability mode.

Specified by:
getLink in interface NOMElement
Overrides:
getLink in class NOMWriteElement