Class 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:
    Serialized Form
    • Field Detail

      • map

        protected final 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,
                                   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 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