Skip to content

Commit

Permalink
SSCC and GSRN implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jlcout committed Oct 15, 2017
1 parent 48bfd44 commit abe93f1
Show file tree
Hide file tree
Showing 11 changed files with 992 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.epctagcoder.option.GSRN;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNFilterValue {
ALL_OTHERS_0(0),
RESERVED_1(1),
RESERVED_2(2),
RESERVED_3(3),
RESERVED_4(4),
RESERVED_5(5),
RESERVED_6(6),
RESERVED_7(7);

private int value;

private GSRNFilterValue(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, GSRNFilterValue> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNFilterValue rae : GSRNFilterValue.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNFilterValue forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.epctagcoder.option.GSRN;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNHeader {
HEADER_00101101("00101101") {
public Integer getTagSize() {
return 96;
}
};

private String value;
public abstract Integer getTagSize();


private GSRNHeader(String value) {
this.value = value;
}

public String getValue() {
return value;
}

private static final Map<String, GSRNHeader> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNHeader rae : GSRNHeader.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNHeader forCode(String code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.epctagcoder.option.GSRN;

import java.util.LinkedHashMap;
import java.util.Map;

public enum GSRNTagSize {
BITS_96(96) {
public Integer getHeader() {
return 45;
}
};

private int value;
public abstract Integer getHeader();

private GSRNTagSize(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, GSRNTagSize> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (GSRNTagSize rae : GSRNTagSize.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static GSRNTagSize forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.epctagcoder.option.GSRN.partitionTable;

import java.util.ArrayList;
import java.util.List;

import org.epctagcoder.option.TableItem;


public class GSRNPartitionTableList {
static final private List<TableItem> list = new ArrayList<TableItem>();

static {
list.add( new TableItem(0, 40, 12, 18, 5) );
list.add( new TableItem(1, 37, 11, 21, 6) );
list.add( new TableItem(2, 34, 10, 24, 7) );
list.add( new TableItem(3, 30, 9, 28, 8) );
list.add( new TableItem(4, 27, 8, 31, 9) );
list.add( new TableItem(5, 24, 7, 34, 10) );
list.add( new TableItem(6, 20, 6, 38, 11) );
}

public GSRNPartitionTableList() {

}

public TableItem getPartitionByL(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getL()==index) {
tableItem = item;
break;
}
}
return tableItem;
}

public TableItem getPartitionByValue(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getPartitionValue()==index) {
tableItem = item;
break;
}
}
return tableItem;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.epctagcoder.option.SSCC;

import java.util.LinkedHashMap;
import java.util.Map;

public enum SSCCExtensionDigit {
EXTENSION_0(0),
EXTENSION_1(1),
EXTENSION_2(2),
EXTENSION_3(3),
EXTENSION_4(4),
EXTENSION_5(5),
EXTENSION_6(6),
EXTENSION_7(7),
EXTENSION_8(8),
EXTENSION_9(9);

private int value;

private SSCCExtensionDigit(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, SSCCExtensionDigit> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (SSCCExtensionDigit rae : SSCCExtensionDigit.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static SSCCExtensionDigit forCode(int code) {
return BY_CODE_MAP.get(code);
}




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.epctagcoder.option.SSCC;

import java.util.LinkedHashMap;
import java.util.Map;

public enum SSCCFilterValue {
ALL_OTHERS_0(0),
RESERVED_1(1),
CASE_2(2),
RESERVED_3(3),
RESERVED_4(4),
RESERVED_5(5),
UNIT_LOAD_6(6),
RESERVED_7(7);

private int value;

private SSCCFilterValue(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, SSCCFilterValue> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (SSCCFilterValue rae : SSCCFilterValue.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static SSCCFilterValue forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.epctagcoder.option.SSCC;

import java.util.LinkedHashMap;
import java.util.Map;

public enum SSCCHeader {
HEADER_00110001("00110001") {
public Integer getTagSize() {
return 96;
}
};

private String value;
public abstract Integer getTagSize();


private SSCCHeader(String value) {
this.value = value;
}

public String getValue() {
return value;
}

private static final Map<String, SSCCHeader> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (SSCCHeader rae : SSCCHeader.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static SSCCHeader forCode(String code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.epctagcoder.option.SSCC;

import java.util.LinkedHashMap;
import java.util.Map;

public enum SSCCTagSize {
BITS_96(96) {
public Integer getHeader() {
return 49;
}
};

private int value;
public abstract Integer getHeader();

private SSCCTagSize(int value) {
this.value = value;
}

public int getValue() {
return value;
}

private static final Map<Integer, SSCCTagSize> BY_CODE_MAP = new LinkedHashMap<>();
static {
for (SSCCTagSize rae : SSCCTagSize.values()) {
BY_CODE_MAP.put(rae.value, rae);
}
}

public static SSCCTagSize forCode(int code) {
return BY_CODE_MAP.get(code);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.epctagcoder.option.SSCC.partitionTable;

import java.util.ArrayList;
import java.util.List;

import org.epctagcoder.option.TableItem;


public class SSCCPartitionTableList {
static final private List<TableItem> list = new ArrayList<TableItem>();

static {
list.add( new TableItem(0, 40, 12, 18, 5) );
list.add( new TableItem(1, 37, 11, 21, 6) );
list.add( new TableItem(2, 34, 10, 24, 7) );
list.add( new TableItem(3, 30, 9, 28, 8) );
list.add( new TableItem(4, 27, 8, 31, 9) );
list.add( new TableItem(5, 24, 7, 34, 10) );
list.add( new TableItem(6, 20, 6, 38, 11) );
}

public SSCCPartitionTableList() {

}

public TableItem getPartitionByL(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getL()==index) {
tableItem = item;
break;
}
}
return tableItem;
}

public TableItem getPartitionByValue(Integer index) {
TableItem tableItem = null;
for (TableItem item : list) {
if (item.getPartitionValue()==index) {
tableItem = item;
break;
}
}
return tableItem;
}


}
Loading

0 comments on commit abe93f1

Please sign in to comment.