本文整理匯總了Java中org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec類的典型用法代碼示例。如果您正苦於以下問題:Java ECGroupSpec類的具體用法?Java ECGroupSpec怎麽用?Java ECGroupSpec使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ECGroupSpec類屬於org.fosstrak.ale.xsd.ale.epcglobal包,在下文中一共展示了ECGroupSpec類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkGroupSpec
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
/**
* check the group spec patterns do not have intersecting groups -> all group patterns have to be disjoint:<br/>
* <ul>
* <li>the same pattern is not allowed to occur twice</li>
* <li>two different pattern with intersecting selectors are not allowed</li>
* <li>no pattern at all is allowed</li>
* </ul>
* @param groupSpec the group spec to tested.
* @throws ECSpecValidationException upon violation.
* @return true if filter group spec is valid. exception otherwise.
*/
public boolean checkGroupSpec(ECGroupSpec groupSpec) throws ECSpecValidationException {
if (groupSpec != null) {
String[] patterns = groupSpec.getPattern().toArray(new String[] {});
for (int i=0; i<patterns.length-1; i++) {
final String pattern1 = patterns[i];
for (int j=i+1; j<patterns.length; j++) {
final String pattern2 = patterns[j];
if (!patternDisjoint(pattern1, pattern2)) {
throw logAndCreateECSpecValidationException("The two grouping patterns '" + pattern1 + "' and '" + pattern2 + "' are not disjoint.");
}
}
}
}
return true;
}
示例2: createECReportSpec
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
public static ECReportSpec createECReportSpec() {
// create spec
ECReportSpec spec = new ECReportSpec();
// set paramteters
spec.setReportName(REPORT_NAME);
spec.setReportOnlyOnChange(REPORT_ONLY_ON_CHANGE);
spec.setReportIfEmpty(REPORT_IF_EMPTY);
spec.setReportSet(createECReportSetSpec());
spec.setFilterSpec(createECFilterSpec());
spec.setGroupSpec(new ECGroupSpec());
spec.getGroupSpec().getPattern().addAll(GROUP_PATTERNS);
spec.setOutput(createECReportOutputSpec());
return spec;
}
示例3: checkGroupSpec
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
/**
* check the group spec patterns do not have intersecting groups -> all group patterns have to be disjoint:<br/>
* <ul>
* <li>the same pattern is not allowed to occur twice</li>
* <li>two different pattern with intersecting selectors are not allowed</li>
* <li>no pattern at all is allowed</li>
* </ul>
* @param groupSpec the group spec to tested.
* @throws ECSpecValidationException upon violation.
* @return true if filter group spec is valid. exception otherwise.
*/
public boolean checkGroupSpec(ECGroupSpec groupSpec) throws ECSpecValidationException {
if (groupSpec != null) {
String[] patterns = groupSpec.getPattern().toArray(new String[] {});
for (int i=0; i<patterns.length-1; i++) {
final String pattern1 = patterns[i];
for (int j=i+1; j<patterns.length; j++) {
final String pattern2 = patterns[j];
if (!patternDisjoint(pattern1, pattern2)) {
throw logAndCreateECSpecValidationException("The two grouping patterns '" + pattern1 + "' and '" + pattern2 + "' are not disjoint.");
}
}
}
}
if (groupSpec != null) {
if (groupSpec.getPattern() != null) {
for (String temp : groupSpec.getPattern()) {
new Pattern(temp, PatternUsage.GROUP);
}
}
}
return true;
}
示例4: testGroupSpec
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
/**
* test the group spec validation.
* @throws ECSpecValidationException violation against the specification.
*/
@Test
public void testGroupSpec() throws ECSpecValidationException {
ECGroupSpec groupSpec = new ECGroupSpec();
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[1-2].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[3-4].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[5-6].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[7-8].*.*");
Assert.assertTrue(validator.checkGroupSpec(groupSpec));
}
示例5: testGroupSpecInvalidInput
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
/**
* test the group spec validation - must throw exception here
* @throws ECSpecValidationException violation against the specification.
*/
@Test(expected = ECSpecValidationException.class)
public void testGroupSpecInvalidInput() throws ECSpecValidationException {
ECGroupSpec groupSpec = new ECGroupSpec();
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[1-2].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[1-2].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[5-6].*.*");
validator.checkGroupSpec(groupSpec);
}
示例6: testGroupSpecInvalidInput2
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
/**
* test the group spec validation - must throw exception here
* @throws ECSpecValidationException violation against the specification.
*/
@Test(expected = ECSpecValidationException.class)
public void testGroupSpecInvalidInput2() throws ECSpecValidationException {
ECGroupSpec groupSpec = new ECGroupSpec();
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[1-2].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[3-4].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[5-6].*.*");
groupSpec.getPattern().add("urn:epc:pat:sgtin-64:1.[5-6].*.*");
validator.checkGroupSpec(groupSpec);
}
示例7: createDummyReportSpecs
import org.fosstrak.ale.xsd.ale.epcglobal.ECGroupSpec; //導入依賴的package包/類
public ReportSpecs createDummyReportSpecs() {
ExcludePatterns excludePatterns = new ExcludePatterns();
excludePatterns.getExcludePattern().add(FILTER_SPEC_EXCLUDE_PATTERN);
IncludePatterns includePatterns = new IncludePatterns();
includePatterns.getIncludePattern().add(FILTER_SPEC_INCLUDE_PATTERN);
ECFilterSpec filterSpec = new ECFilterSpec();
filterSpec.setExcludePatterns(excludePatterns);
filterSpec.setIncludePatterns(includePatterns);
ECGroupSpec groupSpec = new ECGroupSpec();
groupSpec.getPattern().add(GROUP_SPEC_PATTERN);
ECReportOutputSpec outputSpec = new ECReportOutputSpec();
outputSpec.setIncludeCount(true);
outputSpec.setIncludeEPC(true);
outputSpec.setIncludeRawDecimal(true);
outputSpec.setIncludeRawHex(true);
outputSpec.setIncludeTag(true);
ECReportSetSpec reportSet = new ECReportSetSpec();
reportSet.setSet(REPORT_SET);
ECReportSpec reportSpec = new ECReportSpec();
reportSpec.setFilterSpec(filterSpec);
reportSpec.setGroupSpec(groupSpec);
reportSpec.setOutput(outputSpec);
reportSpec.setReportIfEmpty(true);
reportSpec.setReportName(REPORT_NAME);
reportSpec.setReportOnlyOnChange(true);
reportSpec.setReportSet(reportSet);
ReportSpecs specs = new ReportSpecs();
specs.getReportSpec().add(reportSpec);
return specs;
}