本文整理汇总了Java中org.apache.commons.collections.Predicate.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Java Predicate.evaluate方法的具体用法?Java Predicate.evaluate怎么用?Java Predicate.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections.Predicate
的用法示例。
在下文中一共展示了Predicate.evaluate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
@Override
public boolean evaluate(Object object) {
if (super.evaluate(object)) {
} else {
return false;
}
Predicate predicate;
List<? extends ModuloBase> siblings = _modulo.getSiblings();
for (ModuloBase sibling : siblings) {
predicate = sibling.getPagePredicate();
if (predicate == null || predicate.evaluate(object)) {
return false;
}
}
return true;
}
示例2: testPredicateReturnsInRange
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPredicateReturnsInRange() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,1);
TestRollbackableTask1 task = new TestRollbackableTask1(4);
boolean result = patchRollbackPredicate.evaluate(task);
assertTrue("PatchRollbackPredicate returned false unexpectedly",result);
}
示例3: testPredicateReturnsLessThanRollback
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPredicateReturnsLessThanRollback() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
TestRollbackableTask1 task = new TestRollbackableTask1(1);
boolean result = patchRollbackPredicate.evaluate(task);
assertFalse("PatchRollbackPredicate returned true unexpectedly",result);
}
示例4: testPredicateReturnsGreaterThanCurrent
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPredicateReturnsGreaterThanCurrent() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
TestRollbackableTask1 task = new TestRollbackableTask1(11);
boolean result = patchRollbackPredicate.evaluate(task);
assertFalse("PatchRollbackPredicate returned true unexpectedly",result);
}
示例5: testPredicateReturnsLowerBoundary
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPredicateReturnsLowerBoundary() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
TestRollbackableTask1 task = new TestRollbackableTask1(2);
boolean result = patchRollbackPredicate.evaluate(task);
assertFalse("PatchRollbackPredicate returned true unexpectedly",result);
}
示例6: testPredicateReturnsUpperBoundary
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPredicateReturnsUpperBoundary() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
TestRollbackableTask1 task = new TestRollbackableTask1(10);
boolean result = patchRollbackPredicate.evaluate(task);
assertTrue("PatchRollbackPredicate returned false unexpectedly",result);
}
示例7: testPatchRollbackPredicateNull
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPatchRollbackPredicateNull() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
boolean result = patchRollbackPredicate.evaluate(null);
assertFalse("PatchRollbackPredicate returned true unexpectedly",result);
}
示例8: testPatchRollbackPredicateWrongClass
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public void testPatchRollbackPredicateWrongClass() {
//create a new predicate
Predicate patchRollbackPredicate = new PatchRollbackPredicate(10,2);
boolean result = patchRollbackPredicate.evaluate(new Object());
assertFalse("testPatchRollbackPredicateWrongClass returned true unexpectedly",result);
}
示例9: degree
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
/**
* Returns the number of edges in this
* <code>AdjacencyList</code> satisfying the specified
* predicate. If this <code>AdjacencyList</code> contains
* more than <code>Integer.MAX_VALUE</code> such edges,
* returns <code>Integer.MAX_VALUE</code>.
*
* @return the number of edges in this
* <code>AdjacencyList</code> satisfying the specified
* predicate.
*/
int degree( Predicate traverserPredicate )
{
int size = edges.size();
int count = 0;
OrderedPair pair = new OrderedPair( node, null );
for( int i = 0; i < size; i++ ) {
pair.setSecond( edges.get( i ) );
if( traverserPredicate.evaluate( pair ) ) {
count++;
}
}
return count;
}
示例10: searchTypesDef
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
@Override
public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException {
final AtlasTypesDef typesDef = new AtlasTypesDef();
Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter);
for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) {
if (searchPredicates.evaluate(enumType)) {
typesDef.getEnumDefs().add(enumType.getEnumDef());
}
}
for(AtlasStructType structType : typeRegistry.getAllStructTypes()) {
if (searchPredicates.evaluate(structType)) {
typesDef.getStructDefs().add(structType.getStructDef());
}
}
for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) {
if (searchPredicates.evaluate(classificationType)) {
typesDef.getClassificationDefs().add(classificationType.getClassificationDef());
}
}
for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) {
if (searchPredicates.evaluate(entityType)) {
typesDef.getEntityDefs().add(entityType.getEntityDef());
}
}
for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) {
if (searchPredicates.evaluate(relationshipType)) {
typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef());
}
}
return typesDef;
}
示例11: evaluate
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
public boolean evaluate(Object arg0) {
Predicate judgement = new NullPredicate();
if (predicates.size() == 1) {
judgement = predicates.get(0);
} else {
if (conj == Conjunction.AND) {
judgement = PredicateUtils.allPredicate(predicates);
}
else if (conj == Conjunction.OR) {
judgement = PredicateUtils.anyPredicate(predicates);
}
}
return judgement.evaluate(arg0);
}
示例12: and
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
/**
* This constructs a predicate, that performs logical AND operation on a given set of predicates.
* The evaluation returns true if all predicates evaluate to true. Otherwise, it returns false.
*
* @param predicates predicates to perform an operation on.
* @return A predicate that evaluates to true, only if all passed predicates evaluate to true.
*/
public static Predicate and(final Predicate... predicates) {
return new Predicate() {
@Override
public boolean evaluate(Object object) {
for (Predicate predicate : predicates) {
if (!predicate.evaluate(object)) {
return false;
}
}
return true;
}
};
}
示例13: or
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
/**
* This constructs a predicate, that performs logical OR operation on a given set of predicates.
* The evaluation returns false if all predicates evaluate to false. If at least one predicate
* evaluates to true, it will return true.
*
* @param predicates predicates to perform an operation on.
* @return A predicate that evaluates to true, if at least one passed predicate evaluates to true.
*/
public static Predicate or(final Predicate... predicates) {
return new Predicate() {
@Override
public boolean evaluate(Object object) {
for (Predicate predicate : predicates) {
if (predicate.evaluate(object)) {
return true;
}
}
return false;
}
};
}
示例14: not
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
/**
* This constructs a predicate, that performs logical NOT operation on a given predicate. The positive evaluation
* turns to negative evaluation and negative evaluation turns to positive evaluation.
*
* @param predicate a predicate to perform logical NOT on.
* @return A predicate, that evaluates to the opposite value than the passed predicate.
*/
public static Predicate not(final Predicate predicate) {
return new Predicate() {
@Override
public boolean evaluate(Object object) {
return !predicate.evaluate(object);
}
};
}
示例15: filterExtensions
import org.apache.commons.collections.Predicate; //导入方法依赖的package包/类
private static void filterExtensions(DescriptorExtensionList<GhprcExtension, GhprcExtensionDescriptor> descriptors, Class<? extends GhprcExtensionType>... types) {
List<Predicate> predicates = new ArrayList<Predicate>(types.length);
for (Class<? extends GhprcExtensionType> type : types) {
predicates.add(InstanceofPredicate.getInstance(type));
}
Predicate anyPredicate = PredicateUtils.anyPredicate(predicates);
for (GhprcExtensionDescriptor descriptor : descriptors) {
if (!anyPredicate.evaluate(descriptor)) {
descriptors.remove(descriptor);
}
}
}
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:14,代码来源:GhprcExtensionDescriptor.java