Class Edge.Builder

  • Enclosing class:
    Edge

    public static class Edge.Builder
    extends java.lang.Object
    The Edge.Builder can be used to construct an Edge little by little.
    • Constructor Detail

      • Builder

        public Builder​(Node sourceNode,
                       Node targetNode)
        Constructs a new (anonymous) context-free Edge.Builder, which can only be used to construct a single edge via buildEdge(), i.e. which cannot be chained.
        Parameters:
        sourceNode - The source Node.
        targetNode - The target Node.
    • Method Detail

      • attr

        public <T> Edge.Builder attr​(java.util.function.BiConsumer<Edge,​T> setter,
                                     T value)
        Uses the given setter to set the attribute value.
        Type Parameters:
        T - The attribute type.
        Parameters:
        setter - The setter to apply.
        value - The value to apply.
        Returns:
        this for convenience.
      • attr

        public Edge.Builder attr​(java.lang.String key,
                                 java.lang.Object value)
        Puts the given key-value-pair into the attributesProperty map of the Edge which is constructed by this Edge.Builder.
        Parameters:
        key - The attribute name which is inserted.
        value - The attribute value which is inserted.
        Returns:
        this for convenience.
      • build

        public Graph build()
        Constructs a new Graph from the values which have been supplied to the builder chain.
        Returns:
        A new Graph.
      • buildEdge

        public Edge buildEdge()
        Creates a new Edge, setting the values specified via this Edge.Builder.
        Returns:
        A newly created Edge.