slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /** |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 2 | * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org) |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 3 | */ |
| 4 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 5 | package org.onosproject.xran.asn1lib.pdu; |
| 6 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 7 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 9 | import com.fasterxml.jackson.annotation.JsonValue; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 10 | import org.onosproject.xran.asn1lib.api.CRNTI; |
| 11 | import org.onosproject.xran.asn1lib.api.ECGI; |
| 12 | import org.onosproject.xran.asn1lib.api.L2MeasReportInterval; |
| 13 | import org.onosproject.xran.asn1lib.api.L2ReportInterval; |
| 14 | import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream; |
| 15 | import org.onosproject.xran.asn1lib.ber.BerLength; |
| 16 | import org.onosproject.xran.asn1lib.ber.BerTag; |
| 17 | import org.onosproject.xran.asn1lib.ber.types.string.BerUTF8String; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 18 | |
| 19 | import java.io.IOException; |
| 20 | import java.io.InputStream; |
| 21 | import java.io.Serializable; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 22 | import java.io.UnsupportedEncodingException; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 23 | import java.util.ArrayList; |
| 24 | import java.util.Iterator; |
| 25 | import java.util.List; |
| 26 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 27 | public class L2MeasConfig implements Serializable { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 28 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 29 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 30 | private static final long serialVersionUID = 1L; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 31 | @JsonIgnore |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 32 | public byte[] code = null; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 33 | private ECGI ecgi = null; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 34 | private Crnti crnti = null; |
| 35 | private L2ReportInterval reportIntervals = null; |
| 36 | |
| 37 | public L2MeasConfig() { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 38 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 39 | |
| 40 | public L2MeasConfig(byte[] code) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 41 | this.code = code; |
| 42 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 43 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 44 | public static XrancPdu constructPacket(ECGI ecgi, int l2MeasInterval) { |
| 45 | L2MeasConfig measConfig = new L2MeasConfig(); |
| 46 | measConfig.setEcgi(ecgi); |
| 47 | |
| 48 | L2ReportInterval l2ReportInterval = new L2ReportInterval(); |
| 49 | L2MeasReportInterval l2MeasReportInterval = new L2MeasReportInterval(l2MeasInterval); |
| 50 | l2ReportInterval.setTPdcpMeasReportPerUe(l2MeasReportInterval); |
| 51 | l2ReportInterval.setTRadioMeasReportPerCell(l2MeasReportInterval); |
| 52 | l2ReportInterval.setTRadioMeasReportPerUe(l2MeasReportInterval); |
| 53 | l2ReportInterval.setTRadioSchedReportPerUe(l2MeasReportInterval); |
| 54 | l2ReportInterval.setTRadioSchedReportPerCell(l2MeasReportInterval); |
| 55 | |
| 56 | measConfig.setReportIntervals(l2ReportInterval); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 57 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 58 | BerUTF8String ver = null; |
| 59 | try { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 60 | ver = new BerUTF8String("5"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 61 | } catch (UnsupportedEncodingException e) { |
| 62 | e.printStackTrace(); |
| 63 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 64 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 65 | XrancApiID apiID = new XrancApiID(16); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 66 | XrancPduBody body = new XrancPduBody(); |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 67 | body.setL2MeasConfig(measConfig); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 68 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 69 | XrancPduHdr hdr = new XrancPduHdr(); |
| 70 | hdr.setVer(ver); |
| 71 | hdr.setApiId(apiID); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 72 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 73 | XrancPdu pdu = new XrancPdu(); |
| 74 | pdu.setBody(body); |
| 75 | pdu.setHdr(hdr); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 76 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 77 | return pdu; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 78 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 79 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 80 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 81 | public ECGI getEcgi() { |
| 82 | return ecgi; |
| 83 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 84 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 85 | public void setEcgi(ECGI ecgi) { |
| 86 | this.ecgi = ecgi; |
| 87 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 88 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 89 | public Crnti getCrnti() { |
| 90 | return crnti; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 91 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 92 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 93 | public void setCrnti(Crnti crnti) { |
| 94 | this.crnti = crnti; |
| 95 | } |
| 96 | |
| 97 | public L2ReportInterval getReportIntervals() { |
| 98 | return reportIntervals; |
| 99 | } |
| 100 | |
| 101 | public void setReportIntervals(L2ReportInterval reportIntervals) { |
| 102 | this.reportIntervals = reportIntervals; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 103 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 104 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 105 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 106 | return encode(os, true); |
| 107 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 108 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 109 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 110 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 111 | if (code != null) { |
| 112 | for (int i = code.length - 1; i >= 0; i--) { |
| 113 | os.write(code[i]); |
| 114 | } |
| 115 | if (withTag) { |
| 116 | return tag.encode(os) + code.length; |
| 117 | } |
| 118 | return code.length; |
| 119 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 120 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 121 | int codeLength = 0; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 122 | codeLength += reportIntervals.encode(os, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 123 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 |
| 124 | os.write(0xA2); |
| 125 | codeLength += 1; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 126 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 127 | if (crnti != null) { |
| 128 | codeLength += crnti.encode(os, false); |
| 129 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 130 | os.write(0xA1); |
| 131 | codeLength += 1; |
| 132 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 133 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 134 | codeLength += ecgi.encode(os, false); |
| 135 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 136 | os.write(0xA0); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 137 | codeLength += 1; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 138 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 139 | codeLength += BerLength.encodeLength(os, codeLength); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 140 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 141 | if (withTag) { |
| 142 | codeLength += tag.encode(os); |
| 143 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 144 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 145 | return codeLength; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 146 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | public int decode(InputStream is) throws IOException { |
| 150 | return decode(is, true); |
| 151 | } |
| 152 | |
| 153 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 154 | int codeLength = 0; |
| 155 | int subCodeLength = 0; |
| 156 | BerTag berTag = new BerTag(); |
| 157 | |
| 158 | if (withTag) { |
| 159 | codeLength += tag.decodeAndCheck(is); |
| 160 | } |
| 161 | |
| 162 | BerLength length = new BerLength(); |
| 163 | codeLength += length.decode(is); |
| 164 | |
| 165 | int totalLength = length.val; |
| 166 | codeLength += totalLength; |
| 167 | |
| 168 | subCodeLength += berTag.decode(is); |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 169 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 170 | ecgi = new ECGI(); |
| 171 | subCodeLength += ecgi.decode(is, false); |
| 172 | subCodeLength += berTag.decode(is); |
| 173 | } else { |
| 174 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 175 | } |
| 176 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 177 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 178 | crnti = new Crnti(); |
| 179 | subCodeLength += crnti.decode(is, false); |
| 180 | subCodeLength += berTag.decode(is); |
| 181 | } |
| 182 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 183 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 184 | reportIntervals = new L2ReportInterval(); |
| 185 | subCodeLength += reportIntervals.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 186 | if (subCodeLength == totalLength) { |
| 187 | return codeLength; |
| 188 | } |
| 189 | } |
| 190 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 191 | |
| 192 | |
| 193 | } |
| 194 | |
| 195 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 196 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 197 | encode(os, false); |
| 198 | code = os.getArray(); |
| 199 | } |
| 200 | |
| 201 | public String toString() { |
| 202 | StringBuilder sb = new StringBuilder(); |
| 203 | appendAsString(sb, 0); |
| 204 | return sb.toString(); |
| 205 | } |
| 206 | |
| 207 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 208 | |
| 209 | sb.append("{"); |
| 210 | sb.append("\n"); |
| 211 | for (int i = 0; i < indentLevel + 1; i++) { |
| 212 | sb.append("\t"); |
| 213 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 214 | if (ecgi != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 215 | sb.append("ecgi: "); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 216 | ecgi.appendAsString(sb, indentLevel + 1); |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 217 | } else { |
| 218 | sb.append("ecgi: <empty-required-field>"); |
| 219 | } |
| 220 | |
| 221 | if (crnti != null) { |
| 222 | sb.append(",\n"); |
| 223 | for (int i = 0; i < indentLevel + 1; i++) { |
| 224 | sb.append("\t"); |
| 225 | } |
| 226 | sb.append("crnti: "); |
| 227 | crnti.appendAsString(sb, indentLevel + 1); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | sb.append(",\n"); |
| 231 | for (int i = 0; i < indentLevel + 1; i++) { |
| 232 | sb.append("\t"); |
| 233 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 234 | if (reportIntervals != null) { |
| 235 | sb.append("reportIntervals: "); |
| 236 | reportIntervals.appendAsString(sb, indentLevel + 1); |
| 237 | } else { |
| 238 | sb.append("reportIntervals: <empty-required-field>"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | sb.append("\n"); |
| 242 | for (int i = 0; i < indentLevel; i++) { |
| 243 | sb.append("\t"); |
| 244 | } |
| 245 | sb.append("}"); |
| 246 | } |
| 247 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 248 | public static class Crnti implements Serializable { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 249 | |
| 250 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 251 | private static final long serialVersionUID = 1L; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 252 | @JsonIgnore |
| 253 | public byte[] code = null; |
| 254 | private List<CRNTI> seqOf = null; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 255 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 256 | public Crnti() { |
| 257 | seqOf = new ArrayList<CRNTI>(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 258 | } |
| 259 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 260 | public Crnti(byte[] code) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 261 | this.code = code; |
| 262 | } |
| 263 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 264 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 265 | @JsonValue |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 266 | public List<CRNTI> getCRNTI() { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 267 | if (seqOf == null) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 268 | seqOf = new ArrayList<CRNTI>(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 269 | } |
| 270 | return seqOf; |
| 271 | } |
| 272 | |
| 273 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 274 | return encode(os, true); |
| 275 | } |
| 276 | |
| 277 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 278 | |
| 279 | if (code != null) { |
| 280 | for (int i = code.length - 1; i >= 0; i--) { |
| 281 | os.write(code[i]); |
| 282 | } |
| 283 | if (withTag) { |
| 284 | return tag.encode(os) + code.length; |
| 285 | } |
| 286 | return code.length; |
| 287 | } |
| 288 | |
| 289 | int codeLength = 0; |
| 290 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 291 | codeLength += seqOf.get(i).encode(os, true); |
| 292 | } |
| 293 | |
| 294 | codeLength += BerLength.encodeLength(os, codeLength); |
| 295 | |
| 296 | if (withTag) { |
| 297 | codeLength += tag.encode(os); |
| 298 | } |
| 299 | |
| 300 | return codeLength; |
| 301 | } |
| 302 | |
| 303 | public int decode(InputStream is) throws IOException { |
| 304 | return decode(is, true); |
| 305 | } |
| 306 | |
| 307 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 308 | int codeLength = 0; |
| 309 | int subCodeLength = 0; |
| 310 | if (withTag) { |
| 311 | codeLength += tag.decodeAndCheck(is); |
| 312 | } |
| 313 | |
| 314 | BerLength length = new BerLength(); |
| 315 | codeLength += length.decode(is); |
| 316 | int totalLength = length.val; |
| 317 | |
| 318 | while (subCodeLength < totalLength) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 319 | CRNTI element = new CRNTI(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 320 | subCodeLength += element.decode(is, true); |
| 321 | seqOf.add(element); |
| 322 | } |
| 323 | if (subCodeLength != totalLength) { |
| 324 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 325 | |
| 326 | } |
| 327 | codeLength += subCodeLength; |
| 328 | |
| 329 | return codeLength; |
| 330 | } |
| 331 | |
| 332 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 333 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 334 | encode(os, false); |
| 335 | code = os.getArray(); |
| 336 | } |
| 337 | |
| 338 | public String toString() { |
| 339 | StringBuilder sb = new StringBuilder(); |
| 340 | appendAsString(sb, 0); |
| 341 | return sb.toString(); |
| 342 | } |
| 343 | |
| 344 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 345 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 346 | sb.append("{\n"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 347 | for (int i = 0; i < indentLevel + 1; i++) { |
| 348 | sb.append("\t"); |
| 349 | } |
| 350 | if (seqOf == null) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 351 | sb.append("null"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 352 | } else { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 353 | Iterator<CRNTI> it = seqOf.iterator(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 354 | if (it.hasNext()) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 355 | sb.append(it.next()); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 356 | while (it.hasNext()) { |
| 357 | sb.append(",\n"); |
| 358 | for (int i = 0; i < indentLevel + 1; i++) { |
| 359 | sb.append("\t"); |
| 360 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 361 | sb.append(it.next()); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 362 | } |
| 363 | } |
| 364 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 365 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 366 | sb.append("\n"); |
| 367 | for (int i = 0; i < indentLevel; i++) { |
| 368 | sb.append("\t"); |
| 369 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 370 | sb.append("}"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 371 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 372 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 373 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 374 | |
| 375 | } |
| 376 | |