Move case statement implementations
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / spi / TreeNode.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema.tree.spi;
9
10 import org.eclipse.jdt.annotation.NonNullByDefault;
11 import org.opendaylight.yangtools.concepts.Identifiable;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
15
16 /**
17  * A very basic data tree node. It has a version (when it was last modified), a subtree version (when any of its
18  * children were modified) and some read-only data.
19  *
20  * <p>
21  * Semantic difference between these two is important when dealing with modifications involving parent/child
22  * relationships and what operations can be execute concurrently without creating a data dependency conflict.
23  *
24  * <p>
25  * A replace/delete operation cannot be applied to this node if the subtree version does not match. This mismatch
26  * still allows modifications to its descendants.
27  *
28  * <p>
29  * A mismatch in node version indicates a replacement, preventing a modification of descendants or itself.
30  */
31 // FIXME: BUG-2399: clarify that versioning rules are not enforced for non-presence containers, as they are not
32 //                  considered to be data nodes.
33 @NonNullByDefault
34 public interface TreeNode extends Identifiable<PathArgument>, StoreTreeNode<TreeNode> {
35     /**
36      * Get the data node version. This version is updated whenever the data representation of this particular node
37      * changes as a result of a direct write to this node or to its parent nodes -- thus indicating that this node
38      * was logically replaced.
39      *
40      * @return Current data node version.
41      */
42     Version getVersion();
43
44     /**
45      * Get the subtree version. This version is updated whenever the data representation of this particular node
46      * changes as the result of a direct or indirect child node being created, replaced or removed.
47      *
48      * @return Current subtree version.
49      */
50     Version getSubtreeVersion();
51
52     /**
53      * Get a read-only view of the underlying data.
54      *
55      * @return Unmodifiable view of the underlying data.
56      */
57     NormalizedNode getData();
58
59     /**
60      * Get a mutable, isolated copy of the node.
61      *
62      * @return Mutable copy
63      */
64     MutableTreeNode mutable();
65 }