Path.ROOT
. The root element cannot be created or deleted, and its data and name cannot be set. The root element's children however can be modified (added, deleted, etc). The root path can be obtained using the getRoot()
method. ElementTrees are modified in generations. The method newEmptyDelta()
returns a new tree generation that can be modified arbitrarily by the user. For the purpose of explanation, we call such a tree "active". When the method immutable()
is called, that tree generation is frozen, and can never again be modified. A tree must be immutable before a new tree generation can start. Since all ancestor trees are immutable, different active trees can have ancestors in common without fear of thread corruption problems. Internally, any single tree generation is simply stored as the set of changes between itself and its most recent ancestor (its parent). This compact delta representation allows chains of element trees to be created at relatively low cost. Clients of the ElementTree can instantaneously "undo" sets of changes by navigating up to the parent tree using the getParent()
method. Although the delta representation is compact, extremely long delta chains make for a large structure that is potentially slow to query. For this reason, the client is encouraged to minimize delta chain lengths using the collapsing(int)
and makeComplete()
methods. The getDeltaDepth()
method can be used to discover the length of the delta chain. The entire delta chain can also be re-oriented in terms of the current element tree using the reroot()
operation. Classes are also available for tree serialization and navigation.
@see ElementTreeReader
@see ElementTreeWriter
@see ElementTreeIterator Finally, why are ElementTrees in a package called "watson"? - "It's ElementTree my dear Watson, ElementTree."
|
|
|
|
|
|
|
|
|
|
|
|