Koryphe Predicates
Predicates from the Koryphe library.
AgeOff
Checks if a timestamp is recent based on a provided age off time. Javadoc
Input type: java.lang.Long
Example AgeOff in milliseconds
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | ClassCastException: java.lang.String cannot be cast to java.lang.Long | |
java.lang.Long | 1667818781957 | true |
java.lang.Long | 1667818681957 | false |
java.lang.Long | 1667818881957 | true |
java.lang.String | 1667818781957 | ClassCastException: java.lang.String cannot be cast to java.lang.Long |
And
Returns true if all of its predicates are true. Javadoc
Input type: uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example of is less than 3 and is more than 0
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 |
Example of first item less than 2 and second item more than 5
{
"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
}
} ]
}
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 |
AreEqual
Returns true if the two inputs are equal. Javadoc
Input type: java.lang.Object, java.lang.Object
Example AreEqual
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Double] | [1, 1.0] | false |
[java.lang.Double, java.lang.Double] | [2.5, 2.5] | true |
[java.lang.String, ] | [, null] | false |
[java.lang.String, java.lang.String] | [abc, abc] | true |
AreIn
Checks if a provided collection contains all the provided input values. Javadoc
Input type: java.util.Collection
Example AreIn Set
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashSet | [1, 2, 3] | true |
java.util.HashSet | [1, 2, 3, 4] | false |
java.util.HashSet | [4, 1] | false |
java.util.HashSet | [1, 2] | true |
java.util.HashSet | [] | true |
CollectionContains
Checks if a collection contains a provided value. Javadoc
Input type: java.util.Collection
Example CollectionContains
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashSet | [1, 2, 3] | true |
java.util.HashSet | [1] | true |
java.util.HashSet | [2] | false |
java.util.HashSet | [] | false |
Exists
Checks the input exists. Javadoc
Input type: java.lang.Object
Example Exists
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
null | false | |
java.lang.String | true | |
java.lang.String | abc | true |
If
Conditionally applies a predicate. Javadoc
Input type: uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example conditionally applying predicates to input
This example tests first whether the input is an Integer. If so, it is then tested to see if the value is greater than 3. Otherwise, since it is not an Integer, we then test to see if it is NOT a String.
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 2 | false |
java.lang.Integer | 3 | false |
java.lang.Integer | 5 | true |
java.lang.String | test | false |
java.util.HashMap | {} | true |
java.util.ArrayList | [] | true |
Or
Returns true if any of the predicates are true. Javadoc
When using an Or predicate with a single selected value you can just use the constructor new Or(predicates))
'.
When using an Or predicate with multiple selected values, you need to use the Or.Builder
to build your Or predicate, using .select()
then .execute()
. When selecting values in the Or.Builder
you need to refer to the position in the input array. I.e to use the first value use position 0 - select(0)
.You can select multiple values to give to a predicate like isXLessThanY, this is achieved by passing 2 positions to the select method - select(0, 1)
.
Input type: uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example is less than 2 equal to 5 or is more than 10
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
java.lang.Integer | 2 | false |
java.lang.Integer | 3 | false |
java.lang.Integer | 5 | true |
java.lang.Integer | 15 | true |
java.lang.Long | 1 | false |
java.lang.Long | 3 | false |
java.lang.Long | 5 | false |
Example is less than 2 equal to 5 or is more than 10
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
java.lang.Integer | 2 | false |
java.lang.Integer | 3 | false |
java.lang.Integer | 5 | true |
java.lang.Integer | 15 | true |
java.lang.Long | 1 | false |
java.lang.Long | 3 | false |
java.lang.Long | 5 | false |
Example first item is less than 2 or second item is more than 10
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.Or",
"predicates" : [ {
"class" : "IntegerTupleAdaptedPredicate",
"selection" : [ 0 ],
"predicate" : {
"class" : "IsLessThan",
"orEqualTo" : false,
"value" : 2
}
}, {
"class" : "IntegerTupleAdaptedPredicate",
"selection" : [ 1 ],
"predicate" : {
"class" : "IsMoreThan",
"orEqualTo" : false,
"value" : 10
}
} ]
}
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Integer] | [1, 15] | true |
[java.lang.Integer, java.lang.Integer] | [1, 1] | true |
[java.lang.Integer, java.lang.Integer] | [15, 15] | true |
[java.lang.Integer, java.lang.Integer] | [15, 1] | false |
[java.lang.Long, java.lang.Long] | [1, 15] | false |
[java.lang.Integer] | [1] | true |
Not
Returns the inverse of a predicate. Javadoc
Input type: uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType
Example does not exist
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
null | true | |
java.lang.String | false | |
java.lang.String | abc | false |
Example are not equal
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Double] | [1, 1.0] | true |
[java.lang.Integer, java.lang.Integer] | [1, 2] | true |
[java.lang.Double, java.lang.Double] | [2.5, 2.5] | false |
[java.lang.String, ] | [, null] | true |
[java.lang.String, java.lang.String] | [abc, abc] | false |
InDateRange
Tests if a Comparable is within a provided range. By default the range is inclusive, this can be toggled using the startInclusive and endInclusive booleans. Javadoc
You can configure the start and end time strings using the following formats:
- timestamp in milliseconds
yyyy/MM
yyyy/MM/dd
yyyy/MM/dd HH
yyyy/MM/dd HH:mm
yyyy/MM/dd HH:mm:ss
You can use a space, -
, /
, _
, :
, |
, or .
to separate the parts.
Input type: java.util.Date
Example InDateRange with day precision
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Fri Jan 01 00:00:00 GMT 2016 | false |
java.util.Date | Sun Jan 01 00:00:00 GMT 2017 | true |
java.util.Date | Sun Jan 01 01:00:00 GMT 2017 | true |
java.util.Date | Sun Jan 01 23:59:59 GMT 2017 | true |
java.util.Date | Wed Feb 01 00:00:00 GMT 2017 | true |
java.util.Date | Wed Feb 01 00:00:01 GMT 2017 | false |
null | false |
Example InDateRange with second precision
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Sun Jan 01 01:30:09 GMT 2017 | false |
java.util.Date | Sun Jan 01 01:30:10 GMT 2017 | true |
java.util.Date | Sun Jan 01 01:30:20 GMT 2017 | true |
java.util.Date | Sun Jan 01 01:30:50 GMT 2017 | true |
java.util.Date | Sun Jan 01 01:30:51 GMT 2017 | false |
null | false |
Example InDateRange with timestamps
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Sun Jan 18 05:01:55 GMT 1970 | false |
java.util.Date | Sun Jan 18 05:01:55 GMT 1970 | true |
java.util.Date | Sun Jan 18 05:01:56 GMT 1970 | true |
java.util.Date | Sun Jan 18 05:45:07 GMT 1970 | true |
java.util.Date | Sun Jan 18 05:45:07 GMT 1970 | false |
null | false |
Example of range exclusive
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Fri Jan 01 00:00:00 GMT 2016 | false |
java.util.Date | Sun Jan 01 00:00:00 GMT 2017 | false |
java.util.Date | Sun Jan 01 01:00:00 GMT 2017 | true |
java.util.Date | Sun Jan 01 23:59:59 GMT 2017 | true |
java.util.Date | Wed Feb 01 00:00:00 GMT 2017 | false |
java.util.Date | Wed Feb 01 00:00:01 GMT 2017 | false |
null | false |
Example of within the last week
If the end of the range is not specified then the end of the range is unbounded.
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Sun Oct 30 11:00:11 GMT 2022 | false |
java.util.Date | Tue Nov 01 11:00:11 GMT 2022 | true |
java.util.Date | Sun Nov 06 11:00:11 GMT 2022 | true |
java.util.Date | Mon Nov 07 11:00:11 GMT 2022 | true |
null | false |
Example of exactly 7 hours ago
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.Date | Mon Nov 07 03:00:12 GMT 2022 | false |
java.util.Date | Mon Nov 07 04:00:22 GMT 2022 | true |
java.util.Date | Mon Nov 07 05:00:02 GMT 2022 | true |
java.util.Date | Mon Nov 07 05:00:22 GMT 2022 | false |
java.util.Date | Mon Nov 07 11:00:12 GMT 2022 | false |
null | false |
InDateRangeDual
Tests if a start Comparable and end Comparable are within a provided range. Specifically the start Comparable has to be greater than the start bound and the end Comparable has to be less than the end bound. By default the range is inclusive, this can be toggled using the startInclusive and endInclusive booleans. Javadoc
This uses the same input formats as InDateRange.
Input type: java.lang.Comparable, java.lang.Comparable
Example with fully uncontained range
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Wed Feb 01 00:00:00 GMT 2017] | false |
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Sat Apr 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Mon May 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Fri Sep 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Fri Sep 01 00:00:00 BST 2017, Sun Oct 01 00:00:00 BST 2017] | false |
[ ,] | [null, null] | false |
Example with start contained range
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Wed Feb 01 00:00:00 GMT 2017] | false |
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Sat Apr 01 00:00:00 BST 2017] | false |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Mon May 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Fri Sep 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Fri Sep 01 00:00:00 BST 2017, Sun Oct 01 00:00:00 BST 2017] | false |
[ ,] | [null, null] | false |
Example with fully contained range
Input Type | Input | Result |
---|---|---|
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Wed Feb 01 00:00:00 GMT 2017] | false |
[java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Sat Apr 01 00:00:00 BST 2017] | false |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Mon May 01 00:00:00 BST 2017] | true |
[java.util.Date, java.util.Date] | [Sat Apr 01 00:00:00 BST 2017, Fri Sep 01 00:00:00 BST 2017] | false |
[java.util.Date, java.util.Date] | [Fri Sep 01 00:00:00 BST 2017, Sun Oct 01 00:00:00 BST 2017] | false |
[ ,] | [null, null] | false |
InRange
Checks if a comparable is within a provided range. Javadoc
Input type: java.lang.Comparable
Example of Long 5 to 10
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Long | -5 | false |
java.lang.Long | 1 | false |
java.lang.Long | 5 | true |
java.lang.Long | 7 | true |
java.lang.Long | 10 | true |
java.lang.Long | 20 | false |
java.lang.Integer | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.Integer |
java.lang.String | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |
null | false |
Example of Long 5 to 10 exclusive
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Long | -5 | false |
java.lang.Long | 1 | false |
java.lang.Long | 5 | false |
java.lang.Long | 7 | true |
java.lang.Long | 10 | false |
java.lang.Long | 20 | false |
java.lang.Integer | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.Integer |
java.lang.String | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |
null | false |
Example of Long 5 less than 10
If the start of the range is not specified then the start of the range is unbounded.
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Long | -5 | true |
java.lang.Long | 1 | true |
java.lang.Long | 5 | true |
java.lang.Long | 7 | true |
java.lang.Long | 10 | false |
java.lang.Long | 20 | false |
java.lang.Integer | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.Integer |
java.lang.String | 7 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |
null | false |
Example of String 'B' to 'D'
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | A | false |
java.lang.String | B | true |
java.lang.String | C | true |
java.lang.String | D | true |
java.lang.String | c | false |
java.lang.Integer | 1 | ClassCastException: java.lang.String cannot be cast to java.lang.Integer |
null | false |
InRangeDual
Checks if two comparables (a start and an end) are within a provided range. Javadoc
Input type: java.lang.Comparable, java.lang.Comparable
Example of Long overlapping range
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [1, 4] | false |
[java.lang.Long, java.lang.Long] | [1, 7] | true |
[java.lang.Long, java.lang.Long] | [6, 7] | true |
[java.lang.Long, java.lang.Long] | [7, 11] | true |
[java.lang.Long, java.lang.Long] | [11, 20] | false |
[ ,] | [null, null] | false |
Example of Long end overlapping range
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [1, 4] | false |
[java.lang.Long, java.lang.Long] | [1, 7] | false |
[java.lang.Long, java.lang.Long] | [6, 7] | true |
[java.lang.Long, java.lang.Long] | [7, 11] | true |
[java.lang.Long, java.lang.Long] | [11, 20] | false |
[ ,] | [null, null] | false |
Example of Long non overlapping range
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [1, 4] | false |
[java.lang.Long, java.lang.Long] | [1, 7] | false |
[java.lang.Long, java.lang.Long] | [6, 7] | true |
[java.lang.Long, java.lang.Long] | [7, 11] | false |
[java.lang.Long, java.lang.Long] | [11, 20] | false |
[ ,] | [null, null] | false |
Example Long less than 10
If the start of the range is not specified then the start of the range is unbounded.
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [-5, -1] | true |
[java.lang.Long, java.lang.Long] | [1, 6] | true |
[java.lang.Long, java.lang.Long] | [6, 6] | true |
[java.lang.Long, java.lang.Long] | [6, 7] | true |
[java.lang.Long, java.lang.Long] | [6, 10] | true |
[java.lang.Long, java.lang.Long] | [10, 20] | false |
[java.lang.Integer, java.lang.Integer] | [6, 7] | IllegalArgumentException: Input tuple values do not match the required function input types |
[java.lang.String, java.lang.String] | [5, 7] | IllegalArgumentException: Input tuple values do not match the required function input types |
[ ,] | [null, null] | false |
InTimeRange
Functionally identical to InDateRange, except that it uses Long as the timestamp input type. By default, checks are carried out assuming the data will be in milliseconds. If this is not the case, the time unit can be changed using the timeUnit property. Javadoc
Input type: java.lang.Long
Example with time unit microseconds
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Long | 1483234209000000 | false |
java.lang.Long | 1483234210000000 | true |
java.lang.Long | 1483234220000000 | true |
java.lang.Long | 1483234250000000 | true |
java.lang.Long | 1483234251000000 | false |
null | false |
InTimeRangeDual
Functionally identical to InDateRangeDual. By default, checks are carried out assuming the data will be in milliseconds. If this is not the case, the time unit can be changed using the timeUnit property. Javadoc
IsA
Checks if an input is an instance of a class. Javadoc
Input type: java.lang.Object
Example with String
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
java.lang.Double | 2.5 | false |
java.lang.String | abc | true |
Example with Number
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
java.lang.Double | 2.5 | true |
java.lang.String | abc | false |
IsEqual
Checks if an input is equal to a provided value. Javadoc
Input type: java.lang.Object
Example equal to Integer 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 5 | true |
java.lang.Long | 5 | false |
java.lang.String | 5 | false |
java.lang.Character | 5 | false |
Example equal to String 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 5 | false |
java.lang.Long | 5 | false |
java.lang.String | 5 | true |
java.lang.Character | 5 | false |
IsFalse
Checks if an input boolean is false. Javadoc
Input type: java.lang.Boolean
Example IsFalse
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Boolean | true | false |
java.lang.Boolean | false | true |
null | false | |
java.lang.String | true | ClassCastException: java.lang.String cannot be cast to java.lang.Boolean |
IsTrue
Checks if an input boolean is true. Javadoc
Input type: java.lang.Boolean
Example IsTrue
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Boolean | true | true |
java.lang.Boolean | false | false |
null | false | |
java.lang.String | true | ClassCastException: java.lang.String cannot be cast to java.lang.Boolean |
IsIn
Checks if an input is in a set of allowed values. Javadoc
Input type: java.lang.Object
Example IsIn
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 5 | true |
java.lang.Long | 5 | true |
java.lang.String | 5 | true |
java.lang.Character | 5 | true |
java.lang.Integer | 1 | false |
java.lang.Long | 1 | false |
java.lang.String | 1 | false |
java.lang.Character | 1 | false |
IsLessThan
Checks if a comparable is less than a provided value. Javadoc
Input type: java.lang.Comparable
Example IsLessThan with Integer 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
java.lang.Long | 1 | false |
java.lang.Integer | 5 | false |
java.lang.Long | 5 | false |
java.lang.Integer | 10 | false |
java.lang.Long | 10 | false |
java.lang.String | 1 | false |
Example IsLessThan or equal with Integer 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | true |
java.lang.Long | 1 | false |
java.lang.Integer | 5 | true |
java.lang.Long | 5 | false |
java.lang.Integer | 10 | false |
java.lang.Long | 10 | false |
java.lang.String | 1 | false |
Example IsLessThan with String 'B'
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
java.lang.String | A | true |
java.lang.String | B | false |
java.lang.String | C | false |
IsMoreThan
Checks if a comparable is more than a provided value. Javadoc
Input type: java.lang.Comparable
Example IsMoreThan with Integer 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
java.lang.Integer | 5 | false |
java.lang.Integer | 10 | true |
Example IsMoreThan or equal with Integer 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
java.lang.Integer | 5 | true |
java.lang.Integer | 10 | true |
Example IsMoreThan with String 'B'
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.Integer | 1 | false |
java.lang.String | A | false |
java.lang.String | B | false |
java.lang.String | C | true |
IsLongerThan
Checks if the length of an input is more than a value. Javadoc
Input type: java.lang.Object
Example testing size/length attribute is greater than 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | testString | true |
java.lang.String | aTest | false |
[Ljava.lang.String; | [null, null, null, null, null] | false |
[Ljava.lang.String; | [null, null, null, null, null, null, null, null, null, null] | true |
java.util.Arrays$ArrayList | [0, 1, 2, 3, 4, 5] | true |
Example testing size/length attribute is greater than or equal to 5
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | test | false |
java.lang.String | testString | true |
java.lang.String | aTest | true |
[Ljava.lang.String; | [null, null, null, null, null] | true |
[Ljava.lang.String; | [null, null, null, null, null, null, null, null, null, null] | true |
java.util.Arrays$ArrayList | [0, 1, 2, 3, 4, 5] | true |
IsShorterThan
Checks if the length of an input is more than than a value. Javadoc
Input type: java.lang.Object
Example testing size/length attribute is shorter than 4
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | 123 | true |
java.lang.String | 1234 | false |
[Ljava.lang.Integer; | [1, 2, 3] | true |
[Ljava.lang.Integer; | [1, 2, 3, 4] | false |
java.util.ArrayList | [1, 2, 3] | true |
java.util.ArrayList | [1, 2, 3, 4] | false |
java.util.HashMap | {1=a, 2=b, 3=c} | true |
java.util.HashMap | {4=d} | true |
java.lang.Integer | 10000 | IllegalArgumentException: Could not determine the size of the provided value |
java.lang.Long | 10000 | IllegalArgumentException: Could not determine the size of the provided value |
IsXLessThanY
Checks the first comparable is less than the second comparable. Javadoc
Input type: java.lang.Comparable, java.lang.Comparable
Example IsXLessThanY
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Integer] | [1, 5] | true |
[java.lang.Integer, java.lang.Integer] | [5, 5] | false |
[java.lang.Integer, java.lang.Integer] | [10, 5] | false |
[java.lang.Long, java.lang.Integer] | [1, 5] | false |
[java.lang.Long, java.lang.Long] | [1, 5] | true |
[java.lang.Long, java.lang.Long] | [5, 5] | false |
[java.lang.Long, java.lang.Long] | [10, 5] | false |
[java.lang.Integer, java.lang.Long] | [1, 5] | false |
[java.lang.String, java.lang.String] | [bcd, cde] | true |
[java.lang.String, java.lang.String] | [bcd, abc] | false |
[java.lang.String, java.lang.Integer] | [1, 5] | false |
IsXMoreThanY
Checks the first comparable is more than the second comparable. Javadoc
Input type: java.lang.Comparable, java.lang.Comparable
Example IsXMoreThanY
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Integer] | [1, 5] | false |
[java.lang.Integer, java.lang.Integer] | [5, 5] | false |
[java.lang.Integer, java.lang.Integer] | [10, 5] | true |
[java.lang.Long, java.lang.Integer] | [10, 5] | false |
[java.lang.Long, java.lang.Long] | [1, 5] | false |
[java.lang.Long, java.lang.Long] | [5, 5] | false |
[java.lang.Long, java.lang.Long] | [10, 5] | true |
[java.lang.Integer, java.lang.Long] | [10, 5] | false |
[java.lang.String, java.lang.String] | [bcd, cde] | false |
[java.lang.String, java.lang.String] | [bcd, abc] | true |
[java.lang.String, java.lang.Integer] | [10, 5] | false |
MapContains
Checks if a map contains a given key. Javadoc
Input type: java.util.Map
Example MapContains
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashMap | {a=1, b=2, c=3} | true |
java.util.HashMap | {b=2, c=3} | false |
java.util.HashMap | {a=null, b=2, c=3} | true |
MapContainsPredicate
Checks if a map contains a key that matches a predicate. Javadoc
Input type: java.util.Map
Example of MapContainsPredicate with Regex Pedicate
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashMap | {a1=1, a2=2, b=2, c=3} | true |
java.util.HashMap | {b=2, c=3} | false |
java.util.HashMap | {a=null, b=2, c=3} | true |
PredicateMap
Extracts a value from a map then applies the predicate to it. Javadoc
Input type: java.util.Map
Example FreqMap is more than 2
Example inputs:
Input Type | Input | Result |
---|---|---|
uk.gov.gchq.gaffer.types.FreqMap | {key1=1} | false |
uk.gov.gchq.gaffer.types.FreqMap | {key1=2} | false |
uk.gov.gchq.gaffer.types.FreqMap | {key1=3} | true |
uk.gov.gchq.gaffer.types.FreqMap | {key1=3, key2=0} | true |
uk.gov.gchq.gaffer.types.FreqMap | {key2=3} | false |
Example FreqMap is more than or equal to 2
Example inputs:
Input Type | Input | Result |
---|---|---|
uk.gov.gchq.gaffer.types.FreqMap | {key1=1} | false |
uk.gov.gchq.gaffer.types.FreqMap | {key1=2} | true |
uk.gov.gchq.gaffer.types.FreqMap | {key1=3} | true |
uk.gov.gchq.gaffer.types.FreqMap | {key1=3, key2=0} | true |
uk.gov.gchq.gaffer.types.FreqMap | {key2=3} | false |
Example Map with date key having value that exists
Example inputs:
Input Type | Input | Result |
---|---|---|
java.util.HashMap | {Thu Jan 01 01:00:00 GMT 1970=1} | true |
java.util.HashMap | {Mon Nov 07 11:00:16 GMT 2022=2} | false |
StringContains
Checks if a string contains some value. Javadoc
Note
The StringContains predicate is case sensitive by default, hence only exact matches are found.
Input type: java.lang.String
Example StringContains
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | This is a Test | false |
java.lang.String | Test | false |
java.lang.String | test | true |
Example StringContains ignoring case
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | This is a Test | true |
java.lang.String | Test | true |
java.lang.String | test | true |
Regex
Checks if a string matches a pattern. Javadoc
Input type: java.lang.String
Example abc
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | a | true |
java.lang.String | z | false |
java.lang.String | az | false |
java.lang.Character | a | ClassCastException: java.lang.Character cannot be cast to java.lang.String |
java.lang.String | 2 | true |
java.lang.Integer | 2 | ClassCastException: java.lang.Integer cannot be cast to java.lang.String |
java.lang.Long | 2 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |
MultiRegex
Checks if a string matches at least one pattern. Javadoc
Input type: java.lang.String
Example MultiRegex
Example inputs:
Input Type | Input | Result |
---|---|---|
java.lang.String | a | true |
java.lang.String | z | false |
java.lang.String | az | false |
java.lang.Character | a | ClassCastException: java.lang.Character cannot be cast to java.lang.String |
java.lang.String | 2 | true |
java.lang.Integer | 2 | ClassCastException: java.lang.Integer cannot be cast to java.lang.String |
java.lang.Long | 2 | ClassCastException: java.lang.Long cannot be cast to java.lang.String |
Created: May 18, 2023