Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / action / 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.parser.rfc7950.stmt.action;
9
10 import org.opendaylight.yangtools.yang.common.QName;
11 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.ActionEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
15 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveOperationDefinition;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19
20 final class ActionEffectiveStatementImpl extends AbstractEffectiveOperationDefinition<ActionStatement>
21         implements ActionDefinition, ActionEffectiveStatement {
22     private final boolean augmenting;
23     private final boolean addedByUses;
24
25     ActionEffectiveStatementImpl(
26             final StmtContext<QName, ActionStatement, EffectiveStatement<QName, ActionStatement>> ctx) {
27         super(ctx);
28
29         // initCopyType
30         final CopyHistory copyTypesFromOriginal = ctx.getCopyHistory();
31         if (copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
32             this.augmenting = true;
33             this.addedByUses = true;
34         } else {
35             this.augmenting = copyTypesFromOriginal.contains(CopyType.ADDED_BY_AUGMENTATION);
36             this.addedByUses = copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES);
37         }
38     }
39
40     @Deprecated
41     @Override
42     public boolean isAugmenting() {
43         return augmenting;
44     }
45
46     @Deprecated
47     @Override
48     public boolean isAddedByUses() {
49         return addedByUses;
50     }
51 }