APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jpackage.internal.pipeline

public final Record FixedDAG<T>

extends Record
Class Inheritance
Record Components
edgeMatrix:BinaryMatrix
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:FixedDAG.Nodes<T>
the node container
Static Imports
java.util.stream.Collectors.toCollection

Fixed directed acyclic graph (DAG).

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static interface

Field Summary

Modifier and TypeField and Description
private final BinaryMatrix
edgeMatrix

Record Component accessed by edgeMatrix().

the edge matrix.
private final FixedDAG.Nodes<T>
nodes

Record Component accessed by nodes().

the node container

Constructor Summary

AccessConstructor and Description
public
FixedDAG(BinaryMatrix edgeMatrix, FixedDAG.Nodes<T> nodes)

Method Summary

Modifier and TypeMethod and Description
public static <U> FixedDAG.Builder<U>
public static <U> FixedDAG<U>
create(Collection<DirectedEdge<U>> edges, List<U> nodes)

pack-priv static <U> FixedDAG<U>
public void
public void
public BinaryMatrix
edgeMatrix()

Record Component getter of edgeMatrix.

Record Component the edge matrix.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public List<T>
getAllHeadsOf(T node)

private List<T>
getAllNodesOf(T node, boolean heads)

public List<T>
getAllTailsOf(T node)

public List<T>

Returns:

the list of nodes that are heads of the edges sharing the same tail, which is the given node
getHeadsOf
(T
a node
node
)

Gets the list of nodes that are heads of the edges sharing the same tail, which is the given node.

pack-priv static Stream<BinaryMatrix.Cursor>
getIncomingEdges(int node, BinaryMatrix edgeMatrix)

public List<T>

Returns:

the list of nodes without incoming edges
getNoIncomingEdges
()

Get the list of nodes without incoming edges.

pack-priv static IntStream
public List<T>

Returns:

the list of nodes without outgoing edges
getNoOutgoingEdges
()

Get the list of nodes without outgoing edges.

pack-priv static IntStream
pack-priv static Stream<BinaryMatrix.Cursor>
getOutgoingEdges(int node, BinaryMatrix edgeMatrix)

public List<T>

Returns:

the list of nodes that are tails of the edges sharing the same head, which is the given node
getTailsOf
(T
a node
node
)

Gets the list of nodes that are tails of the edges sharing the same head, which is the given node.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

private static boolean
isCyclic(BinaryMatrix edgeMatrix, Consumer<Integer> topologicalOrderAccumulator)

public FixedDAG.Nodes<T>
nodes()

Record Component getter of nodes.

Record Component the node container

public List<T>

Returns:

topologically ordered nodes of this graph
topologicalSort
()

Returns topologically ordered nodes of this graph.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

pack-priv static void
traverseNodes(int nodeIndex, BinaryMatrix edgeMatrix, boolean heads, Function<Integer, Boolean> nodeAccumulator)

Field Detail

edgeMatrixback to summary
private final BinaryMatrix edgeMatrix

Record Component accessed by 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

nodesback to summary
private final FixedDAG.Nodes<T> nodes

Record Component accessed by nodes().

the node container

Constructor Detail

FixedDAGback to summary
public FixedDAG(BinaryMatrix edgeMatrix, FixedDAG.Nodes<T> nodes)

Method Detail

buildback to summary
public static <U> FixedDAG.Builder<U> build()
createback to summary
public static <U> FixedDAG<U> create(Collection<DirectedEdge<U>> edges, List<U> nodes)
createback to summary
pack-priv static <U> FixedDAG<U> create(Collection<DirectedEdge<U>> edges, FixedDAG.Nodes<U> nodes)
dumpback to summary
public void dump(Consumer<String> sink)
dumpToStdoutback to summary
public void dumpToStdout()
edgeMatrixback to summary
public BinaryMatrix edgeMatrix()

Record Component getter of edgeMatrix.

Record Component
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
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
getAllHeadsOfback to summary
public List<T> getAllHeadsOf(T node)
getAllNodesOfback to summary
private List<T> getAllNodesOf(T node, boolean heads)
getAllTailsOfback to summary
public List<T> getAllTailsOf(T node)
getHeadsOfback to summary
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:T

a node

Returns:List<T>

the list of nodes that are heads of the edges sharing the same tail, which is the given node

See Also
Nodes
getIncomingEdgesback to summary
pack-priv static Stream<BinaryMatrix.Cursor> getIncomingEdges(int node, BinaryMatrix edgeMatrix)
getNoIncomingEdgesback to summary
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:List<T>

the list of nodes without incoming edges

getNoIncomingEdgesback to summary
pack-priv static IntStream getNoIncomingEdges(BinaryMatrix edgeMatrix)
getNoOutgoingEdgesback to summary
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:List<T>

the list of nodes without outgoing edges

getNoOutgoingEdgesback to summary
pack-priv static IntStream getNoOutgoingEdges(BinaryMatrix edgeMatrix)
getOutgoingEdgesback to summary
pack-priv static Stream<BinaryMatrix.Cursor> getOutgoingEdges(int node, BinaryMatrix edgeMatrix)
getTailsOfback to summary
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:T

a node

Returns:List<T>

the list of nodes that are tails of the edges sharing the same head, which is the given node

See Also
Nodes
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

isCyclicback to summary
private static boolean isCyclic(BinaryMatrix edgeMatrix, Consumer<Integer> topologicalOrderAccumulator)
nodesback to summary
public FixedDAG.Nodes<T> nodes()

Record Component getter of nodes.

Record Component
the node container
topologicalSortback to summary
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:List<T>

topologically ordered nodes of this graph

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

traverseNodesback to summary
pack-priv static void traverseNodes(int nodeIndex, BinaryMatrix edgeMatrix, boolean heads, Function<Integer, Boolean> nodeAccumulator)
jdk.jpackage.internal.pipeline back to summary

public final Class FixedDAG.Builder<U>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final List<DirectedEdge<U>>
private final List<U>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public FixedDAG.Builder<U>
addEdge(U tail, U head)

public FixedDAG.Builder<U>
public FixedDAG.Builder<U>
addNode(U node)

public FixedDAG<U>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

edgesback to summary
private final List<DirectedEdge<U>> edges
nodesback to summary
private final List<U> nodes

Constructor Detail

Builderback to summary
public Builder()

Method Detail

addEdgeback to summary
public FixedDAG.Builder<U> addEdge(U tail, U head)
addEdgeback to summary
public FixedDAG.Builder<U> addEdge(DirectedEdge<U> edge)
addNodeback to summary
public FixedDAG.Builder<U> addNode(U node)
createback to summary
public FixedDAG<U> create()
jdk.jpackage.internal.pipeline back to summary

public Interface FixedDAG.Nodes<U>

extends Iterable<U>

Method Summary

Modifier and TypeMethod and Description
public U
get(int index)

public int
indexOf(U node)

public static <V> FixedDAG.Nodes<V>
ofList(List<V> list)

public int
size()

Inherited from java.lang.Iterable:
forEachiteratorspliterator

Method Detail

getback to summary
public U get(int index)
indexOfback to summary
public int indexOf(U node)
ofListback to summary
public static <V> FixedDAG.Nodes<V> ofList(List<V> list)
sizeback to summary
public int size()