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

public Class ModuleHashesBuilder

extends Object
Class Inheritance
Imports
java.io.PrintStream, java.lang.module.Configuration, .ModuleReference, .ResolvedModule, java.util.ArrayDeque, .Collections, .Deque, .HashMap, .TreeMap, .HashSet, .Map, .Set, java.util.function.Consumer, java.util.stream.Stream

A Builder to compute ModuleHashes from a given configuration

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class
ModuleHashesBuilder.TopoSorter<T>

Topological sort

Field Summary

Modifier and TypeField and Description
private final Configuration
private final Set<String>

Constructor Summary

AccessConstructor and Description
public
ModuleHashesBuilder(Configuration
Configuration for building module hashes
config
,
Set<String>
the candidate modules to be hashed
modules
)

Constructs a ModuleHashesBuilder that finds the packaged modules from the location of ModuleReference found from the given Configuration.

Method Summary

Modifier and TypeMethod and Description
public Map<String, ModuleHashes>
computeHashes(Set<String> roots)

Returns a map of a module M to ModuleHashes for the modules that depend upon M directly or indirectly.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private final Configuration configuration
hashModuleCandidatesback to summary
private final Set<String> hashModuleCandidates

Constructor Detail

ModuleHashesBuilderback to summary
public ModuleHashesBuilder(Configuration config, Set<String> modules)

Constructs a ModuleHashesBuilder that finds the packaged modules from the location of ModuleReference found from the given Configuration.

Parameters
config:Configuration

Configuration for building module hashes

modules:Set<String>

the candidate modules to be hashed

Method Detail

computeHashesback to summary
public Map<String, ModuleHashes> computeHashes(Set<String> roots)

Returns a map of a module M to ModuleHashes for the modules that depend upon M directly or indirectly. The key for each entry in the returned map is a module M that has no outgoing edges to any of the candidate modules to be hashed i.e. M is a leaf node in a connected subgraph containing M and other candidate modules from the module graph filtering the outgoing edges from M to non-candidate modules.

jdk.internal.module back to summary

pack-priv Class ModuleHashesBuilder.Graph<T>

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Map<T, Set<T>>
private final Set<T>

Constructor Summary

AccessConstructor and Description
public
Graph(Set<T> nodes, Map<T, Set<T>> edges)

Method Summary

Modifier and TypeMethod and Description
public Set<T>
public boolean
contains(T u)

public Set<T>
dfs(T root)

Returns all nodes reachable from the given root.

public Set<T>
dfs(Set<T> roots)

Returns all nodes reachable from the given set of roots.

public Map<T, Set<T>>
public Set<T>
public void
ordered(Consumer<T> action)

Traverses this graph and performs the given action in topological order.

public Stream<T>
orderedNodes()

Returns nodes sorted in topological order.

public void
public void
reverse(Consumer<T> action)

Traverses this graph and performs the given action in reverse topological order.

public ModuleHashesBuilder.Graph<T>
transpose()

Returns a transposed graph from this graph.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

edgesback to summary
private final Map<T, Set<T>> edges
nodesback to summary
private final Set<T> nodes

Constructor Detail

Graphback to summary
public Graph(Set<T> nodes, Map<T, Set<T>> edges)

Method Detail

adjacentNodesback to summary
public Set<T> adjacentNodes(T u)
containsback to summary
public boolean contains(T u)
dfsback to summary
public Set<T> dfs(T root)

Returns all nodes reachable from the given root.

dfsback to summary
public Set<T> dfs(Set<T> roots)

Returns all nodes reachable from the given set of roots.

edgesback to summary
public Map<T, Set<T>> edges()
nodesback to summary
public Set<T> nodes()
orderedback to summary
public void ordered(Consumer<T> action)

Traverses this graph and performs the given action in topological order.

orderedNodesback to summary
public Stream<T> orderedNodes()

Returns nodes sorted in topological order.

printGraphback to summary
public void printGraph(PrintStream out)
reverseback to summary
public void reverse(Consumer<T> action)

Traverses this graph and performs the given action in reverse topological order.

transposeback to summary
public ModuleHashesBuilder.Graph<T> transpose()

Returns a transposed graph from this graph.

jdk.internal.module back to summary

pack-priv Class ModuleHashesBuilder.Graph.Builder<T>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Map<T, Set<T>>
pack-priv final Set<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addEdge(T u, T v)

public void
addNode(T node)

public ModuleHashesBuilder.Graph<T>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

edgesback to summary
pack-priv final Map<T, Set<T>> edges
nodesback to summary
pack-priv final Set<T> nodes

Constructor Detail

Builderback to summary
pack-priv Builder()

Method Detail

addEdgeback to summary
public void addEdge(T u, T v)
addNodeback to summary
public void addNode(T node)
buildback to summary
public ModuleHashesBuilder.Graph<T> build()
jdk.internal.module back to summary

private Class ModuleHashesBuilder.TopoSorter<T>

extends Object
Class Inheritance

Topological sort

Field Summary

Modifier and TypeField and Description
pack-priv final ModuleHashesBuilder.Graph<T>
pack-priv final Deque<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private Set<T>
children(T node)

public void
ordered(Consumer<T> action)

public void
reverse(Consumer<T> action)

private void
sort()

private void
visit(T node, Set<T> visited, Deque<T> stack)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

graphback to summary
pack-priv final ModuleHashesBuilder.Graph<T> graph
resultback to summary
pack-priv final Deque<T> result

Constructor Detail

TopoSorterback to summary
pack-priv TopoSorter(ModuleHashesBuilder.Graph<T> graph)

Method Detail

childrenback to summary
private Set<T> children(T node)
orderedback to summary
public void ordered(Consumer<T> action)
reverseback to summary
public void reverse(Consumer<T> action)
sortback to summary
private void sort()
visitback to summary
private void visit(T node, Set<T> visited, Deque<T> stack)