Introduce ElementCountConstraintAware interface
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / output / OutputEffectiveStatementImpl.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.rfc7950.stmt.output;
9
10 import com.google.common.collect.ImmutableSet;
11 import java.util.Objects;
12 import java.util.Set;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
15 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.OutputEffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
19 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveContainerSchemaNode;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
21
22 // FIXME: hide this class
23 public final class OutputEffectiveStatementImpl extends AbstractEffectiveContainerSchemaNode<OutputStatement>
24         implements OutputEffectiveStatement {
25
26     OutputEffectiveStatementImpl(
27             final StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
28         super(ctx);
29     }
30
31     @Override
32     public Set<ActionDefinition> getActions() {
33         return ImmutableSet.of();
34     }
35
36     @Override
37     public Set<NotificationDefinition> getNotifications() {
38         return ImmutableSet.of();
39     }
40
41     @Override
42     public boolean isPresenceContainer() {
43         // FIXME: this should not really be here
44         return false;
45     }
46
47     @Override
48     public int hashCode() {
49         final int prime = 31;
50         int result = 1;
51         result = prime * result + Objects.hashCode(getQName());
52         result = prime * result + Objects.hashCode(getPath());
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         OutputEffectiveStatementImpl other = (OutputEffectiveStatementImpl) obj;
68         return Objects.equals(getQName(), other.getQName()) && Objects.equals(getPath(), other.getPath());
69     }
70
71     @Override
72     public String toString() {
73         return "RPC Output " + getQName().getLocalName();
74     }
75 }