Populate data/ hierarchy
[yangtools.git] / data / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / nodes / AbstractImmutableNormalizedSimpleValueNode.java
1 /*
2  * Copyright (c) 2013 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.impl.schema.nodes;
9
10 import java.util.Objects;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13
14 public abstract class AbstractImmutableNormalizedSimpleValueNode<K extends PathArgument, N extends NormalizedNode, V>
15         extends AbstractImmutableNormalizedValueNode<K, N, V> {
16     protected AbstractImmutableNormalizedSimpleValueNode(final K nodeIdentifier, final V value) {
17         super(nodeIdentifier, value);
18     }
19
20     @Override
21     protected final int valueHashCode() {
22         return value().hashCode();
23     }
24
25     @Override
26     protected final boolean valueEquals(final N other) {
27         // We can not call directly body().equals because of Empty Type
28         // RequireInstanceStatementSupport leaves which always have NULL value
29         return Objects.deepEquals(value(), other.body());
30     }
31 }