And

See javadoc - uk.gov.gchq.koryphe.impl.predicate.And

Available since Koryphe version 1.0.0

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:

java.lang.Object

Example inputs:

Input TypeInputResult
java.lang.Integer0false
java.lang.Integer1true
java.lang.Integer2true
java.lang.Integer3false
java.lang.Long1false
java.lang.Long2false

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( 
      predicate=g.IsLessThan( 
        or_equal_to=False, 
        value=2 
      ), 
      selection=[ 
        0 
      ] 
    ), 
    g.NestedPredicate( 
      predicate=g.IsMoreThan( 
        or_equal_to=False, 
        value=5 
      ), 
      selection=[ 
        1 
      ] 
    ) 
  ] 
)

Input type:

java.lang.Object

Example inputs:

Input TypeInputResult
[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

results matching ""

    No results matching ""