-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GSRN-P implementation and fix SGTIN
- Loading branch information
jlcout
committed
Dec 6, 2020
1 parent
aab073a
commit 2a1aa84
Showing
11 changed files
with
504 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
epctagcoder/src/main/java/org/epctagcoder/option/GSRNP/GSRNPFilterValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.epctagcoder.option.GSRNP; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum GSRNPFilterValue { | ||
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 GSRNPFilterValue(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<Integer, GSRNPFilterValue> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (GSRNPFilterValue rae : GSRNPFilterValue.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static GSRNPFilterValue forCode(int code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
37 changes: 37 additions & 0 deletions
37
epctagcoder/src/main/java/org/epctagcoder/option/GSRNP/GSRNPHeader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.epctagcoder.option.GSRNP; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum GSRNPHeader { | ||
HEADER_00101110("00101110") { | ||
public Integer getTagSize() { | ||
return 96; | ||
} | ||
}; | ||
|
||
private String value; | ||
public abstract Integer getTagSize(); | ||
|
||
|
||
private GSRNPHeader(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<String, GSRNPHeader> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (GSRNPHeader rae : GSRNPHeader.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static GSRNPHeader forCode(String code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
36 changes: 36 additions & 0 deletions
36
epctagcoder/src/main/java/org/epctagcoder/option/GSRNP/GSRNPTagSize.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.epctagcoder.option.GSRNP; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum GSRNPTagSize { | ||
BITS_96(96) { | ||
public Integer getHeader() { | ||
return 46; | ||
} | ||
}; | ||
|
||
private int value; | ||
public abstract Integer getHeader(); | ||
|
||
private GSRNPTagSize(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<Integer, GSRNPTagSize> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (GSRNPTagSize rae : GSRNPTagSize.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static GSRNPTagSize forCode(int code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
49 changes: 49 additions & 0 deletions
49
...er/src/main/java/org/epctagcoder/option/GSRNP/partitionTable/GSRNPPartitionTableList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.epctagcoder.option.GSRNP.partitionTable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.epctagcoder.option.TableItem; | ||
|
||
|
||
public class GSRNPPartitionTableList { | ||
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 GSRNPPartitionTableList() { | ||
|
||
} | ||
|
||
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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.