Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org) |
| 3 | */ |
| 4 | |
| 5 | package org.onosproject.xran.asn1lib.api; |
| 6 | |
| 7 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 8 | import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream; |
| 9 | import org.onosproject.xran.asn1lib.ber.BerLength; |
| 10 | import org.onosproject.xran.asn1lib.ber.BerTag; |
| 11 | |
| 12 | import java.io.IOException; |
| 13 | import java.io.InputStream; |
| 14 | import java.io.Serializable; |
| 15 | |
| 16 | |
| 17 | public class MeasObject implements Serializable { |
| 18 | |
| 19 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 20 | private static final long serialVersionUID = 1L; |
| 21 | @JsonIgnore |
| 22 | public byte[] code = null; |
| 23 | private ARFCNValue dlFreq = null; |
| 24 | private MeasCells measCells = null; |
| 25 | public MeasObject() { |
| 26 | } |
| 27 | |
| 28 | public MeasObject(byte[] code) { |
| 29 | this.code = code; |
| 30 | } |
| 31 | |
| 32 | public ARFCNValue getDlFreq() { |
| 33 | return dlFreq; |
| 34 | } |
| 35 | |
| 36 | public void setDlFreq(ARFCNValue dlFreq) { |
| 37 | this.dlFreq = dlFreq; |
| 38 | } |
| 39 | |
| 40 | public MeasCells getMeasCells() { |
| 41 | return measCells; |
| 42 | } |
| 43 | |
| 44 | public void setMeasCells(MeasCells measCells) { |
| 45 | this.measCells = measCells; |
| 46 | } |
| 47 | |
| 48 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 49 | return encode(os, true); |
| 50 | } |
| 51 | |
| 52 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 53 | |
| 54 | if (code != null) { |
| 55 | for (int i = code.length - 1; i >= 0; i--) { |
| 56 | os.write(code[i]); |
| 57 | } |
| 58 | if (withTag) { |
| 59 | return tag.encode(os) + code.length; |
| 60 | } |
| 61 | return code.length; |
| 62 | } |
| 63 | |
| 64 | int codeLength = 0; |
| 65 | if (measCells != null) { |
| 66 | codeLength += measCells.encode(os, false); |
| 67 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 68 | os.write(0xA1); |
| 69 | codeLength += 1; |
| 70 | } |
| 71 | |
| 72 | codeLength += dlFreq.encode(os, false); |
| 73 | // write tag: CONTEXT_CLASS, PRIMITIVE, 0 |
| 74 | os.write(0x80); |
| 75 | codeLength += 1; |
| 76 | |
| 77 | codeLength += BerLength.encodeLength(os, codeLength); |
| 78 | |
| 79 | if (withTag) { |
| 80 | codeLength += tag.encode(os); |
| 81 | } |
| 82 | |
| 83 | return codeLength; |
| 84 | |
| 85 | } |
| 86 | |
| 87 | public int decode(InputStream is) throws IOException { |
| 88 | return decode(is, true); |
| 89 | } |
| 90 | |
| 91 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 92 | int codeLength = 0; |
| 93 | int subCodeLength = 0; |
| 94 | BerTag berTag = new BerTag(); |
| 95 | |
| 96 | if (withTag) { |
| 97 | codeLength += tag.decodeAndCheck(is); |
| 98 | } |
| 99 | |
| 100 | BerLength length = new BerLength(); |
| 101 | codeLength += length.decode(is); |
| 102 | |
| 103 | int totalLength = length.val; |
| 104 | codeLength += totalLength; |
| 105 | |
| 106 | subCodeLength += berTag.decode(is); |
| 107 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { |
| 108 | dlFreq = new ARFCNValue(); |
| 109 | subCodeLength += dlFreq.decode(is, false); |
| 110 | if (subCodeLength == totalLength) { |
| 111 | return codeLength; |
| 112 | } |
| 113 | subCodeLength += berTag.decode(is); |
| 114 | } else { |
| 115 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 116 | } |
| 117 | |
| 118 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 119 | measCells = new MeasCells(); |
| 120 | subCodeLength += measCells.decode(is, false); |
| 121 | if (subCodeLength == totalLength) { |
| 122 | return codeLength; |
| 123 | } |
| 124 | } |
| 125 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 126 | |
| 127 | |
| 128 | } |
| 129 | |
| 130 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 131 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 132 | encode(os, false); |
| 133 | code = os.getArray(); |
| 134 | } |
| 135 | |
| 136 | public String toString() { |
| 137 | StringBuilder sb = new StringBuilder(); |
| 138 | appendAsString(sb, 0); |
| 139 | return sb.toString(); |
| 140 | } |
| 141 | |
| 142 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 143 | |
| 144 | sb.append("{"); |
| 145 | sb.append("\n"); |
| 146 | for (int i = 0; i < indentLevel + 1; i++) { |
| 147 | sb.append("\t"); |
| 148 | } |
| 149 | if (dlFreq != null) { |
| 150 | sb.append("dlFreq: ").append(dlFreq); |
| 151 | } else { |
| 152 | sb.append("dlFreq: <empty-required-field>"); |
| 153 | } |
| 154 | |
| 155 | if (measCells != null) { |
| 156 | sb.append(",\n"); |
| 157 | for (int i = 0; i < indentLevel + 1; i++) { |
| 158 | sb.append("\t"); |
| 159 | } |
| 160 | sb.append("measCells: "); |
| 161 | measCells.appendAsString(sb, indentLevel + 1); |
| 162 | } |
| 163 | |
| 164 | sb.append("\n"); |
| 165 | for (int i = 0; i < indentLevel; i++) { |
| 166 | sb.append("\t"); |
| 167 | } |
| 168 | sb.append("}"); |
| 169 | } |
| 170 | |
| 171 | public static class MeasCells implements Serializable { |
| 172 | |
| 173 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 174 | private static final long serialVersionUID = 1L; |
| 175 | @JsonIgnore |
| 176 | public byte[] code = null; |
| 177 | private PhysCellId pci = null; |
| 178 | private QOffsetRange cellIndividualOffset = null; |
| 179 | |
| 180 | public MeasCells() { |
| 181 | } |
| 182 | |
| 183 | public MeasCells(byte[] code) { |
| 184 | this.code = code; |
| 185 | } |
| 186 | |
| 187 | public PhysCellId getPci() { |
| 188 | return pci; |
| 189 | } |
| 190 | |
| 191 | public void setPci(PhysCellId pci) { |
| 192 | this.pci = pci; |
| 193 | } |
| 194 | |
| 195 | public QOffsetRange getCellIndividualOffset() { |
| 196 | return cellIndividualOffset; |
| 197 | } |
| 198 | |
| 199 | public void setCellIndividualOffset(QOffsetRange cellIndividualOffset) { |
| 200 | this.cellIndividualOffset = cellIndividualOffset; |
| 201 | } |
| 202 | |
| 203 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 204 | return encode(os, true); |
| 205 | } |
| 206 | |
| 207 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 208 | |
| 209 | if (code != null) { |
| 210 | for (int i = code.length - 1; i >= 0; i--) { |
| 211 | os.write(code[i]); |
| 212 | } |
| 213 | if (withTag) { |
| 214 | return tag.encode(os) + code.length; |
| 215 | } |
| 216 | return code.length; |
| 217 | } |
| 218 | |
| 219 | int codeLength = 0; |
| 220 | if (cellIndividualOffset != null) { |
| 221 | codeLength += cellIndividualOffset.encode(os, false); |
| 222 | // write tag: CONTEXT_CLASS, PRIMITIVE, 1 |
| 223 | os.write(0x81); |
| 224 | codeLength += 1; |
| 225 | } |
| 226 | |
| 227 | codeLength += pci.encode(os, false); |
| 228 | // write tag: CONTEXT_CLASS, PRIMITIVE, 0 |
| 229 | os.write(0x80); |
| 230 | codeLength += 1; |
| 231 | |
| 232 | codeLength += BerLength.encodeLength(os, codeLength); |
| 233 | |
| 234 | if (withTag) { |
| 235 | codeLength += tag.encode(os); |
| 236 | } |
| 237 | |
| 238 | return codeLength; |
| 239 | |
| 240 | } |
| 241 | |
| 242 | public int decode(InputStream is) throws IOException { |
| 243 | return decode(is, true); |
| 244 | } |
| 245 | |
| 246 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 247 | int codeLength = 0; |
| 248 | int subCodeLength = 0; |
| 249 | BerTag berTag = new BerTag(); |
| 250 | |
| 251 | if (withTag) { |
| 252 | codeLength += tag.decodeAndCheck(is); |
| 253 | } |
| 254 | |
| 255 | BerLength length = new BerLength(); |
| 256 | codeLength += length.decode(is); |
| 257 | |
| 258 | int totalLength = length.val; |
| 259 | codeLength += totalLength; |
| 260 | |
| 261 | subCodeLength += berTag.decode(is); |
| 262 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { |
| 263 | pci = new PhysCellId(); |
| 264 | subCodeLength += pci.decode(is, false); |
| 265 | if (subCodeLength == totalLength) { |
| 266 | return codeLength; |
| 267 | } |
| 268 | subCodeLength += berTag.decode(is); |
| 269 | } else { |
| 270 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 271 | } |
| 272 | |
| 273 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { |
| 274 | cellIndividualOffset = new QOffsetRange(); |
| 275 | subCodeLength += cellIndividualOffset.decode(is, false); |
| 276 | if (subCodeLength == totalLength) { |
| 277 | return codeLength; |
| 278 | } |
| 279 | } |
| 280 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 281 | |
| 282 | |
| 283 | } |
| 284 | |
| 285 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 286 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 287 | encode(os, false); |
| 288 | code = os.getArray(); |
| 289 | } |
| 290 | |
| 291 | public String toString() { |
| 292 | StringBuilder sb = new StringBuilder(); |
| 293 | appendAsString(sb, 0); |
| 294 | return sb.toString(); |
| 295 | } |
| 296 | |
| 297 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 298 | |
| 299 | sb.append("{"); |
| 300 | sb.append("\n"); |
| 301 | for (int i = 0; i < indentLevel + 1; i++) { |
| 302 | sb.append("\t"); |
| 303 | } |
| 304 | if (pci != null) { |
| 305 | sb.append("pci: ").append(pci); |
| 306 | } else { |
| 307 | sb.append("pci: <empty-required-field>"); |
| 308 | } |
| 309 | |
| 310 | if (cellIndividualOffset != null) { |
| 311 | sb.append(",\n"); |
| 312 | for (int i = 0; i < indentLevel + 1; i++) { |
| 313 | sb.append("\t"); |
| 314 | } |
| 315 | sb.append("cellIndividualOffset: ").append(cellIndividualOffset); |
| 316 | } |
| 317 | |
| 318 | sb.append("\n"); |
| 319 | for (int i = 0; i < indentLevel; i++) { |
| 320 | sb.append("\t"); |
| 321 | } |
| 322 | sb.append("}"); |
| 323 | } |
| 324 | |
| 325 | } |
| 326 | |
| 327 | } |
| 328 | |