Class DefaultEdgeFunction<E,T>

java.lang.Object
org.jgrapht.graph.DefaultEdgeFunction<E,T>
Type Parameters:
E - the edge type
T - the value type
All Implemented Interfaces:
Serializable, Function<E,T>

public class DefaultEdgeFunction<E,T> extends Object implements Function<E,T>, Serializable
Default implementation of an edge function which uses a map to store values.
Author:
Dimitrios Michail
See Also:
  • Field Details

    • map

      protected final Map<E,T> map
    • defaultValue

      protected final T defaultValue
  • Constructor Details

    • DefaultEdgeFunction

      public DefaultEdgeFunction(T defaultValue)
      Create a new function
      Parameters:
      defaultValue - the default value
    • DefaultEdgeFunction

      public DefaultEdgeFunction(T defaultValue, Map<E,T> map)
      Create a new function
      Parameters:
      defaultValue - the default value
      map - the underlying map
  • Method Details

    • apply

      public T apply(E e)
      Get the function value for an edge.
      Specified by:
      apply in interface Function<E,T>
      Parameters:
      e - the edge
    • get

      public T get(E e)
      Get the function value for an edge.
      Parameters:
      e - the edge
      Returns:
      the function value for the edge
    • set

      public void set(E e, T value)
      Set the function value for an edge.
      Parameters:
      e - the edge
      value - the value