当前位置: 首页>>代码示例>>Java>>正文


Java Pattern类代码示例

本文整理汇总了Java中org.fosstrak.ale.server.Pattern的典型用法代码示例。如果您正苦于以下问题:Java Pattern类的具体用法?Java Pattern怎么用?Java Pattern使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Pattern类属于org.fosstrak.ale.server包,在下文中一共展示了Pattern类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkGroupSpec

import org.fosstrak.ale.server.Pattern; //导入依赖的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;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:35,代码来源:ECSpecValidator.java

示例2: testCreateTagPatternWithInvalidStringRepresentation

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateTagPatternWithInvalidStringRepresentation() throws Exception {
	try {
		new Pattern(FILTER_PATTERN, PatternUsage.TAG);
	} catch (ECSpecValidationException e) {
		Assert.assertEquals("Invalid data field '[1-2]'. Only 'int' is allowed.", e.getMessage());
		return;
	}
	
	Assert.fail("Should throw an ECSpecValidationException because the string representation of the tag pattern contains a '*'.");
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:12,代码来源:PatternTest.java

示例3: testCreateFilterPatternWithInvalidStringRepresentation

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateFilterPatternWithInvalidStringRepresentation() throws Exception {
	try {
		new Pattern(GROUP_PATTERN, PatternUsage.FILTER);
	} catch (ECSpecValidationException e) {
		Assert.assertEquals("Invalid data field 'X'. Only '*', '[lo-hi]' or 'int' are allowed.", e.getMessage());
		return;
	}
	
	Assert.fail("Should throw an ECSpecValidationException because the string representation of the filter pattern contains a 'X'.");	
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:12,代码来源:PatternTest.java

示例4: testCreateGroupPatternWithInvalidStringRepresentation

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateGroupPatternWithInvalidStringRepresentation() throws Exception {
	try {
		new Pattern(INVALID_PATTERN, PatternUsage.GROUP);
	} catch (ECSpecValidationException e) {
		Assert.assertEquals("Invalid data field 'a'. Only '*', 'X', '[lo-hi]' or 'int' are allowed.", e.getMessage());
		return;
	}
	
	Assert.fail("Should throw an ECSpecValidationException because the string representation of the group pattern is invalid.");		
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:12,代码来源:PatternTest.java

示例5: testIsDisjointString

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testIsDisjointString() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	
	Assert.assertTrue(groupPattern.isDisjoint(DISJOINT_GROUP_PATTERN));
	Assert.assertFalse(groupPattern.isDisjoint(GROUP_PATTERN));
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:8,代码来源:PatternTest.java

示例6: testIsDisjointPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testIsDisjointPattern() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	Pattern disjointGroupPattern = new Pattern(DISJOINT_GROUP_PATTERN, PatternUsage.GROUP);
	
	Assert.assertTrue(groupPattern.isDisjoint(disjointGroupPattern));
	Assert.assertFalse(groupPattern.isDisjoint(groupPattern));
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:9,代码来源:PatternTest.java

示例7: testIsMember

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testIsMember() throws Exception {
	Pattern filterPattern = new Pattern(FILTER_PATTERN, PatternUsage.FILTER);
	
	Assert.assertTrue(filterPattern.isMember(GROUP_MEMBER_PATTERN));
	Assert.assertFalse(filterPattern.isMember(GROUP_NOT_MEMBER_PATTERN));
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:8,代码来源:PatternTest.java

示例8: testIsDisjointPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
public void testIsDisjointPattern() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	Pattern disjointGroupPattern = new Pattern(DISJOINT_GROUP_PATTERN, PatternUsage.GROUP);
	
	Assert.assertTrue(groupPattern.isDisjoint(disjointGroupPattern));
	Assert.assertFalse(groupPattern.isDisjoint(groupPattern));
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:8,代码来源:PatternTest.java

示例9: testCreateTagPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateTagPattern() throws Exception {
	new Pattern(TAG_PATTERN, PatternUsage.TAG);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:5,代码来源:PatternTest.java

示例10: testCreateFilterPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateFilterPattern() throws Exception {
	new Pattern(TAG_PATTERN, PatternUsage.FILTER);
	new Pattern(FILTER_PATTERN, PatternUsage.FILTER);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:6,代码来源:PatternTest.java

示例11: testCreateGroupPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testCreateGroupPattern() throws Exception {
	new Pattern(TAG_PATTERN, PatternUsage.GROUP);
	new Pattern(FILTER_PATTERN, PatternUsage.GROUP);
	new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:7,代码来源:PatternTest.java

示例12: testGetGroupName

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testGetGroupName() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	Assert.assertEquals(GROUP_NAME_PATTERN, groupPattern.getGroupName(GROUP_MEMBER_PATTERN));
	Assert.assertNull(groupPattern.getGroupName(GROUP_NOT_MEMBER_PATTERN));
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:7,代码来源:PatternTest.java

示例13: testToString

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
@Test
public void testToString() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	Assert.assertEquals(GROUP_PATTERN, groupPattern.toString());
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:6,代码来源:PatternTest.java

示例14: testCreateGroupPattern

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
public void testCreateGroupPattern() throws Exception {
	new Pattern(TAG_PATTERN, PatternUsage.GROUP);
	new Pattern(FILTER_PATTERN, PatternUsage.GROUP);
	new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:6,代码来源:PatternTest.java

示例15: testIsDisjointString

import org.fosstrak.ale.server.Pattern; //导入依赖的package包/类
public void testIsDisjointString() throws Exception {
	Pattern groupPattern = new Pattern(GROUP_PATTERN, PatternUsage.GROUP);
	
	Assert.assertTrue(groupPattern.isDisjoint(DISJOINT_GROUP_PATTERN));
	Assert.assertFalse(groupPattern.isDisjoint(GROUP_PATTERN));
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:7,代码来源:PatternTest.java


注:本文中的org.fosstrak.ale.server.Pattern类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。