Search in sources :

Example 11 with IsMoreThan

use of uk.gov.gchq.gaffer.function.filter.IsMoreThan in project Gaffer by gchq.

the class OrExample method property1IsLessThan2OrProperty2IsMoreThan2.

public void property1IsLessThan2OrProperty2IsMoreThan2() {
    // ---------------------------------------------------------
    final Or function = new Or(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 });
}
Also used : FilterFunction(uk.gov.gchq.gaffer.function.FilterFunction) Or(uk.gov.gchq.gaffer.function.filter.Or) ConsumerFunctionContext(uk.gov.gchq.gaffer.function.context.ConsumerFunctionContext) IsLessThan(uk.gov.gchq.gaffer.function.filter.IsLessThan) IsMoreThan(uk.gov.gchq.gaffer.function.filter.IsMoreThan)

Example 12 with IsMoreThan

use of uk.gov.gchq.gaffer.function.filter.IsMoreThan in project Gaffer by gchq.

the class OrExample method isLessThan2OrIsMoreThan2.

public void isLessThan2OrIsMoreThan2() {
    // ---------------------------------------------------------
    final Or function = new Or(Arrays.asList(new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select first property
    0).execute(new IsLessThan(2)).build(), new ConsumerFunctionContext.Builder<Integer, FilterFunction>().select(// select first property
    0).execute(new IsMoreThan(2)).build()));
    // ---------------------------------------------------------
    runExample(function, new Object[] { 1 }, new Object[] { 2 }, new Object[] { 3 }, new Object[] { 1L }, new Object[] { 3L });
}
Also used : FilterFunction(uk.gov.gchq.gaffer.function.FilterFunction) Or(uk.gov.gchq.gaffer.function.filter.Or) ConsumerFunctionContext(uk.gov.gchq.gaffer.function.context.ConsumerFunctionContext) IsLessThan(uk.gov.gchq.gaffer.function.filter.IsLessThan) IsMoreThan(uk.gov.gchq.gaffer.function.filter.IsMoreThan)

Example 13 with IsMoreThan

use of uk.gov.gchq.gaffer.function.filter.IsMoreThan in project Gaffer by gchq.

the class MapFilterExample method freqMapIsMoreThan2.

public void freqMapIsMoreThan2() {
    // ---------------------------------------------------------
    final MapFilter function = new MapFilter("key1", new IsMoreThan(2L));
    // ---------------------------------------------------------
    final FreqMap map1 = new FreqMap();
    map1.put("key1", 1L);
    final FreqMap map2 = new FreqMap();
    map2.put("key1", 2L);
    final FreqMap map3 = new FreqMap();
    map3.put("key1", 3L);
    final FreqMap map4 = new FreqMap();
    map4.put("key1", 3L);
    map4.put("key2", 0L);
    final FreqMap map5 = new FreqMap();
    map5.put("key2", 3L);
    runExample(function, map1, map2, map3, map4, map5);
}
Also used : FreqMap(uk.gov.gchq.gaffer.types.FreqMap) MapFilter(uk.gov.gchq.gaffer.function.MapFilter) IsMoreThan(uk.gov.gchq.gaffer.function.filter.IsMoreThan)

Aggregations

IsMoreThan (uk.gov.gchq.gaffer.function.filter.IsMoreThan)13 IsLessThan (uk.gov.gchq.gaffer.function.filter.IsLessThan)5 FilterFunction (uk.gov.gchq.gaffer.function.FilterFunction)4 ConsumerFunctionContext (uk.gov.gchq.gaffer.function.context.ConsumerFunctionContext)4 Edge (uk.gov.gchq.gaffer.data.element.Edge)3 Graph (uk.gov.gchq.gaffer.graph.Graph)3 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)3 User (uk.gov.gchq.gaffer.user.User)3 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 MapFilter (uk.gov.gchq.gaffer.function.MapFilter)2 And (uk.gov.gchq.gaffer.function.filter.And)2 Or (uk.gov.gchq.gaffer.function.filter.Or)2 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)2 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)2 GetEdges (uk.gov.gchq.gaffer.operation.impl.get.GetEdges)2 FreqMap (uk.gov.gchq.gaffer.types.FreqMap)2 ArrayList (java.util.ArrayList)1 IsEdgeValidator (uk.gov.gchq.gaffer.data.IsEdgeValidator)1 Element (uk.gov.gchq.gaffer.data.element.Element)1