MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.update.store.llImpl
Class LLStore

java.lang.Object
  extended by ch.ethz.mxquery.update.store.llImpl.TokenList
      extended by ch.ethz.mxquery.update.store.llImpl.LLStore
All Implemented Interfaces:
Source, UpdateableStore

public class LLStore
extends TokenList
implements UpdateableStore

Saves elements of one XML store in a double linked list.


Field Summary
 LLStoreSet storeSet
           
 
Constructor Summary
LLStore(LLStoreSet storeSet, XDMIterator initialDataIterator)
           
LLStore(java.lang.String uri, LLStoreSet storeSet, XDMIterator initialDataIterator)
           
 
Method Summary
 void appendForInsert(XDMIterator node)
          Appends the passed not to the store.
 void checkNSXDM()
          Check if the inserted store would create conflicting namespace binding or violate XDM constraints
 int compare(Source store)
           
 boolean containsOnlyAttrs()
          Does this store only contain attributes?
 boolean containsTopAttrs()
          Returns true if the sequence that is represented by this store contains top attributes.
 Source copySource(Context ctx, java.util.Vector nestedPredCtxStack)
           
 void delete(Identifier targetId)
          Deletes the element that has the identifier targetId.
 java.lang.String getDoctypeRootElem()
          If the store contains a document with a docdecls, return the root element definition
 Window getIterator(Context ctx)
          Returns Iterator that points on the first token in the store.
 Window getIteratorForId(Identifier identifier)
          Returns Iterator that points on the token with the passed identifier in the store.
 LLStore getNewStoreForSequence(int startPosition, int endPosition)
           
 XDMIterator getParentIterator(Identifier id)
          Get a window/iterator of the parent
 java.lang.String getPublicID()
          If the store contains a document with a docdecls, return the public id
 StoreSet getStoreSet()
          Get the StoreSet that the store belongs to
 java.lang.String getSystemID()
          If the store contains a document with a docdecls, return the system id
 java.lang.String getURI()
          Returns the URI of the source.
 void insertAfter(Identifier targetId, UpdateableStore store)
          Inserts node after the element with the id targetId into the store.
 void insertAttributes(Identifier targetId, UpdateableStore store)
          Inserts all attributes of node into the XML-start-tag that has the identifier targetId.
 void insertBefore(Identifier targetId, UpdateableStore store)
          Inserts node before the element with the id targetId into the store.
 void insertInto(Identifier targetId, UpdateableStore store)
          Inserts node into the element with the id targetId.
 void insertIntoAsFirst(Identifier targetId, UpdateableStore store)
          Inserts node into the element with the id targetId at first position.
 void insertIntoAsLast(Identifier targetId, UpdateableStore store)
          Inserts node into the element with the id targetId at last position.
 boolean isModified()
          Has this store been modified since it has been initially loaded?
 void materialize()
           
 void mergeCleanTextNodes()
          Merges and/or removes multiple adjacent or empty text nodes under the same element
 UpdateableStore pullAttributes()
          A store represents a sequence of elements.
 void rename(Identifier targetId, QName qname)
          Renames the element with the identifier targetId.
 void replaceNode(Identifier targetId, UpdateableStore store)
          Replaces the element with the identifier targetId with node.
 void replaceNodeContent(Identifier targetId, UpdateableStore store)
          Replaces the content of the element with the identifier targetId with text.
 void replaceValue(Identifier targetId, java.lang.String value)
          Replaces the string value of the element with the identifier targetId with stringValue.
 void setAssignNewIds(boolean assignNewIds)
           
 void setModified(boolean modVal)
          Set the modification state of the store
 java.lang.String toString()
           
 java.lang.String toString(int addDepth)
           
 
Methods inherited from class ch.ethz.mxquery.update.store.llImpl.TokenList
count, countIdiedEls, countLevels, deleteFirst, deleteLast, getFirstToken, getLastToken, getParentId, getToken, hasParent, isEmpty, pullFirst
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.ethz.mxquery.model.updatePrimitives.UpdateableStore
count, getParentId, hasParent, isEmpty
 

Field Detail

storeSet

public LLStoreSet storeSet
Constructor Detail

LLStore

public LLStore(LLStoreSet storeSet,
               XDMIterator initialDataIterator)

LLStore

public LLStore(java.lang.String uri,
               LLStoreSet storeSet,
               XDMIterator initialDataIterator)
Method Detail

getURI

public java.lang.String getURI()
Description copied from interface: Source
Returns the URI of the source.

Specified by:
getURI in interface Source
Returns:
a String representing the URI/Identifier of this source

appendForInsert

public void appendForInsert(XDMIterator node)
                     throws MXQueryException
Description copied from interface: UpdateableStore
Appends the passed not to the store. "ForInsert" means that this Store is used to insert data in another Store. The Difference to the normal append node is that an insert sequence must no contain document nodes => a document node is replaced by its children.

Specified by:
appendForInsert in interface UpdateableStore
Throws:
MXQueryException

materialize

public void materialize()
                 throws MXQueryException
Specified by:
materialize in interface UpdateableStore
Throws:
MXQueryException

delete

public void delete(Identifier targetId)
            throws MXQueryException
Description copied from interface: UpdateableStore
Deletes the element that has the identifier targetId.

Specified by:
delete in interface UpdateableStore
Parameters:
targetId - element identifier
Throws:
MXQueryException

insertAfter

public void insertAfter(Identifier targetId,
                        UpdateableStore store)
                 throws MXQueryException
Description copied from interface: UpdateableStore
Inserts node after the element with the id targetId into the store.

Specified by:
insertAfter in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

insertAttributes

public void insertAttributes(Identifier targetId,
                             UpdateableStore store)
                      throws MXQueryException
Description copied from interface: UpdateableStore
Inserts all attributes of node into the XML-start-tag that has the identifier targetId.

Specified by:
insertAttributes in interface UpdateableStore
Parameters:
targetId - element identifier
store - attributes to insert (one attribute or a sequence of attributes)
Throws:
MXQueryException

checkNSXDM

public void checkNSXDM()
                throws MXQueryException
Check if the inserted store would create conflicting namespace binding or violate XDM constraints

Specified by:
checkNSXDM in interface UpdateableStore
Throws:
MXQueryException

insertBefore

public void insertBefore(Identifier targetId,
                         UpdateableStore store)
                  throws MXQueryException
Description copied from interface: UpdateableStore
Inserts node before the element with the id targetId into the store.

Specified by:
insertBefore in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

insertInto

public void insertInto(Identifier targetId,
                       UpdateableStore store)
                throws MXQueryException
Description copied from interface: UpdateableStore
Inserts node into the element with the id targetId.

Specified by:
insertInto in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

insertIntoAsFirst

public void insertIntoAsFirst(Identifier targetId,
                              UpdateableStore store)
                       throws MXQueryException
Description copied from interface: UpdateableStore
Inserts node into the element with the id targetId at first position.

Specified by:
insertIntoAsFirst in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

insertIntoAsLast

public void insertIntoAsLast(Identifier targetId,
                             UpdateableStore store)
                      throws MXQueryException
Description copied from interface: UpdateableStore
Inserts node into the element with the id targetId at last position.

Specified by:
insertIntoAsLast in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

rename

public void rename(Identifier targetId,
                   QName qname)
            throws MXQueryException
Description copied from interface: UpdateableStore
Renames the element with the identifier targetId.

Specified by:
rename in interface UpdateableStore
Parameters:
targetId - element identifier (element must be an XML-node, or processing instruction node)
qname - new name
Throws:
MXQueryException

replaceNodeContent

public void replaceNodeContent(Identifier targetId,
                               UpdateableStore store)
                        throws MXQueryException
Description copied from interface: UpdateableStore
Replaces the content of the element with the identifier targetId with text.

Specified by:
replaceNodeContent in interface UpdateableStore
Parameters:
targetId - element identifier (element must be an XML-node)
store - contains per facility only one text element (string, int, ...)
Throws:
MXQueryException

replaceNode

public void replaceNode(Identifier targetId,
                        UpdateableStore store)
                 throws MXQueryException
Description copied from interface: UpdateableStore
Replaces the element with the identifier targetId with node.

Specified by:
replaceNode in interface UpdateableStore
Parameters:
targetId - element identifier
store - some data (XQuery Data Model)
Throws:
MXQueryException

replaceValue

public void replaceValue(Identifier targetId,
                         java.lang.String value)
                  throws MXQueryException
Description copied from interface: UpdateableStore
Replaces the string value of the element with the identifier targetId with stringValue.

Specified by:
replaceValue in interface UpdateableStore
Parameters:
targetId - element identifier (element must be an attribute, text, comment, or processing instruction node)
value - data that contains a string
Throws:
MXQueryException

containsTopAttrs

public boolean containsTopAttrs()
                         throws MXQueryException
Description copied from interface: UpdateableStore
Returns true if the sequence that is represented by this store contains top attributes. Top means attributes that are saved directly in the sequence and not indirectly inside other elements.

Specified by:
containsTopAttrs in interface UpdateableStore
Returns:
true/false
Throws:
MXQueryException

containsOnlyAttrs

public boolean containsOnlyAttrs()
                          throws MXQueryException
Description copied from interface: UpdateableStore
Does this store only contain attributes?

Specified by:
containsOnlyAttrs in interface UpdateableStore
Returns:
true if this sequence contains only attributes
Throws:
MXQueryException

pullAttributes

public UpdateableStore pullAttributes()
                               throws MXQueryException
Description copied from interface: UpdateableStore
A store represents a sequence of elements. This methods returns a new store that contains all attributes that are at the beginning of this sequence (the sequence that is represented by this store) and deletes them in this store.

Specified by:
pullAttributes in interface UpdateableStore
Returns:
store of attributes
Throws:
MXQueryException

getIterator

public Window getIterator(Context ctx)
                   throws MXQueryException
Description copied from interface: Source
Returns Iterator that points on the first token in the store.

Specified by:
getIterator in interface Source
Returns:
Iterator a (Window) Iterator to access the contents of this source
Throws:
MXQueryException

getIteratorForId

public Window getIteratorForId(Identifier identifier)
                        throws MXQueryException
Description copied from interface: UpdateableStore
Returns Iterator that points on the token with the passed identifier in the store.

Specified by:
getIteratorForId in interface UpdateableStore
Returns:
Returns null if the token of the passed identifier cannot be found.
Throws:
MXQueryException

getParentIterator

public XDMIterator getParentIterator(Identifier id)
                              throws MXQueryException
Description copied from interface: UpdateableStore
Get a window/iterator of the parent

Specified by:
getParentIterator in interface UpdateableStore
Parameters:
id - Node to take as base for the parent
Returns:
Iterator providing the parent, EmptySequence if there is none
Throws:
MXQueryException

getStoreSet

public StoreSet getStoreSet()
Description copied from interface: UpdateableStore
Get the StoreSet that the store belongs to

Specified by:
getStoreSet in interface UpdateableStore
Returns:
the owning StoreSet

toString

public java.lang.String toString(int addDepth)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compare

public int compare(Source store)
Specified by:
compare in interface Source

copySource

public Source copySource(Context ctx,
                         java.util.Vector nestedPredCtxStack)
Specified by:
copySource in interface Source

isModified

public boolean isModified()
Description copied from interface: UpdateableStore
Has this store been modified since it has been initially loaded?

Specified by:
isModified in interface UpdateableStore
Returns:
true if the store has been modified

setModified

public void setModified(boolean modVal)
Description copied from interface: UpdateableStore
Set the modification state of the store

Specified by:
setModified in interface UpdateableStore

getSystemID

public java.lang.String getSystemID()
Description copied from interface: UpdateableStore
If the store contains a document with a docdecls, return the system id

Specified by:
getSystemID in interface UpdateableStore
Returns:
Contents of the System ID, if present, otherwise null

getPublicID

public java.lang.String getPublicID()
Description copied from interface: UpdateableStore
If the store contains a document with a docdecls, return the public id

Specified by:
getPublicID in interface UpdateableStore
Returns:
Contents of the Public ID, if present, otherwise null

getDoctypeRootElem

public java.lang.String getDoctypeRootElem()
Description copied from interface: UpdateableStore
If the store contains a document with a docdecls, return the root element definition

Specified by:
getDoctypeRootElem in interface UpdateableStore
Returns:
Contents of the root element name, if present, otherwise null

setAssignNewIds

public void setAssignNewIds(boolean assignNewIds)

getNewStoreForSequence

public LLStore getNewStoreForSequence(int startPosition,
                                      int endPosition)
                               throws MXQueryException
Throws:
MXQueryException

mergeCleanTextNodes

public void mergeCleanTextNodes()
Description copied from interface: UpdateableStore
Merges and/or removes multiple adjacent or empty text nodes under the same element

Specified by:
mergeCleanTextNodes in interface UpdateableStore

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich