And
See javadoc - uk.gov.gchq.koryphe.impl.predicate.And
Available since Koryphe version 1.0.0
Returns true if all of its predicates are true
Examples
Is less than 3 and is more than 0
Java
JSON
Full JSON
Python
final And function = new And<>(
new IsLessThan(3),
new IsMoreThan(0)
);
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.And",
"predicates" : [ {
"class" : "IsLessThan",
"orEqualTo" : false,
"value" : 3
}, {
"class" : "IsMoreThan",
"orEqualTo" : false,
"value" : 0
} ]
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.And",
"predicates" : [ {
"class" : "uk.gov.gchq.koryphe.impl.predicate.IsLessThan",
"orEqualTo" : false,
"value" : 3
}, {
"class" : "uk.gov.gchq.koryphe.impl.predicate.IsMoreThan",
"orEqualTo" : false,
"value" : 0
} ]
}
g.And(
predicates=[
g.IsLessThan(
value=3,
or_equal_to=False
),
g.IsMoreThan(
value=0,
or_equal_to=False
)
]
)
Input type:
uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 0 | false |
java.lang.Integer | 1 | true |
java.lang.Integer | 2 | true |
java.lang.Integer | 3 | false |
java.lang.Long | 1 | false |
java.lang.Long | 2 | false |
First item is less than 2 and second item is more than 5
Java
JSON
Full JSON
Python
final And function = new And.Builder()
.select(0)
.execute(new IsLessThan(2))
.select(1)
.execute(new IsMoreThan(5))
.build();
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.And",
"predicates" : [ {
"class" : "IntegerTupleAdaptedPredicate",
"selection" : [ 0 ],
"predicate" : {
"class" : "IsLessThan",
"orEqualTo" : false,
"value" : 2
}
}, {
"class" : "IntegerTupleAdaptedPredicate",
"selection" : [ 1 ],
"predicate" : {
"class" : "IsMoreThan",
"orEqualTo" : false,
"value" : 5
}
} ]
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.And",
"predicates" : [ {
"class" : "uk.gov.gchq.koryphe.tuple.predicate.IntegerTupleAdaptedPredicate",
"selection" : [ 0 ],
"predicate" : {
"class" : "uk.gov.gchq.koryphe.impl.predicate.IsLessThan",
"orEqualTo" : false,
"value" : 2
}
}, {
"class" : "uk.gov.gchq.koryphe.tuple.predicate.IntegerTupleAdaptedPredicate",
"selection" : [ 1 ],
"predicate" : {
"class" : "uk.gov.gchq.koryphe.impl.predicate.IsMoreThan",
"orEqualTo" : false,
"value" : 5
}
} ]
}
g.And(
predicates=[
g.NestedPredicate(
selection=[
0
],
predicate=g.IsLessThan(
value=2,
or_equal_to=False
)
),
g.NestedPredicate(
selection=[
1
],
predicate=g.IsMoreThan(
value=5,
or_equal_to=False
)
)
]
)
Input type:
uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Integer] | [1, 10] | true |
[java.lang.Integer, java.lang.Integer] | [1, 1] | false |
[java.lang.Integer, java.lang.Integer] | [10, 10] | false |
[java.lang.Integer, java.lang.Integer] | [10, 1] | false |
[java.lang.Long, java.lang.Long] | [1, 10] | false |
[java.lang.Integer] | [1] | false |