|
@@ -1,37 +1,37 @@
|
|
|
include "primitives.alh"
|
|
|
|
|
|
-Element function export_node(model_name_ex : String, model_reference : Element):
|
|
|
- Element splitted_ex
|
|
|
- splitted_ex = string_split(model_name_ex, "/")
|
|
|
- Integer length_ex
|
|
|
- length_ex = integer_subtraction(list_len(splitted_ex), 1)
|
|
|
- Integer counter_i_ex
|
|
|
- counter_i_ex = 0
|
|
|
- Element current_ex
|
|
|
- current_ex = dict_read(read_root(), "__hierarchy")
|
|
|
- while(integer_lt(counter_i_ex, length_ex)):
|
|
|
- if (bool_not(dict_in(current_ex, list_read(splitted_ex, counter_i_ex)))):
|
|
|
+Element function export_node(model_name : String, model_reference : Element):
|
|
|
+ Element splitted
|
|
|
+ splitted = string_split(model_name, "/")
|
|
|
+ Integer length
|
|
|
+ length = list_len(splitted) - 1
|
|
|
+ Integer counter_i
|
|
|
+ counter_i = 0
|
|
|
+ Element current
|
|
|
+ current = dict_read(read_root(), "__hierarchy")
|
|
|
+ while(counter_i < length):
|
|
|
+ if (bool_not(dict_in(current, list_read(splitted, counter_i)))):
|
|
|
// Create it first
|
|
|
- dict_add(current_ex, list_read(splitted_ex, counter_i_ex), create_node())
|
|
|
- current_ex = dict_read(current_ex, list_read(splitted_ex, counter_i_ex))
|
|
|
- counter_i_ex = integer_addition(counter_i_ex, 1)
|
|
|
+ dict_add(current, list_read(splitted, counter_i), create_node())
|
|
|
+ current = dict_read(current, list_read(splitted, counter_i))
|
|
|
+ counter_i = counter_i + 1
|
|
|
|
|
|
// current now contains the place where we should add the element
|
|
|
- dict_add(current_ex, list_read(splitted_ex, length_ex), model_reference)
|
|
|
+ dict_add(current, list_read(splitted, length), model_reference)
|
|
|
|
|
|
return model_reference
|
|
|
|
|
|
-Element function import_node(model_name_im : String):
|
|
|
- Element splitted_im
|
|
|
- splitted_im = string_split(model_name_im, "/")
|
|
|
- Integer length_im
|
|
|
- length_im = list_len(splitted_im)
|
|
|
- Integer counter_i_im
|
|
|
- counter_i_im = 0
|
|
|
- Element current_im
|
|
|
- current_im = dict_read(read_root(), "__hierarchy")
|
|
|
- while (integer_lt(counter_i_im, length_im)):
|
|
|
- current_im = dict_read(current_im, list_read(splitted_im, counter_i_im))
|
|
|
- counter_i_im = integer_addition(counter_i_im, 1)
|
|
|
+Element function import_node(model_name : String):
|
|
|
+ Element splitted
|
|
|
+ splitted = string_split(model_name, "/")
|
|
|
+ Integer length
|
|
|
+ length = list_len(splitted)
|
|
|
+ Integer counter_i
|
|
|
+ counter_i = 0
|
|
|
+ Element current
|
|
|
+ current = dict_read(read_root(), "__hierarchy")
|
|
|
+ while (counter_i < length):
|
|
|
+ current = dict_read(current, list_read(splitted, counter_i))
|
|
|
+ counter_i = counter_i + 1
|
|
|
|
|
|
- return current_im
|
|
|
+ return current
|