InRangeDual
See javadoc - uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual
Available since Koryphe version 1.1.0
The predicate tests 2 inputs (a start and an end) are within a defined range.
Examples
In long range 5 to 10
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.start(5L)
.end(10L)
.build();
{
"class" : "InRangeDual",
"start" : {
"Long" : 5
},
"end" : {
"Long" : 10
}
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : {
"java.lang.Long" : 5
},
"end" : {
"java.lang.Long" : 10
}
}
g.InRangeDual(
start={'java.lang.Long': 5},
end={'java.lang.Long': 10}
)
Input type:
java.lang.Comparable, java.lang.Comparable
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [-5, -1] | false |
[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] | true |
[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] | [6, 7] | IllegalArgumentException: Input tuple values do not match the required function input types |
[ ,] | [null, null] | false |
In long range 5 to 10 exclusive
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.start(5L)
.end(10L)
.startInclusive(false)
.endInclusive(false)
.build();
{
"class" : "InRangeDual",
"start" : {
"Long" : 5
},
"end" : {
"Long" : 10
},
"startInclusive" : false,
"endInclusive" : false
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : {
"java.lang.Long" : 5
},
"end" : {
"java.lang.Long" : 10
},
"startInclusive" : false,
"endInclusive" : false
}
g.InRangeDual(
start={'java.lang.Long': 5},
end={'java.lang.Long': 10},
start_inclusive=False,
end_inclusive=False
)
Input type:
java.lang.Comparable, java.lang.Comparable
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Long, java.lang.Long] | [-5, -1] | false |
[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 |
In long overlapping range
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.start(5L)
.end(10L)
.startFullyContained(false)
.endFullyContained(false)
.build();
{
"class" : "InRangeDual",
"start" : {
"Long" : 5
},
"end" : {
"Long" : 10
},
"endFullyContained" : false,
"startFullyContained" : false
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : {
"java.lang.Long" : 5
},
"end" : {
"java.lang.Long" : 10
},
"endFullyContained" : false,
"startFullyContained" : false
}
g.InRangeDual(
start={'java.lang.Long': 5},
end={'java.lang.Long': 10},
start_fully_contained=False,
end_fully_contained=False
)
Input type:
java.lang.Comparable, java.lang.Comparable
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 |
In long end overlapping range
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.start(5L)
.end(10L)
.startFullyContained(true)
.endFullyContained(false)
.build();
{
"class" : "InRangeDual",
"start" : {
"Long" : 5
},
"end" : {
"Long" : 10
},
"endFullyContained" : false,
"startFullyContained" : true
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : {
"java.lang.Long" : 5
},
"end" : {
"java.lang.Long" : 10
},
"endFullyContained" : false,
"startFullyContained" : true
}
g.InRangeDual(
start={'java.lang.Long': 5},
end={'java.lang.Long': 10},
start_fully_contained=True,
end_fully_contained=False
)
Input type:
java.lang.Comparable, java.lang.Comparable
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 |
In long non overlapping range
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.start(5L)
.end(10L)
.startFullyContained(true)
.endFullyContained(true)
.build();
{
"class" : "InRangeDual",
"start" : {
"Long" : 5
},
"end" : {
"Long" : 10
},
"endFullyContained" : true,
"startFullyContained" : true
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : {
"java.lang.Long" : 5
},
"end" : {
"java.lang.Long" : 10
},
"endFullyContained" : true,
"startFullyContained" : true
}
g.InRangeDual(
start={'java.lang.Long': 5},
end={'java.lang.Long': 10},
start_fully_contained=True,
end_fully_contained=True
)
Input type:
java.lang.Comparable, java.lang.Comparable
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 |
In long range less than 10
If the start of the range is not specified then the start of the range is unbounded.
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Long>()
.end(10L)
.endInclusive(false)
.build();
{
"class" : "InRangeDual",
"end" : {
"Long" : 10
},
"endInclusive" : false
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"end" : {
"java.lang.Long" : 10
},
"endInclusive" : false
}
g.InRangeDual(
end={'java.lang.Long': 10},
end_inclusive=False
)
Input type:
java.lang.Comparable, java.lang.Comparable
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 |
In integer range 5 to 10
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<Integer>()
.start(5)
.end(10)
.build();
{
"class" : "InRangeDual",
"start" : 5,
"end" : 10
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : 5,
"end" : 10
}
g.InRangeDual(
start=5,
end=10
)
Input type:
java.lang.Comparable, java.lang.Comparable
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.Integer, java.lang.Integer] | [-5, -1] | false |
[java.lang.Integer, java.lang.Integer] | [1, 6] | true |
[java.lang.Integer, java.lang.Integer] | [6, 6] | true |
[java.lang.Integer, java.lang.Integer] | [6, 7] | true |
[java.lang.Integer, java.lang.Integer] | [6, 10] | true |
[java.lang.Integer, java.lang.Integer] | [10, 20] | true |
[java.lang.Long, java.lang.Long] | [6, 7] | IllegalArgumentException: Input tuple values do not match the required function input types |
[java.lang.String, java.lang.String] | [6, 7] | IllegalArgumentException: Input tuple values do not match the required function input types |
[ ,] | [null, null] | false |
In string range b to d
Java
JSON
Full JSON
Python
final InRangeDual function = new InRangeDual.Builder<String>()
.start("B")
.end("D")
.build();
{
"class" : "InRangeDual",
"start" : "B",
"end" : "D"
}
{
"class" : "uk.gov.gchq.koryphe.impl.predicate.range.InRangeDual",
"start" : "B",
"end" : "D"
}
g.InRangeDual(
start="B",
end="D"
)
Input type:
java.lang.Comparable, java.lang.Comparable
Example inputs:
Input Type | Input | Result |
---|---|---|
[java.lang.String, java.lang.String] | [A, B] | true |
[java.lang.String, java.lang.String] | [B, C] | true |
[java.lang.String, java.lang.String] | [C, D] | true |
[java.lang.String, java.lang.String] | [b, c] | false |
[java.lang.Integer, java.lang.Integer] | [1, 2] | IllegalArgumentException: Input tuple values do not match the required function input types |
[ ,] | [null, null] | false |