Merge "Refactored uses statement handling in parser."
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / UsesNodeBuilder.java
1 /*
2  * Copyright (c) 2013 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.builder.api;
9
10 import java.util.List;
11 import java.util.Set;
12
13 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.UsesNode;
16 import org.opendaylight.yangtools.yang.model.api.YangNode;
17 import org.opendaylight.yangtools.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
18 import org.opendaylight.yangtools.yang.parser.util.RefineHolder;
19
20 /**
21  * Interface for builders of 'uses' statement.
22  */
23 public interface UsesNodeBuilder extends GroupingMember, Builder {
24
25     /**
26      * Get parent of this uses node. Since uses can be defined only under on of
27      * module, container, list, case, grouping, input, output, notification or
28      * augment, return type is DataNodeContainerBuilder.
29      */
30     DataNodeContainerBuilder getParent();
31
32     /**
33      * Get grouping path as string.
34      *
35      * @return grouping path as String
36      */
37     String getGroupingPathAsString();
38
39     /**
40      * Get grouping path.
41      *
42      * @return grouping path as SchemaPath
43      */
44     SchemaPath getGroupingPath();
45
46     /**
47      * Get grouping definition.
48      *
49      * @return GroupingDefinition if present, null otherwise
50      */
51     GroupingDefinition getGroupingDefinition();
52
53     /**
54      * Set grouping definition.
55      *
56      * @param groupingDefinition
57      *            GroupingDefinition object
58      */
59     void setGroupingDefinition(GroupingDefinition groupingDefinition);
60
61     /**
62      * Get grouping builder.
63      *
64      * @return GroupingBuilder if present, null otherwise
65      */
66     GroupingBuilder getGroupingBuilder();
67
68     /**
69      * Set grouping builder.
70      *
71      * @param grouping
72      *            GroupingBuilder object
73      */
74     void setGrouping(GroupingBuilder grouping);
75
76     /**
77      * Get information if this uses node is defined in augment.
78      *
79      * @return true, if this node is defined under augment statement, false
80      *         otherwise
81      */
82     boolean isAugmenting();
83
84     /**
85      * Set information if this uses node is defined in augment.
86      *
87      * @param augmenting
88      */
89     void setAugmenting(boolean augmenting);
90
91     /**
92      * Get augment under which was this uses node was defined.
93      * <p>
94      * Note: This method may return different object than {@link #getParent()}
95      * if this node is a copy of other uses node. If the uses node is copied,
96      * its parent has changed, but parent augment is always same.
97      * </p>
98      *
99      * @return AugmentationSchemaBuilder under which was this node defined
100      */
101     AugmentationSchemaBuilder getParentAugment();
102
103     /**
104      * Set augment under which was this uses node was defined.
105      *
106      * @param augment
107      */
108     void setParentAugment(AugmentationSchemaBuilder augment);
109
110     /**
111      * Get augmentations defined in this uses node.
112      *
113      * @return set of augmentations defined in this node
114      */
115     Set<AugmentationSchemaBuilder> getAugmentations();
116
117     /**
118      * Add augment builder.
119      *
120      * @param builder
121      *            new builder of augment statement
122      */
123     void addAugment(AugmentationSchemaBuilder builder);
124
125     /**
126      * Get refine statements.
127      *
128      * @return list of RefineHolder objects
129      */
130     List<RefineHolder> getRefines();
131
132     /**
133      * Get refined nodes.
134      *
135      * @return List of refined SchemaNodeBuilder objects
136      */
137     List<SchemaNodeBuilder> getRefineNodes();
138
139     /**
140      * Add refine statement.
141      *
142      * @param refine
143      *            new RefineHolder object
144      */
145     void addRefine(RefineHolder refine);
146
147     /**
148      * Add refine node.
149      *
150      * @param refineNode
151      *            refined DataSchemaNodeBuilder object
152      */
153     void addRefineNode(DataSchemaNodeBuilder refineNode);
154
155     /**
156      * Build new UsesNode object.
157      */
158     UsesNode build(YangNode parent);
159
160     /**
161      * Get child nodes defined in target grouping.
162      *
163      * @return set of DataSchemaNodeBuilder objects
164      */
165     Set<DataSchemaNodeBuilder> getTargetChildren();
166
167     /**
168      * Get groupings defined in target grouping.
169      *
170      * @return set of GroupingBuilder objects
171      */
172     Set<GroupingBuilder> getTargetGroupings();
173
174     /**
175      * Get type definitions defined in target grouping.
176      *
177      * @return set of typedefs defined in target grouping
178      */
179     Set<TypeDefinitionBuilder> getTargetTypedefs();
180
181     /**
182      * Get unknown nodes defined in target grouping.
183      *
184      * @return list of unknown nodes defined in target grouping
185      */
186     List<UnknownSchemaNodeBuilder> getTargetUnknownNodes();
187
188     /**
189      *
190      * @return true, if this object was built based on another UsesNodeBuilder,
191      *         false otherwise
192      */
193     boolean isCopy();
194
195     /**
196      *
197      * @return true, if target grouping objects was loaded already, false
198      *         otherwise
199      */
200     boolean isDataCollected();
201
202     /**
203      * Set if target grouping objects was loaded already.
204      *
205      * @param dataCollected
206      */
207     void setDataCollected(boolean dataCollected);
208
209     boolean isResolved();
210
211     void setResolved(boolean resolved);
212
213 }