use of uk.gov.gchq.koryphe.impl.function.Length in project gaffer-doc by gchq.
the class LengthExample method getLength.
public void getLength() {
// ---------------------------------------------------------
final Length function = new Length();
// ---------------------------------------------------------
runExample(function, null, Lists.newArrayList(new Entity.Builder().group("entity").vertex("1").build(), new Entity.Builder().group("entity").vertex("2").build(), new Entity.Builder().group("entity").vertex("3").build(), new Entity.Builder().group("entity").vertex("4").build(), new Entity.Builder().group("entity").vertex("5").build()), new GetAllElements.Builder().option("option1", "value1").option("option2", "value2").option("option3", "value3").build().getOptions(), new Walk.Builder().edge(new Edge.Builder().group("BasicEdge").source("A").dest("B").directed(true).build()).edges(new Edge.Builder().group("BasicEdge").source("B").dest("C").directed(true).build(), new Edge.Builder().group("EnhancedEdge").source("B").dest("C").directed(true).build()).edge(new Edge.Builder().group("BasicEdge").source("C").dest("A").directed(true).build()).edge(new Edge.Builder().group("BasicEdge").source("A").dest("E").directed(true).build()).build(), 5, "some string", new String[] { "1", "2" }, null);
}
use of uk.gov.gchq.koryphe.impl.function.Length in project Gaffer by gchq.
the class TypeValueToTupleTest method shouldGetAndSetUsingCompositeFunction.
@Test
public void shouldGetAndSetUsingCompositeFunction() {
// Given
final TypeValue typeValue = new TypeValue("type", "value");
final Function<Object, Object> compositeFunction = new FunctionComposite(Lists.newArrayList(new TypeValueToTuple(), new TupleAdaptedFunctionComposite.Builder().select(new String[] { "value" }).execute(new FunctionComposite(Arrays.asList(new Length(), new ToString()))).project(new String[] { "type" }).build()));
// When
compositeFunction.apply(typeValue);
// Then
assertEquals(new TypeValue("5", "value"), typeValue);
}
use of uk.gov.gchq.koryphe.impl.function.Length in project Gaffer by gchq.
the class TypeSubTypeValueToTupleTest method shouldGetAndSetUsingCompositeFunction.
@Test
public void shouldGetAndSetUsingCompositeFunction() {
// Given
final TypeSubTypeValue typeSubTypeValue = new TypeSubTypeValue("type", "subType", "value");
final Function<Object, Object> compositeFunction = new FunctionComposite(Lists.newArrayList(new TypeSubTypeValueToTuple(), new TupleAdaptedFunctionComposite.Builder().select(new String[] { "value" }).execute(new FunctionComposite(Arrays.asList(new Length(), new ToString()))).project(new String[] { "type" }).build()));
// When
compositeFunction.apply(typeSubTypeValue);
// Then
assertEquals(new TypeSubTypeValue("5", "subType", "value"), typeSubTypeValue);
}
Aggregations