blob: 5e33e36fd68f67ae2128473a82a7ca95110381e5 [file] [log] [blame]
Vinod Kumar S2ff139c2016-02-16 01:37:16 +05301/*
2 * Copyright 2016 Open Networking Laboratory
3 *
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.yangutils.datamodel;
18
19import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
20import org.onosproject.yangutils.parser.Parsable;
21import org.onosproject.yangutils.parser.ParsableDataType;
22
23/*-
24 * The "bit" statement, which is a sub-statement to the "type" statement,
25 * MUST be present if the type is "bits". It is repeatedly used to
26 * specify each assigned named bit of a bits type. It takes as an
27 * argument a string that is the assigned name of the bit. It is
28 * followed by a block of sub-statements that holds detailed bit
29 * information.
30 * All assigned names in a bits type MUST be unique.
31 *
32 * The bit's sub-statements
33 *
34 * +--------------+---------+-------------+------------------+
35 * | substatement | section | cardinality |data model mapping|
36 * +--------------+---------+-------------+------------------+
37 * | description | 7.19.3 | 0..1 | - string |
38 * | reference | 7.19.4 | 0..1 | - string |
39 * | status | 7.19.2 | 0..1 | - YangStatus |
40 * | position | 9.7.4.2 | 0..1 | - int |
41 * +--------------+---------+-------------+------------------+
42 */
43
44/**
45 * Maintains the bit data type information.
46 */
47public class YangBit implements YangCommonInfo, Parsable {
48
49 /**
50 * Name of the bit.
51 */
52 private String bitName;
53
54 /**
55 * Description of the bit field.
56 */
57 private String description;
58
59 /**
60 * reference info of the bit field.
61 */
62 private String reference;
63
64 /**
65 * Status of the bit field.
66 */
67 private YangStatusType status;
68
69 /**
70 * position of the bit whose name bit is described.
71 */
72 private int position;
73
74 /**
75 * Create a YANG bit type object.
76 */
77 public YangBit() {
78
79 }
80
81 /**
82 * Get the bit name.
83 *
84 * @return the bit name.
85 */
86 public String getBitName() {
87 return bitName;
88 }
89
90 /**
91 * Set the bit name.
92 *
93 * @param bitName the bit name to set.
94 */
95 public void setBitName(String bitName) {
96 this.bitName = bitName;
97 }
98
99 /**
100 * Get the description.
101 *
102 * @return the description.
103 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530104 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530105 public String getDescription() {
106 return description;
107 }
108
109 /**
110 * Set the description.
111 *
112 * @param description set the description.
113 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530114 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530115 public void setDescription(String description) {
116 this.description = description;
117 }
118
119 /**
120 * Get the textual reference.
121 *
122 * @return the reference.
123 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530124 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530125 public String getReference() {
126 return reference;
127 }
128
129 /**
130 * Set the textual reference.
131 *
132 * @param reference the reference to set.
133 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530134 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530135 public void setReference(String reference) {
136 this.reference = reference;
137 }
138
139 /**
140 * Get the status.
141 *
142 * @return the status.
143 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530144 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530145 public YangStatusType getStatus() {
146 return status;
147 }
148
149 /**
150 * Set the status.
151 *
152 * @param status the status to set.
153 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530154 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530155 public void setStatus(YangStatusType status) {
156 this.status = status;
157 }
158
159 /**
160 * Get the bit position.
161 *
162 * @return the position
163 */
164 public int getPosition() {
165 return position;
166 }
167
168 /**
169 * Set the bit position.
170 *
171 * @param position the position to set.
172 */
173 public void setPosition(int position) {
174 this.position = position;
175 }
176
177 /**
178 * Returns the type of the data.
179 *
180 * @return ParsedDataType returns BIT_DATA
181 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530182 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530183 public ParsableDataType getParsableDataType() {
184 return ParsableDataType.BIT_DATA;
185 }
186
187 /**
188 * Validate the data on entering the corresponding parse tree node.
189 *
190 * @throws DataModelException a violation of data model rules.
191 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530192 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530193 public void validateDataOnEntry() throws DataModelException {
194 // TODO auto-generated method stub, to be implemented by parser
195 }
196
197 /**
198 * Validate the data on exiting the corresponding parse tree node.
199 *
200 * @throws DataModelException a violation of data model rules.
201 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530202 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530203 public void validateDataOnExit() throws DataModelException {
204 // TODO auto-generated method stub, to be implemented by parser
205 }
206}