Class DefaultEdgeFunction<E,​T>

  • Type Parameters:
    E - the edge type
    T - the value type
    All Implemented Interfaces:
    java.io.Serializable, java.util.function.Function<E,​T>

    public class DefaultEdgeFunction<E,​T>
    extends java.lang.Object
    implements java.util.function.Function<E,​T>, java.io.Serializable
    Default implementation of an edge function which uses a map to store values.
    Author:
    Dimitrios Michail
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected T defaultValue  
      protected java.util.Map<E,​T> map  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T apply​(E e)
      Get the function value for an edge.
      T get​(E e)
      Get the function value for an edge.
      void set​(E e, T value)
      Set the function value for an edge.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • map

        protected final java.util.Map<E,​T> map
      • defaultValue

        protected final T defaultValue
    • Constructor Detail

      • DefaultEdgeFunction

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

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

      • apply

        public T apply​(E e)
        Get the function value for an edge.
        Specified by:
        apply in interface java.util.function.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