/*
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.yang.data.api.schema.tree;

import com.google.common.base.Optional;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;

/**
 * A single node within a {@link DataTreeCandidate}. The nodes are organized
 * in tree hierarchy, reflecting the modification from which this candidate
 * was created. The node itself exposes the before- and after-image of the
 * tree restricted to the modified nodes.
 */
public interface DataTreeCandidateNode {

    /**
     * Get the node identifier.
     *
     * @return The node identifier.
     */
    @Nonnull PathArgument getIdentifier();

    /**
     * Get an unmodifiable collection of modified child nodes.
     *
     * @return Unmodifiable collection of modified child nodes.
     */
    @Nonnull Collection<DataTreeCandidateNode> getChildNodes();

    /**
     * Returns modified child or null if child was not modified
     * / does not exists.
     *
     * @param identifier Identifier of child node
     * @return Modified child or null if child was not modified.
     */
    @Nullable DataTreeCandidateNode getModifiedChild(PathArgument identifier);

    /**
     * Return the type of modification this node is undergoing.
     *
     * @return Node modification type.
     */
    @Nonnull ModificationType getModificationType();

    /**
     * Return the before-image of data corresponding to the node.
     *
     * @return Node data as they were present in the tree before
     *         the modification was applied.
     */
    Optional<NormalizedNode<?, ?>> getDataAfter();

    /**
     * Return the after-image of data corresponding to the node.
     *
     * @return Node data as they will be present in the tree after
     *         the modification is applied.
     */
    Optional<NormalizedNode<?, ?>> getDataBefore();
}

@@ -1841,22 +1841,21 @@
 urn the 
-before
+after
 -image o
@@ -1929,18 +1929,21 @@
 s they w
-er
+ill b
 e presen
@@ -1956,22 +1956,21 @@
 he tree 
-before
+after
 %0A     * 
@@ -1994,18 +1994,17 @@
 ication 
-wa
+i
 s applie
@@ -2009,32 +2009,41 @@
 ied.%0A     */%0A   
+ 
+@Nonnull
  Optional%3CNormal
@@ -2093,37 +2093,38 @@
    * Return the 
-after
+before
 -image of data c
@@ -2182,37 +2182,34 @@
 e data as they w
-ill b
+er
 e present in the
@@ -2206,37 +2206,38 @@
 ent in the tree 
-after
+before
 %0A     *         
@@ -2245,33 +2245,34 @@
 he modification 
-i
+wa
 s applied.%0A     
@@ -2277,16 +2277,25 @@
   */%0A   
+ 
+@Nonnull
  Optiona

Fix DataTreeCandidateNode API definition