edu.claflin.finder.logic

## Class Edge<D>

- java.lang.Object
- - edu.claflin.finder.logic.Edge<D>

- Type Parameters:
    `D` - the data type of the data attached to the edge object.

      public class Edge<D>
      extends java.lang.Object

  Represents an Edge in memory. A simple implementation requiring only two nodes and a single piece of edge data.
  Version:
    3.1 February 2, 2016
  Author:
    Charles Allen Schultz II

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private D` | `data` The data attached to the edge.
    `private Node` | `destination` The node representing the destination.
    `private Node` | `source` The node representing the source.
    `private boolean` | `undirected` Indicates if this edge should be treated as being undirected.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Edge(Node source, Node destination, D data, boolean undirected)` Initializes the Edge object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Edge` | `duplicate(Node source, Node destination)` Attempts to duplicate an Edge based on the supplied parameters.
    `boolean` | `equals(java.lang.Object o)`
    `D` | `getData()` Access method for the Edge's data (such as weight).
    `Node` | `getDestination()` Access method for the Edge's destination.
    `Node` | `getSource()` Access method for the Edge's source.
    `int` | `hashCode()`
    `boolean` | `isUndirected()` Access method for the Edge's undirectedness parameter.
    `void` | `setData(D data)` Access method for the Edge's data (such as weight).
    `void` | `setUndirected(boolean undirected)` Access method for the Edge's undirectedness parameter.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### source

          private final Node source

      The node representing the source.

    - #### destination

          private final Node destination

      The node representing the destination.

    - #### data

          private D data

      The data attached to the edge.

    - #### undirected

          private boolean undirected

      Indicates if this edge should be treated as being undirected.

  - ### Constructor Detail

    - #### Edge

          public Edge(Node source,
                      Node destination,
                      D data,
                      boolean undirected)

      Initializes the Edge object.
      Parameters:
        `source` - the Node representing the interaction source.
        `destination` - t111111111111111he Node representing the interaction destination.
        `data` - the Object representing the Edge data.
        `undirected` - the boolean indicating if this edge is undirected.

  - ### Method Detail

    - #### getSource

          public Node getSource()

      Access method for the Edge's source.
      Returns:
        the Node representing the source.

    - #### getDestination

          public Node getDestination()

      Access method for the Edge's destination.
      Returns:
        the Node representing the destination.

    - #### getData

          public D getData()

      Access method for the Edge's data (such as weight).
      Returns:
        the Object representing the data.

    - #### setData

          public void setData(D data)

      Access method for the Edge's data (such as weight).
      Parameters:
        `data` - the new data for the edge.

    - #### isUndirected

          public boolean isUndirected()

      Access method for the Edge's undirectedness parameter.
      Returns:
        the boolean indicating if this edge is undirected.

    - #### setUndirected

          public void setUndirected(boolean undirected)

      Access method for the Edge's undirectedness parameter.
      Parameters:
        `undirected` - a boolean indicating if this edge should be undirected.

    - #### duplicate

          public Edge duplicate(Node source,
                                Node destination)

      Attempts to duplicate an Edge based on the supplied parameters. The data attached to the edge REMAINS THE SAME OBJECT as the original graph. As such, non-immutable objects will reflect changes across both edges. The supplied Node objects must be equivalent to the old ones.
      Parameters:
        `source` - the new Source node reference to utilize.
        `destination` - the new Destination node reference to utilize.
      Returns:
        a duplicate Edge decoupled from the original Graph.

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`