Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / odlext / stmt / AnyxmlSchemaLocationEffectiveStatementImpl.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.odlext.stmt;
9
10 import com.google.common.annotations.VisibleForTesting;
11 import java.util.Objects;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationEffectiveStatement;
14 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationStatement;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
18 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20
21 @VisibleForTesting
22 public final class AnyxmlSchemaLocationEffectiveStatementImpl
23         extends UnknownEffectiveStatementBase<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>
24         implements AnyxmlSchemaLocationEffectiveStatement {
25
26     private final SchemaPath path;
27
28     AnyxmlSchemaLocationEffectiveStatementImpl(
29             final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
30         super(ctx);
31         path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
32     }
33
34     @Nonnull
35     @Override
36     public QName getQName() {
37         return getNodeType();
38     }
39
40     @Nonnull
41     @Override
42     public SchemaPath getPath() {
43         return path;
44     }
45
46     @Override
47     public int hashCode() {
48         final int prime = 31;
49         int result = 1;
50         result = prime * result + Objects.hashCode(path);
51         result = prime * result + Objects.hashCode(getNodeType());
52         result = prime * result + Objects.hashCode(getNodeParameter());
53         return result;
54     }
55
56     @Override
57     public boolean equals(final Object obj) {
58         if (this == obj) {
59             return true;
60         }
61         if (obj == null) {
62             return false;
63         }
64         if (getClass() != obj.getClass()) {
65             return false;
66         }
67         AnyxmlSchemaLocationEffectiveStatementImpl other = (AnyxmlSchemaLocationEffectiveStatementImpl) obj;
68         if (!Objects.equals(path, other.path)) {
69             return false;
70         }
71         if (!Objects.equals(getNodeType(), other.getNodeType())) {
72             return false;
73         }
74         if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
75             return false;
76         }
77         return true;
78     }
79 }