YANGTOOLS-706: Retrofit EffectiveStatement interfaces into parser
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / FeatureEffectiveStatementImpl.java
1 /*
2  * Copyright (c) 2015 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.parser.stmt.rfc6020.effective;
9
10 import java.util.Objects;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
13 import org.opendaylight.yangtools.yang.model.api.stmt.FeatureEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16
17 public final class FeatureEffectiveStatementImpl extends AbstractEffectiveSchemaNode<FeatureStatement> implements
18         FeatureDefinition, FeatureEffectiveStatement {
19
20     public FeatureEffectiveStatementImpl(final StmtContext<QName, FeatureStatement, ?> ctx) {
21         super(ctx);
22     }
23
24     @Override
25     public int hashCode() {
26         final int prime = 31;
27         int result = 1;
28         result = prime * result + Objects.hashCode(getQName());
29         result = prime * result + Objects.hashCode(getPath());
30         return result;
31     }
32
33     @Override
34     public boolean equals(final Object obj) {
35         if (this == obj) {
36             return true;
37         }
38         if (obj == null) {
39             return false;
40         }
41         if (getClass() != obj.getClass()) {
42             return false;
43         }
44         FeatureEffectiveStatementImpl other = (FeatureEffectiveStatementImpl) obj;
45         return Objects.equals(getQName(), other.getQName()) && Objects.equals(getPath(), other.getPath());
46     }
47
48     @Override
49     public String toString() {
50         return FeatureEffectiveStatementImpl.class.getSimpleName() + "[name=" + getQName() + "]";
51     }
52 }