Skip to content

Commit

Permalink
public static tlc2.value.impl.Value tlc2.overrides.SVG.directedMultiG…
Browse files Browse the repository at this point in the history
…raph(tlc2.value.impl.SetEnumValue,tlc2.value.impl.SetEnumValue,tlc2.value.impl.RecordValue) throws java.lang.Exception,

but it produced the following error:
Cannot cast tlc2.value.impl.SetPredValue to tlc2.value.impl.SetEnumValue

[Bug]
  • Loading branch information
lemmy committed Mar 23, 2022
1 parent 50999d7 commit 0e6ffe5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/tlc2/overrides/SVG.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,24 @@ public static Value ringNetwork(IntValue cx, IntValue cy, IntValue r, IntValue n
}

@TLAPlusOperator(identifier = "NodesOfDirectedMultiGraph", module = "SVG", warn = false)
public static Value directedMultiGraph(final SetEnumValue nodes, final SetEnumValue edges, final RecordValue opts)
public static Value directedMultiGraph(final Value n, final Value e, final Value o)
throws Exception {
if (!(n instanceof SetEnumValue) && n.toSetEnum() == null) {
throw new Exception(
"Nodes must be a set. Value given is of type: " + n.getClass().getName());
}
if (!(e instanceof SetEnumValue) && e.toSetEnum() == null) {
throw new Exception(
"Edges must be a set. Value given is of type: " + e.getClass().getName());
}
if (!(o instanceof RecordValue) && o.toRcd() == null) {
throw new Exception(
"Opts must be a record. Value given is of type: " + o.getClass().getName());
}
final SetEnumValue nodes = (SetEnumValue) n.toSetEnum();
final SetEnumValue edges = (SetEnumValue) e.toSetEnum();
final RecordValue opts = (RecordValue) o.toRcd();

// https://jgrapht.org/guide/UserOverview#graph-structures
final Graph<Value, Integer> graph = GraphTypeBuilder
.<Value, Integer>forGraphType(DefaultGraphType.directedMultigraph())
Expand Down

0 comments on commit 0e6ffe5

Please sign in to comment.