use of uk.gov.gchq.gaffer.function.filter.IsLessThan in project Gaffer by gchq.
the class AndExample method isLessThan3AndIsMoreThan0.
public void isLessThan3AndIsMoreThan0() {
// ---------------------------------------------------------
final And function = new And(Arrays.asList(new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select first property
0).execute(new IsLessThan(3)).build(), new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select first property
0).execute(new IsMoreThan(0)).build()));
// ---------------------------------------------------------
runExample(function, new Object[] { 0 }, new Object[] { 1 }, new Object[] { 2 }, new Object[] { 3 }, new Object[] { 1L }, new Object[] { 2L });
}
use of uk.gov.gchq.gaffer.function.filter.IsLessThan in project Gaffer by gchq.
the class AndExample method property1IsLessThan2AndProperty2IsMoreThan2.
public void property1IsLessThan2AndProperty2IsMoreThan2() {
// ---------------------------------------------------------
final And function = new And(Arrays.asList(new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select first property
0).execute(new IsLessThan(2)).build(), new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select second property
1).execute(new IsMoreThan(2)).build()));
// ---------------------------------------------------------
runExample(function, new Object[] { 1, 3 }, new Object[] { 1, 1 }, new Object[] { 3, 3 }, new Object[] { 3, 1 }, new Object[] { 1L, 3L }, new Object[] { 1 });
}
use of uk.gov.gchq.gaffer.function.filter.IsLessThan in project Gaffer by gchq.
the class IsLessThanExample method isLessThan5.
public void isLessThan5() {
// ---------------------------------------------------------
final IsLessThan function = new IsLessThan(5);
// ---------------------------------------------------------
runExample(function, 1, 1L, 5, 5L, 10, 10L, "1");
}
use of uk.gov.gchq.gaffer.function.filter.IsLessThan in project Gaffer by gchq.
the class IsLessThanExample method isLessThanALong5.
public void isLessThanALong5() {
// ---------------------------------------------------------
final IsLessThan function = new IsLessThan(5L);
// ---------------------------------------------------------
runExample(function, 1, 1L, 5, 5L, 10, 10L, "1");
}
use of uk.gov.gchq.gaffer.function.filter.IsLessThan in project Gaffer by gchq.
the class ArrayListStoreTest method shouldAddAndGetEdgesThenEntities.
@Test
public void shouldAddAndGetEdgesThenEntities() throws OperationException {
final Graph graph = createGraph();
addElementsToGraph(graph);
//set up the operation to fetch the entities
final OperationChain<CloseableIterable<SimpleEntityDataObject>> opChain = new OperationChain.Builder().first(new GetEdges.Builder<>().addSeed(new EntitySeed(1)).build()).then(new GenerateObjects.Builder<Edge, EntitySeed>().generator(new EntitySeedExtractor(IdentifierType.DESTINATION)).build()).then(new GetEntities.Builder().view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.INT).execute(new IsLessThan(2)).build()).build()).build()).build()).then(new GenerateObjects.Builder<Entity, SimpleEntityDataObject>().generator(new SimpleEntityGenerator()).build()).build();
//now do the hop
final CloseableIterable<SimpleEntityDataObject> results = graph.execute(opChain, new User());
//check the results by converting our edges back into SimpleDataObjects
if (!results.iterator().hasNext()) {
fail("No results returned");
} else {
for (final SimpleEntityDataObject obj : results) {
LOGGER.info(obj.toString());
}
final List<SimpleEntityDataObject> resultList = Lists.newArrayList(results);
assertEquals(1, resultList.size());
assertEquals(1, resultList.get(0).getId());
assertEquals(1, resultList.get(0).getVisibility());
assertEquals("Red", resultList.get(0).getProperties());
}
results.close();
}
Aggregations