a638d2361fa537a6ab1e90b2ced89e89126da2be
[yangtools.git] / model / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / stmt / impl / eff / ActionEffectiveStatementImpl.java
1 /*
2  * Copyright (c) 2016 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.model.ri.stmt.impl.eff;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.ImmutableList;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.concepts.Immutable;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.ActionEffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
20 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultWithDataTree.WithSubstatements;
21 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.CopyableMixin;
22 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.OperationDefinitionMixin;
23
24 public final class ActionEffectiveStatementImpl
25         extends WithSubstatements<QName, ActionStatement, ActionEffectiveStatement>
26         implements ActionDefinition, ActionEffectiveStatement, OperationDefinitionMixin<ActionStatement>,
27                    CopyableMixin<QName, ActionStatement> {
28     private final @NonNull Immutable path;
29     private final int flags;
30
31     public ActionEffectiveStatementImpl(final ActionStatement declared, final Immutable path, final int flags,
32             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
33         super(declared, substatements);
34         this.path = requireNonNull(path);
35         this.flags = flags;
36     }
37
38     public ActionEffectiveStatementImpl(final ActionEffectiveStatementImpl original, final Immutable path,
39             final int flags) {
40         super(original);
41         this.path = requireNonNull(path);
42         this.flags = flags;
43     }
44
45     @Override
46     public Immutable pathObject() {
47         return path;
48     }
49
50     @Override
51     public int flags() {
52         return flags;
53     }
54
55     @Override
56     public ActionEffectiveStatement asEffectiveStatement() {
57         return this;
58     }
59 }