public static final class PGrammars.Dependencies extends Object implements SCC.Graph<String>
Modifier and Type | Field and Description |
---|---|
Map<String,Set<String>> |
backward
The backward dependencies associate to each non-terminal
the set of non-terminals which mention it in the
right-hand side of their productions
|
Map<String,Set<String>> |
forward
The forward dependencies associate to each non-terminal
the set of non-terminals which appear in the right-hand
side of its productions
|
Constructor and Description |
---|
Dependencies(Map<String,Set<String>> forward,
Map<String,Set<String>> backward)
Builds the given dependencies
|
Modifier and Type | Method and Description |
---|---|
int |
index(String n)
Each node must have a unique index, i.e. for
every index
0 <= i < size() , there must
be some node n such that index(n) = i . |
void |
iter(Consumer<String> f)
Applies the function
f to all the nodes in
the graph, in no particular order |
int |
size() |
void |
successors(String n,
Consumer<String> f)
Applies the function
f to all the successors
of the node n , in no particular order |
String |
toString() |
public final Map<String,Set<String>> forward
public int size()
public int index(String n)
SCC.Graph
0 <= i < size()
, there must
be some node n
such that index(n) = i
.public void successors(String n, Consumer<String> f)
SCC.Graph
f
to all the successors
of the node n
, in no particular ordersuccessors
in interface SCC.Graph<String>