本文整理汇总了Java中uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate.getPredicate方法的典型用法代码示例。如果您正苦于以下问题:Java TupleAdaptedPredicate.getPredicate方法的具体用法?Java TupleAdaptedPredicate.getPredicate怎么用?Java TupleAdaptedPredicate.getPredicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate
的用法示例。
在下文中一共展示了TupleAdaptedPredicate.getPredicate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldJsonSerialiseAndDeserialise
import uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate; //导入方法依赖的package包/类
@Test
public void shouldJsonSerialiseAndDeserialise() throws IOException {
// set up a tuple validate
TupleAdaptedPredicate<String, Object> predicate = new TupleAdaptedPredicate<>();
Predicate<Object> function = new MockPredicateObject();
predicate.setPredicate(function);
Function<Tuple<String>, Object> inputAdapter = new TupleInputAdapter<>();
predicate.setInputAdapter(inputAdapter);
String json = JsonSerialiser.serialise(predicate);
TupleAdaptedPredicate<String, Object> deserialisedPredicate = JsonSerialiser.deserialise(json, TupleAdaptedPredicate.class);
assertNotSame(predicate, deserialisedPredicate);
Predicate deserialisedFunction = deserialisedPredicate.getPredicate();
assertNotSame(function, deserialisedFunction);
Function<Tuple<String>, Object> deserialisedInputAdapter = deserialisedPredicate.getInputAdapter();
assertNotSame(inputAdapter, deserialisedInputAdapter);
assertTrue(deserialisedInputAdapter instanceof Function);
}
示例2: validateFilterPropertyClasses
import uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate; //导入方法依赖的package包/类
/**
* Validates that the predicates to be executed are assignable to the corresponding properties
*
* @param elementDef The SchemaElementDefinition to validate against
* @param filter The ElementFilter to be validated against
* @return ValidationResult of the validation
*/
private ValidationResult validateFilterPropertyClasses(final SchemaElementDefinition elementDef, final ElementFilter filter) {
final ValidationResult result = new ValidationResult();
if (null != elementDef) {
final List<TupleAdaptedPredicate<String, ?>> components = filter.getComponents();
for (final TupleAdaptedPredicate<String, ?> component : components) {
final Map<String, String> properties = elementDef.getPropertyMap();
if (!properties.isEmpty()) {
if (null == component.getPredicate()) {
result.addError(filter.getClass().getSimpleName() + " contains a null function.");
} else {
final Class[] selectionClasses = getTypeClasses(component.getSelection(), elementDef);
if (!ArrayUtils.contains(selectionClasses, null)) {
final Signature inputSig = Signature.getInputSignature(component.getPredicate());
result.add(inputSig.assignable(selectionClasses));
}
}
}
}
}
return result;
}
示例3: validateFunctionArgumentTypes
import uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate; //导入方法依赖的package包/类
protected ValidationResult validateFunctionArgumentTypes(
final ElementFilter filter, final SchemaElementDefinition schemaElDef) {
final ValidationResult result = new ValidationResult();
if (null != filter && null != filter.getComponents()) {
for (final TupleAdaptedPredicate<String, ?> adaptedPredicate : filter.getComponents()) {
if (null == adaptedPredicate.getPredicate()) {
result.addError(filter.getClass().getSimpleName() + " contains a null function.");
} else {
final Signature inputSig = Signature.getInputSignature(adaptedPredicate.getPredicate());
result.add(inputSig.assignable(getTypeClasses(adaptedPredicate.getSelection(), schemaElDef)));
}
}
}
return result;
}
示例4: validateFunctionArgumentTypes
import uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate; //导入方法依赖的package包/类
private ValidationResult validateFunctionArgumentTypes(
final ElementFilter filter,
final ViewElementDefinition viewElDef, final SchemaElementDefinition schemaElDef) {
final ValidationResult result = new ValidationResult();
if (null != filter && null != filter.getComponents()) {
for (final TupleAdaptedPredicate<String, ?> adaptedPredicate : filter.getComponents()) {
if (null == adaptedPredicate.getPredicate()) {
result.addError(filter.getClass().getSimpleName() + " contains a null function.");
} else {
final Class[] inputTypeClasses = getTypeClasses(adaptedPredicate.getSelection(), viewElDef, schemaElDef);
if (!ArrayUtils.contains(inputTypeClasses, null)) {
final Signature inputSig = Signature.getInputSignature(adaptedPredicate.getPredicate());
result.add(inputSig.assignable(inputTypeClasses));
}
}
}
}
return result;
}
示例5: validateElementFilter
import uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate; //导入方法依赖的package包/类
private ValidationResult validateElementFilter(final ElementFilter filter) {
final ValidationResult result = new ValidationResult();
if (null != filter && null != filter.getComponents()) {
for (final TupleAdaptedPredicate<String, ?> adaptedPredicate : filter.getComponents()) {
if (null == adaptedPredicate.getPredicate()) {
result.addError(filter.getClass().getSimpleName() + " contains a null function.");
}
}
}
return result;
}