public void testNotPredicateEx() { try { PredicateUtils.notPredicate(null); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNotPredicate() { assertNotNull(PredicateUtils.notPredicate(PredicateUtils.truePredicate())); assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(null)); assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cObject)); assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cString)); assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cInteger)); }
@SuppressWarnings("unchecked") private Iterator<String> wrapIterator(final Iterator<String> keysIterator) { final String childNodeKey = childNodeKey(""); if (StringUtils.isEmpty(childNodeKey)) { return keysIterator; } final FilterIterator filterIterator = new FilterIterator(keysIterator, PredicateUtils.notPredicate(PredicateUtils.equalPredicate(childNodeKey))); AbstractIteratorDecorator iteratorDecorator = new AbstractIteratorDecorator(filterIterator) { @Override public Object next() { String key = (String) super.next(); String stripKey; if (!key.startsWith(childNodeKey)) { stripKey = key; } else { stripKey = key.substring(childNodeKey.length()+1); } return stripKey; } }; return iteratorDecorator; }
@Override @SuppressWarnings("unchecked") public Iterator<Object> get(String field) throws IllegalArgumentException { if(field == null){ throw new IllegalArgumentException("The parsed field MUST NOT be NULL"); } else if(field.isEmpty()){ throw new IllegalArgumentException("The parsed field MUST NOT be Empty"); } URI property = sesameFactory.createURI(field); return IteratorUtils.transformedIterator( IteratorUtils.filteredIterator( IteratorUtils.transformedIterator( model.filter(subject, property, null).iterator(), objectTransFormer), // get the object from the statement notPredicate(instanceofPredicate(BNode.class))), org.apache.stanbol.entityhub.model.sesame.ModelUtils.VALUE_TRANSFORMER); // transform the values }
@Override @SuppressWarnings("unchecked") public Iterator<Object> get(String field) throws IllegalArgumentException { if(field == null){ throw new IllegalArgumentException("The parsed field MUST NOT be NULL"); } else if(field.isEmpty()){ throw new IllegalArgumentException("The parsed field MUST NOT be Empty"); } URI property = sesameFactory.createURI(field); return IteratorUtils.transformedIterator( IteratorUtils.filteredIterator( IteratorUtils.transformedIterator( model.filter(subject, property, null).iterator(), objectTransFormer), // get the object from the statement notPredicate(instanceofPredicate(BNode.class))), org.apache.stanbol.entityhub.model.sesame.ModelUtils.VALUE_TRANSFORMER); // transform the values }
CollectionUtils.filter(modelNames, PredicateUtils.notPredicate(prototypeChecker));
CollectionUtils.filter(modelNames, PredicateUtils.notPredicate(prototypeChecker));
CollectionUtils.filter(modelNames, PredicateUtils.notPredicate(prototypeChecker));
@SuppressWarnings("unchecked") public static DescribableList<GhprbExtension, GhprbExtensionDescriptor> getJobExtensions( GhprbTrigger trigger, Class<?>... types ) { // First get all global extensions DescribableList<GhprbExtension, GhprbExtensionDescriptor> copied = copyExtensions(trigger.getDescriptor().getExtensions()); // Remove extensions that are specified by job filterList(copied, PredicateUtils.notPredicate(InstanceofPredicate.getInstance(GhprbProjectExtension.class))); // Then get the rest of the extensions from the job copied = copyExtensions(copied, trigger.getExtensions()); // Filter extensions by desired interface filterList(copied, PredicateUtils.anyPredicate(createPredicate(types))); return copied; }