Class FilterWithKey

java.lang.Object
hydra.tools.PrimitiveFunction
hydra.lib.maps.FilterWithKey

public class FilterWithKey extends PrimitiveFunction
Filters map entries by key and value.
  • Constructor Details

    • FilterWithKey

      public FilterWithKey()
  • Method Details

    • name

      public Name name()
      Get the name of this primitive function.
      Specified by:
      name in class PrimitiveFunction
      Returns:
      the name
    • type

      public TypeScheme type()
      Get the type scheme of this primitive function.
      Specified by:
      type in class PrimitiveFunction
      Returns:
      the type scheme
    • implementation

      protected Function<List<Term>,Flow<Graph,Term>> implementation()
      Get the implementation of this primitive function.
      Specified by:
      implementation in class PrimitiveFunction
      Returns:
      the implementation function
    • apply

      public static <K, V> Function<Map<K,V>,Map<K,V>> apply(Function<K,Function<V,Boolean>> pred)
      Filters entries based on a curried key-value predicate (used by generated code).
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      pred - the curried predicate: key -> value -> Boolean
      Returns:
      a function that takes a map and returns the filtered map
    • apply

      public static <K, V> Map<K,V> apply(Function<K,Function<V,Boolean>> pred, Map<K,V> mp)
      Filters entries based on a curried key-value predicate (used by generated code).
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      pred - the curried predicate: key -> value -> Boolean
      mp - the map to filter
      Returns:
      the filtered map