当前位置: 首页>>代码示例>>Java>>正文


Java TupleAdaptedPredicate.getPredicate方法代码示例

本文整理汇总了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);
}
 
开发者ID:gchq,项目名称:koryphe,代码行数:22,代码来源:TuplePredicateTest.java

示例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;
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:30,代码来源:FilterValidator.java

示例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;
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:17,代码来源:SchemaElementDefinitionValidator.java

示例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;
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:21,代码来源:ViewValidator.java

示例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;
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:12,代码来源:FilterValidator.java


注:本文中的uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate.getPredicate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。