blob: 722f23944a1952534f3f82cc8ebb28ff4302d5a2 [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 */
104 public String getDescription() {
105 return description;
106 }
107
108 /**
109 * Set the description.
110 *
111 * @param description set the description.
112 */
113 public void setDescription(String description) {
114 this.description = description;
115 }
116
117 /**
118 * Get the textual reference.
119 *
120 * @return the reference.
121 */
122 public String getReference() {
123 return reference;
124 }
125
126 /**
127 * Set the textual reference.
128 *
129 * @param reference the reference to set.
130 */
131 public void setReference(String reference) {
132 this.reference = reference;
133 }
134
135 /**
136 * Get the status.
137 *
138 * @return the status.
139 */
140 public YangStatusType getStatus() {
141 return status;
142 }
143
144 /**
145 * Set the status.
146 *
147 * @param status the status to set.
148 */
149 public void setStatus(YangStatusType status) {
150 this.status = status;
151 }
152
153 /**
154 * Get the bit position.
155 *
156 * @return the position
157 */
158 public int getPosition() {
159 return position;
160 }
161
162 /**
163 * Set the bit position.
164 *
165 * @param position the position to set.
166 */
167 public void setPosition(int position) {
168 this.position = position;
169 }
170
171 /**
172 * Returns the type of the data.
173 *
174 * @return ParsedDataType returns BIT_DATA
175 */
176 public ParsableDataType getParsableDataType() {
177 return ParsableDataType.BIT_DATA;
178 }
179
180 /**
181 * Validate the data on entering the corresponding parse tree node.
182 *
183 * @throws DataModelException a violation of data model rules.
184 */
185 public void validateDataOnEntry() throws DataModelException {
186 // TODO auto-generated method stub, to be implemented by parser
187 }
188
189 /**
190 * Validate the data on exiting the corresponding parse tree node.
191 *
192 * @throws DataModelException a violation of data model rules.
193 */
194 public void validateDataOnExit() throws DataModelException {
195 // TODO auto-generated method stub, to be implemented by parser
196 }
197}