Record Class FixedDAG<T>

java.lang.Object
java.lang.Record
jdk.jpackage.internal.pipeline.FixedDAG<T>
Record Components:
edgeMatrix - the edge matrix. [i,j] addresses an edge, where 'i' is the index of the head node of the edge in the node container and 'j' is the index of the tail node of the edge in the node container
nodes - the node container

public record FixedDAG<T>(BinaryMatrix edgeMatrix, FixedDAG.Nodes<T> nodes) extends Record
Fixed directed acyclic graph (DAG).

Number of nodes is fixed, links between nodes can be added or removed.

  • Constructor Details

    • FixedDAG

      public FixedDAG(BinaryMatrix edgeMatrix, FixedDAG.Nodes<T> nodes)
      Creates an instance of a FixedDAG record class.
      Parameters:
      edgeMatrix - the value for the edgeMatrix record component
      nodes - the value for the nodes record component
  • Method Details

    • build

      public static <U> FixedDAG.Builder<U> build()
    • create

      public static <U> FixedDAG<U> create(Collection<DirectedEdge<U>> edges, List<U> nodes)
    • topologicalSort

      public List<T> topologicalSort()
      Returns topologically ordered nodes of this graph.

      For every directed edge ("tail", "head") from "tail" to "head", "tail" comes before "head".

      Returns:
      topologically ordered nodes of this graph
    • getAllHeadsOf

      public List<T> getAllHeadsOf(T node)
    • getAllTailsOf

      public List<T> getAllTailsOf(T node)
    • getHeadsOf

      public List<T> getHeadsOf(T node)
      Gets the list of nodes that are heads of the edges sharing the same tail, which is the given node.

      The returned list is ordered by the indexes of the nodes in the node container of this graph.

      Parameters:
      node - a node
      Returns:
      the list of nodes that are heads of the edges sharing the same tail, which is the given node
      See Also:
    • getTailsOf

      public List<T> getTailsOf(T node)
      Gets the list of nodes that are tails of the edges sharing the same head, which is the given node.

      The returned list is ordered by the indexes of the nodes in the node container of this graph.

      Parameters:
      node - a node
      Returns:
      the list of nodes that are tails of the edges sharing the same head, which is the given node
      See Also:
    • getNoIncomingEdges

      public List<T> getNoIncomingEdges()
      Get the list of nodes without incoming edges.

      A node without incoming edges is a node that is not a head of any of the edges in the graph.

      The returned list is ordered by the indexes of the nodes in the node container of this graph.

      Returns:
      the list of nodes without incoming edges
    • getNoOutgoingEdges

      public List<T> getNoOutgoingEdges()
      Get the list of nodes without outgoing edges.

      A node without outgoing edges is a node that is not a tail of any of the edges in the graph.

      The returned list is ordered by the indexes of the nodes in the node container of this graph.

      Returns:
      the list of nodes without outgoing edges
    • dumpToStdout

      public void dumpToStdout()
    • dump

      public void dump(Consumer<String> sink)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • edgeMatrix

      public BinaryMatrix edgeMatrix()
      Returns the value of the edgeMatrix record component.
      Returns:
      the value of the edgeMatrix record component
    • nodes

      public FixedDAG.Nodes<T> nodes()
      Returns the value of the nodes record component.
      Returns:
      the value of the nodes record component