blob: 045192dd9fe4cc2baff0c568eff515ba8d0aaf0e [file] [log] [blame]
janani b05614f12016-10-04 12:55:43 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
janani b05614f12016-10-04 12:55:43 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.yms.app.ytb;
18
19import org.onosproject.yangutils.datamodel.YangAugment;
20
21import java.util.Iterator;
22import java.util.Map;
23
24/**
25 * Represents YTB node info for all the nodes that are added to the YDT
26 * builder tree.Contains the information which can be attached and retrieved
27 * back from YDT while walking.
28 */
29public class YtbNodeInfo {
30
31 /**
32 * Object of the corresponding YANG construct. This object is bound to
33 * each and every YDT node. So, whenever walk of parent and sibling
34 * happens, object can be retrieved from its YDT node.
35 */
36 private Object yangObject;
37
38 /**
39 * The list iterator since first content of the multi instance node is
40 * faced. With this iterator the node can be walked multiple times till
41 * it becomes empty.
42 */
43 private Iterator<Object> listIterator;
44
45 /**
46 * The current YTB node's, list of augments are iterated through this
47 * iterator. Every time an augment is built completely, this iterator
48 * gives the next augment node until it becomes empty.
49 */
50 private Iterator<YangAugment> augmentNodeItr;
51
52 /**
53 * The map with case object as value and choice node name as key is added
54 * for the current YTB info. Every time a case schema node comes, it takes
55 * this map and checks if it is present.
56 */
57 private Map<String, Object> choiceCaseMap;
58
59 /**
60 * When the case finds its object in map, it assigns it to case object of
61 * the YTB info, so when its child wants to take the parent object, they
62 * can take from the YTB info's case object.
63 */
64 private Object caseObject;
65
66 /**
67 * When the augment object is present, it assigns it to augment object of
68 * the YTB info, so when its child wants to take the parent object, they
69 * can take from the YTB info's augment object.
70 */
71 private Object augmentObject;
72
73 /**
74 * Constructs a default YTB node info.
75 */
76 public YtbNodeInfo() {
77 }
78
79 /**
80 * Returns the object of the YANG schema node.
81 *
82 * @return YANG node object
83 */
84 public Object getYangObject() {
85 return yangObject;
86 }
87
88 /**
89 * Sets the object of the YANG schema node.
90 *
91 * @param yangObject YANG node object
92 */
93 public void setYangObject(Object yangObject) {
94 this.yangObject = yangObject;
95 }
96
97 /**
98 * Returns the current list iterator of the YANG schema node.
99 *
100 * @return current list iterator for the schema node
101 */
102 public Iterator<Object> getListIterator() {
103 return listIterator;
104 }
105
106 /**
107 * Sets the current list iterator of the YANG schema node.
108 *
109 * @param listIterator current list iterator for the schema node
110 */
111 public void setListIterator(Iterator<Object> listIterator) {
112 this.listIterator = listIterator;
113 }
114
115 /**
116 * Returns the map of choice schema name and case object.
117 *
118 * @return choice name and case object map
119 */
120 public Map<String, Object> getChoiceCaseMap() {
121 return choiceCaseMap;
122 }
123
124 /**
125 * Sets the map of choice schema name and case object.
126 *
127 * @param choiceCaseMap choice name and case object map
128 */
129 public void setChoiceCaseMap(Map<String, Object> choiceCaseMap) {
130 this.choiceCaseMap = choiceCaseMap;
131 }
132
133 /**
134 * Returns the case object.
135 *
136 * @return case object
137 */
138 public Object getCaseObject() {
139 return caseObject;
140 }
141
142 /**
143 * Sets the case node object.
144 *
145 * @param caseObject case node object
146 */
147 public void setCaseObject(Object caseObject) {
148 this.caseObject = caseObject;
149 }
150
151 /**
152 * Returns the augment node object.
153 *
154 * @return augment node object
155 */
156 public Object getAugmentObject() {
157 return augmentObject;
158 }
159
160 /**
161 * Sets the augment node object.
162 *
163 * @param augmentObject augment node object
164 */
165 public void setAugmentObject(Object augmentObject) {
166 this.augmentObject = augmentObject;
167 }
168
169 /**
170 * Returns the current list iterator of the YANG augment node.
171 *
172 * @return augment node iterator
173 */
174 public Iterator<YangAugment> getAugmentIterator() {
175 return augmentNodeItr;
176 }
177
178 /**
179 * Sets the current list iterator of the YANG augment node.
180 *
181 * @param augmentNodeItr augment node iterator
182 */
183 public void setAugmentIterator(Iterator<YangAugment> augmentNodeItr) {
184 this.augmentNodeItr = augmentNodeItr;
185 }
186}