Skip to content

Commit 923d911

Browse files
committed
public static tlc2.value.impl.Value tlc2.overrides.SVG.directedMultiGraph(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]
1 parent 50999d7 commit 923d911

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

modules/tlc2/overrides/SVG.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,24 @@ public static Value ringNetwork(IntValue cx, IntValue cy, IntValue r, IntValue n
158158
}
159159

160160
@TLAPlusOperator(identifier = "NodesOfDirectedMultiGraph", module = "SVG", warn = false)
161-
public static Value directedMultiGraph(final SetEnumValue nodes, final SetEnumValue edges, final RecordValue opts)
161+
public static Value directedMultiGraph(final Value n, final Value e, final Value o)
162162
throws Exception {
163+
if (!(n instanceof SetEnumValue) || n.toSetEnum() == null) {
164+
throw new Exception(
165+
"Nodes must be a set. Value given is of type: " + n.getClass().getName());
166+
}
167+
if (!(e instanceof SetEnumValue) || e.toSetEnum() == null) {
168+
throw new Exception(
169+
"Edges must be a record. Value given is of type: " + e.getClass().getName());
170+
}
171+
if (!(o instanceof RecordValue) || o.toRcd() == null) {
172+
throw new Exception(
173+
"Opts must be a record. Value given is of type: " + o.getClass().getName());
174+
}
175+
final SetEnumValue nodes = (SetEnumValue) n.toSetEnum();
176+
final SetEnumValue edges = (SetEnumValue) e.toSetEnum();
177+
final RecordValue opts = (RecordValue) o.toRcd();
178+
163179
// https://jgrapht.org/guide/UserOverview#graph-structures
164180
final Graph<Value, Integer> graph = GraphTypeBuilder
165181
.<Value, Integer>forGraphType(DefaultGraphType.directedMultigraph())

0 commit comments

Comments
 (0)