|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.data.atomic.AtomicUpdateList
public final class AtomicUpdateList
A container/list for atomic updates. Updates are then carried out in the same order that they have been added. No reordering takes place. The user is responsible to add them in the correct order.
Updates must be strictly ordered from the highest to the lowest PRE value, otherwise an exception is returned.
If a collection of updates is carried out via this container there are several benefits:
Mind that two delete atomics on a list targeting the same PRE value location result in two nodes A and B being deleted, due to PRE value shifts after the first delete, where pre(B) = pre(A) + 1. If a list of atomic updates is prepared for execution it should be ordered from the highest to the lowest PRE value.
To avoid ambiguity it is not allowed to add:
Delete
or Replace
operating
on the same node.Rename
or UpdateValue
operating
on the same node.
Field Summary | |
---|---|
Data |
data
Target data reference. |
Constructor Summary | |
---|---|
AtomicUpdateList(Data d)
Constructor. |
Method Summary | |
---|---|
void |
addDelete(int pre)
Adds a delete atomic to the list. |
void |
addInsert(int pre,
int par,
DataClip clip,
boolean attr)
Adds an insert atomic to the list. |
void |
addRename(int pre,
int k,
byte[] n,
byte[] u)
Adds a rename atomic to the list. |
void |
addReplace(int pre,
DataClip clip)
Adds a replace atomic to the list. |
void |
addUpdateValue(int pre,
int k,
byte[] v)
Adds an updateValue atomic to the list. |
void |
applyStructuralUpdates()
Carries out structural updates. |
void |
applyValueUpdates()
Carries out value updates. |
int |
calculatePreValue(int pre,
boolean beforeUpdates)
Calculates the PRE value of a given node before/after updates. |
void |
check()
Checks the list of updates for violations. |
void |
clear()
Resets the list. |
void |
execute(boolean mergeTexts)
Executes the updates. |
void |
optimize()
Removes superfluous update operations. |
int |
structuralUpdatesSize()
Returns the number of structural updates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Data data
Constructor Detail |
---|
public AtomicUpdateList(Data d)
d
- target data referenceMethod Detail |
---|
public void addDelete(int pre)
pre
- PRE value of the target node/update locationpublic void addInsert(int pre, int par, DataClip clip, boolean attr)
pre
- PRE value of the target node/update locationpar
- new parent of the inserted nodesclip
- insertion sequence data clipattr
- insert attribute if true or a node of any other kind if falsepublic void addReplace(int pre, DataClip clip)
pre
- PRE value of the target node/update locationclip
- insertion sequence data clippublic void addRename(int pre, int k, byte[] n, byte[] u)
pre
- PRE value of the target node/update locationk
- kind of the target noden
- new name for the target nodeu
- new uri for the target nodepublic void addUpdateValue(int pre, int k, byte[] v)
pre
- PRE value of the target node/update locationk
- kind of the target nodev
- new value for the target nodepublic int structuralUpdatesSize()
public void clear()
public void check()
Rename
,
UpdateValue
operation.
A single node must not be affected by more than one destructive operation. These
operations include Replace
, Delete
.
public void optimize()
public void execute(boolean mergeTexts)
mergeTexts
- adjacent text nodes are to be expected and must be mergedpublic void applyStructuralUpdates()
public void applyValueUpdates()
public int calculatePreValue(int pre, boolean beforeUpdates)
pre
- PRE valuebeforeUpdates
- calculate PRE value before shifts/updates have been applied
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |