use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class OrPredicate method negate.
@Override
public Predicate negate() {
int size = predicates.length;
Predicate[] inners = new Predicate[size];
for (int i = 0; i < size; i++) {
Predicate original = predicates[i];
Predicate negated;
if (original instanceof NegatablePredicate) {
negated = ((NegatablePredicate) original).negate();
} else {
negated = new NotPredicate(original);
}
inners[i] = negated;
}
AndPredicate andPredicate = new AndPredicate(inners);
return andPredicate;
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddLocalEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate.
@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate() throws Exception {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addLocalEntryListener(mapListener, predicate, null, true);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddLocalEntryListenerWithMapListenerAndPredicate_NullPredicate.
@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListenerWithMapListenerAndPredicate_NullPredicate() throws Exception {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addLocalEntryListener(mapListener, predicate, true);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddLocalEntryListenerWithEntryListenerAndPredicateAndKey_NullPredicate.
@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListenerWithEntryListenerAndPredicateAndKey_NullPredicate() throws Exception {
EntryListener entryListener = new TestEntryListener();
Predicate predicate = null;
map.addLocalEntryListener(entryListener, predicate, null, true);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapMBean method values.
@ManagedAnnotation(value = "values", operation = true)
public String values(String query) {
Collection coll;
if (query != null && !query.isEmpty()) {
Predicate predicate = new SqlPredicate(query);
coll = managedObject.values(predicate);
} else {
coll = managedObject.values();
}
StringBuilder buf = new StringBuilder();
if (coll.size() == 0) {
buf.append("Empty");
} else {
buf.append("[");
for (Object obj : coll) {
buf.append(obj);
buf.append(", ");
}
buf.replace(buf.length() - 1, buf.length(), "]");
}
return buf.toString();
}
Aggregations