added javadocs and comments
diff --git a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
index a02833d..7a44283 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
@@ -16,168 +16,172 @@
public class PCIARFCN implements Serializable {
- private static final long serialVersionUID = 1L;
+ public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+ private static final long serialVersionUID = 1L;
+ @JsonIgnore
+ public byte[] code = null;
+ private PhysCellId pci = null;
+ private ARFCNValue earfcnDl = null;
- public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+ public PCIARFCN() {
+ }
- @JsonIgnore
- public byte[] code = null;
- private PhysCellId pci = null;
- private ARFCNValue earfcnDl = null;
-
- public PCIARFCN() {
- }
+ public PCIARFCN(byte[] code) {
+ this.code = code;
+ }
- public PCIARFCN(byte[] code) {
- this.code = code;
- }
+ public static PCIARFCN valueOf(PhysCellId pci, ARFCNValue arfcnValue) {
+ PCIARFCN pciarfcn = new PCIARFCN();
+ pciarfcn.setEarfcnDl(arfcnValue);
+ pciarfcn.setPci(pci);
+ return pciarfcn;
+ }
- public void setPci(PhysCellId pci) {
- this.pci = pci;
- }
+ public PhysCellId getPci() {
+ return pci;
+ }
- public PhysCellId getPci() {
- return pci;
- }
+ public void setPci(PhysCellId pci) {
+ this.pci = pci;
+ }
- public void setEarfcnDl(ARFCNValue earfcnDl) {
- this.earfcnDl = earfcnDl;
- }
+ public ARFCNValue getEarfcnDl() {
+ return earfcnDl;
+ }
- public ARFCNValue getEarfcnDl() {
- return earfcnDl;
- }
+ public void setEarfcnDl(ARFCNValue earfcnDl) {
+ this.earfcnDl = earfcnDl;
+ }
- public int encode(BerByteArrayOutputStream os) throws IOException {
- return encode(os, true);
- }
+ public int encode(BerByteArrayOutputStream os) throws IOException {
+ return encode(os, true);
+ }
- public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
+ public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
- if (code != null) {
- for (int i = code.length - 1; i >= 0; i--) {
- os.write(code[i]);
- }
- if (withTag) {
- return tag.encode(os) + code.length;
- }
- return code.length;
- }
+ if (code != null) {
+ for (int i = code.length - 1; i >= 0; i--) {
+ os.write(code[i]);
+ }
+ if (withTag) {
+ return tag.encode(os) + code.length;
+ }
+ return code.length;
+ }
- int codeLength = 0;
- codeLength += earfcnDl.encode(os, false);
- // write tag: CONTEXT_CLASS, PRIMITIVE, 1
- os.write(0x81);
- codeLength += 1;
-
- codeLength += pci.encode(os, false);
- // write tag: CONTEXT_CLASS, PRIMITIVE, 0
- os.write(0x80);
- codeLength += 1;
-
- codeLength += BerLength.encodeLength(os, codeLength);
+ int codeLength = 0;
+ codeLength += earfcnDl.encode(os, false);
+ // write tag: CONTEXT_CLASS, PRIMITIVE, 1
+ os.write(0x81);
+ codeLength += 1;
- if (withTag) {
- codeLength += tag.encode(os);
- }
+ codeLength += pci.encode(os, false);
+ // write tag: CONTEXT_CLASS, PRIMITIVE, 0
+ os.write(0x80);
+ codeLength += 1;
- return codeLength;
+ codeLength += BerLength.encodeLength(os, codeLength);
- }
+ if (withTag) {
+ codeLength += tag.encode(os);
+ }
- public int decode(InputStream is) throws IOException {
- return decode(is, true);
- }
+ return codeLength;
- public int decode(InputStream is, boolean withTag) throws IOException {
- int codeLength = 0;
- int subCodeLength = 0;
- BerTag berTag = new BerTag();
+ }
- if (withTag) {
- codeLength += tag.decodeAndCheck(is);
- }
+ public int decode(InputStream is) throws IOException {
+ return decode(is, true);
+ }
- BerLength length = new BerLength();
- codeLength += length.decode(is);
+ public int decode(InputStream is, boolean withTag) throws IOException {
+ int codeLength = 0;
+ int subCodeLength = 0;
+ BerTag berTag = new BerTag();
- int totalLength = length.val;
- codeLength += totalLength;
+ if (withTag) {
+ codeLength += tag.decodeAndCheck(is);
+ }
- subCodeLength += berTag.decode(is);
- if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
- pci = new PhysCellId();
- subCodeLength += pci.decode(is, false);
- subCodeLength += berTag.decode(is);
- }
- else {
- throw new IOException("Tag does not match the mandatory sequence element tag.");
- }
-
- if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
- earfcnDl = new ARFCNValue();
- subCodeLength += earfcnDl.decode(is, false);
- if (subCodeLength == totalLength) {
- return codeLength;
- }
- }
- throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
+ BerLength length = new BerLength();
+ codeLength += length.decode(is);
-
- }
+ int totalLength = length.val;
+ codeLength += totalLength;
- public void encodeAndSave(int encodingSizeGuess) throws IOException {
- BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
- encode(os, false);
- code = os.getArray();
- }
+ subCodeLength += berTag.decode(is);
+ if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
+ pci = new PhysCellId();
+ subCodeLength += pci.decode(is, false);
+ subCodeLength += berTag.decode(is);
+ } else {
+ throw new IOException("Tag does not match the mandatory sequence element tag.");
+ }
- public String toString() {
- StringBuilder sb = new StringBuilder();
- appendAsString(sb, 0);
- return sb.toString();
- }
+ if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
+ earfcnDl = new ARFCNValue();
+ subCodeLength += earfcnDl.decode(is, false);
+ if (subCodeLength == totalLength) {
+ return codeLength;
+ }
+ }
+ throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
- public void appendAsString(StringBuilder sb, int indentLevel) {
- sb.append("{");
- sb.append("\n");
- for (int i = 0; i < indentLevel + 1; i++) {
- sb.append("\t");
- }
- if (pci != null) {
- sb.append("pci: ").append(pci);
- }
-
- sb.append(",\n");
- for (int i = 0; i < indentLevel + 1; i++) {
- sb.append("\t");
- }
- if (earfcnDl != null) {
- sb.append("earfcnDl: ").append(earfcnDl);
- }
-
- sb.append("\n");
- for (int i = 0; i < indentLevel; i++) {
- sb.append("\t");
- }
- sb.append("}");
- }
+ }
- @Override
- public boolean equals(Object o) {
- if (o instanceof PCIARFCN) {
- return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
- }
+ public void encodeAndSave(int encodingSizeGuess) throws IOException {
+ BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
+ encode(os, false);
+ code = os.getArray();
+ }
- return super.equals(o);
- }
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ appendAsString(sb, 0);
+ return sb.toString();
+ }
- @Override
- public int hashCode() {
- int result = pci.hashCode();
- result = 31 * result + earfcnDl.hashCode();
- return result;
- }
+ public void appendAsString(StringBuilder sb, int indentLevel) {
+
+ sb.append("{");
+ sb.append("\n");
+ for (int i = 0; i < indentLevel + 1; i++) {
+ sb.append("\t");
+ }
+ if (pci != null) {
+ sb.append("pci: ").append(pci);
+ }
+
+ sb.append(",\n");
+ for (int i = 0; i < indentLevel + 1; i++) {
+ sb.append("\t");
+ }
+ if (earfcnDl != null) {
+ sb.append("earfcnDl: ").append(earfcnDl);
+ }
+
+ sb.append("\n");
+ for (int i = 0; i < indentLevel; i++) {
+ sb.append("\t");
+ }
+ sb.append("}");
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof PCIARFCN) {
+ return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
+ }
+
+ return super.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = pci.hashCode();
+ result = 31 * result + earfcnDl.hashCode();
+ return result;
+ }
}
diff --git a/src/main/java/org.onosproject.xran/codecs/api/package-info.java b/src/main/java/org.onosproject.xran/codecs/api/package-info.java
index e3949c9..ace3595 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java b/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
index 570aae0..f258255 100644
--- a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.