Selaa lähdekoodia

Changes in models code for new set representation

Yentl Van Tendeloo 8 vuotta sitten
vanhempi
commit
064d8b08cd

+ 2 - 2
models/CBD_mapper.mvc

@@ -72,7 +72,7 @@ Composite schedule {
                 label = "1"
                 value___asid = $
                     String function value(model : Element, name : String, mapping : Element):
-                        if (read_nr_out(string_split(mapping["0"], "/")) > 1):
+                        if (list_len(string_split(mapping["0"], "/")) > 1):
                             return list_read(string_split(mapping["0"], "/"), 1)!
                         else:
                             return mapping["0"]!
@@ -245,7 +245,7 @@ Composite schedule {
                 label = "7"
                 value___asid = $
                     String function value(model : Element, name : String, mapping : Element):
-                        if (read_nr_out(string_split(mapping["2"], "/")) > 1):
+                        if (list_len(string_split(mapping["2"], "/")) > 1):
                             return list_read(string_split(mapping["2"], "/"), 1)!
                         else:
                             return mapping["2"]!

+ 32 - 32
models/SCCD_execute.alc

@@ -19,14 +19,14 @@ Void function print_states(model : Element, data : Element):
 
 	log("Current states:")
 	classes = set_copy(data["classes"])
-	while (read_nr_out(classes) > 0):
+	while (set_len(classes) > 0):
 		class = set_pop(classes)
 		log(string_join(string_join(string_join("  ", class["ID"]), " : "), read_attribute(model, class["type"], "name")))
 		log("	Attributes: " + dict_to_string(class["attributes"]))
 
 		states = set_copy(class["states"])
 		log("	States:")
-		while (read_nr_out(states) > 0):
+		while (set_len(states) > 0):
 			state = set_pop(states)
 			log(string_join("		", read_attribute(model, state, "name")))
 
@@ -38,7 +38,7 @@ Element function filter(model : Element, set : Element, attribute_name : String,
 	Element result
 
 	result = create_node()
-	while (read_nr_out(set) > 0):
+	while (set_len(set) > 0):
 		key = set_pop(set)
 		if (value_eq(read_attribute(model, key, attribute_name), attribute_value)):
 			set_add(result, key)
@@ -51,7 +51,7 @@ Element function filter_exists(model : Element, set : Element, attribute_name :
 	Element result
 
 	result = create_node()
-	while (read_nr_out(set) > 0):
+	while (set_len(set) > 0):
 		key = set_pop(set)
 		if (element_neq(read_attribute(model, key, attribute_name), read_root())):
 			set_add(result, key)
@@ -67,7 +67,7 @@ Element function expand_current_state(model : Element, state : String, data : El
 
 	Element hierarchy
 	String deep_state
-	while (read_nr_out(current_states) > 0):
+	while (set_len(current_states) > 0):
 		deep_state = set_pop(current_states)
 		hierarchy = find_hierarchy(model, deep_state, data)
 		// Got the hierarchy of one of the states
@@ -117,7 +117,7 @@ Element function expand_parallel_state(model : Element, parallel_state : String,
 	children = allAssociationDestinations(model, parallel_state, "SCCD/parallel_children")
 	result = create_node()
 
-	while (read_nr_out(children) > 0):
+	while (set_len(children) > 0):
 		set_merge(result, expand_initial_state(model, set_pop(children), data))
 
 	return result!
@@ -158,7 +158,7 @@ Void function start_class(model : Element, data : Element, class : String, ident
 	history = create_node()
 	dict_add(class_handle, "history", history)
 	cstates = allInstances(model, "SCCD/CompositeState")
-	while (read_nr_out(cstates) > 0):
+	while (set_len(cstates) > 0):
 		cstate = set_pop(cstates)
 		dict_add(history, cstate, expand_initial_state(model, cstate, class_handle))
 
@@ -167,7 +167,7 @@ Void function start_class(model : Element, data : Element, class : String, ident
 	attributes = create_node()
 	Element attrs
 	attrs = allAssociationDestinations(model, class, "SCCD/class_attributes")
-	while (read_nr_out(attrs) > 0):
+	while (set_len(attrs) > 0):
 		dict_add(attributes, read_attribute(model, set_pop(attrs), "name"), read_root())
 	dict_add(class_handle, "attributes", attributes)
 
@@ -212,7 +212,7 @@ Element function get_enabled_transitions(model : Element, state : String, data :
 	event_names = create_node()
 	event_parameters = create_node()
 	events = set_copy(data["current_class_handle"]["events"])
-	while (read_nr_out(events) > 0):
+	while (set_len(events) > 0):
 		evt = set_pop(events)
 		evt_name = list_read(evt, 0)
 
@@ -223,7 +223,7 @@ Element function get_enabled_transitions(model : Element, state : String, data :
 		// Add event parameters
 		set_add(event_parameters[evt_name], list_read(evt, 1))
 
-	while (read_nr_out(to_filter) > 0):
+	while (set_len(to_filter) > 0):
 		transition = set_pop(to_filter)
 
 		// Check event
@@ -255,7 +255,7 @@ Element function get_enabled_transitions(model : Element, state : String, data :
 			Element params
 			Element param
 			params = set_copy(event_parameters[attr])
-			while (read_nr_out(params) > 0):
+			while (set_len(params) > 0):
 				param = set_pop(params)
 				if (element_neq(cond, read_root())):
 					// Got a condition to check first
@@ -308,7 +308,7 @@ Void function process_raised_event(model : Element, event : Element, parameter_a
 		// Send to all classes
 		Element classes
 		classes = dict_keys(data["classes"])
-		while(read_nr_out(classes) > 0):
+		while(set_len(classes) > 0):
 			set_add_node(data["classes"][set_pop(classes)]["new_events"], create_tuple(read_attribute(model, event, "event"), parameter_action))
 	elif (scope == "narrow"):
 		// Send to the specified class only
@@ -337,7 +337,7 @@ Element function execute_transition(model : Element, data : Element, transition_
 	Element events
 	String event
 	events = allAssociationDestinations(model, transition, "SCCD/transition_raises")
-	while (read_nr_out(events) > 0):
+	while (set_len(events) > 0):
 		event = set_pop(events)
 
 		Element parameter_action
@@ -385,17 +385,17 @@ Boolean function step_class(model : Element, data : Element, class : String):
 	new_states = create_node()
 	transitioned = False
 
-	while (read_nr_out(states) > 0):
+	while (set_len(states) > 0):
 		state = set_pop(states)
 		found = False
 
 		// Loop over the hierarchy of this state and try to apply transitions
 		hierarchy = find_hierarchy(model, state, data)
-		while (read_nr_out(hierarchy) > 0):
+		while (list_len(hierarchy) > 0):
 			current_state = list_pop(hierarchy, 0)
 			transitions = get_enabled_transitions(model, current_state, data)
 
-			if (read_nr_out(transitions) > 0):
+			if (set_len(transitions) > 0):
 				// Found an enabled transition, so store that one
 				transition = random_choice(set_to_list(transitions))
 				
@@ -424,7 +424,7 @@ String function get_parent(model : Element, state : String):
 	Element tmp_set
 	tmp_set = allAssociationOrigins(model, state, "SCCD/composite_children")
 	set_merge(tmp_set, allAssociationOrigins(model, state, "SCCD/parallel_children"))
-	if (read_nr_out(tmp_set) > 0):
+	if (set_len(tmp_set) > 0):
 		return set_pop(tmp_set)!
 	else:
 		return ""!
@@ -462,11 +462,11 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 	Element all_hierarchies
 
 	hierarchy_sources = create_node()
-	while (read_nr_out(source_states) > 0):
+	while (set_len(source_states) > 0):
 		set_add(hierarchy_sources, find_hierarchy(model, set_pop(source_states), data))
 
 	hierarchy_targets = create_node()
-	while (read_nr_out(target_states) > 0):
+	while (set_len(target_states) > 0):
 		set_add(hierarchy_targets, find_hierarchy(model, set_pop(target_states), data))
 
 	all_hierarchies = set_copy(hierarchy_sources)
@@ -492,7 +492,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 			// Check the i-th element in both and see if they are equal
 			current = ""
 			iter_hierarchies = set_copy(all_hierarchies)
-			while (read_nr_out(iter_hierarchies) > 0):
+			while (set_len(iter_hierarchies) > 0):
 				hierarchy = set_pop(iter_hierarchies)
 
 				// Exhausted one of the lists
@@ -541,7 +541,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 	Element hierarchy_source
 	Element hierarchy_target
 	visited = create_node()
-	while (read_nr_out(hierarchy_sources) > 0):
+	while (set_len(hierarchy_sources) > 0):
 		// Get one of these hierarchies
 		hierarchy_source = set_pop(hierarchy_sources)
 		spliced_hierarchy = list_splice(hierarchy_source, i, list_len(hierarchy_source))
@@ -561,7 +561,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 	// Add hierarchy_targets actions
 	// Clear visited, just to be safe, though it should not matter
 	visited = create_node()
-	while (read_nr_out(hierarchy_targets) > 0):
+	while (set_len(hierarchy_targets) > 0):
 		// Get one of these hierarchies
 		hierarchy_target = set_pop(hierarchy_targets)
 		spliced_hierarchy = list_splice(hierarchy_target, i, list_len(hierarchy_target))
@@ -584,7 +584,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 	Element events
 	String event
 	// First do exit actions
-	while (read_nr_out(exit) > 0):
+	while (list_len(exit) > 0):
 		state = list_pop(exit, 0)
 
 		// Set history when leaving
@@ -600,7 +600,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 
 		// Raise events
 		events = allAssociationDestinations(model, state, "SCCD/onExitRaise")
-		while (read_nr_out(events) > 0):
+		while (set_len(events) > 0):
 			event = set_pop(events)
 
 			Element parameter_action
@@ -615,11 +615,11 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 		// Unschedule after events
 		Element timed_transitions
 		timed_transitions = filter_exists(model, allOutgoingAssociationInstances(model, state, "SCCD/transition"), "after")
-		while (read_nr_out(timed_transitions) > 0):
+		while (set_len(timed_transitions) > 0):
 			dict_delete(data["current_class_handle"]["timers"], set_pop(timed_transitions))
 
 	// Then do entry actions
-	while (read_nr_out(entry) > 0):
+	while (list_len(entry) > 0):
 		state = list_pop(entry, 0)
 
 		// Do entry actions
@@ -631,7 +631,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 
 		// Raise events
 		events = allAssociationDestinations(model, state, "SCCD/onEntryRaise")
-		while (read_nr_out(events) > 0):
+		while (set_len(events) > 0):
 			event = set_pop(events)
 
 			Element parameter_action
@@ -648,7 +648,7 @@ Void function execute_actions(model : Element, source_states : Element, target_s
 		String transition
 		Element after
 		timed_transitions = filter_exists(model, allOutgoingAssociationInstances(model, state, "SCCD/transition"), "after")
-		while (read_nr_out(timed_transitions) > 0):
+		while (set_len(timed_transitions) > 0):
 			transition = set_pop(timed_transitions)
 			after = resolve_function(read_attribute(model, transition, "after"), data)
 			dict_add(data["current_class_handle"]["timers"], transition, float_addition(data["time_sim"], after(data["current_class_handle"]["attributes"])))
@@ -669,7 +669,7 @@ Float function step(model : Element, data : Element):
 	classes = dict_keys(data["classes"])
 
 	transitioned = False
-	while (read_nr_out(classes) > 0):
+	while (set_len(classes) > 0):
 		class = set_pop(classes)
 		if (step_class(model, data, class)):
 			transitioned = True
@@ -677,7 +677,7 @@ Float function step(model : Element, data : Element):
 		if (bool_not(transitioned)):
 			// Find minimum timer for this class, and store that
 			keys = dict_keys(data["classes"][class]["timers"])
-			while (read_nr_out(keys) > 0):
+			while (set_len(keys) > 0):
 				key = set_pop(keys)
 				t_current = data["classes"][class]["timers"][key]
 				if (t_current < t_min):
@@ -735,7 +735,7 @@ Boolean function main(model : Element):
 		dict_overwrite(data, "new_events", create_node())
 		Element classes
 		classes = dict_keys(data["classes"])
-		while(read_nr_out(classes) > 0):
+		while(set_len(classes) > 0):
 			String class
 			class = set_pop(classes)
 			dict_overwrite(data["classes"][class], "events", data["classes"][class]["new_events"])
@@ -753,7 +753,7 @@ Boolean function main(model : Element):
 		if (float_gt(time_sim, data["time_sim"])):
 			print_states(model, data)
 
-		if (read_nr_out(data["classes"]) == 0):
+		if (dict_len(data["classes"]) == 0):
 			// No more active classes left: terminate!
 			log("Finished SCCD execution")
 			break!

+ 7 - 7
models/bfs.alc

@@ -15,20 +15,20 @@ Boolean function bfs(model : Element):
 	String dest
 	Integer total_states
 
-	total_states = read_nr_out(allInstances(model, "ReachabilityGraph/State"))
+	total_states = set_len(allInstances(model, "ReachabilityGraph/State"))
 
-	worklist = create_node()
-	visited = create_node()
+	worklist = list_create()
+	visited = set_create()
 	initial = set_pop(allInstances(model, "ReachabilityGraph/InitialState"))
-	list_append(worklist, create_tuple(initial, create_node()))
+	list_append(worklist, create_tuple(initial, dict_create()))
 	set_add(visited, initial)
 
-	while (read_nr_out(worklist) > 0):
+	while (list_len(worklist) > 0):
 		work_unit = list_pop(worklist, 0)
 		state = work_unit[0]
 		path = work_unit[1]
 
-		if (read_nr_out(visited) == total_states):
+		if (set_len(visited) == total_states):
 			log("No error path found!")
 			break!
 
@@ -42,7 +42,7 @@ Boolean function bfs(model : Element):
 
 		options = allOutgoingAssociationInstances(model, state, "ReachabilityGraph/Transition")
 
-		while (read_nr_out(options) > 0):
+		while (set_len(options) > 0):
 			option = set_pop(options)
 			dest = readAssociationDestination(model, option)
 

+ 3 - 3
models/control_to_EPN.mvc

@@ -143,7 +143,7 @@ Composite schedule {
                         String state
 
                         states = allInstances(model, "PW_Control/State")
-                        while (read_nr_out(states) > 0):
+                        while (set_len(states) > 0):
                             state = set_pop(states)
                             if (value_eq(read_attribute(model, state, "isInitial"), True)):
                                 if (read_type(model, state) == "PW_Control/Up"):
@@ -175,7 +175,7 @@ Composite schedule {
                         String state
 
                         states = allInstances(model, "PW_Control/State")
-                        while (read_nr_out(states) > 0):
+                        while (set_len(states) > 0):
                             state = set_pop(states)
                             if (value_eq(read_attribute(model, state, "isInitial"), True)):
                                 if (read_type(model, state) == "PW_Control/Neutral"):
@@ -207,7 +207,7 @@ Composite schedule {
                         String state
 
                         states = allInstances(model, "PW_Control/State")
-                        while (read_nr_out(states) > 0):
+                        while (set_len(states) > 0):
                             state = set_pop(states)
                             if (value_eq(read_attribute(model, state, "isInitial"), True)):
                                 if (read_type(model, state) == "PW_Control/Down"):

+ 2 - 2
models/dynamic_trafficlight.mvc

@@ -34,7 +34,7 @@ transition (manager_main_start, manager_main_start) {
         parameter = $
                 Element function raise(attributes : Element, parameters : Element):
                     Element result
-                    result = create_node()
+                    result = list_create()
                     list_append(result, "TrafficLight")
                     list_append(result, attributes["counter"])
                     list_append(result, read_root())
@@ -54,7 +54,7 @@ transition (manager_main_start, manager_main_start) {
         parameter = $
                 Element function raise(attributes : Element, parameters : Element):
                     Element result
-                    result = create_node()
+                    result = list_create()
                     dict_overwrite(attributes, "counter", integer_subtraction(attributes["counter"], 1))
                     list_append(result, attributes["counter"])
                     return result!

+ 6 - 5
models/epn_print.alc

@@ -12,7 +12,7 @@ Boolean function pn_print(model : Element):
 
 	log("Places:")
 	all_places = allInstances(model, "Encapsulated_PetriNet/Place")
-	while (read_nr_out(all_places) > 0):
+	while (set_len(all_places) > 0):
 		place = set_pop(all_places)
 		name = read_attribute(model, place, "name")
 		tokens = read_attribute(model, place, "tokens")
@@ -21,24 +21,25 @@ Boolean function pn_print(model : Element):
 
 	log("Transitions:")
 	all_places = allInstances(model, "Encapsulated_PetriNet/Transition")
-	while (read_nr_out(all_places) > 0):
+	while (set_len(all_places) > 0):
 		place = set_pop(all_places)
 		name = read_attribute(model, place, "name")
 
 		log("  " + name)
 
 		all_t = allIncomingAssociationInstances(model, place, "Encapsulated_PetriNet/P2T")
-		while (read_nr_out(all_t) > 0):
+		while (set_len(all_t) > 0):
 			t = set_pop(all_t)
 			log("    <-- " + cast_v2s(read_attribute(model, readAssociationSource(model, t), "name")))
+
 		all_t = allOutgoingAssociationInstances(model, place, "Encapsulated_PetriNet/T2P")
-		while (read_nr_out(all_t) > 0):
+		while (set_len(all_t) > 0):
 			t = set_pop(all_t)
 			log("    --> " + cast_v2s(read_attribute(model, readAssociationDestination(model, t), "name")))
 
 	log("Ports:")
 	all_places = allInstances(model, "Encapsulated_PetriNet/Port")
-	while (read_nr_out(all_places) > 0):
+	while (set_len(all_places) > 0):
 		place = set_pop(all_places)
 		name = read_attribute(model, place, "name")
 

+ 1 - 1
models/merge_EPN.alc

@@ -9,7 +9,7 @@ Boolean function main(model : Element):
 	tm = model["type_mapping"]
 
 	keys = dict_keys(tm)
-	while (read_nr_out(keys) > 0):
+	while (set_len(keys) > 0):
 		key = set_pop(keys)
 		split = string_split(tm[key], "/")
 		dict_overwrite(tm, key, string_join("Encapsulated_PetriNet/", split[1]))

+ 2 - 2
models/plant_to_EPN.mvc

@@ -125,7 +125,7 @@ Composite schedule {
                         String state
 
                         states = allInstances(model, "PW_Plant/State")
-                        while (read_nr_out(states) > 0):
+                        while (set_len(states) > 0):
                             state = set_pop(states)
                             if (value_eq(read_attribute(model, state, "isInitial"), True)):
                                 if (read_type(model, state) == "PW_Plant/ErrorState"):
@@ -158,7 +158,7 @@ Composite schedule {
                         String state
 
                         states = allInstances(model, "PW_Plant/State")
-                        while (read_nr_out(states) > 0):
+                        while (set_len(states) > 0):
                             state = set_pop(states)
                             if (value_eq(read_attribute(model, state, "isInitial"), True)):
                                 if (read_type(model, state) == "PW_Plant/ErrorState"):

+ 24 - 24
models/reachability.alc

@@ -31,49 +31,49 @@ Boolean function reachability_graph(model : Element):
 	Element work_unit
 
 	Element cache
-	cache = create_node()
+	cache = dict_create()
 
 	// Create a dictionary representation for each transition
-	transition_vectors_produce = create_node()
-	transition_vectors_consume = create_node()
+	transition_vectors_produce = dict_create()
+	transition_vectors_consume = dict_create()
 	all_transitions = allInstances(model, "PetriNet/Transition")
-	while (read_nr_out(all_transitions) > 0):
+	while (set_len(all_transitions) > 0):
 		transition = set_pop(all_transitions)
 
-		tv = create_node()
+		tv = dict_create()
 		links = allIncomingAssociationInstances(model, transition, "PetriNet/P2T")
-		while (read_nr_out(links) > 0):
+		while (set_len(links) > 0):
 			link = set_pop(links)
 			name = reverseKeyLookup(model["model"], read_edge_src(model["model"][link]))
 			link_weight = read_attribute(model, link, "weight")
 			dict_add_fast(tv, name, link_weight)
 		dict_add_fast(transition_vectors_consume, transition, tv)
 
-		tv = create_node()
+		tv = dict_create()
 		links = allOutgoingAssociationInstances(model, transition, "PetriNet/T2P")
-		while (read_nr_out(links) > 0):
+		while (set_len(links) > 0):
 			link = set_pop(links)
 			name = reverseKeyLookup(model["model"], read_edge_dst(model["model"][link]))
 			link_weight = read_attribute(model, link, "weight")
 			dict_add_fast(tv, name, link_weight)
 		dict_add_fast(transition_vectors_produce, transition, tv)
 
-	workset = create_node()
+	workset = set_create()
 
 	all_places = allInstances(model, "PetriNet/Place")
-	dict_repr = create_node()
-	while (read_nr_out(all_places) > 0):
+	dict_repr = dict_create()
+	while (set_len(all_places) > 0):
 		place = set_pop(all_places)
 		dict_add_fast(dict_repr, place, read_attribute(model, place, "tokens"))
 
 	all_transitions_original = allInstances(model, "PetriNet/Transition")
 
-	mappings = create_node()
+	mappings = dict_create()
 	state_id = 0
 	next_id = 1
-	reachable_states = create_node()
+	reachable_states = dict_create()
 	dict_add_fast(reachable_states, state_id, dict_repr)
-	dict_add_fast(mappings, state_id, create_node())
+	dict_add_fast(mappings, state_id, dict_create())
 	set_add(workset, state_id)
 
 	// And add in the model itself
@@ -81,14 +81,14 @@ Boolean function reachability_graph(model : Element):
 	instantiate_attribute(model, state, "name", cast_i2s(state_id))
 	instantiate_attribute(model, state, "error", False)
 	keys = dict_keys(dict_repr)
-	while (read_nr_out(keys) > 0):
+	while (set_len(keys) > 0):
 		key = set_pop(keys)
 		place = instantiate_node(model, "ReachabilityGraph/Place", "")
 		instantiate_attribute(model, place, "name", read_attribute(model, key, "name"))
 		instantiate_attribute(model, place, "tokens", dict_repr[key])
 		instantiate_link(model, "ReachabilityGraph/Contains", "", state, place)
 
-	while (read_nr_out(workset) > 0):
+	while (set_len(workset) > 0):
 		state_id = set_pop(workset)
 
 		dict_repr = reachable_states[state_id]
@@ -96,12 +96,12 @@ Boolean function reachability_graph(model : Element):
 		// Compute how the PN behaves with this specific state
 		// For this, we fetch all transitions and check if they are enabled
 		all_transitions = set_copy(all_transitions_original)
-		while (read_nr_out(all_transitions) > 0):
+		while (set_len(all_transitions) > 0):
 			transition = set_pop(all_transitions)
 
 			keys = dict_keys(transition_vectors_consume[transition])
 			possible = True
-			while (read_nr_out(keys) > 0):
+			while (set_len(keys) > 0):
 				key = set_pop(keys)
 
 				// Compare the values in the state with those consumed by the transition
@@ -114,12 +114,12 @@ Boolean function reachability_graph(model : Element):
 				new_dict_repr = dict_copy(dict_repr)
 				// Transition can execute, so compute and add the new state based on the consume/produce vectors
 				keys = dict_keys(transition_vectors_consume[transition])
-				while (read_nr_out(keys) > 0):
+				while (set_len(keys) > 0):
 					key = set_pop(keys)
 					dict_overwrite(new_dict_repr, key, integer_subtraction(new_dict_repr[key], transition_vectors_consume[transition][key]))
 
 				keys = dict_keys(transition_vectors_produce[transition])
-				while (read_nr_out(keys) > 0):
+				while (set_len(keys) > 0):
 					key = set_pop(keys)
 					dict_overwrite(new_dict_repr, key, integer_addition(new_dict_repr[key], transition_vectors_produce[transition][key]))
 
@@ -130,7 +130,7 @@ Boolean function reachability_graph(model : Element):
 				keys = dict_keys(reachable_states)
 				target_id = -1
 				Float start
-				while (read_nr_out(keys) > 0):
+				while (set_len(keys) > 0):
 					other_state_id = set_pop(keys)
 
 					if (dict_eq(reachable_states[other_state_id], new_dict_repr)):
@@ -144,7 +144,7 @@ Boolean function reachability_graph(model : Element):
 
 					// Add to all data structures
 					dict_add_fast(reachable_states, target_id, new_dict_repr)
-					dict_add_fast(mappings, target_id, create_node())
+					dict_add_fast(mappings, target_id, dict_create())
 					set_add(workset, target_id)
 
 					// And add in the model itself
@@ -155,11 +155,11 @@ Boolean function reachability_graph(model : Element):
 					keys = dict_keys(new_dict_repr)
 					Element sub
 					String name
-					while (read_nr_out(keys) > 0):
+					while (set_len(keys) > 0):
 						key = set_pop(keys)
 						name = read_attribute(model, key, "name")
 						if (bool_not(dict_in(cache, name))):
-							dict_add_fast(cache, name, create_node())
+							dict_add_fast(cache, name, dict_create())
 						sub = cache[name]
 						if (bool_not(dict_in(sub, new_dict_repr[key]))):
 							place = instantiate_node(model, "ReachabilityGraph/Place", "")

+ 4 - 4
models/reachability_graph.mvc

@@ -36,21 +36,21 @@ GlobalConstraint {
 
             states = allInstances(model, "State")
 
-            if (read_nr_out(states) > 0):
+            if (set_len(states) > 0):
                 expected = create_node()
                 state = set_pop(states)
                 places = allAssociationDestinations(model, state, "Contains")
-                while (read_nr_out(places)):
+                while (set_len(places)):
                     place = set_pop(places)
                     set_add(expected, read_attribute(model, place, "name"))
             else:
                 return "OK"!
             
-            while (read_nr_out(states) > 0):
+            while (set_len(states) > 0):
                 got = create_node()
                 state = set_pop(states)
                 places = allAssociationDestinations(model, state, "Contains")
-                while (read_nr_out(places)):
+                while (set_len(places) > 0):
                     place = set_pop(places)
                     set_add(got, read_attribute(model, place, "name"))
 

+ 1 - 1
models/reachabilitygraph_print.mvc

@@ -21,7 +21,7 @@ Composite schedule {
                         String place
                         dict_values = create_node()
                         all_values = allAssociationDestinations(model, name, "ReachabilityGraph/Contains")
-                        while (read_nr_out(all_values) > 0):
+                        while (set_len(all_values) > 0):
                             place = set_pop(all_values)
                             dict_add(dict_values, read_attribute(model, place, "name"), read_attribute(model, place, "tokens"))
                         output((cast_v2s(read_attribute(model, name, "name")) + ": ") + dict_to_string(dict_values))