Improve TreeNode and Version documentation
[yangtools.git] / data / yang-data-tree-ri / src / main / java / org / opendaylight / yangtools / yang / data / tree / impl / node / Version.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.tree.impl.node;
9
10 import org.opendaylight.yangtools.concepts.Immutable;
11
12 /**
13  * The concept of a version, either node version, or a subtree version. The only interface contract this class has is
14  * that no two {@link Version} are the same.
15  *
16  * <p>
17  * This class relies on Java Virtual machine's guarantee that the identity of an Object is distinct from any other
18  * Object in the Java heap.
19  *
20  * <p>
21  * From data management perspective, this concept serves as JVM-level MVCC
22  * <a href="https://en.wikipedia.org/wiki/Multiversion_concurrency_control#Implementation">timestamp (TS)</a>.
23  */
24 public final class Version implements Immutable {
25     private Version() {
26         // Hidden on purpose
27     }
28
29     /**
30      * Create a new version, distinct from any other version.
31      *
32      * @return a new version.
33      */
34     @SuppressWarnings("static-method")
35     public Version next() {
36         return new Version();
37     }
38
39     /**
40      * Create an initial version.
41      *
42      * @return a new version.
43      */
44     public static Version initial() {
45         return new Version();
46     }
47 }