diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-03-10 16:49:58 +0100 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-03-10 16:49:58 +0100 |
commit | 7ec06722923d96d2e51300bafb44b920ca341d58 (patch) | |
tree | 3a3635f56092a4fe1d6c15d88872ea699fb97666 /src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java | |
parent | ssb added to encoder and decoder (diff) | |
download | UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar.gz UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar.bz2 UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar.lz UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar.xz UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.tar.zst UIC-barcode-7ec06722923d96d2e51300bafb44b920ca341d58.zip |
Diffstat (limited to 'src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java')
-rw-r--r-- | src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java b/src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java index c7f520d..73017d7 100644 --- a/src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java +++ b/src/main/java/org/uic/barcode/ssbFrame/SsbReservation.java @@ -30,17 +30,17 @@ public class SsbReservation extends SsbCommonTicketPart { @Override - protected void decodeContent(byte[] bytes) { + protected int decodeContent(byte[] bytes, int offset) { - int offset = decodeCommonPart(bytes); + offset = offset + decodeCommonPart(bytes); BitBuffer bits = new ByteBitBuffer(bytes); ticketSubType = bits.getInteger(offset, 2); - offset = offset + 4; + offset = offset + 2; stations = new SsbStations(); - stations.decode(offset, bytes); + offset = stations.decode(offset, bytes); /* * Departure date : First day of validity from the issuing date Num (<367) 9,000 @@ -60,7 +60,7 @@ public class SsbReservation extends SsbCommonTicketPart { offset = offset + 11; train = bits.getChar6String(offset, 30); - offset = offset +30; + offset = offset + 30; coach = bits.getInteger(offset, 10); offset = offset + 10; @@ -76,17 +76,19 @@ public class SsbReservation extends SsbCommonTicketPart { text = bits.getChar6String(offset, 162); offset = offset + 162; + + return offset; } @Override - protected void encodeContent(byte[] bytes) { + protected int encodeContent(byte[] bytes, int offset) { - int offset = encodeCommonPart(bytes); + offset = offset + encodeCommonPart(bytes, offset); BitBuffer bits = new ByteBitBuffer(bytes); bits.putInteger(offset, 2,ticketSubType); - offset = offset + 4; + offset = offset + 2; offset = stations.encode(offset, bytes); @@ -108,7 +110,7 @@ public class SsbReservation extends SsbCommonTicketPart { offset = offset + 11; bits.putChar6String(offset, 30,train); - offset = offset +30; + offset = offset + 30; bits.putInteger(offset, 10,coach); offset = offset + 10; @@ -117,7 +119,7 @@ public class SsbReservation extends SsbCommonTicketPart { offset = offset + 18; bits.put(offset, overbooking); - offset++; + offset++; bits.putInteger(offset, 14, infoCode); offset = offset + 14; @@ -125,6 +127,8 @@ public class SsbReservation extends SsbCommonTicketPart { bits.putChar6String(offset, 162, text); offset = offset + 162; + return offset; + } public SsbStations getStations() { |