pops.ale.epc.spec.grouping.string
Class GroupPattern
java.lang.Object
pops.ale.epc.spec.grouping.string.Epc
pops.ale.epc.spec.grouping.string.GroupPattern
public class GroupPattern
- extends Epc
Representation of an URI object containing a Grouping pattern.
Pattern codes may be in one of the following forms :
- epc-tag type :
urn:epc:pat:sgtin-96:FilterValue.CompanyPrefix.ItemReference.SerialNumber
urn:epc:pat:sgln-96:FilterValue.CompanyPrefix.LocationReference.ExtensionComponent
- epc-pure type :
urn:epc:idpat:sgtin:CompanyPrefix.ItemReference.SerialNumber
urn:epc:idpat:sgln:CompanyPrefix.LocationReference.ExtensionComponent
The difference from Epc
class is that fields may have one of the following values :
- Number : equals number
- [Lo-hi] : in interval
- * : Any
- X : Group By
However, this class considers the URI in the following notation :
'header':'type':'field_1'.'field_2'.'...etc'.'field_n'
Example for a given epc-tag URI : urn:epc:pat:sgtin-96:3.*.X.[40-50]
Meaning that we have to group by CompanyPrefix the SGTINs having the FilterValue equal to 3,
and the SerialNumber between 40 and 50 inclusive.
The URI will be decoded as follows:
- header = 'urn:epc:pat'
- type = 'sgtin-96'
- field_1 = '3'
- field_2 = '*'
- field_3 = 'X'
- field_4 = '[40-50]'
Finally, not all constructs are permitted, and this class assumes that the patterns are valid.
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GroupPattern
public GroupPattern(java.lang.String patternUri)
- Constructor
- Parameters:
patternUri
-
GroupPattern
public GroupPattern()
- Constructor
matches
public static boolean matches(Epc epc,
GroupPattern patternGroup)
- Utility for testing if a given epc URI matches a grouping patern
- Parameters:
epc
- URI to match against grouppatternGroup
- to match
- Returns:
areDisjoint
public static boolean areDisjoint(GroupPattern gPattA,
GroupPattern gPattB)
- Disjointness of two patterns test. It is defined as follows :
Let Pat_i and Pat_j be two pattern URIs, written as a series of fields as follows:
Pat_i = urn:epc:pat:type_i:field_i_1.field_i_2.field_i_3...
Pat_j = urn:epc:pat:type_j:field_j_1.field_j_2.field_j_3...
Then Pat_i and Pat_j are disjoint if:
- type_i is not equal to type_j
- type_i = type_j but there is at least one field k for which
field_i_k and field_j_k are disjoint (cf.
areDisjoint
)
- Parameters:
gPattA
- Group pattern leftgPattB
- Group pattern right
- Returns:
- true if disjoint, false otherwise
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception