diff --git a/Cargo.toml b/Cargo.toml index 00715ca8..b8a0f61a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sarzak" -version = "2.13.30" +version = "2.14.0" edition = "2021" authors = ["Keith T. Star "] categories = ["compilers", "memory-management"] diff --git a/src/v2/lu_dog_ndrwlock_vec/store.rs b/src/v2/lu_dog_ndrwlock_vec/store.rs index fc40e917..f8110b68 100644 --- a/src/v2/lu_dog_ndrwlock_vec/store.rs +++ b/src/v2/lu_dog_ndrwlock_vec/store.rs @@ -93,9928 +93,8748 @@ //! * [`Variable`] //! * [`VariableExpression`] // {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-definition"}}} -use no_deadlocks::RwLock; use std::sync::Arc; +use no_deadlocks::RwLock; use std::sync::Mutex; -use heck::ToUpperCamelCase; use rustc_hash::FxHashMap as HashMap; use serde::{Deserialize, Serialize}; use uuid::Uuid; +use heck::ToUpperCamelCase; + use crate::v2::lu_dog_ndrwlock_vec::types::{ - AWait, Argument, Binary, Block, Body, BooleanLiteral, BooleanOperator, Call, CharLiteral, - Comparison, DataStructure, DwarfSourceFile, EnumField, EnumGeneric, EnumGenericType, - Enumeration, Expression, ExpressionBit, ExpressionStatement, ExternalImplementation, Field, - FieldAccess, FieldAccessTarget, FieldExpression, FloatLiteral, ForLoop, FormatBit, - FormatString, FuncGeneric, Function, FunctionCall, Grouped, HaltAndCatchFire, - ImplementationBlock, Import, Index, IntegerLiteral, Item, Lambda, LambdaParameter, - LetStatement, List, ListElement, ListExpression, Literal, LocalVariable, Map, MapElement, - MapExpression, MethodCall, NamedFieldExpression, ObjectWrapper, Operator, Parameter, - PathElement, Pattern, RangeExpression, ResultStatement, Span, Statement, StaticMethodCall, - StringBit, StringLiteral, StructExpression, StructField, StructGeneric, TupleField, TypeCast, - Unary, Unit, UnnamedFieldExpression, ValueType, Variable, VariableExpression, WoogStruct, - XFuture, XIf, XMacro, XMatch, XPath, XPlugin, XPrint, XReturn, XValue, ZObjectStore, ADDITION, - AND, ANY_LIST, ASSIGNMENT, CHAR, DIVISION, EMPTY, EMPTY_EXPRESSION, EQUAL, FALSE_LITERAL, FROM, - FULL, GREATER_THAN, GREATER_THAN_OR_EQUAL, INCLUSIVE, ITEM_STATEMENT, LESS_THAN, - LESS_THAN_OR_EQUAL, MACRO_CALL, MULTIPLICATION, NEGATION, NOT, NOT_EQUAL, OR, RANGE, - SUBTRACTION, TASK, TO, TO_INCLUSIVE, TRUE_LITERAL, UNKNOWN, X_DEBUGGER, +Argument, +AWait, +Binary, +Block, +Body, +BooleanLiteral, +BooleanOperator, +Call, +CharLiteral, +Comparison, +DataStructure, +DwarfSourceFile, +EnumField, +EnumGeneric, +EnumGenericType, +Enumeration, +Expression, +ExpressionBit, +ExpressionStatement, +ExternalImplementation, +Field, +FieldAccess, +FieldAccessTarget, +FieldExpression, +FloatLiteral, +ForLoop, +FormatBit, +FormatString, +FuncGeneric, +Function, +FunctionCall, +XFuture, +Grouped, +HaltAndCatchFire, +XIf, +ImplementationBlock, +Import, +Index, +IntegerLiteral, +Item, +Lambda, +LambdaParameter, +LetStatement, +List, +ListElement, +ListExpression, +Literal, +LocalVariable, +XMacro, +Map, +MapElement, +MapExpression, +XMatch, +MethodCall, +NamedFieldExpression, +ZObjectStore, +ObjectWrapper, +Operator, +Parameter, +XPath, +PathElement, +Pattern, +XPlugin, +XPrint, +RangeExpression, +ResultStatement, +XReturn, +Span, +Statement, +StaticMethodCall, +StringBit, +StringLiteral, +WoogStruct, +StructExpression, +StructField, +StructGeneric, +TupleField, +TypeCast, +Unary, +Unit, +UnnamedFieldExpression, +XValue, +ValueType, +Variable, +VariableExpression, +EMPTY, +EQUAL, +NOT, +MULTIPLICATION, +TO_INCLUSIVE, +OR, +MACRO_CALL, +EMPTY_EXPRESSION, +ITEM_STATEMENT, +X_DEBUGGER, +ANY_LIST, +ASSIGNMENT, +TO, +AND, +TRUE_LITERAL, +NEGATION, +INCLUSIVE, +FALSE_LITERAL, +RANGE, +CHAR, +LESS_THAN_OR_EQUAL, +TASK, +ADDITION, +GREATER_THAN_OR_EQUAL, +UNKNOWN, +FROM, +DIVISION, +FULL, +NOT_EQUAL, +LESS_THAN, +GREATER_THAN, +SUBTRACTION, }; #[derive(Debug)] pub struct ObjectStore { - argument_free_list: std::sync::Mutex>, - argument: Arc>>>>>, - a_wait_free_list: std::sync::Mutex>, - a_wait: Arc>>>>>, - binary_free_list: std::sync::Mutex>, - binary: Arc>>>>>, - block_free_list: std::sync::Mutex>, - block: Arc>>>>>, - body_free_list: std::sync::Mutex>, - body: Arc>>>>>, - boolean_literal_free_list: std::sync::Mutex>, - boolean_literal: Arc>>>>>, - boolean_operator_free_list: std::sync::Mutex>, - boolean_operator: Arc>>>>>, - call_free_list: std::sync::Mutex>, - call: Arc>>>>>, - char_literal_free_list: std::sync::Mutex>, - char_literal: Arc>>>>>, - comparison_free_list: std::sync::Mutex>, - comparison: Arc>>>>>, - data_structure_free_list: std::sync::Mutex>, - data_structure: Arc>>>>>, - dwarf_source_file_free_list: std::sync::Mutex>, - dwarf_source_file: Arc>>>>>, - enum_field_free_list: std::sync::Mutex>, - enum_field: Arc>>>>>, - enum_generic_free_list: std::sync::Mutex>, - enum_generic: Arc>>>>>, - enum_generic_type_free_list: std::sync::Mutex>, - enum_generic_type: Arc>>>>>, - enumeration_free_list: std::sync::Mutex>, - enumeration: Arc>>>>>, - enumeration_id_by_name: Arc>>, - expression_free_list: std::sync::Mutex>, - expression: Arc>>>>>, - expression_bit_free_list: std::sync::Mutex>, - expression_bit: Arc>>>>>, - expression_statement_free_list: std::sync::Mutex>, - expression_statement: Arc>>>>>, - external_implementation_free_list: std::sync::Mutex>, - external_implementation: Arc>>>>>, - field_free_list: std::sync::Mutex>, - field: Arc>>>>>, - field_id_by_name: Arc>>, - field_access_free_list: std::sync::Mutex>, - field_access: Arc>>>>>, - field_access_target_free_list: std::sync::Mutex>, - field_access_target: Arc>>>>>, - field_expression_free_list: std::sync::Mutex>, - field_expression: Arc>>>>>, - float_literal_free_list: std::sync::Mutex>, - float_literal: Arc>>>>>, - for_loop_free_list: std::sync::Mutex>, - for_loop: Arc>>>>>, - format_bit_free_list: std::sync::Mutex>, - format_bit: Arc>>>>>, - format_string_free_list: std::sync::Mutex>, - format_string: Arc>>>>>, - func_generic_free_list: std::sync::Mutex>, - func_generic: Arc>>>>>, - function_free_list: std::sync::Mutex>, - function: Arc>>>>>, - function_id_by_name: Arc>>, - function_call_free_list: std::sync::Mutex>, - function_call: Arc>>>>>, - x_future_free_list: std::sync::Mutex>, - x_future: Arc>>>>>, - grouped_free_list: std::sync::Mutex>, - grouped: Arc>>>>>, - halt_and_catch_fire_free_list: std::sync::Mutex>, - halt_and_catch_fire: Arc>>>>>, - x_if_free_list: std::sync::Mutex>, - x_if: Arc>>>>>, - implementation_block_free_list: std::sync::Mutex>, - implementation_block: Arc>>>>>, - import_free_list: std::sync::Mutex>, - import: Arc>>>>>, - index_free_list: std::sync::Mutex>, - index: Arc>>>>>, - integer_literal_free_list: std::sync::Mutex>, - integer_literal: Arc>>>>>, - item_free_list: std::sync::Mutex>, - item: Arc>>>>>, - lambda_free_list: std::sync::Mutex>, - lambda: Arc>>>>>, - lambda_parameter_free_list: std::sync::Mutex>, - lambda_parameter: Arc>>>>>, - let_statement_free_list: std::sync::Mutex>, - let_statement: Arc>>>>>, - list_free_list: std::sync::Mutex>, - list: Arc>>>>>, - list_element_free_list: std::sync::Mutex>, - list_element: Arc>>>>>, - list_expression_free_list: std::sync::Mutex>, - list_expression: Arc>>>>>, - literal_free_list: std::sync::Mutex>, - literal: Arc>>>>>, - local_variable_free_list: std::sync::Mutex>, - local_variable: Arc>>>>>, - x_macro_free_list: std::sync::Mutex>, - x_macro: Arc>>>>>, - map_free_list: std::sync::Mutex>, - map: Arc>>>>>, - map_element_free_list: std::sync::Mutex>, - map_element: Arc>>>>>, - map_expression_free_list: std::sync::Mutex>, - map_expression: Arc>>>>>, - x_match_free_list: std::sync::Mutex>, - x_match: Arc>>>>>, - method_call_free_list: std::sync::Mutex>, - method_call: Arc>>>>>, - named_field_expression_free_list: std::sync::Mutex>, - named_field_expression: Arc>>>>>, - z_object_store_free_list: std::sync::Mutex>, - z_object_store: Arc>>>>>, - z_object_store_id_by_name: Arc>>, - object_wrapper_free_list: std::sync::Mutex>, - object_wrapper: Arc>>>>>, - operator_free_list: std::sync::Mutex>, - operator: Arc>>>>>, - parameter_free_list: std::sync::Mutex>, - parameter: Arc>>>>>, - x_path_free_list: std::sync::Mutex>, - x_path: Arc>>>>>, - path_element_free_list: std::sync::Mutex>, - path_element: Arc>>>>>, - pattern_free_list: std::sync::Mutex>, - pattern: Arc>>>>>, - x_plugin_free_list: std::sync::Mutex>, - x_plugin: Arc>>>>>, - x_plugin_id_by_name: Arc>>, - x_print_free_list: std::sync::Mutex>, - x_print: Arc>>>>>, - range_expression_free_list: std::sync::Mutex>, - range_expression: Arc>>>>>, - result_statement_free_list: std::sync::Mutex>, - result_statement: Arc>>>>>, - x_return_free_list: std::sync::Mutex>, - x_return: Arc>>>>>, - span_free_list: std::sync::Mutex>, - span: Arc>>>>>, - statement_free_list: std::sync::Mutex>, - statement: Arc>>>>>, - static_method_call_free_list: std::sync::Mutex>, - static_method_call: Arc>>>>>, - string_bit_free_list: std::sync::Mutex>, - string_bit: Arc>>>>>, - string_literal_free_list: std::sync::Mutex>, - string_literal: Arc>>>>>, - woog_struct_free_list: std::sync::Mutex>, - woog_struct: Arc>>>>>, - woog_struct_id_by_name: Arc>>, - struct_expression_free_list: std::sync::Mutex>, - struct_expression: Arc>>>>>, - struct_field_free_list: std::sync::Mutex>, - struct_field: Arc>>>>>, - struct_generic_free_list: std::sync::Mutex>, - struct_generic: Arc>>>>>, - tuple_field_free_list: std::sync::Mutex>, - tuple_field: Arc>>>>>, - type_cast_free_list: std::sync::Mutex>, - type_cast: Arc>>>>>, - unary_free_list: std::sync::Mutex>, - unary: Arc>>>>>, - unit_free_list: std::sync::Mutex>, - unit: Arc>>>>>, - unnamed_field_expression_free_list: std::sync::Mutex>, - unnamed_field_expression: Arc>>>>>, - x_value_free_list: std::sync::Mutex>, - x_value: Arc>>>>>, - value_type_free_list: std::sync::Mutex>, - value_type: Arc>>>>>, - variable_free_list: std::sync::Mutex>, - variable: Arc>>>>>, - variable_expression_free_list: std::sync::Mutex>, - variable_expression: Arc>>>>>, +argument_free_list: std::sync::Mutex>, +argument: Arc>>>>>, +a_wait_free_list: std::sync::Mutex>, +a_wait: Arc>>>>>, +binary_free_list: std::sync::Mutex>, +binary: Arc>>>>>, +block_free_list: std::sync::Mutex>, +block: Arc>>>>>, +body_free_list: std::sync::Mutex>, +body: Arc>>>>>, +boolean_literal_free_list: std::sync::Mutex>, +boolean_literal: Arc>>>>>, +boolean_operator_free_list: std::sync::Mutex>, +boolean_operator: Arc>>>>>, +call_free_list: std::sync::Mutex>, +call: Arc>>>>>, +char_literal_free_list: std::sync::Mutex>, +char_literal: Arc>>>>>, +comparison_free_list: std::sync::Mutex>, +comparison: Arc>>>>>, +data_structure_free_list: std::sync::Mutex>, +data_structure: Arc>>>>>, +dwarf_source_file_free_list: std::sync::Mutex>, +dwarf_source_file: Arc>>>>>, +enum_field_free_list: std::sync::Mutex>, +enum_field: Arc>>>>>, +enum_generic_free_list: std::sync::Mutex>, +enum_generic: Arc>>>>>, +enum_generic_type_free_list: std::sync::Mutex>, +enum_generic_type: Arc>>>>>, +enumeration_free_list: std::sync::Mutex>, +enumeration: Arc>>>>>, +enumeration_id_by_name: Arc>>, +expression_free_list: std::sync::Mutex>, +expression: Arc>>>>>, +expression_bit_free_list: std::sync::Mutex>, +expression_bit: Arc>>>>>, +expression_statement_free_list: std::sync::Mutex>, +expression_statement: Arc>>>>>, +external_implementation_free_list: std::sync::Mutex>, +external_implementation: Arc>>>>>, +field_free_list: std::sync::Mutex>, +field: Arc>>>>>, +field_id_by_name: Arc>>, +field_access_free_list: std::sync::Mutex>, +field_access: Arc>>>>>, +field_access_target_free_list: std::sync::Mutex>, +field_access_target: Arc>>>>>, +field_expression_free_list: std::sync::Mutex>, +field_expression: Arc>>>>>, +float_literal_free_list: std::sync::Mutex>, +float_literal: Arc>>>>>, +for_loop_free_list: std::sync::Mutex>, +for_loop: Arc>>>>>, +format_bit_free_list: std::sync::Mutex>, +format_bit: Arc>>>>>, +format_string_free_list: std::sync::Mutex>, +format_string: Arc>>>>>, +func_generic_free_list: std::sync::Mutex>, +func_generic: Arc>>>>>, +function_free_list: std::sync::Mutex>, +function: Arc>>>>>, +function_id_by_name: Arc>>, +function_call_free_list: std::sync::Mutex>, +function_call: Arc>>>>>, +x_future_free_list: std::sync::Mutex>, +x_future: Arc>>>>>, +grouped_free_list: std::sync::Mutex>, +grouped: Arc>>>>>, +halt_and_catch_fire_free_list: std::sync::Mutex>, +halt_and_catch_fire: Arc>>>>>, +x_if_free_list: std::sync::Mutex>, +x_if: Arc>>>>>, +implementation_block_free_list: std::sync::Mutex>, +implementation_block: Arc>>>>>, +import_free_list: std::sync::Mutex>, +import: Arc>>>>>, +index_free_list: std::sync::Mutex>, +index: Arc>>>>>, +integer_literal_free_list: std::sync::Mutex>, +integer_literal: Arc>>>>>, +item_free_list: std::sync::Mutex>, +item: Arc>>>>>, +lambda_free_list: std::sync::Mutex>, +lambda: Arc>>>>>, +lambda_parameter_free_list: std::sync::Mutex>, +lambda_parameter: Arc>>>>>, +let_statement_free_list: std::sync::Mutex>, +let_statement: Arc>>>>>, +list_free_list: std::sync::Mutex>, +list: Arc>>>>>, +list_element_free_list: std::sync::Mutex>, +list_element: Arc>>>>>, +list_expression_free_list: std::sync::Mutex>, +list_expression: Arc>>>>>, +literal_free_list: std::sync::Mutex>, +literal: Arc>>>>>, +local_variable_free_list: std::sync::Mutex>, +local_variable: Arc>>>>>, +x_macro_free_list: std::sync::Mutex>, +x_macro: Arc>>>>>, +map_free_list: std::sync::Mutex>, +map: Arc>>>>>, +map_element_free_list: std::sync::Mutex>, +map_element: Arc>>>>>, +map_expression_free_list: std::sync::Mutex>, +map_expression: Arc>>>>>, +x_match_free_list: std::sync::Mutex>, +x_match: Arc>>>>>, +method_call_free_list: std::sync::Mutex>, +method_call: Arc>>>>>, +named_field_expression_free_list: std::sync::Mutex>, +named_field_expression: Arc>>>>>, +z_object_store_free_list: std::sync::Mutex>, +z_object_store: Arc>>>>>, +z_object_store_id_by_name: Arc>>, +object_wrapper_free_list: std::sync::Mutex>, +object_wrapper: Arc>>>>>, +operator_free_list: std::sync::Mutex>, +operator: Arc>>>>>, +parameter_free_list: std::sync::Mutex>, +parameter: Arc>>>>>, +x_path_free_list: std::sync::Mutex>, +x_path: Arc>>>>>, +path_element_free_list: std::sync::Mutex>, +path_element: Arc>>>>>, +pattern_free_list: std::sync::Mutex>, +pattern: Arc>>>>>, +x_plugin_free_list: std::sync::Mutex>, +x_plugin: Arc>>>>>, +x_plugin_id_by_name: Arc>>, +x_print_free_list: std::sync::Mutex>, +x_print: Arc>>>>>, +range_expression_free_list: std::sync::Mutex>, +range_expression: Arc>>>>>, +result_statement_free_list: std::sync::Mutex>, +result_statement: Arc>>>>>, +x_return_free_list: std::sync::Mutex>, +x_return: Arc>>>>>, +span_free_list: std::sync::Mutex>, +span: Arc>>>>>, +statement_free_list: std::sync::Mutex>, +statement: Arc>>>>>, +static_method_call_free_list: std::sync::Mutex>, +static_method_call: Arc>>>>>, +string_bit_free_list: std::sync::Mutex>, +string_bit: Arc>>>>>, +string_literal_free_list: std::sync::Mutex>, +string_literal: Arc>>>>>, +woog_struct_free_list: std::sync::Mutex>, +woog_struct: Arc>>>>>, +woog_struct_id_by_name: Arc>>, +struct_expression_free_list: std::sync::Mutex>, +struct_expression: Arc>>>>>, +struct_field_free_list: std::sync::Mutex>, +struct_field: Arc>>>>>, +struct_generic_free_list: std::sync::Mutex>, +struct_generic: Arc>>>>>, +tuple_field_free_list: std::sync::Mutex>, +tuple_field: Arc>>>>>, +type_cast_free_list: std::sync::Mutex>, +type_cast: Arc>>>>>, +unary_free_list: std::sync::Mutex>, +unary: Arc>>>>>, +unit_free_list: std::sync::Mutex>, +unit: Arc>>>>>, +unnamed_field_expression_free_list: std::sync::Mutex>, +unnamed_field_expression: Arc>>>>>, +x_value_free_list: std::sync::Mutex>, +x_value: Arc>>>>>, +value_type_free_list: std::sync::Mutex>, +value_type: Arc>>>>>, +variable_free_list: std::sync::Mutex>, +variable: Arc>>>>>, +variable_expression_free_list: std::sync::Mutex>, +variable_expression: Arc>>>>>, } impl Clone for ObjectStore { - fn clone(&self) -> Self { - ObjectStore { - argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), - argument: Arc::new(RwLock::new(self.argument.read().unwrap().clone())), - a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), - a_wait: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), - binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), - binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), - block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), - block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), - body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), - body: Arc::new(RwLock::new(self.body.read().unwrap().clone())), - boolean_literal_free_list: Mutex::new( - self.boolean_literal_free_list.lock().unwrap().clone(), - ), - boolean_literal: Arc::new(RwLock::new(self.boolean_literal.read().unwrap().clone())), - boolean_operator_free_list: Mutex::new( - self.boolean_operator_free_list.lock().unwrap().clone(), - ), - boolean_operator: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), - call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), - call: Arc::new(RwLock::new(self.call.read().unwrap().clone())), - char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), - char_literal: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), - comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), - comparison: Arc::new(RwLock::new(self.comparison.read().unwrap().clone())), - data_structure_free_list: Mutex::new( - self.data_structure_free_list.lock().unwrap().clone(), - ), - data_structure: Arc::new(RwLock::new(self.data_structure.read().unwrap().clone())), - dwarf_source_file_free_list: Mutex::new( - self.dwarf_source_file_free_list.lock().unwrap().clone(), - ), - dwarf_source_file: Arc::new(RwLock::new( - self.dwarf_source_file.read().unwrap().clone(), - )), - enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), - enum_field: Arc::new(RwLock::new(self.enum_field.read().unwrap().clone())), - enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), - enum_generic: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), - enum_generic_type_free_list: Mutex::new( - self.enum_generic_type_free_list.lock().unwrap().clone(), - ), - enum_generic_type: Arc::new(RwLock::new( - self.enum_generic_type.read().unwrap().clone(), - )), - enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), - enumeration: Arc::new(RwLock::new(self.enumeration.read().unwrap().clone())), - enumeration_id_by_name: self.enumeration_id_by_name.clone(), - expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), - expression: Arc::new(RwLock::new(self.expression.read().unwrap().clone())), - expression_bit_free_list: Mutex::new( - self.expression_bit_free_list.lock().unwrap().clone(), - ), - expression_bit: Arc::new(RwLock::new(self.expression_bit.read().unwrap().clone())), - expression_statement_free_list: Mutex::new( - self.expression_statement_free_list.lock().unwrap().clone(), - ), - expression_statement: Arc::new(RwLock::new( - self.expression_statement.read().unwrap().clone(), - )), - external_implementation_free_list: Mutex::new( - self.external_implementation_free_list - .lock() - .unwrap() - .clone(), - ), - external_implementation: Arc::new(RwLock::new( - self.external_implementation.read().unwrap().clone(), - )), - field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), - field: Arc::new(RwLock::new(self.field.read().unwrap().clone())), - field_id_by_name: self.field_id_by_name.clone(), - field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), - field_access: Arc::new(RwLock::new(self.field_access.read().unwrap().clone())), - field_access_target_free_list: Mutex::new( - self.field_access_target_free_list.lock().unwrap().clone(), - ), - field_access_target: Arc::new(RwLock::new( - self.field_access_target.read().unwrap().clone(), - )), - field_expression_free_list: Mutex::new( - self.field_expression_free_list.lock().unwrap().clone(), - ), - field_expression: Arc::new(RwLock::new(self.field_expression.read().unwrap().clone())), - float_literal_free_list: Mutex::new( - self.float_literal_free_list.lock().unwrap().clone(), - ), - float_literal: Arc::new(RwLock::new(self.float_literal.read().unwrap().clone())), - for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), - for_loop: Arc::new(RwLock::new(self.for_loop.read().unwrap().clone())), - format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), - format_bit: Arc::new(RwLock::new(self.format_bit.read().unwrap().clone())), - format_string_free_list: Mutex::new( - self.format_string_free_list.lock().unwrap().clone(), - ), - format_string: Arc::new(RwLock::new(self.format_string.read().unwrap().clone())), - func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), - func_generic: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), - function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), - function: Arc::new(RwLock::new(self.function.read().unwrap().clone())), - function_id_by_name: self.function_id_by_name.clone(), - function_call_free_list: Mutex::new( - self.function_call_free_list.lock().unwrap().clone(), - ), - function_call: Arc::new(RwLock::new(self.function_call.read().unwrap().clone())), - x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), - x_future: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), - grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), - grouped: Arc::new(RwLock::new(self.grouped.read().unwrap().clone())), - halt_and_catch_fire_free_list: Mutex::new( - self.halt_and_catch_fire_free_list.lock().unwrap().clone(), - ), - halt_and_catch_fire: Arc::new(RwLock::new( - self.halt_and_catch_fire.read().unwrap().clone(), - )), - x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), - x_if: Arc::new(RwLock::new(self.x_if.read().unwrap().clone())), - implementation_block_free_list: Mutex::new( - self.implementation_block_free_list.lock().unwrap().clone(), - ), - implementation_block: Arc::new(RwLock::new( - self.implementation_block.read().unwrap().clone(), - )), - import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), - import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), - index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), - index: Arc::new(RwLock::new(self.index.read().unwrap().clone())), - integer_literal_free_list: Mutex::new( - self.integer_literal_free_list.lock().unwrap().clone(), - ), - integer_literal: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), - item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), - item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), - lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), - lambda: Arc::new(RwLock::new(self.lambda.read().unwrap().clone())), - lambda_parameter_free_list: Mutex::new( - self.lambda_parameter_free_list.lock().unwrap().clone(), - ), - lambda_parameter: Arc::new(RwLock::new(self.lambda_parameter.read().unwrap().clone())), - let_statement_free_list: Mutex::new( - self.let_statement_free_list.lock().unwrap().clone(), - ), - let_statement: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), - list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), - list: Arc::new(RwLock::new(self.list.read().unwrap().clone())), - list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), - list_element: Arc::new(RwLock::new(self.list_element.read().unwrap().clone())), - list_expression_free_list: Mutex::new( - self.list_expression_free_list.lock().unwrap().clone(), - ), - list_expression: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), - literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), - literal: Arc::new(RwLock::new(self.literal.read().unwrap().clone())), - local_variable_free_list: Mutex::new( - self.local_variable_free_list.lock().unwrap().clone(), - ), - local_variable: Arc::new(RwLock::new(self.local_variable.read().unwrap().clone())), - x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), - x_macro: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), - map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), - map: Arc::new(RwLock::new(self.map.read().unwrap().clone())), - map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), - map_element: Arc::new(RwLock::new(self.map_element.read().unwrap().clone())), - map_expression_free_list: Mutex::new( - self.map_expression_free_list.lock().unwrap().clone(), - ), - map_expression: Arc::new(RwLock::new(self.map_expression.read().unwrap().clone())), - x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), - x_match: Arc::new(RwLock::new(self.x_match.read().unwrap().clone())), - method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), - method_call: Arc::new(RwLock::new(self.method_call.read().unwrap().clone())), - named_field_expression_free_list: Mutex::new( - self.named_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), - named_field_expression: Arc::new(RwLock::new( - self.named_field_expression.read().unwrap().clone(), - )), - z_object_store_free_list: Mutex::new( - self.z_object_store_free_list.lock().unwrap().clone(), - ), - z_object_store: Arc::new(RwLock::new(self.z_object_store.read().unwrap().clone())), - z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), - object_wrapper_free_list: Mutex::new( - self.object_wrapper_free_list.lock().unwrap().clone(), - ), - object_wrapper: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), - operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), - operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), - parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), - parameter: Arc::new(RwLock::new(self.parameter.read().unwrap().clone())), - x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), - x_path: Arc::new(RwLock::new(self.x_path.read().unwrap().clone())), - path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), - path_element: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), - pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), - pattern: Arc::new(RwLock::new(self.pattern.read().unwrap().clone())), - x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), - x_plugin: Arc::new(RwLock::new(self.x_plugin.read().unwrap().clone())), - x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), - x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), - x_print: Arc::new(RwLock::new(self.x_print.read().unwrap().clone())), - range_expression_free_list: Mutex::new( - self.range_expression_free_list.lock().unwrap().clone(), - ), - range_expression: Arc::new(RwLock::new(self.range_expression.read().unwrap().clone())), - result_statement_free_list: Mutex::new( - self.result_statement_free_list.lock().unwrap().clone(), - ), - result_statement: Arc::new(RwLock::new(self.result_statement.read().unwrap().clone())), - x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), - x_return: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), - span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), - span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), - statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), - statement: Arc::new(RwLock::new(self.statement.read().unwrap().clone())), - static_method_call_free_list: Mutex::new( - self.static_method_call_free_list.lock().unwrap().clone(), - ), - static_method_call: Arc::new(RwLock::new( - self.static_method_call.read().unwrap().clone(), - )), - string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), - string_bit: Arc::new(RwLock::new(self.string_bit.read().unwrap().clone())), - string_literal_free_list: Mutex::new( - self.string_literal_free_list.lock().unwrap().clone(), - ), - string_literal: Arc::new(RwLock::new(self.string_literal.read().unwrap().clone())), - woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), - woog_struct: Arc::new(RwLock::new(self.woog_struct.read().unwrap().clone())), - woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), - struct_expression_free_list: Mutex::new( - self.struct_expression_free_list.lock().unwrap().clone(), - ), - struct_expression: Arc::new(RwLock::new( - self.struct_expression.read().unwrap().clone(), - )), - struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), - struct_field: Arc::new(RwLock::new(self.struct_field.read().unwrap().clone())), - struct_generic_free_list: Mutex::new( - self.struct_generic_free_list.lock().unwrap().clone(), - ), - struct_generic: Arc::new(RwLock::new(self.struct_generic.read().unwrap().clone())), - tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), - tuple_field: Arc::new(RwLock::new(self.tuple_field.read().unwrap().clone())), - type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), - type_cast: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), - unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), - unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), - unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), - unit: Arc::new(RwLock::new(self.unit.read().unwrap().clone())), - unnamed_field_expression_free_list: Mutex::new( - self.unnamed_field_expression_free_list - .lock() - .unwrap() - .clone(), - ), - unnamed_field_expression: Arc::new(RwLock::new( - self.unnamed_field_expression.read().unwrap().clone(), - )), - x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), - x_value: Arc::new(RwLock::new(self.x_value.read().unwrap().clone())), - value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), - value_type: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), - variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), - variable: Arc::new(RwLock::new(self.variable.read().unwrap().clone())), - variable_expression_free_list: Mutex::new( - self.variable_expression_free_list.lock().unwrap().clone(), - ), - variable_expression: Arc::new(RwLock::new( - self.variable_expression.read().unwrap().clone(), - )), - } - } +fn clone(&self) -> Self { +ObjectStore { +argument_free_list: Mutex::new(self.argument_free_list.lock().unwrap().clone()), +argument: Arc::new(RwLock::new(self.argument.read().unwrap().clone())), +a_wait_free_list: Mutex::new(self.a_wait_free_list.lock().unwrap().clone()), +a_wait: Arc::new(RwLock::new(self.a_wait.read().unwrap().clone())), +binary_free_list: Mutex::new(self.binary_free_list.lock().unwrap().clone()), +binary: Arc::new(RwLock::new(self.binary.read().unwrap().clone())), +block_free_list: Mutex::new(self.block_free_list.lock().unwrap().clone()), +block: Arc::new(RwLock::new(self.block.read().unwrap().clone())), +body_free_list: Mutex::new(self.body_free_list.lock().unwrap().clone()), +body: Arc::new(RwLock::new(self.body.read().unwrap().clone())), +boolean_literal_free_list: Mutex::new(self.boolean_literal_free_list.lock().unwrap().clone()), +boolean_literal: Arc::new(RwLock::new(self.boolean_literal.read().unwrap().clone())), +boolean_operator_free_list: Mutex::new(self.boolean_operator_free_list.lock().unwrap().clone()), +boolean_operator: Arc::new(RwLock::new(self.boolean_operator.read().unwrap().clone())), +call_free_list: Mutex::new(self.call_free_list.lock().unwrap().clone()), +call: Arc::new(RwLock::new(self.call.read().unwrap().clone())), +char_literal_free_list: Mutex::new(self.char_literal_free_list.lock().unwrap().clone()), +char_literal: Arc::new(RwLock::new(self.char_literal.read().unwrap().clone())), +comparison_free_list: Mutex::new(self.comparison_free_list.lock().unwrap().clone()), +comparison: Arc::new(RwLock::new(self.comparison.read().unwrap().clone())), +data_structure_free_list: Mutex::new(self.data_structure_free_list.lock().unwrap().clone()), +data_structure: Arc::new(RwLock::new(self.data_structure.read().unwrap().clone())), +dwarf_source_file_free_list: Mutex::new(self.dwarf_source_file_free_list.lock().unwrap().clone()), +dwarf_source_file: Arc::new(RwLock::new(self.dwarf_source_file.read().unwrap().clone())), +enum_field_free_list: Mutex::new(self.enum_field_free_list.lock().unwrap().clone()), +enum_field: Arc::new(RwLock::new(self.enum_field.read().unwrap().clone())), +enum_generic_free_list: Mutex::new(self.enum_generic_free_list.lock().unwrap().clone()), +enum_generic: Arc::new(RwLock::new(self.enum_generic.read().unwrap().clone())), +enum_generic_type_free_list: Mutex::new(self.enum_generic_type_free_list.lock().unwrap().clone()), +enum_generic_type: Arc::new(RwLock::new(self.enum_generic_type.read().unwrap().clone())), +enumeration_free_list: Mutex::new(self.enumeration_free_list.lock().unwrap().clone()), +enumeration: Arc::new(RwLock::new(self.enumeration.read().unwrap().clone())), +enumeration_id_by_name: self.enumeration_id_by_name.clone(), +expression_free_list: Mutex::new(self.expression_free_list.lock().unwrap().clone()), +expression: Arc::new(RwLock::new(self.expression.read().unwrap().clone())), +expression_bit_free_list: Mutex::new(self.expression_bit_free_list.lock().unwrap().clone()), +expression_bit: Arc::new(RwLock::new(self.expression_bit.read().unwrap().clone())), +expression_statement_free_list: Mutex::new(self.expression_statement_free_list.lock().unwrap().clone()), +expression_statement: Arc::new(RwLock::new(self.expression_statement.read().unwrap().clone())), +external_implementation_free_list: Mutex::new(self.external_implementation_free_list.lock().unwrap().clone()), +external_implementation: Arc::new(RwLock::new(self.external_implementation.read().unwrap().clone())), +field_free_list: Mutex::new(self.field_free_list.lock().unwrap().clone()), +field: Arc::new(RwLock::new(self.field.read().unwrap().clone())), +field_id_by_name: self.field_id_by_name.clone(), +field_access_free_list: Mutex::new(self.field_access_free_list.lock().unwrap().clone()), +field_access: Arc::new(RwLock::new(self.field_access.read().unwrap().clone())), +field_access_target_free_list: Mutex::new(self.field_access_target_free_list.lock().unwrap().clone()), +field_access_target: Arc::new(RwLock::new(self.field_access_target.read().unwrap().clone())), +field_expression_free_list: Mutex::new(self.field_expression_free_list.lock().unwrap().clone()), +field_expression: Arc::new(RwLock::new(self.field_expression.read().unwrap().clone())), +float_literal_free_list: Mutex::new(self.float_literal_free_list.lock().unwrap().clone()), +float_literal: Arc::new(RwLock::new(self.float_literal.read().unwrap().clone())), +for_loop_free_list: Mutex::new(self.for_loop_free_list.lock().unwrap().clone()), +for_loop: Arc::new(RwLock::new(self.for_loop.read().unwrap().clone())), +format_bit_free_list: Mutex::new(self.format_bit_free_list.lock().unwrap().clone()), +format_bit: Arc::new(RwLock::new(self.format_bit.read().unwrap().clone())), +format_string_free_list: Mutex::new(self.format_string_free_list.lock().unwrap().clone()), +format_string: Arc::new(RwLock::new(self.format_string.read().unwrap().clone())), +func_generic_free_list: Mutex::new(self.func_generic_free_list.lock().unwrap().clone()), +func_generic: Arc::new(RwLock::new(self.func_generic.read().unwrap().clone())), +function_free_list: Mutex::new(self.function_free_list.lock().unwrap().clone()), +function: Arc::new(RwLock::new(self.function.read().unwrap().clone())), +function_id_by_name: self.function_id_by_name.clone(), +function_call_free_list: Mutex::new(self.function_call_free_list.lock().unwrap().clone()), +function_call: Arc::new(RwLock::new(self.function_call.read().unwrap().clone())), +x_future_free_list: Mutex::new(self.x_future_free_list.lock().unwrap().clone()), +x_future: Arc::new(RwLock::new(self.x_future.read().unwrap().clone())), +grouped_free_list: Mutex::new(self.grouped_free_list.lock().unwrap().clone()), +grouped: Arc::new(RwLock::new(self.grouped.read().unwrap().clone())), +halt_and_catch_fire_free_list: Mutex::new(self.halt_and_catch_fire_free_list.lock().unwrap().clone()), +halt_and_catch_fire: Arc::new(RwLock::new(self.halt_and_catch_fire.read().unwrap().clone())), +x_if_free_list: Mutex::new(self.x_if_free_list.lock().unwrap().clone()), +x_if: Arc::new(RwLock::new(self.x_if.read().unwrap().clone())), +implementation_block_free_list: Mutex::new(self.implementation_block_free_list.lock().unwrap().clone()), +implementation_block: Arc::new(RwLock::new(self.implementation_block.read().unwrap().clone())), +import_free_list: Mutex::new(self.import_free_list.lock().unwrap().clone()), +import: Arc::new(RwLock::new(self.import.read().unwrap().clone())), +index_free_list: Mutex::new(self.index_free_list.lock().unwrap().clone()), +index: Arc::new(RwLock::new(self.index.read().unwrap().clone())), +integer_literal_free_list: Mutex::new(self.integer_literal_free_list.lock().unwrap().clone()), +integer_literal: Arc::new(RwLock::new(self.integer_literal.read().unwrap().clone())), +item_free_list: Mutex::new(self.item_free_list.lock().unwrap().clone()), +item: Arc::new(RwLock::new(self.item.read().unwrap().clone())), +lambda_free_list: Mutex::new(self.lambda_free_list.lock().unwrap().clone()), +lambda: Arc::new(RwLock::new(self.lambda.read().unwrap().clone())), +lambda_parameter_free_list: Mutex::new(self.lambda_parameter_free_list.lock().unwrap().clone()), +lambda_parameter: Arc::new(RwLock::new(self.lambda_parameter.read().unwrap().clone())), +let_statement_free_list: Mutex::new(self.let_statement_free_list.lock().unwrap().clone()), +let_statement: Arc::new(RwLock::new(self.let_statement.read().unwrap().clone())), +list_free_list: Mutex::new(self.list_free_list.lock().unwrap().clone()), +list: Arc::new(RwLock::new(self.list.read().unwrap().clone())), +list_element_free_list: Mutex::new(self.list_element_free_list.lock().unwrap().clone()), +list_element: Arc::new(RwLock::new(self.list_element.read().unwrap().clone())), +list_expression_free_list: Mutex::new(self.list_expression_free_list.lock().unwrap().clone()), +list_expression: Arc::new(RwLock::new(self.list_expression.read().unwrap().clone())), +literal_free_list: Mutex::new(self.literal_free_list.lock().unwrap().clone()), +literal: Arc::new(RwLock::new(self.literal.read().unwrap().clone())), +local_variable_free_list: Mutex::new(self.local_variable_free_list.lock().unwrap().clone()), +local_variable: Arc::new(RwLock::new(self.local_variable.read().unwrap().clone())), +x_macro_free_list: Mutex::new(self.x_macro_free_list.lock().unwrap().clone()), +x_macro: Arc::new(RwLock::new(self.x_macro.read().unwrap().clone())), +map_free_list: Mutex::new(self.map_free_list.lock().unwrap().clone()), +map: Arc::new(RwLock::new(self.map.read().unwrap().clone())), +map_element_free_list: Mutex::new(self.map_element_free_list.lock().unwrap().clone()), +map_element: Arc::new(RwLock::new(self.map_element.read().unwrap().clone())), +map_expression_free_list: Mutex::new(self.map_expression_free_list.lock().unwrap().clone()), +map_expression: Arc::new(RwLock::new(self.map_expression.read().unwrap().clone())), +x_match_free_list: Mutex::new(self.x_match_free_list.lock().unwrap().clone()), +x_match: Arc::new(RwLock::new(self.x_match.read().unwrap().clone())), +method_call_free_list: Mutex::new(self.method_call_free_list.lock().unwrap().clone()), +method_call: Arc::new(RwLock::new(self.method_call.read().unwrap().clone())), +named_field_expression_free_list: Mutex::new(self.named_field_expression_free_list.lock().unwrap().clone()), +named_field_expression: Arc::new(RwLock::new(self.named_field_expression.read().unwrap().clone())), +z_object_store_free_list: Mutex::new(self.z_object_store_free_list.lock().unwrap().clone()), +z_object_store: Arc::new(RwLock::new(self.z_object_store.read().unwrap().clone())), +z_object_store_id_by_name: self.z_object_store_id_by_name.clone(), +object_wrapper_free_list: Mutex::new(self.object_wrapper_free_list.lock().unwrap().clone()), +object_wrapper: Arc::new(RwLock::new(self.object_wrapper.read().unwrap().clone())), +operator_free_list: Mutex::new(self.operator_free_list.lock().unwrap().clone()), +operator: Arc::new(RwLock::new(self.operator.read().unwrap().clone())), +parameter_free_list: Mutex::new(self.parameter_free_list.lock().unwrap().clone()), +parameter: Arc::new(RwLock::new(self.parameter.read().unwrap().clone())), +x_path_free_list: Mutex::new(self.x_path_free_list.lock().unwrap().clone()), +x_path: Arc::new(RwLock::new(self.x_path.read().unwrap().clone())), +path_element_free_list: Mutex::new(self.path_element_free_list.lock().unwrap().clone()), +path_element: Arc::new(RwLock::new(self.path_element.read().unwrap().clone())), +pattern_free_list: Mutex::new(self.pattern_free_list.lock().unwrap().clone()), +pattern: Arc::new(RwLock::new(self.pattern.read().unwrap().clone())), +x_plugin_free_list: Mutex::new(self.x_plugin_free_list.lock().unwrap().clone()), +x_plugin: Arc::new(RwLock::new(self.x_plugin.read().unwrap().clone())), +x_plugin_id_by_name: self.x_plugin_id_by_name.clone(), +x_print_free_list: Mutex::new(self.x_print_free_list.lock().unwrap().clone()), +x_print: Arc::new(RwLock::new(self.x_print.read().unwrap().clone())), +range_expression_free_list: Mutex::new(self.range_expression_free_list.lock().unwrap().clone()), +range_expression: Arc::new(RwLock::new(self.range_expression.read().unwrap().clone())), +result_statement_free_list: Mutex::new(self.result_statement_free_list.lock().unwrap().clone()), +result_statement: Arc::new(RwLock::new(self.result_statement.read().unwrap().clone())), +x_return_free_list: Mutex::new(self.x_return_free_list.lock().unwrap().clone()), +x_return: Arc::new(RwLock::new(self.x_return.read().unwrap().clone())), +span_free_list: Mutex::new(self.span_free_list.lock().unwrap().clone()), +span: Arc::new(RwLock::new(self.span.read().unwrap().clone())), +statement_free_list: Mutex::new(self.statement_free_list.lock().unwrap().clone()), +statement: Arc::new(RwLock::new(self.statement.read().unwrap().clone())), +static_method_call_free_list: Mutex::new(self.static_method_call_free_list.lock().unwrap().clone()), +static_method_call: Arc::new(RwLock::new(self.static_method_call.read().unwrap().clone())), +string_bit_free_list: Mutex::new(self.string_bit_free_list.lock().unwrap().clone()), +string_bit: Arc::new(RwLock::new(self.string_bit.read().unwrap().clone())), +string_literal_free_list: Mutex::new(self.string_literal_free_list.lock().unwrap().clone()), +string_literal: Arc::new(RwLock::new(self.string_literal.read().unwrap().clone())), +woog_struct_free_list: Mutex::new(self.woog_struct_free_list.lock().unwrap().clone()), +woog_struct: Arc::new(RwLock::new(self.woog_struct.read().unwrap().clone())), +woog_struct_id_by_name: self.woog_struct_id_by_name.clone(), +struct_expression_free_list: Mutex::new(self.struct_expression_free_list.lock().unwrap().clone()), +struct_expression: Arc::new(RwLock::new(self.struct_expression.read().unwrap().clone())), +struct_field_free_list: Mutex::new(self.struct_field_free_list.lock().unwrap().clone()), +struct_field: Arc::new(RwLock::new(self.struct_field.read().unwrap().clone())), +struct_generic_free_list: Mutex::new(self.struct_generic_free_list.lock().unwrap().clone()), +struct_generic: Arc::new(RwLock::new(self.struct_generic.read().unwrap().clone())), +tuple_field_free_list: Mutex::new(self.tuple_field_free_list.lock().unwrap().clone()), +tuple_field: Arc::new(RwLock::new(self.tuple_field.read().unwrap().clone())), +type_cast_free_list: Mutex::new(self.type_cast_free_list.lock().unwrap().clone()), +type_cast: Arc::new(RwLock::new(self.type_cast.read().unwrap().clone())), +unary_free_list: Mutex::new(self.unary_free_list.lock().unwrap().clone()), +unary: Arc::new(RwLock::new(self.unary.read().unwrap().clone())), +unit_free_list: Mutex::new(self.unit_free_list.lock().unwrap().clone()), +unit: Arc::new(RwLock::new(self.unit.read().unwrap().clone())), +unnamed_field_expression_free_list: Mutex::new(self.unnamed_field_expression_free_list.lock().unwrap().clone()), +unnamed_field_expression: Arc::new(RwLock::new(self.unnamed_field_expression.read().unwrap().clone())), +x_value_free_list: Mutex::new(self.x_value_free_list.lock().unwrap().clone()), +x_value: Arc::new(RwLock::new(self.x_value.read().unwrap().clone())), +value_type_free_list: Mutex::new(self.value_type_free_list.lock().unwrap().clone()), +value_type: Arc::new(RwLock::new(self.value_type.read().unwrap().clone())), +variable_free_list: Mutex::new(self.variable_free_list.lock().unwrap().clone()), +variable: Arc::new(RwLock::new(self.variable.read().unwrap().clone())), +variable_expression_free_list: Mutex::new(self.variable_expression_free_list.lock().unwrap().clone()), +variable_expression: Arc::new(RwLock::new(self.variable_expression.read().unwrap().clone())), +} +} } impl ObjectStore { - pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap(); - other.argument.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in argument, if it's not there add it to argument. - if argument - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = argument.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; +pub fn merge(&mut self, other: &ObjectStore) { + + if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { + let mut argument = self.argument.write().unwrap();kts + other.argument.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in argument, if it's not there add it to argument. + if argument + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = argument.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + argument.push(Some(x.clone())); + } + } + }); } - argument.push(Some(x.clone())); - } - } - }); - } - - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap(); - other.a_wait.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in a_wait, if it's not there add it to a_wait. - if a_wait - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = a_wait.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { + let mut a_wait = self.a_wait.write().unwrap();kts + other.a_wait.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in a_wait, if it's not there add it to a_wait. + if a_wait + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = a_wait.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + a_wait.push(Some(x.clone())); + } + } + }); } - a_wait.push(Some(x.clone())); - } - } - }); - } - - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap(); - other.binary.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in binary, if it's not there add it to binary. - if binary - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = binary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { + let mut binary = self.binary.write().unwrap();kts + other.binary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in binary, if it's not there add it to binary. + if binary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = binary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + binary.push(Some(x.clone())); + } + } + }); } - binary.push(Some(x.clone())); - } - } - }); - } - - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap(); - other.block.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in block, if it's not there add it to block. - if block - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.block.read().unwrap().len() != other.block.read().unwrap().len() { + let mut block = self.block.write().unwrap();kts + other.block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in block, if it's not there add it to block. + if block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + block.push(Some(x.clone())); + } + } + }); } - block.push(Some(x.clone())); - } - } - }); - } - - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap(); - other.body.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in body, if it's not there add it to body. - if body - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = body.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.body.read().unwrap().len() != other.body.read().unwrap().len() { + let mut body = self.body.write().unwrap();kts + other.body.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in body, if it's not there add it to body. + if body + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = body.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + body.push(Some(x.clone())); + } + } + }); } - body.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() - { - let mut boolean_literal = self.boolean_literal.write().unwrap(); - other.boolean_literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in boolean_literal, if it's not there add it to boolean_literal. - if boolean_literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() { + let mut boolean_literal = self.boolean_literal.write().unwrap();kts + other.boolean_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_literal, if it's not there add it to boolean_literal. + if boolean_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_literal.push(Some(x.clone())); + } + } + }); } - boolean_literal.push(Some(x.clone())); - } - } - }); - } - - if self.boolean_operator.read().unwrap().len() - != other.boolean_operator.read().unwrap().len() - { - let mut boolean_operator = self.boolean_operator.write().unwrap(); - other.boolean_operator.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in boolean_operator, if it's not there add it to boolean_operator. - if boolean_operator - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = boolean_operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.boolean_operator.read().unwrap().len() != other.boolean_operator.read().unwrap().len() { + let mut boolean_operator = self.boolean_operator.write().unwrap();kts + other.boolean_operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in boolean_operator, if it's not there add it to boolean_operator. + if boolean_operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = boolean_operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + boolean_operator.push(Some(x.clone())); + } + } + }); } - boolean_operator.push(Some(x.clone())); - } - } - }); - } - - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - let mut call = self.call.write().unwrap(); - other.call.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in call, if it's not there add it to call. - if call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.call.read().unwrap().len() != other.call.read().unwrap().len() { + let mut call = self.call.write().unwrap();kts + other.call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in call, if it's not there add it to call. + if call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + call.push(Some(x.clone())); + } + } + }); } - call.push(Some(x.clone())); - } - } - }); - } - - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - let mut char_literal = self.char_literal.write().unwrap(); - other.char_literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in char_literal, if it's not there add it to char_literal. - if char_literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = char_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { + let mut char_literal = self.char_literal.write().unwrap();kts + other.char_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in char_literal, if it's not there add it to char_literal. + if char_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = char_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + char_literal.push(Some(x.clone())); + } + } + }); } - char_literal.push(Some(x.clone())); - } - } - }); - } - - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - let mut comparison = self.comparison.write().unwrap(); - other.comparison.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in comparison, if it's not there add it to comparison. - if comparison - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = comparison.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { + let mut comparison = self.comparison.write().unwrap();kts + other.comparison.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in comparison, if it's not there add it to comparison. + if comparison + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = comparison.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + comparison.push(Some(x.clone())); + } + } + }); } - comparison.push(Some(x.clone())); - } - } - }); - } - - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - let mut data_structure = self.data_structure.write().unwrap(); - other.data_structure.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in data_structure, if it's not there add it to data_structure. - if data_structure - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = data_structure.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { + let mut data_structure = self.data_structure.write().unwrap();kts + other.data_structure.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in data_structure, if it's not there add it to data_structure. + if data_structure + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = data_structure.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + data_structure.push(Some(x.clone())); + } + } + }); } - data_structure.push(Some(x.clone())); - } - } - }); - } - - if self.dwarf_source_file.read().unwrap().len() - != other.dwarf_source_file.read().unwrap().len() - { - let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); - other - .dwarf_source_file - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. - if dwarf_source_file - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.dwarf_source_file.read().unwrap().len() != other.dwarf_source_file.read().unwrap().len() { + let mut dwarf_source_file = self.dwarf_source_file.write().unwrap();kts + other.dwarf_source_file.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + dwarf_source_file.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - dwarf_source_file.push(Some(x.clone())); + }); } - } - }); - } - - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - let mut enum_field = self.enum_field.write().unwrap(); - other.enum_field.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_field, if it's not there add it to enum_field. - if enum_field - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { + let mut enum_field = self.enum_field.write().unwrap();kts + other.enum_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_field, if it's not there add it to enum_field. + if enum_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_field.push(Some(x.clone())); + } + } + }); } - enum_field.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - let mut enum_generic = self.enum_generic.write().unwrap(); - other.enum_generic.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic, if it's not there add it to enum_generic. - if enum_generic - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { + let mut enum_generic = self.enum_generic.write().unwrap();kts + other.enum_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic, if it's not there add it to enum_generic. + if enum_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic.push(Some(x.clone())); + } + } + }); } - enum_generic.push(Some(x.clone())); - } - } - }); - } - - if self.enum_generic_type.read().unwrap().len() - != other.enum_generic_type.read().unwrap().len() - { - let mut enum_generic_type = self.enum_generic_type.write().unwrap(); - other - .enum_generic_type - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.enum_generic_type.read().unwrap().len() != other.enum_generic_type.read().unwrap().len() { + let mut enum_generic_type = self.enum_generic_type.write().unwrap();kts + other.enum_generic_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if enum_generic_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enum_generic_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enum_generic_type.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - enum_generic_type.push(Some(x.clone())); + }); } - } - }); - } - - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - let mut enumeration = self.enumeration.write().unwrap(); - other.enumeration.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in enumeration, if it's not there add it to enumeration. - if enumeration - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enumeration.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { + let mut enumeration = self.enumeration.write().unwrap();kts + other.enumeration.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enumeration, if it's not there add it to enumeration. + if enumeration + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = enumeration.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + enumeration.push(Some(x.clone())); + } + } + }); } - enumeration.push(Some(x.clone())); - } - } - }); - } - - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - let mut expression = self.expression.write().unwrap(); - other.expression.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in expression, if it's not there add it to expression. - if expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { + let mut expression = self.expression.write().unwrap();kts + other.expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression, if it's not there add it to expression. + if expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression.push(Some(x.clone())); + } + } + }); } - expression.push(Some(x.clone())); - } - } - }); - } - - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - let mut expression_bit = self.expression_bit.write().unwrap(); - other.expression_bit.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in expression_bit, if it's not there add it to expression_bit. - if expression_bit - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { + let mut expression_bit = self.expression_bit.write().unwrap();kts + other.expression_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_bit, if it's not there add it to expression_bit. + if expression_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_bit.push(Some(x.clone())); + } + } + }); } - expression_bit.push(Some(x.clone())); - } - } - }); - } - - if self.expression_statement.read().unwrap().len() - != other.expression_statement.read().unwrap().len() - { - let mut expression_statement = self.expression_statement.write().unwrap(); - other - .expression_statement - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in expression_statement, if it's not there add it to expression_statement. - if expression_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.expression_statement.read().unwrap().len() != other.expression_statement.read().unwrap().len() { + let mut expression_statement = self.expression_statement.write().unwrap();kts + other.expression_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + expression_statement.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - expression_statement.push(Some(x.clone())); + }); } - } - }); - } - - if self.external_implementation.read().unwrap().len() - != other.external_implementation.read().unwrap().len() - { - let mut external_implementation = self.external_implementation.write().unwrap(); - other - .external_implementation - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in external_implementation, if it's not there add it to external_implementation. - if external_implementation - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.external_implementation.read().unwrap().len() != other.external_implementation.read().unwrap().len() { + let mut external_implementation = self.external_implementation.write().unwrap();kts + other.external_implementation.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + external_implementation.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - external_implementation.push(Some(x.clone())); + }); } - } - }); - } - - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - let mut field = self.field.write().unwrap(); - other.field.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in field, if it's not there add it to field. - if field - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.field.read().unwrap().len() != other.field.read().unwrap().len() { + let mut field = self.field.write().unwrap();kts + other.field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field, if it's not there add it to field. + if field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field.push(Some(x.clone())); + } + } + }); } - field.push(Some(x.clone())); - } - } - }); - } - - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - let mut field_access = self.field_access.write().unwrap(); - other.field_access.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in field_access, if it's not there add it to field_access. - if field_access - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { + let mut field_access = self.field_access.write().unwrap();kts + other.field_access.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access, if it's not there add it to field_access. + if field_access + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access.push(Some(x.clone())); + } + } + }); } - field_access.push(Some(x.clone())); - } - } - }); - } - - if self.field_access_target.read().unwrap().len() - != other.field_access_target.read().unwrap().len() - { - let mut field_access_target = self.field_access_target.write().unwrap(); - other - .field_access_target - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in field_access_target, if it's not there add it to field_access_target. - if field_access_target - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.field_access_target.read().unwrap().len() != other.field_access_target.read().unwrap().len() { + let mut field_access_target = self.field_access_target.write().unwrap();kts + other.field_access_target.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_access_target.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - field_access_target.push(Some(x.clone())); + }); } - } - }); - } - - if self.field_expression.read().unwrap().len() - != other.field_expression.read().unwrap().len() - { - let mut field_expression = self.field_expression.write().unwrap(); - other.field_expression.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in field_expression, if it's not there add it to field_expression. - if field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.field_expression.read().unwrap().len() != other.field_expression.read().unwrap().len() { + let mut field_expression = self.field_expression.write().unwrap();kts + other.field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_expression, if it's not there add it to field_expression. + if field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + field_expression.push(Some(x.clone())); + } + } + }); } - field_expression.push(Some(x.clone())); - } - } - }); - } - - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - let mut float_literal = self.float_literal.write().unwrap(); - other.float_literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in float_literal, if it's not there add it to float_literal. - if float_literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = float_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { + let mut float_literal = self.float_literal.write().unwrap();kts + other.float_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in float_literal, if it's not there add it to float_literal. + if float_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = float_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + float_literal.push(Some(x.clone())); + } + } + }); } - float_literal.push(Some(x.clone())); - } - } - }); - } - - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - let mut for_loop = self.for_loop.write().unwrap(); - other.for_loop.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in for_loop, if it's not there add it to for_loop. - if for_loop - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = for_loop.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { + let mut for_loop = self.for_loop.write().unwrap();kts + other.for_loop.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in for_loop, if it's not there add it to for_loop. + if for_loop + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = for_loop.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + for_loop.push(Some(x.clone())); + } + } + }); } - for_loop.push(Some(x.clone())); - } - } - }); - } - - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - let mut format_bit = self.format_bit.write().unwrap(); - other.format_bit.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in format_bit, if it's not there add it to format_bit. - if format_bit - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = format_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { + let mut format_bit = self.format_bit.write().unwrap();kts + other.format_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_bit, if it's not there add it to format_bit. + if format_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_bit.push(Some(x.clone())); + } + } + }); } - format_bit.push(Some(x.clone())); - } - } - }); - } - - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - let mut format_string = self.format_string.write().unwrap(); - other.format_string.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in format_string, if it's not there add it to format_string. - if format_string - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = format_string.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { + let mut format_string = self.format_string.write().unwrap();kts + other.format_string.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in format_string, if it's not there add it to format_string. + if format_string + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = format_string.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + format_string.push(Some(x.clone())); + } + } + }); } - format_string.push(Some(x.clone())); - } - } - }); - } - - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - let mut func_generic = self.func_generic.write().unwrap(); - other.func_generic.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in func_generic, if it's not there add it to func_generic. - if func_generic - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = func_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { + let mut func_generic = self.func_generic.write().unwrap();kts + other.func_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in func_generic, if it's not there add it to func_generic. + if func_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = func_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + func_generic.push(Some(x.clone())); + } + } + }); } - func_generic.push(Some(x.clone())); - } - } - }); - } - - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - let mut function = self.function.write().unwrap(); - other.function.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in function, if it's not there add it to function. - if function - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = function.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.function.read().unwrap().len() != other.function.read().unwrap().len() { + let mut function = self.function.write().unwrap();kts + other.function.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function, if it's not there add it to function. + if function + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function.push(Some(x.clone())); + } + } + }); } - function.push(Some(x.clone())); - } - } - }); - } - - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - let mut function_call = self.function_call.write().unwrap(); - other.function_call.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in function_call, if it's not there add it to function_call. - if function_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = function_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { + let mut function_call = self.function_call.write().unwrap();kts + other.function_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in function_call, if it's not there add it to function_call. + if function_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = function_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + function_call.push(Some(x.clone())); + } + } + }); } - function_call.push(Some(x.clone())); - } - } - }); - } - - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - let mut x_future = self.x_future.write().unwrap(); - other.x_future.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_future, if it's not there add it to x_future. - if x_future - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_future.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { + let mut x_future = self.x_future.write().unwrap();kts + other.x_future.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_future, if it's not there add it to x_future. + if x_future + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_future.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_future.push(Some(x.clone())); + } + } + }); } - x_future.push(Some(x.clone())); - } - } - }); - } - - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - let mut grouped = self.grouped.write().unwrap(); - other.grouped.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in grouped, if it's not there add it to grouped. - if grouped - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = grouped.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { + let mut grouped = self.grouped.write().unwrap();kts + other.grouped.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in grouped, if it's not there add it to grouped. + if grouped + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = grouped.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + grouped.push(Some(x.clone())); + } + } + }); } - grouped.push(Some(x.clone())); - } - } - }); - } - - if self.halt_and_catch_fire.read().unwrap().len() - != other.halt_and_catch_fire.read().unwrap().len() - { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); - other - .halt_and_catch_fire - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. - if halt_and_catch_fire - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.halt_and_catch_fire.read().unwrap().len() != other.halt_and_catch_fire.read().unwrap().len() { + let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap();kts + other.halt_and_catch_fire.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + halt_and_catch_fire.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - halt_and_catch_fire.push(Some(x.clone())); + }); } - } - }); - } - - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - let mut x_if = self.x_if.write().unwrap(); - other.x_if.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_if, if it's not there add it to x_if. - if x_if - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_if.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { + let mut x_if = self.x_if.write().unwrap();kts + other.x_if.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_if, if it's not there add it to x_if. + if x_if + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_if.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_if.push(Some(x.clone())); + } + } + }); } - x_if.push(Some(x.clone())); - } - } - }); - } - - if self.implementation_block.read().unwrap().len() - != other.implementation_block.read().unwrap().len() - { - let mut implementation_block = self.implementation_block.write().unwrap(); - other - .implementation_block - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in implementation_block, if it's not there add it to implementation_block. - if implementation_block - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.implementation_block.read().unwrap().len() != other.implementation_block.read().unwrap().len() { + let mut implementation_block = self.implementation_block.write().unwrap();kts + other.implementation_block.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + implementation_block.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - implementation_block.push(Some(x.clone())); + }); } - } - }); - } - - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - let mut import = self.import.write().unwrap(); - other.import.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in import, if it's not there add it to import. - if import - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = import.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.import.read().unwrap().len() != other.import.read().unwrap().len() { + let mut import = self.import.write().unwrap();kts + other.import.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in import, if it's not there add it to import. + if import + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = import.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + import.push(Some(x.clone())); + } + } + }); } - import.push(Some(x.clone())); - } - } - }); - } - - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - let mut index = self.index.write().unwrap(); - other.index.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in index, if it's not there add it to index. - if index - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = index.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.index.read().unwrap().len() != other.index.read().unwrap().len() { + let mut index = self.index.write().unwrap();kts + other.index.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in index, if it's not there add it to index. + if index + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = index.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + index.push(Some(x.clone())); + } + } + }); } - index.push(Some(x.clone())); - } - } - }); - } - - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() - { - let mut integer_literal = self.integer_literal.write().unwrap(); - other.integer_literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in integer_literal, if it's not there add it to integer_literal. - if integer_literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = integer_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() { + let mut integer_literal = self.integer_literal.write().unwrap();kts + other.integer_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in integer_literal, if it's not there add it to integer_literal. + if integer_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = integer_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + integer_literal.push(Some(x.clone())); + } + } + }); } - integer_literal.push(Some(x.clone())); - } - } - }); - } - - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - let mut item = self.item.write().unwrap(); - other.item.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in item, if it's not there add it to item. - if item - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = item.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.item.read().unwrap().len() != other.item.read().unwrap().len() { + let mut item = self.item.write().unwrap();kts + other.item.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in item, if it's not there add it to item. + if item + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = item.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + item.push(Some(x.clone())); + } + } + }); } - item.push(Some(x.clone())); - } - } - }); - } - - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - let mut lambda = self.lambda.write().unwrap(); - other.lambda.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in lambda, if it's not there add it to lambda. - if lambda - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { + let mut lambda = self.lambda.write().unwrap();kts + other.lambda.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda, if it's not there add it to lambda. + if lambda + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda.push(Some(x.clone())); + } + } + }); } - lambda.push(Some(x.clone())); - } - } - }); - } - - if self.lambda_parameter.read().unwrap().len() - != other.lambda_parameter.read().unwrap().len() - { - let mut lambda_parameter = self.lambda_parameter.write().unwrap(); - other.lambda_parameter.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. - if lambda_parameter - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = lambda_parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.lambda_parameter.read().unwrap().len() != other.lambda_parameter.read().unwrap().len() { + let mut lambda_parameter = self.lambda_parameter.write().unwrap();kts + other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. + if lambda_parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = lambda_parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + lambda_parameter.push(Some(x.clone())); + } + } + }); } - lambda_parameter.push(Some(x.clone())); - } - } - }); - } - - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - let mut let_statement = self.let_statement.write().unwrap(); - other.let_statement.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in let_statement, if it's not there add it to let_statement. - if let_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = let_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { + let mut let_statement = self.let_statement.write().unwrap();kts + other.let_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in let_statement, if it's not there add it to let_statement. + if let_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = let_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + let_statement.push(Some(x.clone())); + } + } + }); } - let_statement.push(Some(x.clone())); - } - } - }); - } - - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - let mut list = self.list.write().unwrap(); - other.list.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in list, if it's not there add it to list. - if list - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = list.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.list.read().unwrap().len() != other.list.read().unwrap().len() { + let mut list = self.list.write().unwrap();kts + other.list.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list, if it's not there add it to list. + if list + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list.push(Some(x.clone())); + } + } + }); } - list.push(Some(x.clone())); - } - } - }); - } - - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - let mut list_element = self.list_element.write().unwrap(); - other.list_element.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in list_element, if it's not there add it to list_element. - if list_element - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = list_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { + let mut list_element = self.list_element.write().unwrap();kts + other.list_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_element, if it's not there add it to list_element. + if list_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_element.push(Some(x.clone())); + } + } + }); } - list_element.push(Some(x.clone())); - } - } - }); - } - - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() - { - let mut list_expression = self.list_expression.write().unwrap(); - other.list_expression.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in list_expression, if it's not there add it to list_expression. - if list_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = list_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() { + let mut list_expression = self.list_expression.write().unwrap();kts + other.list_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in list_expression, if it's not there add it to list_expression. + if list_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = list_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + list_expression.push(Some(x.clone())); + } + } + }); } - list_expression.push(Some(x.clone())); - } - } - }); - } - - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - let mut literal = self.literal.write().unwrap(); - other.literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in literal, if it's not there add it to literal. - if literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { + let mut literal = self.literal.write().unwrap();kts + other.literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in literal, if it's not there add it to literal. + if literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + literal.push(Some(x.clone())); + } + } + }); } - literal.push(Some(x.clone())); - } - } - }); - } - - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - let mut local_variable = self.local_variable.write().unwrap(); - other.local_variable.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in local_variable, if it's not there add it to local_variable. - if local_variable - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = local_variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { + let mut local_variable = self.local_variable.write().unwrap();kts + other.local_variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in local_variable, if it's not there add it to local_variable. + if local_variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = local_variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + local_variable.push(Some(x.clone())); + } + } + }); } - local_variable.push(Some(x.clone())); - } - } - }); - } - - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - let mut x_macro = self.x_macro.write().unwrap(); - other.x_macro.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_macro, if it's not there add it to x_macro. - if x_macro - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_macro.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { + let mut x_macro = self.x_macro.write().unwrap();kts + other.x_macro.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_macro, if it's not there add it to x_macro. + if x_macro + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_macro.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_macro.push(Some(x.clone())); + } + } + }); } - x_macro.push(Some(x.clone())); - } - } - }); - } - - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - let mut map = self.map.write().unwrap(); - other.map.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in map, if it's not there add it to map. - if map - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = map.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.map.read().unwrap().len() != other.map.read().unwrap().len() { + let mut map = self.map.write().unwrap();kts + other.map.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map, if it's not there add it to map. + if map + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map.push(Some(x.clone())); + } + } + }); } - map.push(Some(x.clone())); - } - } - }); - } - - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - let mut map_element = self.map_element.write().unwrap(); - other.map_element.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in map_element, if it's not there add it to map_element. - if map_element - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = map_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { + let mut map_element = self.map_element.write().unwrap();kts + other.map_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_element, if it's not there add it to map_element. + if map_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_element.push(Some(x.clone())); + } + } + }); } - map_element.push(Some(x.clone())); - } - } - }); - } - - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - let mut map_expression = self.map_expression.write().unwrap(); - other.map_expression.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in map_expression, if it's not there add it to map_expression. - if map_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = map_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { + let mut map_expression = self.map_expression.write().unwrap();kts + other.map_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in map_expression, if it's not there add it to map_expression. + if map_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = map_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + map_expression.push(Some(x.clone())); + } + } + }); } - map_expression.push(Some(x.clone())); - } - } - }); - } - - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - let mut x_match = self.x_match.write().unwrap(); - other.x_match.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_match, if it's not there add it to x_match. - if x_match - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_match.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { + let mut x_match = self.x_match.write().unwrap();kts + other.x_match.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_match, if it's not there add it to x_match. + if x_match + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_match.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_match.push(Some(x.clone())); + } + } + }); } - x_match.push(Some(x.clone())); - } - } - }); - } - - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap(); - other.method_call.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in method_call, if it's not there add it to method_call. - if method_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { + let mut method_call = self.method_call.write().unwrap();kts + other.method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in method_call, if it's not there add it to method_call. + if method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + method_call.push(Some(x.clone())); + } + } + }); } - method_call.push(Some(x.clone())); - } - } - }); - } - - if self.named_field_expression.read().unwrap().len() - != other.named_field_expression.read().unwrap().len() - { - let mut named_field_expression = self.named_field_expression.write().unwrap(); - other - .named_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in named_field_expression, if it's not there add it to named_field_expression. - if named_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.named_field_expression.read().unwrap().len() != other.named_field_expression.read().unwrap().len() { + let mut named_field_expression = self.named_field_expression.write().unwrap();kts + other.named_field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + named_field_expression.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - named_field_expression.push(Some(x.clone())); + }); } - } - }); - } - - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - let mut z_object_store = self.z_object_store.write().unwrap(); - other.z_object_store.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in z_object_store, if it's not there add it to z_object_store. - if z_object_store - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = z_object_store.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { + let mut z_object_store = self.z_object_store.write().unwrap();kts + other.z_object_store.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in z_object_store, if it's not there add it to z_object_store. + if z_object_store + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = z_object_store.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + z_object_store.push(Some(x.clone())); + } + } + }); } - z_object_store.push(Some(x.clone())); - } - } - }); - } - - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - let mut object_wrapper = self.object_wrapper.write().unwrap(); - other.object_wrapper.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in object_wrapper, if it's not there add it to object_wrapper. - if object_wrapper - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = object_wrapper.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { + let mut object_wrapper = self.object_wrapper.write().unwrap();kts + other.object_wrapper.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in object_wrapper, if it's not there add it to object_wrapper. + if object_wrapper + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = object_wrapper.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + object_wrapper.push(Some(x.clone())); + } + } + }); } - object_wrapper.push(Some(x.clone())); - } - } - }); - } - - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - let mut operator = self.operator.write().unwrap(); - other.operator.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in operator, if it's not there add it to operator. - if operator - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { + let mut operator = self.operator.write().unwrap();kts + other.operator.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in operator, if it's not there add it to operator. + if operator + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = operator.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + operator.push(Some(x.clone())); + } + } + }); } - operator.push(Some(x.clone())); - } - } - }); - } - - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - let mut parameter = self.parameter.write().unwrap(); - other.parameter.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in parameter, if it's not there add it to parameter. - if parameter - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { + let mut parameter = self.parameter.write().unwrap();kts + other.parameter.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in parameter, if it's not there add it to parameter. + if parameter + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = parameter.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + parameter.push(Some(x.clone())); + } + } + }); } - parameter.push(Some(x.clone())); - } - } - }); - } - - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - let mut x_path = self.x_path.write().unwrap(); - other.x_path.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_path, if it's not there add it to x_path. - if x_path - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_path.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { + let mut x_path = self.x_path.write().unwrap();kts + other.x_path.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_path, if it's not there add it to x_path. + if x_path + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_path.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_path.push(Some(x.clone())); + } + } + }); } - x_path.push(Some(x.clone())); - } - } - }); - } - - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - let mut path_element = self.path_element.write().unwrap(); - other.path_element.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in path_element, if it's not there add it to path_element. - if path_element - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = path_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { + let mut path_element = self.path_element.write().unwrap();kts + other.path_element.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in path_element, if it's not there add it to path_element. + if path_element + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = path_element.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + path_element.push(Some(x.clone())); + } + } + }); } - path_element.push(Some(x.clone())); - } - } - }); - } - - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - let mut pattern = self.pattern.write().unwrap(); - other.pattern.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in pattern, if it's not there add it to pattern. - if pattern - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = pattern.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { + let mut pattern = self.pattern.write().unwrap();kts + other.pattern.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in pattern, if it's not there add it to pattern. + if pattern + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = pattern.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + pattern.push(Some(x.clone())); + } + } + }); } - pattern.push(Some(x.clone())); - } - } - }); - } - - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - let mut x_plugin = self.x_plugin.write().unwrap(); - other.x_plugin.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_plugin, if it's not there add it to x_plugin. - if x_plugin - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_plugin.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { + let mut x_plugin = self.x_plugin.write().unwrap();kts + other.x_plugin.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_plugin, if it's not there add it to x_plugin. + if x_plugin + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_plugin.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_plugin.push(Some(x.clone())); + } + } + }); } - x_plugin.push(Some(x.clone())); - } - } - }); - } - - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - let mut x_print = self.x_print.write().unwrap(); - other.x_print.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_print, if it's not there add it to x_print. - if x_print - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_print.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { + let mut x_print = self.x_print.write().unwrap();kts + other.x_print.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_print, if it's not there add it to x_print. + if x_print + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_print.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_print.push(Some(x.clone())); + } + } + }); } - x_print.push(Some(x.clone())); - } - } - }); - } - - if self.range_expression.read().unwrap().len() - != other.range_expression.read().unwrap().len() - { - let mut range_expression = self.range_expression.write().unwrap(); - other.range_expression.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in range_expression, if it's not there add it to range_expression. - if range_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = range_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.range_expression.read().unwrap().len() != other.range_expression.read().unwrap().len() { + let mut range_expression = self.range_expression.write().unwrap();kts + other.range_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in range_expression, if it's not there add it to range_expression. + if range_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = range_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + range_expression.push(Some(x.clone())); + } + } + }); } - range_expression.push(Some(x.clone())); - } - } - }); - } - - if self.result_statement.read().unwrap().len() - != other.result_statement.read().unwrap().len() - { - let mut result_statement = self.result_statement.write().unwrap(); - other.result_statement.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in result_statement, if it's not there add it to result_statement. - if result_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = result_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.result_statement.read().unwrap().len() != other.result_statement.read().unwrap().len() { + let mut result_statement = self.result_statement.write().unwrap();kts + other.result_statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in result_statement, if it's not there add it to result_statement. + if result_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = result_statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + result_statement.push(Some(x.clone())); + } + } + }); } - result_statement.push(Some(x.clone())); - } - } - }); - } - - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - let mut x_return = self.x_return.write().unwrap(); - other.x_return.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_return, if it's not there add it to x_return. - if x_return - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_return.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { + let mut x_return = self.x_return.write().unwrap();kts + other.x_return.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_return, if it's not there add it to x_return. + if x_return + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_return.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_return.push(Some(x.clone())); + } + } + }); } - x_return.push(Some(x.clone())); - } - } - }); - } - - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - let mut span = self.span.write().unwrap(); - other.span.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in span, if it's not there add it to span. - if span - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = span.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.span.read().unwrap().len() != other.span.read().unwrap().len() { + let mut span = self.span.write().unwrap();kts + other.span.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in span, if it's not there add it to span. + if span + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = span.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + span.push(Some(x.clone())); + } + } + }); } - span.push(Some(x.clone())); - } - } - }); - } - - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap(); - other.statement.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in statement, if it's not there add it to statement. - if statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { + let mut statement = self.statement.write().unwrap();kts + other.statement.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in statement, if it's not there add it to statement. + if statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = statement.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + statement.push(Some(x.clone())); + } + } + }); } - statement.push(Some(x.clone())); - } - } - }); - } - - if self.static_method_call.read().unwrap().len() - != other.static_method_call.read().unwrap().len() - { - let mut static_method_call = self.static_method_call.write().unwrap(); - other - .static_method_call - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in static_method_call, if it's not there add it to static_method_call. - if static_method_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.static_method_call.read().unwrap().len() != other.static_method_call.read().unwrap().len() { + let mut static_method_call = self.static_method_call.write().unwrap();kts + other.static_method_call.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + static_method_call.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - static_method_call.push(Some(x.clone())); + }); } - } - }); - } - - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - let mut string_bit = self.string_bit.write().unwrap(); - other.string_bit.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in string_bit, if it's not there add it to string_bit. - if string_bit - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = string_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { + let mut string_bit = self.string_bit.write().unwrap();kts + other.string_bit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_bit, if it's not there add it to string_bit. + if string_bit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_bit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_bit.push(Some(x.clone())); + } + } + }); } - string_bit.push(Some(x.clone())); - } - } - }); - } - - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - let mut string_literal = self.string_literal.write().unwrap(); - other.string_literal.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in string_literal, if it's not there add it to string_literal. - if string_literal - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = string_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { + let mut string_literal = self.string_literal.write().unwrap();kts + other.string_literal.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in string_literal, if it's not there add it to string_literal. + if string_literal + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = string_literal.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + string_literal.push(Some(x.clone())); + } + } + }); } - string_literal.push(Some(x.clone())); - } - } - }); - } - - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap(); - other.woog_struct.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in woog_struct, if it's not there add it to woog_struct. - if woog_struct - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = woog_struct.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { + let mut woog_struct = self.woog_struct.write().unwrap();kts + other.woog_struct.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in woog_struct, if it's not there add it to woog_struct. + if woog_struct + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = woog_struct.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + woog_struct.push(Some(x.clone())); + } + } + }); } - woog_struct.push(Some(x.clone())); - } - } - }); - } - - if self.struct_expression.read().unwrap().len() - != other.struct_expression.read().unwrap().len() - { - let mut struct_expression = self.struct_expression.write().unwrap(); - other - .struct_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in struct_expression, if it's not there add it to struct_expression. - if struct_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.struct_expression.read().unwrap().len() != other.struct_expression.read().unwrap().len() { + let mut struct_expression = self.struct_expression.write().unwrap();kts + other.struct_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_expression.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - struct_expression.push(Some(x.clone())); + }); } - } - }); - } - - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - let mut struct_field = self.struct_field.write().unwrap(); - other.struct_field.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in struct_field, if it's not there add it to struct_field. - if struct_field - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { + let mut struct_field = self.struct_field.write().unwrap();kts + other.struct_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_field, if it's not there add it to struct_field. + if struct_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_field.push(Some(x.clone())); + } + } + }); } - struct_field.push(Some(x.clone())); - } - } - }); - } - - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - let mut struct_generic = self.struct_generic.write().unwrap(); - other.struct_generic.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in struct_generic, if it's not there add it to struct_generic. - if struct_generic - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { + let mut struct_generic = self.struct_generic.write().unwrap();kts + other.struct_generic.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_generic, if it's not there add it to struct_generic. + if struct_generic + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = struct_generic.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + struct_generic.push(Some(x.clone())); + } + } + }); } - struct_generic.push(Some(x.clone())); - } - } - }); - } - - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - let mut tuple_field = self.tuple_field.write().unwrap(); - other.tuple_field.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in tuple_field, if it's not there add it to tuple_field. - if tuple_field - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = tuple_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { + let mut tuple_field = self.tuple_field.write().unwrap();kts + other.tuple_field.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in tuple_field, if it's not there add it to tuple_field. + if tuple_field + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = tuple_field.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + tuple_field.push(Some(x.clone())); + } + } + }); } - tuple_field.push(Some(x.clone())); - } - } - }); - } - - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - let mut type_cast = self.type_cast.write().unwrap(); - other.type_cast.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in type_cast, if it's not there add it to type_cast. - if type_cast - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = type_cast.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { + let mut type_cast = self.type_cast.write().unwrap();kts + other.type_cast.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in type_cast, if it's not there add it to type_cast. + if type_cast + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = type_cast.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + type_cast.push(Some(x.clone())); + } + } + }); } - type_cast.push(Some(x.clone())); - } - } - }); - } - - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - let mut unary = self.unary.write().unwrap(); - other.unary.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in unary, if it's not there add it to unary. - if unary - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = unary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { + let mut unary = self.unary.write().unwrap();kts + other.unary.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unary, if it's not there add it to unary. + if unary + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unary.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unary.push(Some(x.clone())); + } + } + }); } - unary.push(Some(x.clone())); - } - } - }); - } - - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap(); - other.unit.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in unit, if it's not there add it to unit. - if unit - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = unit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { + let mut unit = self.unit.write().unwrap();kts + other.unit.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unit, if it's not there add it to unit. + if unit + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unit.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unit.push(Some(x.clone())); + } + } + }); } - unit.push(Some(x.clone())); - } - } - }); - } - - if self.unnamed_field_expression.read().unwrap().len() - != other.unnamed_field_expression.read().unwrap().len() - { - let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); - other - .unnamed_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. - if unnamed_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.unnamed_field_expression.read().unwrap().len() != other.unnamed_field_expression.read().unwrap().len() { + let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap();kts + other.unnamed_field_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + unnamed_field_expression.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - unnamed_field_expression.push(Some(x.clone())); + }); } - } - }); - } - - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - let mut x_value = self.x_value.write().unwrap(); - other.x_value.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in x_value, if it's not there add it to x_value. - if x_value - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = x_value.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { + let mut x_value = self.x_value.write().unwrap();kts + other.x_value.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in x_value, if it's not there add it to x_value. + if x_value + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = x_value.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + x_value.push(Some(x.clone())); + } + } + }); } - x_value.push(Some(x.clone())); - } - } - }); - } - - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - let mut value_type = self.value_type.write().unwrap(); - other.value_type.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in value_type, if it's not there add it to value_type. - if value_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = value_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { + let mut value_type = self.value_type.write().unwrap();kts + other.value_type.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in value_type, if it's not there add it to value_type. + if value_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = value_type.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + value_type.push(Some(x.clone())); + } + } + }); } - value_type.push(Some(x.clone())); - } - } - }); - } - - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap(); - other.variable.read().unwrap().iter().for_each(|x| { - if let Some(x) = x { - // Look for other in variable, if it's not there add it to variable. - if variable - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + + + if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { + let mut variable = self.variable.write().unwrap();kts + other.variable.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable, if it's not there add it to variable. + if variable + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable.push(Some(x.clone())); + } + } + }); } - variable.push(Some(x.clone())); - } - } - }); - } - - if self.variable_expression.read().unwrap().len() - != other.variable_expression.read().unwrap().len() - { - let mut variable_expression = self.variable_expression.write().unwrap(); - other - .variable_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in variable_expression, if it's not there add it to variable_expression. - if variable_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false + + + if self.variable_expression.read().unwrap().len() != other.variable_expression.read().unwrap().len() { + let mut variable_expression = self.variable_expression.write().unwrap();kts + other.variable_expression.read().unwrap().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read().unwrap() == *x.read().unwrap() + } else { + false + } + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().unwrap().id != _index_ { + x.write().unwrap().id = _index_; + } + variable_expression.push(Some(x.clone())); + } } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - variable_expression.push(Some(x.clone())); + }); } - } - }); - } - } - pub fn new() -> Self { - let mut store = Self { - argument_free_list: std::sync::Mutex::new(Vec::new()), - argument: Arc::new(RwLock::new(Vec::new())), - a_wait_free_list: std::sync::Mutex::new(Vec::new()), - a_wait: Arc::new(RwLock::new(Vec::new())), - binary_free_list: std::sync::Mutex::new(Vec::new()), - binary: Arc::new(RwLock::new(Vec::new())), - block_free_list: std::sync::Mutex::new(Vec::new()), - block: Arc::new(RwLock::new(Vec::new())), - body_free_list: std::sync::Mutex::new(Vec::new()), - body: Arc::new(RwLock::new(Vec::new())), - boolean_literal_free_list: std::sync::Mutex::new(Vec::new()), - boolean_literal: Arc::new(RwLock::new(Vec::new())), - boolean_operator_free_list: std::sync::Mutex::new(Vec::new()), - boolean_operator: Arc::new(RwLock::new(Vec::new())), - call_free_list: std::sync::Mutex::new(Vec::new()), - call: Arc::new(RwLock::new(Vec::new())), - char_literal_free_list: std::sync::Mutex::new(Vec::new()), - char_literal: Arc::new(RwLock::new(Vec::new())), - comparison_free_list: std::sync::Mutex::new(Vec::new()), - comparison: Arc::new(RwLock::new(Vec::new())), - data_structure_free_list: std::sync::Mutex::new(Vec::new()), - data_structure: Arc::new(RwLock::new(Vec::new())), - dwarf_source_file_free_list: std::sync::Mutex::new(Vec::new()), - dwarf_source_file: Arc::new(RwLock::new(Vec::new())), - enum_field_free_list: std::sync::Mutex::new(Vec::new()), - enum_field: Arc::new(RwLock::new(Vec::new())), - enum_generic_free_list: std::sync::Mutex::new(Vec::new()), - enum_generic: Arc::new(RwLock::new(Vec::new())), - enum_generic_type_free_list: std::sync::Mutex::new(Vec::new()), - enum_generic_type: Arc::new(RwLock::new(Vec::new())), - enumeration_free_list: std::sync::Mutex::new(Vec::new()), - enumeration: Arc::new(RwLock::new(Vec::new())), - enumeration_id_by_name: Arc::new(RwLock::new(HashMap::default())), - expression_free_list: std::sync::Mutex::new(Vec::new()), - expression: Arc::new(RwLock::new(Vec::new())), - expression_bit_free_list: std::sync::Mutex::new(Vec::new()), - expression_bit: Arc::new(RwLock::new(Vec::new())), - expression_statement_free_list: std::sync::Mutex::new(Vec::new()), - expression_statement: Arc::new(RwLock::new(Vec::new())), - external_implementation_free_list: std::sync::Mutex::new(Vec::new()), - external_implementation: Arc::new(RwLock::new(Vec::new())), - field_free_list: std::sync::Mutex::new(Vec::new()), - field: Arc::new(RwLock::new(Vec::new())), - field_id_by_name: Arc::new(RwLock::new(HashMap::default())), - field_access_free_list: std::sync::Mutex::new(Vec::new()), - field_access: Arc::new(RwLock::new(Vec::new())), - field_access_target_free_list: std::sync::Mutex::new(Vec::new()), - field_access_target: Arc::new(RwLock::new(Vec::new())), - field_expression_free_list: std::sync::Mutex::new(Vec::new()), - field_expression: Arc::new(RwLock::new(Vec::new())), - float_literal_free_list: std::sync::Mutex::new(Vec::new()), - float_literal: Arc::new(RwLock::new(Vec::new())), - for_loop_free_list: std::sync::Mutex::new(Vec::new()), - for_loop: Arc::new(RwLock::new(Vec::new())), - format_bit_free_list: std::sync::Mutex::new(Vec::new()), - format_bit: Arc::new(RwLock::new(Vec::new())), - format_string_free_list: std::sync::Mutex::new(Vec::new()), - format_string: Arc::new(RwLock::new(Vec::new())), - func_generic_free_list: std::sync::Mutex::new(Vec::new()), - func_generic: Arc::new(RwLock::new(Vec::new())), - function_free_list: std::sync::Mutex::new(Vec::new()), - function: Arc::new(RwLock::new(Vec::new())), - function_id_by_name: Arc::new(RwLock::new(HashMap::default())), - function_call_free_list: std::sync::Mutex::new(Vec::new()), - function_call: Arc::new(RwLock::new(Vec::new())), - x_future_free_list: std::sync::Mutex::new(Vec::new()), - x_future: Arc::new(RwLock::new(Vec::new())), - grouped_free_list: std::sync::Mutex::new(Vec::new()), - grouped: Arc::new(RwLock::new(Vec::new())), - halt_and_catch_fire_free_list: std::sync::Mutex::new(Vec::new()), - halt_and_catch_fire: Arc::new(RwLock::new(Vec::new())), - x_if_free_list: std::sync::Mutex::new(Vec::new()), - x_if: Arc::new(RwLock::new(Vec::new())), - implementation_block_free_list: std::sync::Mutex::new(Vec::new()), - implementation_block: Arc::new(RwLock::new(Vec::new())), - import_free_list: std::sync::Mutex::new(Vec::new()), - import: Arc::new(RwLock::new(Vec::new())), - index_free_list: std::sync::Mutex::new(Vec::new()), - index: Arc::new(RwLock::new(Vec::new())), - integer_literal_free_list: std::sync::Mutex::new(Vec::new()), - integer_literal: Arc::new(RwLock::new(Vec::new())), - item_free_list: std::sync::Mutex::new(Vec::new()), - item: Arc::new(RwLock::new(Vec::new())), - lambda_free_list: std::sync::Mutex::new(Vec::new()), - lambda: Arc::new(RwLock::new(Vec::new())), - lambda_parameter_free_list: std::sync::Mutex::new(Vec::new()), - lambda_parameter: Arc::new(RwLock::new(Vec::new())), - let_statement_free_list: std::sync::Mutex::new(Vec::new()), - let_statement: Arc::new(RwLock::new(Vec::new())), - list_free_list: std::sync::Mutex::new(Vec::new()), - list: Arc::new(RwLock::new(Vec::new())), - list_element_free_list: std::sync::Mutex::new(Vec::new()), - list_element: Arc::new(RwLock::new(Vec::new())), - list_expression_free_list: std::sync::Mutex::new(Vec::new()), - list_expression: Arc::new(RwLock::new(Vec::new())), - literal_free_list: std::sync::Mutex::new(Vec::new()), - literal: Arc::new(RwLock::new(Vec::new())), - local_variable_free_list: std::sync::Mutex::new(Vec::new()), - local_variable: Arc::new(RwLock::new(Vec::new())), - x_macro_free_list: std::sync::Mutex::new(Vec::new()), - x_macro: Arc::new(RwLock::new(Vec::new())), - map_free_list: std::sync::Mutex::new(Vec::new()), - map: Arc::new(RwLock::new(Vec::new())), - map_element_free_list: std::sync::Mutex::new(Vec::new()), - map_element: Arc::new(RwLock::new(Vec::new())), - map_expression_free_list: std::sync::Mutex::new(Vec::new()), - map_expression: Arc::new(RwLock::new(Vec::new())), - x_match_free_list: std::sync::Mutex::new(Vec::new()), - x_match: Arc::new(RwLock::new(Vec::new())), - method_call_free_list: std::sync::Mutex::new(Vec::new()), - method_call: Arc::new(RwLock::new(Vec::new())), - named_field_expression_free_list: std::sync::Mutex::new(Vec::new()), - named_field_expression: Arc::new(RwLock::new(Vec::new())), - z_object_store_free_list: std::sync::Mutex::new(Vec::new()), - z_object_store: Arc::new(RwLock::new(Vec::new())), - z_object_store_id_by_name: Arc::new(RwLock::new(HashMap::default())), - object_wrapper_free_list: std::sync::Mutex::new(Vec::new()), - object_wrapper: Arc::new(RwLock::new(Vec::new())), - operator_free_list: std::sync::Mutex::new(Vec::new()), - operator: Arc::new(RwLock::new(Vec::new())), - parameter_free_list: std::sync::Mutex::new(Vec::new()), - parameter: Arc::new(RwLock::new(Vec::new())), - x_path_free_list: std::sync::Mutex::new(Vec::new()), - x_path: Arc::new(RwLock::new(Vec::new())), - path_element_free_list: std::sync::Mutex::new(Vec::new()), - path_element: Arc::new(RwLock::new(Vec::new())), - pattern_free_list: std::sync::Mutex::new(Vec::new()), - pattern: Arc::new(RwLock::new(Vec::new())), - x_plugin_free_list: std::sync::Mutex::new(Vec::new()), - x_plugin: Arc::new(RwLock::new(Vec::new())), - x_plugin_id_by_name: Arc::new(RwLock::new(HashMap::default())), - x_print_free_list: std::sync::Mutex::new(Vec::new()), - x_print: Arc::new(RwLock::new(Vec::new())), - range_expression_free_list: std::sync::Mutex::new(Vec::new()), - range_expression: Arc::new(RwLock::new(Vec::new())), - result_statement_free_list: std::sync::Mutex::new(Vec::new()), - result_statement: Arc::new(RwLock::new(Vec::new())), - x_return_free_list: std::sync::Mutex::new(Vec::new()), - x_return: Arc::new(RwLock::new(Vec::new())), - span_free_list: std::sync::Mutex::new(Vec::new()), - span: Arc::new(RwLock::new(Vec::new())), - statement_free_list: std::sync::Mutex::new(Vec::new()), - statement: Arc::new(RwLock::new(Vec::new())), - static_method_call_free_list: std::sync::Mutex::new(Vec::new()), - static_method_call: Arc::new(RwLock::new(Vec::new())), - string_bit_free_list: std::sync::Mutex::new(Vec::new()), - string_bit: Arc::new(RwLock::new(Vec::new())), - string_literal_free_list: std::sync::Mutex::new(Vec::new()), - string_literal: Arc::new(RwLock::new(Vec::new())), - woog_struct_free_list: std::sync::Mutex::new(Vec::new()), - woog_struct: Arc::new(RwLock::new(Vec::new())), - woog_struct_id_by_name: Arc::new(RwLock::new(HashMap::default())), - struct_expression_free_list: std::sync::Mutex::new(Vec::new()), - struct_expression: Arc::new(RwLock::new(Vec::new())), - struct_field_free_list: std::sync::Mutex::new(Vec::new()), - struct_field: Arc::new(RwLock::new(Vec::new())), - struct_generic_free_list: std::sync::Mutex::new(Vec::new()), - struct_generic: Arc::new(RwLock::new(Vec::new())), - tuple_field_free_list: std::sync::Mutex::new(Vec::new()), - tuple_field: Arc::new(RwLock::new(Vec::new())), - type_cast_free_list: std::sync::Mutex::new(Vec::new()), - type_cast: Arc::new(RwLock::new(Vec::new())), - unary_free_list: std::sync::Mutex::new(Vec::new()), - unary: Arc::new(RwLock::new(Vec::new())), - unit_free_list: std::sync::Mutex::new(Vec::new()), - unit: Arc::new(RwLock::new(Vec::new())), - unnamed_field_expression_free_list: std::sync::Mutex::new(Vec::new()), - unnamed_field_expression: Arc::new(RwLock::new(Vec::new())), - x_value_free_list: std::sync::Mutex::new(Vec::new()), - x_value: Arc::new(RwLock::new(Vec::new())), - value_type_free_list: std::sync::Mutex::new(Vec::new()), - value_type: Arc::new(RwLock::new(Vec::new())), - variable_free_list: std::sync::Mutex::new(Vec::new()), - variable: Arc::new(RwLock::new(Vec::new())), - variable_expression_free_list: std::sync::Mutex::new(Vec::new()), - variable_expression: Arc::new(RwLock::new(Vec::new())), - }; - - // Initialize Singleton Subtypes - // 💥 Look at how beautiful this generated code is for super/sub-type graphs! - // I remember having a bit of a struggle making it work. It's recursive, with - // a lot of special cases, and I think it calls other recursive functions...💥 - - store - } - - // {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-methods"}}} - /// Inter (insert) [`Argument`] into the store. - /// - #[inline] - pub fn inter_argument(&mut self, argument: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.argument_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.argument.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.argument.write().unwrap().push(None); - _index - }; - - let argument = argument(_index); - - let found = if let Some(argument) = self.argument.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *argument.read().unwrap() - } else { - false - } - }) { - argument.clone() - } else { - None - }; - - if let Some(argument) = found { - tracing::debug!(target: "store", "found duplicate {argument:?}."); - self.argument_free_list.lock().unwrap().push(_index); - argument.clone() - } else { - tracing::debug!(target: "store", "interring {argument:?}."); - self.argument.write().unwrap()[_index] = Some(argument.clone()); - argument - } - } - - /// Exhume (get) [`Argument`] from the store. - /// - #[inline] - pub fn exhume_argument(&self, id: &usize) -> Option>> { - match self.argument.read().unwrap().get(*id) { - Some(argument) => argument.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Argument`] from the store. - /// - #[inline] - pub fn exorcise_argument(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising argument slot: {id}."); - let result = self.argument.write().unwrap()[*id].take(); - self.argument_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Argument>`. - /// - #[inline] - pub fn iter_argument(&self) -> impl Iterator>> + '_ { - let len = self.argument.read().unwrap().len(); - (0..len) - .filter(|i| self.argument.read().unwrap()[*i].is_some()) - .map(move |i| { - self.argument.read().unwrap()[i] - .as_ref() - .map(|argument| argument.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`AWait`] into the store. - /// - #[inline] - pub fn inter_a_wait(&mut self, a_wait: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.a_wait_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.a_wait.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.a_wait.write().unwrap().push(None); - _index - }; - - let a_wait = a_wait(_index); - - let found = if let Some(a_wait) = self.a_wait.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *a_wait.read().unwrap() - } else { - false - } - }) { - a_wait.clone() - } else { - None - }; - - if let Some(a_wait) = found { - tracing::debug!(target: "store", "found duplicate {a_wait:?}."); - self.a_wait_free_list.lock().unwrap().push(_index); - a_wait.clone() - } else { - tracing::debug!(target: "store", "interring {a_wait:?}."); - self.a_wait.write().unwrap()[_index] = Some(a_wait.clone()); - a_wait - } - } - - /// Exhume (get) [`AWait`] from the store. - /// - #[inline] - pub fn exhume_a_wait(&self, id: &usize) -> Option>> { - match self.a_wait.read().unwrap().get(*id) { - Some(a_wait) => a_wait.clone(), - None => None, - } - } - - /// Exorcise (remove) [`AWait`] from the store. - /// - #[inline] - pub fn exorcise_a_wait(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising a_wait slot: {id}."); - let result = self.a_wait.write().unwrap()[*id].take(); - self.a_wait_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, AWait>`. - /// - #[inline] - pub fn iter_a_wait(&self) -> impl Iterator>> + '_ { - let len = self.a_wait.read().unwrap().len(); - (0..len) - .filter(|i| self.a_wait.read().unwrap()[*i].is_some()) - .map(move |i| { - self.a_wait.read().unwrap()[i] - .as_ref() - .map(|a_wait| a_wait.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Binary`] into the store. - /// - #[inline] - pub fn inter_binary(&mut self, binary: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.binary_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.binary.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.binary.write().unwrap().push(None); - _index - }; - - let binary = binary(_index); - - let found = if let Some(binary) = self.binary.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *binary.read().unwrap() - } else { - false - } - }) { - binary.clone() - } else { - None - }; - - if let Some(binary) = found { - tracing::debug!(target: "store", "found duplicate {binary:?}."); - self.binary_free_list.lock().unwrap().push(_index); - binary.clone() - } else { - tracing::debug!(target: "store", "interring {binary:?}."); - self.binary.write().unwrap()[_index] = Some(binary.clone()); - binary - } - } - - /// Exhume (get) [`Binary`] from the store. - /// - #[inline] - pub fn exhume_binary(&self, id: &usize) -> Option>> { - match self.binary.read().unwrap().get(*id) { - Some(binary) => binary.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Binary`] from the store. - /// - #[inline] - pub fn exorcise_binary(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising binary slot: {id}."); - let result = self.binary.write().unwrap()[*id].take(); - self.binary_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Binary>`. - /// - #[inline] - pub fn iter_binary(&self) -> impl Iterator>> + '_ { - let len = self.binary.read().unwrap().len(); - (0..len) - .filter(|i| self.binary.read().unwrap()[*i].is_some()) - .map(move |i| { - self.binary.read().unwrap()[i] - .as_ref() - .map(|binary| binary.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Block`] into the store. - /// - #[inline] - pub fn inter_block(&mut self, block: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.block_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.block.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.block.write().unwrap().push(None); - _index - }; - - let block = block(_index); - - let found = if let Some(block) = self.block.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *block.read().unwrap() - } else { - false - } - }) { - block.clone() - } else { - None - }; - - if let Some(block) = found { - tracing::debug!(target: "store", "found duplicate {block:?}."); - self.block_free_list.lock().unwrap().push(_index); - block.clone() - } else { - tracing::debug!(target: "store", "interring {block:?}."); - self.block.write().unwrap()[_index] = Some(block.clone()); - block - } - } - - /// Exhume (get) [`Block`] from the store. - /// - #[inline] - pub fn exhume_block(&self, id: &usize) -> Option>> { - match self.block.read().unwrap().get(*id) { - Some(block) => block.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Block`] from the store. - /// - #[inline] - pub fn exorcise_block(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising block slot: {id}."); - let result = self.block.write().unwrap()[*id].take(); - self.block_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Block>`. - /// - #[inline] - pub fn iter_block(&self) -> impl Iterator>> + '_ { - let len = self.block.read().unwrap().len(); - (0..len) - .filter(|i| self.block.read().unwrap()[*i].is_some()) - .map(move |i| { - self.block.read().unwrap()[i] - .as_ref() - .map(|block| block.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Body`] into the store. - /// - #[inline] - pub fn inter_body(&mut self, body: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.body_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.body.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.body.write().unwrap().push(None); - _index - }; - - let body = body(_index); - - let found = if let Some(body) = self.body.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *body.read().unwrap() - } else { - false - } - }) { - body.clone() - } else { - None - }; - - if let Some(body) = found { - tracing::debug!(target: "store", "found duplicate {body:?}."); - self.body_free_list.lock().unwrap().push(_index); - body.clone() - } else { - tracing::debug!(target: "store", "interring {body:?}."); - self.body.write().unwrap()[_index] = Some(body.clone()); - body - } - } - - /// Exhume (get) [`Body`] from the store. - /// - #[inline] - pub fn exhume_body(&self, id: &usize) -> Option>> { - match self.body.read().unwrap().get(*id) { - Some(body) => body.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Body`] from the store. - /// - #[inline] - pub fn exorcise_body(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising body slot: {id}."); - let result = self.body.write().unwrap()[*id].take(); - self.body_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Body>`. - /// - #[inline] - pub fn iter_body(&self) -> impl Iterator>> + '_ { - let len = self.body.read().unwrap().len(); - (0..len) - .filter(|i| self.body.read().unwrap()[*i].is_some()) - .map(move |i| { - self.body.read().unwrap()[i] - .as_ref() - .map(|body| body.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`BooleanLiteral`] into the store. - /// - #[inline] - pub fn inter_boolean_literal(&mut self, boolean_literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.boolean_literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.boolean_literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.boolean_literal.write().unwrap().push(None); - _index - }; - - let boolean_literal = boolean_literal(_index); - - let found = if let Some(boolean_literal) = - self.boolean_literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *boolean_literal.read().unwrap() - } else { - false - } - }) { - boolean_literal.clone() - } else { - None - }; - - if let Some(boolean_literal) = found { - tracing::debug!(target: "store", "found duplicate {boolean_literal:?}."); - self.boolean_literal_free_list.lock().unwrap().push(_index); - boolean_literal.clone() - } else { - tracing::debug!(target: "store", "interring {boolean_literal:?}."); - self.boolean_literal.write().unwrap()[_index] = Some(boolean_literal.clone()); - boolean_literal - } - } - - /// Exhume (get) [`BooleanLiteral`] from the store. - /// - #[inline] - pub fn exhume_boolean_literal(&self, id: &usize) -> Option>> { - match self.boolean_literal.read().unwrap().get(*id) { - Some(boolean_literal) => boolean_literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`BooleanLiteral`] from the store. - /// - #[inline] - pub fn exorcise_boolean_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising boolean_literal slot: {id}."); - let result = self.boolean_literal.write().unwrap()[*id].take(); - self.boolean_literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, BooleanLiteral>`. - /// - #[inline] - pub fn iter_boolean_literal(&self) -> impl Iterator>> + '_ { - let len = self.boolean_literal.read().unwrap().len(); - (0..len) - .filter(|i| self.boolean_literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.boolean_literal.read().unwrap()[i] - .as_ref() - .map(|boolean_literal| boolean_literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`BooleanOperator`] into the store. - /// - #[inline] - pub fn inter_boolean_operator(&mut self, boolean_operator: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.boolean_operator_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.boolean_operator.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.boolean_operator.write().unwrap().push(None); - _index - }; - - let boolean_operator = boolean_operator(_index); - - let found = if let Some(boolean_operator) = - self.boolean_operator.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *boolean_operator.read().unwrap() - } else { - false - } - }) { - boolean_operator.clone() - } else { - None - }; - - if let Some(boolean_operator) = found { - tracing::debug!(target: "store", "found duplicate {boolean_operator:?}."); - self.boolean_operator_free_list.lock().unwrap().push(_index); - boolean_operator.clone() - } else { - tracing::debug!(target: "store", "interring {boolean_operator:?}."); - self.boolean_operator.write().unwrap()[_index] = Some(boolean_operator.clone()); - boolean_operator - } - } - - /// Exhume (get) [`BooleanOperator`] from the store. - /// - #[inline] - pub fn exhume_boolean_operator(&self, id: &usize) -> Option>> { - match self.boolean_operator.read().unwrap().get(*id) { - Some(boolean_operator) => boolean_operator.clone(), - None => None, - } - } - - /// Exorcise (remove) [`BooleanOperator`] from the store. - /// - #[inline] - pub fn exorcise_boolean_operator( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising boolean_operator slot: {id}."); - let result = self.boolean_operator.write().unwrap()[*id].take(); - self.boolean_operator_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, BooleanOperator>`. - /// - #[inline] - pub fn iter_boolean_operator(&self) -> impl Iterator>> + '_ { - let len = self.boolean_operator.read().unwrap().len(); - (0..len) - .filter(|i| self.boolean_operator.read().unwrap()[*i].is_some()) - .map(move |i| { - self.boolean_operator.read().unwrap()[i] - .as_ref() - .map(|boolean_operator| boolean_operator.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Call`] into the store. - /// - #[inline] - pub fn inter_call(&mut self, call: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.call_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.call.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.call.write().unwrap().push(None); - _index - }; - - let call = call(_index); - - let found = if let Some(call) = self.call.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *call.read().unwrap() - } else { - false - } - }) { - call.clone() - } else { - None - }; - - if let Some(call) = found { - tracing::debug!(target: "store", "found duplicate {call:?}."); - self.call_free_list.lock().unwrap().push(_index); - call.clone() - } else { - tracing::debug!(target: "store", "interring {call:?}."); - self.call.write().unwrap()[_index] = Some(call.clone()); - call - } - } - - /// Exhume (get) [`Call`] from the store. - /// - #[inline] - pub fn exhume_call(&self, id: &usize) -> Option>> { - match self.call.read().unwrap().get(*id) { - Some(call) => call.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Call`] from the store. - /// - #[inline] - pub fn exorcise_call(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising call slot: {id}."); - let result = self.call.write().unwrap()[*id].take(); - self.call_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Call>`. - /// - #[inline] - pub fn iter_call(&self) -> impl Iterator>> + '_ { - let len = self.call.read().unwrap().len(); - (0..len) - .filter(|i| self.call.read().unwrap()[*i].is_some()) - .map(move |i| { - self.call.read().unwrap()[i] - .as_ref() - .map(|call| call.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`CharLiteral`] into the store. - /// - #[inline] - pub fn inter_char_literal(&mut self, char_literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.char_literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.char_literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.char_literal.write().unwrap().push(None); - _index - }; - - let char_literal = char_literal(_index); - - let found = if let Some(char_literal) = - self.char_literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *char_literal.read().unwrap() - } else { - false - } - }) { - char_literal.clone() - } else { - None - }; - - if let Some(char_literal) = found { - tracing::debug!(target: "store", "found duplicate {char_literal:?}."); - self.char_literal_free_list.lock().unwrap().push(_index); - char_literal.clone() - } else { - tracing::debug!(target: "store", "interring {char_literal:?}."); - self.char_literal.write().unwrap()[_index] = Some(char_literal.clone()); - char_literal - } - } - - /// Exhume (get) [`CharLiteral`] from the store. - /// - #[inline] - pub fn exhume_char_literal(&self, id: &usize) -> Option>> { - match self.char_literal.read().unwrap().get(*id) { - Some(char_literal) => char_literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`CharLiteral`] from the store. - /// - #[inline] - pub fn exorcise_char_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising char_literal slot: {id}."); - let result = self.char_literal.write().unwrap()[*id].take(); - self.char_literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, CharLiteral>`. - /// - #[inline] - pub fn iter_char_literal(&self) -> impl Iterator>> + '_ { - let len = self.char_literal.read().unwrap().len(); - (0..len) - .filter(|i| self.char_literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.char_literal.read().unwrap()[i] - .as_ref() - .map(|char_literal| char_literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Comparison`] into the store. - /// - #[inline] - pub fn inter_comparison(&mut self, comparison: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.comparison_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.comparison.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.comparison.write().unwrap().push(None); - _index - }; - - let comparison = comparison(_index); - - let found = if let Some(comparison) = - self.comparison.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *comparison.read().unwrap() - } else { - false - } - }) { - comparison.clone() - } else { - None - }; - - if let Some(comparison) = found { - tracing::debug!(target: "store", "found duplicate {comparison:?}."); - self.comparison_free_list.lock().unwrap().push(_index); - comparison.clone() - } else { - tracing::debug!(target: "store", "interring {comparison:?}."); - self.comparison.write().unwrap()[_index] = Some(comparison.clone()); - comparison - } - } - - /// Exhume (get) [`Comparison`] from the store. - /// - #[inline] - pub fn exhume_comparison(&self, id: &usize) -> Option>> { - match self.comparison.read().unwrap().get(*id) { - Some(comparison) => comparison.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Comparison`] from the store. - /// - #[inline] - pub fn exorcise_comparison(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising comparison slot: {id}."); - let result = self.comparison.write().unwrap()[*id].take(); - self.comparison_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Comparison>`. - /// - #[inline] - pub fn iter_comparison(&self) -> impl Iterator>> + '_ { - let len = self.comparison.read().unwrap().len(); - (0..len) - .filter(|i| self.comparison.read().unwrap()[*i].is_some()) - .map(move |i| { - self.comparison.read().unwrap()[i] - .as_ref() - .map(|comparison| comparison.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`DataStructure`] into the store. - /// - #[inline] - pub fn inter_data_structure(&mut self, data_structure: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.data_structure_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.data_structure.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.data_structure.write().unwrap().push(None); - _index - }; - - let data_structure = data_structure(_index); - - let found = if let Some(data_structure) = - self.data_structure.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *data_structure.read().unwrap() - } else { - false - } - }) { - data_structure.clone() - } else { - None - }; - - if let Some(data_structure) = found { - tracing::debug!(target: "store", "found duplicate {data_structure:?}."); - self.data_structure_free_list.lock().unwrap().push(_index); - data_structure.clone() - } else { - tracing::debug!(target: "store", "interring {data_structure:?}."); - self.data_structure.write().unwrap()[_index] = Some(data_structure.clone()); - data_structure - } - } - - /// Exhume (get) [`DataStructure`] from the store. - /// - #[inline] - pub fn exhume_data_structure(&self, id: &usize) -> Option>> { - match self.data_structure.read().unwrap().get(*id) { - Some(data_structure) => data_structure.clone(), - None => None, - } - } - - /// Exorcise (remove) [`DataStructure`] from the store. - /// - #[inline] - pub fn exorcise_data_structure(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising data_structure slot: {id}."); - let result = self.data_structure.write().unwrap()[*id].take(); - self.data_structure_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, DataStructure>`. - /// - #[inline] - pub fn iter_data_structure(&self) -> impl Iterator>> + '_ { - let len = self.data_structure.read().unwrap().len(); - (0..len) - .filter(|i| self.data_structure.read().unwrap()[*i].is_some()) - .map(move |i| { - self.data_structure.read().unwrap()[i] - .as_ref() - .map(|data_structure| data_structure.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`DwarfSourceFile`] into the store. - /// - #[inline] - pub fn inter_dwarf_source_file( - &mut self, - dwarf_source_file: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.dwarf_source_file_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.dwarf_source_file.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.dwarf_source_file.write().unwrap().push(None); - _index - }; - - let dwarf_source_file = dwarf_source_file(_index); - - let found = if let Some(dwarf_source_file) = self - .dwarf_source_file - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *dwarf_source_file.read().unwrap() - } else { - false - } - }) { - dwarf_source_file.clone() - } else { - None - }; - - if let Some(dwarf_source_file) = found { - tracing::debug!(target: "store", "found duplicate {dwarf_source_file:?}."); - self.dwarf_source_file_free_list - .lock() - .unwrap() - .push(_index); - dwarf_source_file.clone() - } else { - tracing::debug!(target: "store", "interring {dwarf_source_file:?}."); - self.dwarf_source_file.write().unwrap()[_index] = Some(dwarf_source_file.clone()); - dwarf_source_file - } - } - - /// Exhume (get) [`DwarfSourceFile`] from the store. - /// - #[inline] - pub fn exhume_dwarf_source_file(&self, id: &usize) -> Option>> { - match self.dwarf_source_file.read().unwrap().get(*id) { - Some(dwarf_source_file) => dwarf_source_file.clone(), - None => None, - } - } - - /// Exorcise (remove) [`DwarfSourceFile`] from the store. - /// - #[inline] - pub fn exorcise_dwarf_source_file( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising dwarf_source_file slot: {id}."); - let result = self.dwarf_source_file.write().unwrap()[*id].take(); - self.dwarf_source_file_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, DwarfSourceFile>`. - /// - #[inline] - pub fn iter_dwarf_source_file( - &self, - ) -> impl Iterator>> + '_ { - let len = self.dwarf_source_file.read().unwrap().len(); - (0..len) - .filter(|i| self.dwarf_source_file.read().unwrap()[*i].is_some()) - .map(move |i| { - self.dwarf_source_file.read().unwrap()[i] - .as_ref() - .map(|dwarf_source_file| dwarf_source_file.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`EnumField`] into the store. - /// - #[inline] - pub fn inter_enum_field(&mut self, enum_field: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.enum_field_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.enum_field.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.enum_field.write().unwrap().push(None); - _index - }; - - let enum_field = enum_field(_index); - - let found = if let Some(enum_field) = - self.enum_field.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *enum_field.read().unwrap() - } else { - false - } - }) { - enum_field.clone() - } else { - None - }; - - if let Some(enum_field) = found { - tracing::debug!(target: "store", "found duplicate {enum_field:?}."); - self.enum_field_free_list.lock().unwrap().push(_index); - enum_field.clone() - } else { - tracing::debug!(target: "store", "interring {enum_field:?}."); - self.enum_field.write().unwrap()[_index] = Some(enum_field.clone()); - enum_field - } - } - - /// Exhume (get) [`EnumField`] from the store. - /// - #[inline] - pub fn exhume_enum_field(&self, id: &usize) -> Option>> { - match self.enum_field.read().unwrap().get(*id) { - Some(enum_field) => enum_field.clone(), - None => None, - } - } - - /// Exorcise (remove) [`EnumField`] from the store. - /// - #[inline] - pub fn exorcise_enum_field(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising enum_field slot: {id}."); - let result = self.enum_field.write().unwrap()[*id].take(); - self.enum_field_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, EnumField>`. - /// - #[inline] - pub fn iter_enum_field(&self) -> impl Iterator>> + '_ { - let len = self.enum_field.read().unwrap().len(); - (0..len) - .filter(|i| self.enum_field.read().unwrap()[*i].is_some()) - .map(move |i| { - self.enum_field.read().unwrap()[i] - .as_ref() - .map(|enum_field| enum_field.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`EnumGeneric`] into the store. - /// - #[inline] - pub fn inter_enum_generic(&mut self, enum_generic: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.enum_generic_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.enum_generic.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.enum_generic.write().unwrap().push(None); - _index - }; - - let enum_generic = enum_generic(_index); - - let found = if let Some(enum_generic) = - self.enum_generic.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *enum_generic.read().unwrap() - } else { - false - } - }) { - enum_generic.clone() - } else { - None - }; - - if let Some(enum_generic) = found { - tracing::debug!(target: "store", "found duplicate {enum_generic:?}."); - self.enum_generic_free_list.lock().unwrap().push(_index); - enum_generic.clone() - } else { - tracing::debug!(target: "store", "interring {enum_generic:?}."); - self.enum_generic.write().unwrap()[_index] = Some(enum_generic.clone()); - enum_generic - } - } - - /// Exhume (get) [`EnumGeneric`] from the store. - /// - #[inline] - pub fn exhume_enum_generic(&self, id: &usize) -> Option>> { - match self.enum_generic.read().unwrap().get(*id) { - Some(enum_generic) => enum_generic.clone(), - None => None, - } - } - - /// Exorcise (remove) [`EnumGeneric`] from the store. - /// - #[inline] - pub fn exorcise_enum_generic(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising enum_generic slot: {id}."); - let result = self.enum_generic.write().unwrap()[*id].take(); - self.enum_generic_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, EnumGeneric>`. - /// - #[inline] - pub fn iter_enum_generic(&self) -> impl Iterator>> + '_ { - let len = self.enum_generic.read().unwrap().len(); - (0..len) - .filter(|i| self.enum_generic.read().unwrap()[*i].is_some()) - .map(move |i| { - self.enum_generic.read().unwrap()[i] - .as_ref() - .map(|enum_generic| enum_generic.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`EnumGenericType`] into the store. - /// - #[inline] - pub fn inter_enum_generic_type( - &mut self, - enum_generic_type: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.enum_generic_type_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.enum_generic_type.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.enum_generic_type.write().unwrap().push(None); - _index - }; - - let enum_generic_type = enum_generic_type(_index); - - let found = if let Some(enum_generic_type) = self - .enum_generic_type - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *enum_generic_type.read().unwrap() - } else { - false - } - }) { - enum_generic_type.clone() - } else { - None - }; - - if let Some(enum_generic_type) = found { - tracing::debug!(target: "store", "found duplicate {enum_generic_type:?}."); - self.enum_generic_type_free_list - .lock() - .unwrap() - .push(_index); - enum_generic_type.clone() - } else { - tracing::debug!(target: "store", "interring {enum_generic_type:?}."); - self.enum_generic_type.write().unwrap()[_index] = Some(enum_generic_type.clone()); - enum_generic_type - } - } - - /// Exhume (get) [`EnumGenericType`] from the store. - /// - #[inline] - pub fn exhume_enum_generic_type(&self, id: &usize) -> Option>> { - match self.enum_generic_type.read().unwrap().get(*id) { - Some(enum_generic_type) => enum_generic_type.clone(), - None => None, - } - } - - /// Exorcise (remove) [`EnumGenericType`] from the store. - /// - #[inline] - pub fn exorcise_enum_generic_type( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising enum_generic_type slot: {id}."); - let result = self.enum_generic_type.write().unwrap()[*id].take(); - self.enum_generic_type_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, EnumGenericType>`. - /// - #[inline] - pub fn iter_enum_generic_type( - &self, - ) -> impl Iterator>> + '_ { - let len = self.enum_generic_type.read().unwrap().len(); - (0..len) - .filter(|i| self.enum_generic_type.read().unwrap()[*i].is_some()) - .map(move |i| { - self.enum_generic_type.read().unwrap()[i] - .as_ref() - .map(|enum_generic_type| enum_generic_type.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Enumeration`] into the store. - /// - #[inline] - pub fn inter_enumeration(&mut self, enumeration: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.enumeration_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.enumeration.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.enumeration.write().unwrap().push(None); - _index - }; - - let enumeration = enumeration(_index); - - let found = if let Some(enumeration) = - self.enumeration.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *enumeration.read().unwrap() - } else { - false - } - }) { - enumeration.clone() - } else { - None - }; - - let enumeration = if let Some(enumeration) = found { - tracing::debug!(target: "store", "found duplicate {enumeration:?}."); - self.enumeration_free_list.lock().unwrap().push(_index); - enumeration.clone() - } else { - tracing::debug!(target: "store", "interring {enumeration:?}."); - self.enumeration.write().unwrap()[_index] = Some(enumeration.clone()); - enumeration - }; - self.enumeration_id_by_name.write().unwrap().insert( - enumeration.read().unwrap().name.to_owned(), - enumeration.read().unwrap().id, - ); - enumeration - } - - /// Exhume (get) [`Enumeration`] from the store. - /// - #[inline] - pub fn exhume_enumeration(&self, id: &usize) -> Option>> { - match self.enumeration.read().unwrap().get(*id) { - Some(enumeration) => enumeration.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Enumeration`] from the store. - /// - #[inline] - pub fn exorcise_enumeration(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising enumeration slot: {id}."); - let result = self.enumeration.write().unwrap()[*id].take(); - self.enumeration_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`Enumeration`] id from the store by name. - /// - #[inline] - pub fn exhume_enumeration_id_by_name(&self, name: &str) -> Option { - self.enumeration_id_by_name - .read() - .unwrap() - .get(name) - .map(|enumeration| *enumeration) - } - - /// Get an iterator over the internal `HashMap<&Uuid, Enumeration>`. - /// - #[inline] - pub fn iter_enumeration(&self) -> impl Iterator>> + '_ { - let len = self.enumeration.read().unwrap().len(); - (0..len) - .filter(|i| self.enumeration.read().unwrap()[*i].is_some()) - .map(move |i| { - self.enumeration.read().unwrap()[i] - .as_ref() - .map(|enumeration| enumeration.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Expression`] into the store. - /// - #[inline] - pub fn inter_expression(&mut self, expression: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.expression.write().unwrap().push(None); - _index - }; - - let expression = expression(_index); - - let found = if let Some(expression) = - self.expression.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *expression.read().unwrap() - } else { - false - } - }) { - expression.clone() - } else { - None - }; - - if let Some(expression) = found { - tracing::debug!(target: "store", "found duplicate {expression:?}."); - self.expression_free_list.lock().unwrap().push(_index); - expression.clone() - } else { - tracing::debug!(target: "store", "interring {expression:?}."); - self.expression.write().unwrap()[_index] = Some(expression.clone()); - expression - } - } - - /// Exhume (get) [`Expression`] from the store. - /// - #[inline] - pub fn exhume_expression(&self, id: &usize) -> Option>> { - match self.expression.read().unwrap().get(*id) { - Some(expression) => expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Expression`] from the store. - /// - #[inline] - pub fn exorcise_expression(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising expression slot: {id}."); - let result = self.expression.write().unwrap()[*id].take(); - self.expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Expression>`. - /// - #[inline] - pub fn iter_expression(&self) -> impl Iterator>> + '_ { - let len = self.expression.read().unwrap().len(); - (0..len) - .filter(|i| self.expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.expression.read().unwrap()[i] - .as_ref() - .map(|expression| expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ExpressionBit`] into the store. - /// - #[inline] - pub fn inter_expression_bit(&mut self, expression_bit: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.expression_bit_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.expression_bit.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.expression_bit.write().unwrap().push(None); - _index - }; - - let expression_bit = expression_bit(_index); - - let found = if let Some(expression_bit) = - self.expression_bit.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *expression_bit.read().unwrap() - } else { - false - } - }) { - expression_bit.clone() - } else { - None - }; - - if let Some(expression_bit) = found { - tracing::debug!(target: "store", "found duplicate {expression_bit:?}."); - self.expression_bit_free_list.lock().unwrap().push(_index); - expression_bit.clone() - } else { - tracing::debug!(target: "store", "interring {expression_bit:?}."); - self.expression_bit.write().unwrap()[_index] = Some(expression_bit.clone()); - expression_bit - } - } - - /// Exhume (get) [`ExpressionBit`] from the store. - /// - #[inline] - pub fn exhume_expression_bit(&self, id: &usize) -> Option>> { - match self.expression_bit.read().unwrap().get(*id) { - Some(expression_bit) => expression_bit.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ExpressionBit`] from the store. - /// - #[inline] - pub fn exorcise_expression_bit(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising expression_bit slot: {id}."); - let result = self.expression_bit.write().unwrap()[*id].take(); - self.expression_bit_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ExpressionBit>`. - /// - #[inline] - pub fn iter_expression_bit(&self) -> impl Iterator>> + '_ { - let len = self.expression_bit.read().unwrap().len(); - (0..len) - .filter(|i| self.expression_bit.read().unwrap()[*i].is_some()) - .map(move |i| { - self.expression_bit.read().unwrap()[i] - .as_ref() - .map(|expression_bit| expression_bit.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ExpressionStatement`] into the store. - /// - #[inline] - pub fn inter_expression_statement( - &mut self, - expression_statement: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.expression_statement_free_list.lock().unwrap().pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.expression_statement.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.expression_statement.write().unwrap().push(None); - _index - }; - - let expression_statement = expression_statement(_index); - - let found = if let Some(expression_statement) = self - .expression_statement - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *expression_statement.read().unwrap() - } else { - false - } - }) { - expression_statement.clone() - } else { - None - }; - - if let Some(expression_statement) = found { - tracing::debug!(target: "store", "found duplicate {expression_statement:?}."); - self.expression_statement_free_list - .lock() - .unwrap() - .push(_index); - expression_statement.clone() - } else { - tracing::debug!(target: "store", "interring {expression_statement:?}."); - self.expression_statement.write().unwrap()[_index] = Some(expression_statement.clone()); - expression_statement - } - } - - /// Exhume (get) [`ExpressionStatement`] from the store. - /// - #[inline] - pub fn exhume_expression_statement( - &self, - id: &usize, - ) -> Option>> { - match self.expression_statement.read().unwrap().get(*id) { - Some(expression_statement) => expression_statement.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ExpressionStatement`] from the store. - /// - #[inline] - pub fn exorcise_expression_statement( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising expression_statement slot: {id}."); - let result = self.expression_statement.write().unwrap()[*id].take(); - self.expression_statement_free_list - .lock() - .unwrap() - .push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ExpressionStatement>`. - /// - #[inline] - pub fn iter_expression_statement( - &self, - ) -> impl Iterator>> + '_ { - let len = self.expression_statement.read().unwrap().len(); - (0..len) - .filter(|i| self.expression_statement.read().unwrap()[*i].is_some()) - .map(move |i| { - self.expression_statement.read().unwrap()[i] - .as_ref() - .map(|expression_statement| expression_statement.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ExternalImplementation`] into the store. - /// - #[inline] - pub fn inter_external_implementation( - &mut self, - external_implementation: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = - if let Some(_index) = self.external_implementation_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.external_implementation.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.external_implementation.write().unwrap().push(None); - _index - }; - - let external_implementation = external_implementation(_index); - - let found = if let Some(external_implementation) = self - .external_implementation - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *external_implementation.read().unwrap() - } else { - false - } - }) { - external_implementation.clone() - } else { - None - }; - - if let Some(external_implementation) = found { - tracing::debug!(target: "store", "found duplicate {external_implementation:?}."); - self.external_implementation_free_list - .lock() - .unwrap() - .push(_index); - external_implementation.clone() - } else { - tracing::debug!(target: "store", "interring {external_implementation:?}."); - self.external_implementation.write().unwrap()[_index] = - Some(external_implementation.clone()); - external_implementation - } - } - - /// Exhume (get) [`ExternalImplementation`] from the store. - /// - #[inline] - pub fn exhume_external_implementation( - &self, - id: &usize, - ) -> Option>> { - match self.external_implementation.read().unwrap().get(*id) { - Some(external_implementation) => external_implementation.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ExternalImplementation`] from the store. - /// - #[inline] - pub fn exorcise_external_implementation( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising external_implementation slot: {id}."); - let result = self.external_implementation.write().unwrap()[*id].take(); - self.external_implementation_free_list - .lock() - .unwrap() - .push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ExternalImplementation>`. - /// - #[inline] - pub fn iter_external_implementation( - &self, - ) -> impl Iterator>> + '_ { - let len = self.external_implementation.read().unwrap().len(); - (0..len) - .filter(|i| self.external_implementation.read().unwrap()[*i].is_some()) - .map(move |i| { - self.external_implementation.read().unwrap()[i] - .as_ref() - .map(|external_implementation| external_implementation.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Field`] into the store. - /// - #[inline] - pub fn inter_field(&mut self, field: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.field_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.field.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.field.write().unwrap().push(None); - _index - }; - - let field = field(_index); - - let found = if let Some(field) = self.field.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *field.read().unwrap() - } else { - false - } - }) { - field.clone() - } else { - None - }; - - let field = if let Some(field) = found { - tracing::debug!(target: "store", "found duplicate {field:?}."); - self.field_free_list.lock().unwrap().push(_index); - field.clone() - } else { - tracing::debug!(target: "store", "interring {field:?}."); - self.field.write().unwrap()[_index] = Some(field.clone()); - field - }; - self.field_id_by_name.write().unwrap().insert( - field.read().unwrap().name.to_owned(), - field.read().unwrap().id, - ); - field - } - - /// Exhume (get) [`Field`] from the store. - /// - #[inline] - pub fn exhume_field(&self, id: &usize) -> Option>> { - match self.field.read().unwrap().get(*id) { - Some(field) => field.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Field`] from the store. - /// - #[inline] - pub fn exorcise_field(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising field slot: {id}."); - let result = self.field.write().unwrap()[*id].take(); - self.field_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`Field`] id from the store by name. - /// - #[inline] - pub fn exhume_field_id_by_name(&self, name: &str) -> Option { - self.field_id_by_name - .read() - .unwrap() - .get(name) - .map(|field| *field) - } - - /// Get an iterator over the internal `HashMap<&Uuid, Field>`. - /// - #[inline] - pub fn iter_field(&self) -> impl Iterator>> + '_ { - let len = self.field.read().unwrap().len(); - (0..len) - .filter(|i| self.field.read().unwrap()[*i].is_some()) - .map(move |i| { - self.field.read().unwrap()[i] - .as_ref() - .map(|field| field.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FieldAccess`] into the store. - /// - #[inline] - pub fn inter_field_access(&mut self, field_access: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.field_access_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.field_access.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.field_access.write().unwrap().push(None); - _index - }; - - let field_access = field_access(_index); - - let found = if let Some(field_access) = - self.field_access.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *field_access.read().unwrap() - } else { - false - } - }) { - field_access.clone() - } else { - None - }; - - if let Some(field_access) = found { - tracing::debug!(target: "store", "found duplicate {field_access:?}."); - self.field_access_free_list.lock().unwrap().push(_index); - field_access.clone() - } else { - tracing::debug!(target: "store", "interring {field_access:?}."); - self.field_access.write().unwrap()[_index] = Some(field_access.clone()); - field_access - } - } - - /// Exhume (get) [`FieldAccess`] from the store. - /// - #[inline] - pub fn exhume_field_access(&self, id: &usize) -> Option>> { - match self.field_access.read().unwrap().get(*id) { - Some(field_access) => field_access.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FieldAccess`] from the store. - /// - #[inline] - pub fn exorcise_field_access(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising field_access slot: {id}."); - let result = self.field_access.write().unwrap()[*id].take(); - self.field_access_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FieldAccess>`. - /// - #[inline] - pub fn iter_field_access(&self) -> impl Iterator>> + '_ { - let len = self.field_access.read().unwrap().len(); - (0..len) - .filter(|i| self.field_access.read().unwrap()[*i].is_some()) - .map(move |i| { - self.field_access.read().unwrap()[i] - .as_ref() - .map(|field_access| field_access.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FieldAccessTarget`] into the store. - /// - #[inline] - pub fn inter_field_access_target( - &mut self, - field_access_target: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.field_access_target_free_list.lock().unwrap().pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.field_access_target.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.field_access_target.write().unwrap().push(None); - _index - }; - - let field_access_target = field_access_target(_index); - - let found = if let Some(field_access_target) = self - .field_access_target - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *field_access_target.read().unwrap() - } else { - false - } - }) { - field_access_target.clone() - } else { - None - }; - - if let Some(field_access_target) = found { - tracing::debug!(target: "store", "found duplicate {field_access_target:?}."); - self.field_access_target_free_list - .lock() - .unwrap() - .push(_index); - field_access_target.clone() - } else { - tracing::debug!(target: "store", "interring {field_access_target:?}."); - self.field_access_target.write().unwrap()[_index] = Some(field_access_target.clone()); - field_access_target - } - } - - /// Exhume (get) [`FieldAccessTarget`] from the store. - /// - #[inline] - pub fn exhume_field_access_target(&self, id: &usize) -> Option>> { - match self.field_access_target.read().unwrap().get(*id) { - Some(field_access_target) => field_access_target.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FieldAccessTarget`] from the store. - /// - #[inline] - pub fn exorcise_field_access_target( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising field_access_target slot: {id}."); - let result = self.field_access_target.write().unwrap()[*id].take(); - self.field_access_target_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FieldAccessTarget>`. - /// - #[inline] - pub fn iter_field_access_target( - &self, - ) -> impl Iterator>> + '_ { - let len = self.field_access_target.read().unwrap().len(); - (0..len) - .filter(|i| self.field_access_target.read().unwrap()[*i].is_some()) - .map(move |i| { - self.field_access_target.read().unwrap()[i] - .as_ref() - .map(|field_access_target| field_access_target.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FieldExpression`] into the store. - /// - #[inline] - pub fn inter_field_expression(&mut self, field_expression: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.field_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.field_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.field_expression.write().unwrap().push(None); - _index - }; - - let field_expression = field_expression(_index); - - let found = if let Some(field_expression) = - self.field_expression.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *field_expression.read().unwrap() - } else { - false - } - }) { - field_expression.clone() - } else { - None - }; - - if let Some(field_expression) = found { - tracing::debug!(target: "store", "found duplicate {field_expression:?}."); - self.field_expression_free_list.lock().unwrap().push(_index); - field_expression.clone() - } else { - tracing::debug!(target: "store", "interring {field_expression:?}."); - self.field_expression.write().unwrap()[_index] = Some(field_expression.clone()); - field_expression - } - } - - /// Exhume (get) [`FieldExpression`] from the store. - /// - #[inline] - pub fn exhume_field_expression(&self, id: &usize) -> Option>> { - match self.field_expression.read().unwrap().get(*id) { - Some(field_expression) => field_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FieldExpression`] from the store. - /// - #[inline] - pub fn exorcise_field_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising field_expression slot: {id}."); - let result = self.field_expression.write().unwrap()[*id].take(); - self.field_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FieldExpression>`. - /// - #[inline] - pub fn iter_field_expression(&self) -> impl Iterator>> + '_ { - let len = self.field_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.field_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.field_expression.read().unwrap()[i] - .as_ref() - .map(|field_expression| field_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FloatLiteral`] into the store. - /// - #[inline] - pub fn inter_float_literal(&mut self, float_literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.float_literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.float_literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.float_literal.write().unwrap().push(None); - _index - }; - - let float_literal = float_literal(_index); - - let found = if let Some(float_literal) = - self.float_literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *float_literal.read().unwrap() - } else { - false - } - }) { - float_literal.clone() - } else { - None - }; - - if let Some(float_literal) = found { - tracing::debug!(target: "store", "found duplicate {float_literal:?}."); - self.float_literal_free_list.lock().unwrap().push(_index); - float_literal.clone() - } else { - tracing::debug!(target: "store", "interring {float_literal:?}."); - self.float_literal.write().unwrap()[_index] = Some(float_literal.clone()); - float_literal - } - } - - /// Exhume (get) [`FloatLiteral`] from the store. - /// - #[inline] - pub fn exhume_float_literal(&self, id: &usize) -> Option>> { - match self.float_literal.read().unwrap().get(*id) { - Some(float_literal) => float_literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FloatLiteral`] from the store. - /// - #[inline] - pub fn exorcise_float_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising float_literal slot: {id}."); - let result = self.float_literal.write().unwrap()[*id].take(); - self.float_literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FloatLiteral>`. - /// - #[inline] - pub fn iter_float_literal(&self) -> impl Iterator>> + '_ { - let len = self.float_literal.read().unwrap().len(); - (0..len) - .filter(|i| self.float_literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.float_literal.read().unwrap()[i] - .as_ref() - .map(|float_literal| float_literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ForLoop`] into the store. - /// - #[inline] - pub fn inter_for_loop(&mut self, for_loop: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.for_loop_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.for_loop.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.for_loop.write().unwrap().push(None); - _index - }; - - let for_loop = for_loop(_index); - - let found = if let Some(for_loop) = self.for_loop.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *for_loop.read().unwrap() - } else { - false - } - }) { - for_loop.clone() - } else { - None - }; - - if let Some(for_loop) = found { - tracing::debug!(target: "store", "found duplicate {for_loop:?}."); - self.for_loop_free_list.lock().unwrap().push(_index); - for_loop.clone() - } else { - tracing::debug!(target: "store", "interring {for_loop:?}."); - self.for_loop.write().unwrap()[_index] = Some(for_loop.clone()); - for_loop - } - } - - /// Exhume (get) [`ForLoop`] from the store. - /// - #[inline] - pub fn exhume_for_loop(&self, id: &usize) -> Option>> { - match self.for_loop.read().unwrap().get(*id) { - Some(for_loop) => for_loop.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ForLoop`] from the store. - /// - #[inline] - pub fn exorcise_for_loop(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising for_loop slot: {id}."); - let result = self.for_loop.write().unwrap()[*id].take(); - self.for_loop_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ForLoop>`. - /// - #[inline] - pub fn iter_for_loop(&self) -> impl Iterator>> + '_ { - let len = self.for_loop.read().unwrap().len(); - (0..len) - .filter(|i| self.for_loop.read().unwrap()[*i].is_some()) - .map(move |i| { - self.for_loop.read().unwrap()[i] - .as_ref() - .map(|for_loop| for_loop.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FormatBit`] into the store. - /// - #[inline] - pub fn inter_format_bit(&mut self, format_bit: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.format_bit_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.format_bit.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.format_bit.write().unwrap().push(None); - _index - }; - - let format_bit = format_bit(_index); - - let found = if let Some(format_bit) = - self.format_bit.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *format_bit.read().unwrap() - } else { - false - } - }) { - format_bit.clone() - } else { - None - }; - - if let Some(format_bit) = found { - tracing::debug!(target: "store", "found duplicate {format_bit:?}."); - self.format_bit_free_list.lock().unwrap().push(_index); - format_bit.clone() - } else { - tracing::debug!(target: "store", "interring {format_bit:?}."); - self.format_bit.write().unwrap()[_index] = Some(format_bit.clone()); - format_bit - } - } - - /// Exhume (get) [`FormatBit`] from the store. - /// - #[inline] - pub fn exhume_format_bit(&self, id: &usize) -> Option>> { - match self.format_bit.read().unwrap().get(*id) { - Some(format_bit) => format_bit.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FormatBit`] from the store. - /// - #[inline] - pub fn exorcise_format_bit(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising format_bit slot: {id}."); - let result = self.format_bit.write().unwrap()[*id].take(); - self.format_bit_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FormatBit>`. - /// - #[inline] - pub fn iter_format_bit(&self) -> impl Iterator>> + '_ { - let len = self.format_bit.read().unwrap().len(); - (0..len) - .filter(|i| self.format_bit.read().unwrap()[*i].is_some()) - .map(move |i| { - self.format_bit.read().unwrap()[i] - .as_ref() - .map(|format_bit| format_bit.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FormatString`] into the store. - /// - #[inline] - pub fn inter_format_string(&mut self, format_string: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.format_string_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.format_string.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.format_string.write().unwrap().push(None); - _index - }; - - let format_string = format_string(_index); - - let found = if let Some(format_string) = - self.format_string.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *format_string.read().unwrap() - } else { - false - } - }) { - format_string.clone() - } else { - None - }; - - if let Some(format_string) = found { - tracing::debug!(target: "store", "found duplicate {format_string:?}."); - self.format_string_free_list.lock().unwrap().push(_index); - format_string.clone() - } else { - tracing::debug!(target: "store", "interring {format_string:?}."); - self.format_string.write().unwrap()[_index] = Some(format_string.clone()); - format_string - } - } - - /// Exhume (get) [`FormatString`] from the store. - /// - #[inline] - pub fn exhume_format_string(&self, id: &usize) -> Option>> { - match self.format_string.read().unwrap().get(*id) { - Some(format_string) => format_string.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FormatString`] from the store. - /// - #[inline] - pub fn exorcise_format_string(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising format_string slot: {id}."); - let result = self.format_string.write().unwrap()[*id].take(); - self.format_string_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FormatString>`. - /// - #[inline] - pub fn iter_format_string(&self) -> impl Iterator>> + '_ { - let len = self.format_string.read().unwrap().len(); - (0..len) - .filter(|i| self.format_string.read().unwrap()[*i].is_some()) - .map(move |i| { - self.format_string.read().unwrap()[i] - .as_ref() - .map(|format_string| format_string.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FuncGeneric`] into the store. - /// - #[inline] - pub fn inter_func_generic(&mut self, func_generic: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.func_generic_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.func_generic.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.func_generic.write().unwrap().push(None); - _index - }; - - let func_generic = func_generic(_index); - - let found = if let Some(func_generic) = - self.func_generic.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *func_generic.read().unwrap() - } else { - false - } - }) { - func_generic.clone() - } else { - None - }; - - if let Some(func_generic) = found { - tracing::debug!(target: "store", "found duplicate {func_generic:?}."); - self.func_generic_free_list.lock().unwrap().push(_index); - func_generic.clone() - } else { - tracing::debug!(target: "store", "interring {func_generic:?}."); - self.func_generic.write().unwrap()[_index] = Some(func_generic.clone()); - func_generic - } - } - - /// Exhume (get) [`FuncGeneric`] from the store. - /// - #[inline] - pub fn exhume_func_generic(&self, id: &usize) -> Option>> { - match self.func_generic.read().unwrap().get(*id) { - Some(func_generic) => func_generic.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FuncGeneric`] from the store. - /// - #[inline] - pub fn exorcise_func_generic(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising func_generic slot: {id}."); - let result = self.func_generic.write().unwrap()[*id].take(); - self.func_generic_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FuncGeneric>`. - /// - #[inline] - pub fn iter_func_generic(&self) -> impl Iterator>> + '_ { - let len = self.func_generic.read().unwrap().len(); - (0..len) - .filter(|i| self.func_generic.read().unwrap()[*i].is_some()) - .map(move |i| { - self.func_generic.read().unwrap()[i] - .as_ref() - .map(|func_generic| func_generic.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Function`] into the store. - /// - #[inline] - pub fn inter_function(&mut self, function: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.function_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.function.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.function.write().unwrap().push(None); - _index - }; - - let function = function(_index); - - let found = if let Some(function) = self.function.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *function.read().unwrap() - } else { - false - } - }) { - function.clone() - } else { - None - }; - - let function = if let Some(function) = found { - tracing::debug!(target: "store", "found duplicate {function:?}."); - self.function_free_list.lock().unwrap().push(_index); - function.clone() - } else { - tracing::debug!(target: "store", "interring {function:?}."); - self.function.write().unwrap()[_index] = Some(function.clone()); - function - }; - self.function_id_by_name.write().unwrap().insert( - function.read().unwrap().name.to_owned(), - function.read().unwrap().id, - ); - function - } - - /// Exhume (get) [`Function`] from the store. - /// - #[inline] - pub fn exhume_function(&self, id: &usize) -> Option>> { - match self.function.read().unwrap().get(*id) { - Some(function) => function.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Function`] from the store. - /// - #[inline] - pub fn exorcise_function(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising function slot: {id}."); - let result = self.function.write().unwrap()[*id].take(); - self.function_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`Function`] id from the store by name. - /// - #[inline] - pub fn exhume_function_id_by_name(&self, name: &str) -> Option { - self.function_id_by_name - .read() - .unwrap() - .get(name) - .map(|function| *function) - } - - /// Get an iterator over the internal `HashMap<&Uuid, Function>`. - /// - #[inline] - pub fn iter_function(&self) -> impl Iterator>> + '_ { - let len = self.function.read().unwrap().len(); - (0..len) - .filter(|i| self.function.read().unwrap()[*i].is_some()) - .map(move |i| { - self.function.read().unwrap()[i] - .as_ref() - .map(|function| function.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`FunctionCall`] into the store. - /// - #[inline] - pub fn inter_function_call(&mut self, function_call: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.function_call_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.function_call.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.function_call.write().unwrap().push(None); - _index - }; - - let function_call = function_call(_index); - - let found = if let Some(function_call) = - self.function_call.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *function_call.read().unwrap() - } else { - false - } - }) { - function_call.clone() - } else { - None - }; - - if let Some(function_call) = found { - tracing::debug!(target: "store", "found duplicate {function_call:?}."); - self.function_call_free_list.lock().unwrap().push(_index); - function_call.clone() - } else { - tracing::debug!(target: "store", "interring {function_call:?}."); - self.function_call.write().unwrap()[_index] = Some(function_call.clone()); - function_call - } - } - - /// Exhume (get) [`FunctionCall`] from the store. - /// - #[inline] - pub fn exhume_function_call(&self, id: &usize) -> Option>> { - match self.function_call.read().unwrap().get(*id) { - Some(function_call) => function_call.clone(), - None => None, - } - } - - /// Exorcise (remove) [`FunctionCall`] from the store. - /// - #[inline] - pub fn exorcise_function_call(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising function_call slot: {id}."); - let result = self.function_call.write().unwrap()[*id].take(); - self.function_call_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, FunctionCall>`. - /// - #[inline] - pub fn iter_function_call(&self) -> impl Iterator>> + '_ { - let len = self.function_call.read().unwrap().len(); - (0..len) - .filter(|i| self.function_call.read().unwrap()[*i].is_some()) - .map(move |i| { - self.function_call.read().unwrap()[i] - .as_ref() - .map(|function_call| function_call.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XFuture`] into the store. - /// - #[inline] - pub fn inter_x_future(&mut self, x_future: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_future_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_future.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_future.write().unwrap().push(None); - _index - }; - - let x_future = x_future(_index); - - let found = if let Some(x_future) = self.x_future.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_future.read().unwrap() - } else { - false - } - }) { - x_future.clone() - } else { - None - }; - - if let Some(x_future) = found { - tracing::debug!(target: "store", "found duplicate {x_future:?}."); - self.x_future_free_list.lock().unwrap().push(_index); - x_future.clone() - } else { - tracing::debug!(target: "store", "interring {x_future:?}."); - self.x_future.write().unwrap()[_index] = Some(x_future.clone()); - x_future - } - } - - /// Exhume (get) [`XFuture`] from the store. - /// - #[inline] - pub fn exhume_x_future(&self, id: &usize) -> Option>> { - match self.x_future.read().unwrap().get(*id) { - Some(x_future) => x_future.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XFuture`] from the store. - /// - #[inline] - pub fn exorcise_x_future(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_future slot: {id}."); - let result = self.x_future.write().unwrap()[*id].take(); - self.x_future_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XFuture>`. - /// - #[inline] - pub fn iter_x_future(&self) -> impl Iterator>> + '_ { - let len = self.x_future.read().unwrap().len(); - (0..len) - .filter(|i| self.x_future.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_future.read().unwrap()[i] - .as_ref() - .map(|x_future| x_future.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Grouped`] into the store. - /// - #[inline] - pub fn inter_grouped(&mut self, grouped: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.grouped_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.grouped.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.grouped.write().unwrap().push(None); - _index - }; - - let grouped = grouped(_index); - - let found = if let Some(grouped) = self.grouped.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *grouped.read().unwrap() - } else { - false - } - }) { - grouped.clone() - } else { - None - }; - - if let Some(grouped) = found { - tracing::debug!(target: "store", "found duplicate {grouped:?}."); - self.grouped_free_list.lock().unwrap().push(_index); - grouped.clone() - } else { - tracing::debug!(target: "store", "interring {grouped:?}."); - self.grouped.write().unwrap()[_index] = Some(grouped.clone()); - grouped - } - } - - /// Exhume (get) [`Grouped`] from the store. - /// - #[inline] - pub fn exhume_grouped(&self, id: &usize) -> Option>> { - match self.grouped.read().unwrap().get(*id) { - Some(grouped) => grouped.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Grouped`] from the store. - /// - #[inline] - pub fn exorcise_grouped(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising grouped slot: {id}."); - let result = self.grouped.write().unwrap()[*id].take(); - self.grouped_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Grouped>`. - /// - #[inline] - pub fn iter_grouped(&self) -> impl Iterator>> + '_ { - let len = self.grouped.read().unwrap().len(); - (0..len) - .filter(|i| self.grouped.read().unwrap()[*i].is_some()) - .map(move |i| { - self.grouped.read().unwrap()[i] - .as_ref() - .map(|grouped| grouped.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`HaltAndCatchFire`] into the store. - /// - #[inline] - pub fn inter_halt_and_catch_fire( - &mut self, - halt_and_catch_fire: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.halt_and_catch_fire_free_list.lock().unwrap().pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.halt_and_catch_fire.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.halt_and_catch_fire.write().unwrap().push(None); - _index - }; - - let halt_and_catch_fire = halt_and_catch_fire(_index); - - let found = if let Some(halt_and_catch_fire) = self - .halt_and_catch_fire - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *halt_and_catch_fire.read().unwrap() - } else { - false - } - }) { - halt_and_catch_fire.clone() - } else { - None - }; - - if let Some(halt_and_catch_fire) = found { - tracing::debug!(target: "store", "found duplicate {halt_and_catch_fire:?}."); - self.halt_and_catch_fire_free_list - .lock() - .unwrap() - .push(_index); - halt_and_catch_fire.clone() - } else { - tracing::debug!(target: "store", "interring {halt_and_catch_fire:?}."); - self.halt_and_catch_fire.write().unwrap()[_index] = Some(halt_and_catch_fire.clone()); - halt_and_catch_fire - } - } - - /// Exhume (get) [`HaltAndCatchFire`] from the store. - /// - #[inline] - pub fn exhume_halt_and_catch_fire(&self, id: &usize) -> Option>> { - match self.halt_and_catch_fire.read().unwrap().get(*id) { - Some(halt_and_catch_fire) => halt_and_catch_fire.clone(), - None => None, - } - } - - /// Exorcise (remove) [`HaltAndCatchFire`] from the store. - /// - #[inline] - pub fn exorcise_halt_and_catch_fire( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising halt_and_catch_fire slot: {id}."); - let result = self.halt_and_catch_fire.write().unwrap()[*id].take(); - self.halt_and_catch_fire_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, HaltAndCatchFire>`. - /// - #[inline] - pub fn iter_halt_and_catch_fire( - &self, - ) -> impl Iterator>> + '_ { - let len = self.halt_and_catch_fire.read().unwrap().len(); - (0..len) - .filter(|i| self.halt_and_catch_fire.read().unwrap()[*i].is_some()) - .map(move |i| { - self.halt_and_catch_fire.read().unwrap()[i] - .as_ref() - .map(|halt_and_catch_fire| halt_and_catch_fire.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XIf`] into the store. - /// - #[inline] - pub fn inter_x_if(&mut self, x_if: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_if_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_if.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_if.write().unwrap().push(None); - _index - }; - - let x_if = x_if(_index); - - let found = if let Some(x_if) = self.x_if.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_if.read().unwrap() - } else { - false - } - }) { - x_if.clone() - } else { - None - }; - - if let Some(x_if) = found { - tracing::debug!(target: "store", "found duplicate {x_if:?}."); - self.x_if_free_list.lock().unwrap().push(_index); - x_if.clone() - } else { - tracing::debug!(target: "store", "interring {x_if:?}."); - self.x_if.write().unwrap()[_index] = Some(x_if.clone()); - x_if - } - } - - /// Exhume (get) [`XIf`] from the store. - /// - #[inline] - pub fn exhume_x_if(&self, id: &usize) -> Option>> { - match self.x_if.read().unwrap().get(*id) { - Some(x_if) => x_if.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XIf`] from the store. - /// - #[inline] - pub fn exorcise_x_if(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_if slot: {id}."); - let result = self.x_if.write().unwrap()[*id].take(); - self.x_if_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XIf>`. - /// - #[inline] - pub fn iter_x_if(&self) -> impl Iterator>> + '_ { - let len = self.x_if.read().unwrap().len(); - (0..len) - .filter(|i| self.x_if.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_if.read().unwrap()[i] - .as_ref() - .map(|x_if| x_if.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ImplementationBlock`] into the store. - /// - #[inline] - pub fn inter_implementation_block( - &mut self, - implementation_block: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.implementation_block_free_list.lock().unwrap().pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.implementation_block.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.implementation_block.write().unwrap().push(None); - _index - }; - - let implementation_block = implementation_block(_index); - - let found = if let Some(implementation_block) = self - .implementation_block - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *implementation_block.read().unwrap() - } else { - false - } - }) { - implementation_block.clone() - } else { - None - }; - - if let Some(implementation_block) = found { - tracing::debug!(target: "store", "found duplicate {implementation_block:?}."); - self.implementation_block_free_list - .lock() - .unwrap() - .push(_index); - implementation_block.clone() - } else { - tracing::debug!(target: "store", "interring {implementation_block:?}."); - self.implementation_block.write().unwrap()[_index] = Some(implementation_block.clone()); - implementation_block - } - } - - /// Exhume (get) [`ImplementationBlock`] from the store. - /// - #[inline] - pub fn exhume_implementation_block( - &self, - id: &usize, - ) -> Option>> { - match self.implementation_block.read().unwrap().get(*id) { - Some(implementation_block) => implementation_block.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ImplementationBlock`] from the store. - /// - #[inline] - pub fn exorcise_implementation_block( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising implementation_block slot: {id}."); - let result = self.implementation_block.write().unwrap()[*id].take(); - self.implementation_block_free_list - .lock() - .unwrap() - .push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ImplementationBlock>`. - /// - #[inline] - pub fn iter_implementation_block( - &self, - ) -> impl Iterator>> + '_ { - let len = self.implementation_block.read().unwrap().len(); - (0..len) - .filter(|i| self.implementation_block.read().unwrap()[*i].is_some()) - .map(move |i| { - self.implementation_block.read().unwrap()[i] - .as_ref() - .map(|implementation_block| implementation_block.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Import`] into the store. - /// - #[inline] - pub fn inter_import(&mut self, import: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.import_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.import.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.import.write().unwrap().push(None); - _index - }; - - let import = import(_index); - - let found = if let Some(import) = self.import.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *import.read().unwrap() - } else { - false - } - }) { - import.clone() - } else { - None - }; - - if let Some(import) = found { - tracing::debug!(target: "store", "found duplicate {import:?}."); - self.import_free_list.lock().unwrap().push(_index); - import.clone() - } else { - tracing::debug!(target: "store", "interring {import:?}."); - self.import.write().unwrap()[_index] = Some(import.clone()); - import - } - } - - /// Exhume (get) [`Import`] from the store. - /// - #[inline] - pub fn exhume_import(&self, id: &usize) -> Option>> { - match self.import.read().unwrap().get(*id) { - Some(import) => import.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Import`] from the store. - /// - #[inline] - pub fn exorcise_import(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising import slot: {id}."); - let result = self.import.write().unwrap()[*id].take(); - self.import_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Import>`. - /// - #[inline] - pub fn iter_import(&self) -> impl Iterator>> + '_ { - let len = self.import.read().unwrap().len(); - (0..len) - .filter(|i| self.import.read().unwrap()[*i].is_some()) - .map(move |i| { - self.import.read().unwrap()[i] - .as_ref() - .map(|import| import.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Index`] into the store. - /// - #[inline] - pub fn inter_index(&mut self, index: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.index_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.index.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.index.write().unwrap().push(None); - _index - }; - - let index = index(_index); - - let found = if let Some(index) = self.index.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *index.read().unwrap() - } else { - false - } - }) { - index.clone() - } else { - None - }; - - if let Some(index) = found { - tracing::debug!(target: "store", "found duplicate {index:?}."); - self.index_free_list.lock().unwrap().push(_index); - index.clone() - } else { - tracing::debug!(target: "store", "interring {index:?}."); - self.index.write().unwrap()[_index] = Some(index.clone()); - index - } - } - - /// Exhume (get) [`Index`] from the store. - /// - #[inline] - pub fn exhume_index(&self, id: &usize) -> Option>> { - match self.index.read().unwrap().get(*id) { - Some(index) => index.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Index`] from the store. - /// - #[inline] - pub fn exorcise_index(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising index slot: {id}."); - let result = self.index.write().unwrap()[*id].take(); - self.index_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Index>`. - /// - #[inline] - pub fn iter_index(&self) -> impl Iterator>> + '_ { - let len = self.index.read().unwrap().len(); - (0..len) - .filter(|i| self.index.read().unwrap()[*i].is_some()) - .map(move |i| { - self.index.read().unwrap()[i] - .as_ref() - .map(|index| index.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`IntegerLiteral`] into the store. - /// - #[inline] - pub fn inter_integer_literal(&mut self, integer_literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.integer_literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.integer_literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.integer_literal.write().unwrap().push(None); - _index - }; - - let integer_literal = integer_literal(_index); - - let found = if let Some(integer_literal) = - self.integer_literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *integer_literal.read().unwrap() - } else { - false - } - }) { - integer_literal.clone() - } else { - None - }; - - if let Some(integer_literal) = found { - tracing::debug!(target: "store", "found duplicate {integer_literal:?}."); - self.integer_literal_free_list.lock().unwrap().push(_index); - integer_literal.clone() - } else { - tracing::debug!(target: "store", "interring {integer_literal:?}."); - self.integer_literal.write().unwrap()[_index] = Some(integer_literal.clone()); - integer_literal - } - } - - /// Exhume (get) [`IntegerLiteral`] from the store. - /// - #[inline] - pub fn exhume_integer_literal(&self, id: &usize) -> Option>> { - match self.integer_literal.read().unwrap().get(*id) { - Some(integer_literal) => integer_literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`IntegerLiteral`] from the store. - /// - #[inline] - pub fn exorcise_integer_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising integer_literal slot: {id}."); - let result = self.integer_literal.write().unwrap()[*id].take(); - self.integer_literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, IntegerLiteral>`. - /// - #[inline] - pub fn iter_integer_literal(&self) -> impl Iterator>> + '_ { - let len = self.integer_literal.read().unwrap().len(); - (0..len) - .filter(|i| self.integer_literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.integer_literal.read().unwrap()[i] - .as_ref() - .map(|integer_literal| integer_literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Item`] into the store. - /// - #[inline] - pub fn inter_item(&mut self, item: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.item_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.item.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.item.write().unwrap().push(None); - _index - }; - - let item = item(_index); - - let found = if let Some(item) = self.item.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *item.read().unwrap() - } else { - false - } - }) { - item.clone() - } else { - None - }; - - if let Some(item) = found { - tracing::debug!(target: "store", "found duplicate {item:?}."); - self.item_free_list.lock().unwrap().push(_index); - item.clone() - } else { - tracing::debug!(target: "store", "interring {item:?}."); - self.item.write().unwrap()[_index] = Some(item.clone()); - item - } - } - - /// Exhume (get) [`Item`] from the store. - /// - #[inline] - pub fn exhume_item(&self, id: &usize) -> Option>> { - match self.item.read().unwrap().get(*id) { - Some(item) => item.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Item`] from the store. - /// - #[inline] - pub fn exorcise_item(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising item slot: {id}."); - let result = self.item.write().unwrap()[*id].take(); - self.item_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Item>`. - /// - #[inline] - pub fn iter_item(&self) -> impl Iterator>> + '_ { - let len = self.item.read().unwrap().len(); - (0..len) - .filter(|i| self.item.read().unwrap()[*i].is_some()) - .map(move |i| { - self.item.read().unwrap()[i] - .as_ref() - .map(|item| item.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Lambda`] into the store. - /// - #[inline] - pub fn inter_lambda(&mut self, lambda: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.lambda_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.lambda.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.lambda.write().unwrap().push(None); - _index - }; - - let lambda = lambda(_index); - - let found = if let Some(lambda) = self.lambda.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *lambda.read().unwrap() - } else { - false - } - }) { - lambda.clone() - } else { - None - }; - - if let Some(lambda) = found { - tracing::debug!(target: "store", "found duplicate {lambda:?}."); - self.lambda_free_list.lock().unwrap().push(_index); - lambda.clone() - } else { - tracing::debug!(target: "store", "interring {lambda:?}."); - self.lambda.write().unwrap()[_index] = Some(lambda.clone()); - lambda - } - } - - /// Exhume (get) [`Lambda`] from the store. - /// - #[inline] - pub fn exhume_lambda(&self, id: &usize) -> Option>> { - match self.lambda.read().unwrap().get(*id) { - Some(lambda) => lambda.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Lambda`] from the store. - /// - #[inline] - pub fn exorcise_lambda(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising lambda slot: {id}."); - let result = self.lambda.write().unwrap()[*id].take(); - self.lambda_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Lambda>`. - /// - #[inline] - pub fn iter_lambda(&self) -> impl Iterator>> + '_ { - let len = self.lambda.read().unwrap().len(); - (0..len) - .filter(|i| self.lambda.read().unwrap()[*i].is_some()) - .map(move |i| { - self.lambda.read().unwrap()[i] - .as_ref() - .map(|lambda| lambda.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`LambdaParameter`] into the store. - /// - #[inline] - pub fn inter_lambda_parameter(&mut self, lambda_parameter: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.lambda_parameter_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.lambda_parameter.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.lambda_parameter.write().unwrap().push(None); - _index - }; - - let lambda_parameter = lambda_parameter(_index); - - let found = if let Some(lambda_parameter) = - self.lambda_parameter.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *lambda_parameter.read().unwrap() - } else { - false - } - }) { - lambda_parameter.clone() - } else { - None - }; - - if let Some(lambda_parameter) = found { - tracing::debug!(target: "store", "found duplicate {lambda_parameter:?}."); - self.lambda_parameter_free_list.lock().unwrap().push(_index); - lambda_parameter.clone() - } else { - tracing::debug!(target: "store", "interring {lambda_parameter:?}."); - self.lambda_parameter.write().unwrap()[_index] = Some(lambda_parameter.clone()); - lambda_parameter - } - } - - /// Exhume (get) [`LambdaParameter`] from the store. - /// - #[inline] - pub fn exhume_lambda_parameter(&self, id: &usize) -> Option>> { - match self.lambda_parameter.read().unwrap().get(*id) { - Some(lambda_parameter) => lambda_parameter.clone(), - None => None, - } - } - - /// Exorcise (remove) [`LambdaParameter`] from the store. - /// - #[inline] - pub fn exorcise_lambda_parameter( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising lambda_parameter slot: {id}."); - let result = self.lambda_parameter.write().unwrap()[*id].take(); - self.lambda_parameter_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, LambdaParameter>`. - /// - #[inline] - pub fn iter_lambda_parameter(&self) -> impl Iterator>> + '_ { - let len = self.lambda_parameter.read().unwrap().len(); - (0..len) - .filter(|i| self.lambda_parameter.read().unwrap()[*i].is_some()) - .map(move |i| { - self.lambda_parameter.read().unwrap()[i] - .as_ref() - .map(|lambda_parameter| lambda_parameter.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`LetStatement`] into the store. - /// - #[inline] - pub fn inter_let_statement(&mut self, let_statement: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.let_statement_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.let_statement.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.let_statement.write().unwrap().push(None); - _index - }; - - let let_statement = let_statement(_index); - - let found = if let Some(let_statement) = - self.let_statement.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *let_statement.read().unwrap() - } else { - false - } - }) { - let_statement.clone() - } else { - None - }; - - if let Some(let_statement) = found { - tracing::debug!(target: "store", "found duplicate {let_statement:?}."); - self.let_statement_free_list.lock().unwrap().push(_index); - let_statement.clone() - } else { - tracing::debug!(target: "store", "interring {let_statement:?}."); - self.let_statement.write().unwrap()[_index] = Some(let_statement.clone()); - let_statement - } - } - - /// Exhume (get) [`LetStatement`] from the store. - /// - #[inline] - pub fn exhume_let_statement(&self, id: &usize) -> Option>> { - match self.let_statement.read().unwrap().get(*id) { - Some(let_statement) => let_statement.clone(), - None => None, - } - } - - /// Exorcise (remove) [`LetStatement`] from the store. - /// - #[inline] - pub fn exorcise_let_statement(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising let_statement slot: {id}."); - let result = self.let_statement.write().unwrap()[*id].take(); - self.let_statement_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, LetStatement>`. - /// - #[inline] - pub fn iter_let_statement(&self) -> impl Iterator>> + '_ { - let len = self.let_statement.read().unwrap().len(); - (0..len) - .filter(|i| self.let_statement.read().unwrap()[*i].is_some()) - .map(move |i| { - self.let_statement.read().unwrap()[i] - .as_ref() - .map(|let_statement| let_statement.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`List`] into the store. - /// - #[inline] - pub fn inter_list(&mut self, list: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.list_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.list.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.list.write().unwrap().push(None); - _index - }; - - let list = list(_index); - - let found = if let Some(list) = self.list.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *list.read().unwrap() - } else { - false - } - }) { - list.clone() - } else { - None - }; - - if let Some(list) = found { - tracing::debug!(target: "store", "found duplicate {list:?}."); - self.list_free_list.lock().unwrap().push(_index); - list.clone() - } else { - tracing::debug!(target: "store", "interring {list:?}."); - self.list.write().unwrap()[_index] = Some(list.clone()); - list - } - } - - /// Exhume (get) [`List`] from the store. - /// - #[inline] - pub fn exhume_list(&self, id: &usize) -> Option>> { - match self.list.read().unwrap().get(*id) { - Some(list) => list.clone(), - None => None, - } - } - - /// Exorcise (remove) [`List`] from the store. - /// - #[inline] - pub fn exorcise_list(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising list slot: {id}."); - let result = self.list.write().unwrap()[*id].take(); - self.list_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, List>`. - /// - #[inline] - pub fn iter_list(&self) -> impl Iterator>> + '_ { - let len = self.list.read().unwrap().len(); - (0..len) - .filter(|i| self.list.read().unwrap()[*i].is_some()) - .map(move |i| { - self.list.read().unwrap()[i] - .as_ref() - .map(|list| list.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ListElement`] into the store. - /// - #[inline] - pub fn inter_list_element(&mut self, list_element: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.list_element_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.list_element.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.list_element.write().unwrap().push(None); - _index - }; - - let list_element = list_element(_index); - - let found = if let Some(list_element) = - self.list_element.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *list_element.read().unwrap() - } else { - false - } - }) { - list_element.clone() - } else { - None - }; - - if let Some(list_element) = found { - tracing::debug!(target: "store", "found duplicate {list_element:?}."); - self.list_element_free_list.lock().unwrap().push(_index); - list_element.clone() - } else { - tracing::debug!(target: "store", "interring {list_element:?}."); - self.list_element.write().unwrap()[_index] = Some(list_element.clone()); - list_element - } - } - - /// Exhume (get) [`ListElement`] from the store. - /// - #[inline] - pub fn exhume_list_element(&self, id: &usize) -> Option>> { - match self.list_element.read().unwrap().get(*id) { - Some(list_element) => list_element.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ListElement`] from the store. - /// - #[inline] - pub fn exorcise_list_element(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising list_element slot: {id}."); - let result = self.list_element.write().unwrap()[*id].take(); - self.list_element_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ListElement>`. - /// - #[inline] - pub fn iter_list_element(&self) -> impl Iterator>> + '_ { - let len = self.list_element.read().unwrap().len(); - (0..len) - .filter(|i| self.list_element.read().unwrap()[*i].is_some()) - .map(move |i| { - self.list_element.read().unwrap()[i] - .as_ref() - .map(|list_element| list_element.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ListExpression`] into the store. - /// - #[inline] - pub fn inter_list_expression(&mut self, list_expression: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.list_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.list_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.list_expression.write().unwrap().push(None); - _index - }; - - let list_expression = list_expression(_index); - - let found = if let Some(list_expression) = - self.list_expression.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *list_expression.read().unwrap() - } else { - false - } - }) { - list_expression.clone() - } else { - None - }; - - if let Some(list_expression) = found { - tracing::debug!(target: "store", "found duplicate {list_expression:?}."); - self.list_expression_free_list.lock().unwrap().push(_index); - list_expression.clone() - } else { - tracing::debug!(target: "store", "interring {list_expression:?}."); - self.list_expression.write().unwrap()[_index] = Some(list_expression.clone()); - list_expression - } - } - - /// Exhume (get) [`ListExpression`] from the store. - /// - #[inline] - pub fn exhume_list_expression(&self, id: &usize) -> Option>> { - match self.list_expression.read().unwrap().get(*id) { - Some(list_expression) => list_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ListExpression`] from the store. - /// - #[inline] - pub fn exorcise_list_expression(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising list_expression slot: {id}."); - let result = self.list_expression.write().unwrap()[*id].take(); - self.list_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ListExpression>`. - /// - #[inline] - pub fn iter_list_expression(&self) -> impl Iterator>> + '_ { - let len = self.list_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.list_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.list_expression.read().unwrap()[i] - .as_ref() - .map(|list_expression| list_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Literal`] into the store. - /// - #[inline] - pub fn inter_literal(&mut self, literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.literal.write().unwrap().push(None); - _index - }; - - let literal = literal(_index); - - let found = if let Some(literal) = self.literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *literal.read().unwrap() - } else { - false - } - }) { - literal.clone() - } else { - None - }; - - if let Some(literal) = found { - tracing::debug!(target: "store", "found duplicate {literal:?}."); - self.literal_free_list.lock().unwrap().push(_index); - literal.clone() - } else { - tracing::debug!(target: "store", "interring {literal:?}."); - self.literal.write().unwrap()[_index] = Some(literal.clone()); - literal - } - } - - /// Exhume (get) [`Literal`] from the store. - /// - #[inline] - pub fn exhume_literal(&self, id: &usize) -> Option>> { - match self.literal.read().unwrap().get(*id) { - Some(literal) => literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Literal`] from the store. - /// - #[inline] - pub fn exorcise_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising literal slot: {id}."); - let result = self.literal.write().unwrap()[*id].take(); - self.literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Literal>`. - /// - #[inline] - pub fn iter_literal(&self) -> impl Iterator>> + '_ { - let len = self.literal.read().unwrap().len(); - (0..len) - .filter(|i| self.literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.literal.read().unwrap()[i] - .as_ref() - .map(|literal| literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`LocalVariable`] into the store. - /// - #[inline] - pub fn inter_local_variable(&mut self, local_variable: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.local_variable_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.local_variable.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.local_variable.write().unwrap().push(None); - _index - }; - - let local_variable = local_variable(_index); - - let found = if let Some(local_variable) = - self.local_variable.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *local_variable.read().unwrap() - } else { - false - } - }) { - local_variable.clone() - } else { - None - }; - - if let Some(local_variable) = found { - tracing::debug!(target: "store", "found duplicate {local_variable:?}."); - self.local_variable_free_list.lock().unwrap().push(_index); - local_variable.clone() - } else { - tracing::debug!(target: "store", "interring {local_variable:?}."); - self.local_variable.write().unwrap()[_index] = Some(local_variable.clone()); - local_variable - } - } - - /// Exhume (get) [`LocalVariable`] from the store. - /// - #[inline] - pub fn exhume_local_variable(&self, id: &usize) -> Option>> { - match self.local_variable.read().unwrap().get(*id) { - Some(local_variable) => local_variable.clone(), - None => None, - } - } - - /// Exorcise (remove) [`LocalVariable`] from the store. - /// - #[inline] - pub fn exorcise_local_variable(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising local_variable slot: {id}."); - let result = self.local_variable.write().unwrap()[*id].take(); - self.local_variable_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, LocalVariable>`. - /// - #[inline] - pub fn iter_local_variable(&self) -> impl Iterator>> + '_ { - let len = self.local_variable.read().unwrap().len(); - (0..len) - .filter(|i| self.local_variable.read().unwrap()[*i].is_some()) - .map(move |i| { - self.local_variable.read().unwrap()[i] - .as_ref() - .map(|local_variable| local_variable.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XMacro`] into the store. - /// - #[inline] - pub fn inter_x_macro(&mut self, x_macro: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_macro_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_macro.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_macro.write().unwrap().push(None); - _index - }; - - let x_macro = x_macro(_index); - - let found = if let Some(x_macro) = self.x_macro.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_macro.read().unwrap() - } else { - false - } - }) { - x_macro.clone() - } else { - None - }; - - if let Some(x_macro) = found { - tracing::debug!(target: "store", "found duplicate {x_macro:?}."); - self.x_macro_free_list.lock().unwrap().push(_index); - x_macro.clone() - } else { - tracing::debug!(target: "store", "interring {x_macro:?}."); - self.x_macro.write().unwrap()[_index] = Some(x_macro.clone()); - x_macro - } - } - - /// Exhume (get) [`XMacro`] from the store. - /// - #[inline] - pub fn exhume_x_macro(&self, id: &usize) -> Option>> { - match self.x_macro.read().unwrap().get(*id) { - Some(x_macro) => x_macro.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XMacro`] from the store. - /// - #[inline] - pub fn exorcise_x_macro(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_macro slot: {id}."); - let result = self.x_macro.write().unwrap()[*id].take(); - self.x_macro_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XMacro>`. - /// - #[inline] - pub fn iter_x_macro(&self) -> impl Iterator>> + '_ { - let len = self.x_macro.read().unwrap().len(); - (0..len) - .filter(|i| self.x_macro.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_macro.read().unwrap()[i] - .as_ref() - .map(|x_macro| x_macro.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Map`] into the store. - /// - #[inline] - pub fn inter_map(&mut self, map: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.map_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.map.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.map.write().unwrap().push(None); - _index - }; - - let map = map(_index); - - let found = if let Some(map) = self.map.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *map.read().unwrap() - } else { - false - } - }) { - map.clone() - } else { - None - }; - - if let Some(map) = found { - tracing::debug!(target: "store", "found duplicate {map:?}."); - self.map_free_list.lock().unwrap().push(_index); - map.clone() - } else { - tracing::debug!(target: "store", "interring {map:?}."); - self.map.write().unwrap()[_index] = Some(map.clone()); - map - } - } - - /// Exhume (get) [`Map`] from the store. - /// - #[inline] - pub fn exhume_map(&self, id: &usize) -> Option>> { - match self.map.read().unwrap().get(*id) { - Some(map) => map.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Map`] from the store. - /// - #[inline] - pub fn exorcise_map(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising map slot: {id}."); - let result = self.map.write().unwrap()[*id].take(); - self.map_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Map>`. - /// - #[inline] - pub fn iter_map(&self) -> impl Iterator>> + '_ { - let len = self.map.read().unwrap().len(); - (0..len) - .filter(|i| self.map.read().unwrap()[*i].is_some()) - .map(move |i| { - self.map.read().unwrap()[i] - .as_ref() - .map(|map| map.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`MapElement`] into the store. - /// - #[inline] - pub fn inter_map_element(&mut self, map_element: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.map_element_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.map_element.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.map_element.write().unwrap().push(None); - _index - }; - - let map_element = map_element(_index); - - let found = if let Some(map_element) = - self.map_element.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *map_element.read().unwrap() - } else { - false - } - }) { - map_element.clone() - } else { - None - }; - - if let Some(map_element) = found { - tracing::debug!(target: "store", "found duplicate {map_element:?}."); - self.map_element_free_list.lock().unwrap().push(_index); - map_element.clone() - } else { - tracing::debug!(target: "store", "interring {map_element:?}."); - self.map_element.write().unwrap()[_index] = Some(map_element.clone()); - map_element - } - } - - /// Exhume (get) [`MapElement`] from the store. - /// - #[inline] - pub fn exhume_map_element(&self, id: &usize) -> Option>> { - match self.map_element.read().unwrap().get(*id) { - Some(map_element) => map_element.clone(), - None => None, - } - } - - /// Exorcise (remove) [`MapElement`] from the store. - /// - #[inline] - pub fn exorcise_map_element(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising map_element slot: {id}."); - let result = self.map_element.write().unwrap()[*id].take(); - self.map_element_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, MapElement>`. - /// - #[inline] - pub fn iter_map_element(&self) -> impl Iterator>> + '_ { - let len = self.map_element.read().unwrap().len(); - (0..len) - .filter(|i| self.map_element.read().unwrap()[*i].is_some()) - .map(move |i| { - self.map_element.read().unwrap()[i] - .as_ref() - .map(|map_element| map_element.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`MapExpression`] into the store. - /// - #[inline] - pub fn inter_map_expression(&mut self, map_expression: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.map_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.map_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.map_expression.write().unwrap().push(None); - _index - }; - - let map_expression = map_expression(_index); - - let found = if let Some(map_expression) = - self.map_expression.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *map_expression.read().unwrap() - } else { - false - } - }) { - map_expression.clone() - } else { - None - }; - - if let Some(map_expression) = found { - tracing::debug!(target: "store", "found duplicate {map_expression:?}."); - self.map_expression_free_list.lock().unwrap().push(_index); - map_expression.clone() - } else { - tracing::debug!(target: "store", "interring {map_expression:?}."); - self.map_expression.write().unwrap()[_index] = Some(map_expression.clone()); - map_expression - } - } - - /// Exhume (get) [`MapExpression`] from the store. - /// - #[inline] - pub fn exhume_map_expression(&self, id: &usize) -> Option>> { - match self.map_expression.read().unwrap().get(*id) { - Some(map_expression) => map_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`MapExpression`] from the store. - /// - #[inline] - pub fn exorcise_map_expression(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising map_expression slot: {id}."); - let result = self.map_expression.write().unwrap()[*id].take(); - self.map_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, MapExpression>`. - /// - #[inline] - pub fn iter_map_expression(&self) -> impl Iterator>> + '_ { - let len = self.map_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.map_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.map_expression.read().unwrap()[i] - .as_ref() - .map(|map_expression| map_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XMatch`] into the store. - /// - #[inline] - pub fn inter_x_match(&mut self, x_match: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_match_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_match.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_match.write().unwrap().push(None); - _index - }; - - let x_match = x_match(_index); - - let found = if let Some(x_match) = self.x_match.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_match.read().unwrap() - } else { - false - } - }) { - x_match.clone() - } else { - None - }; - - if let Some(x_match) = found { - tracing::debug!(target: "store", "found duplicate {x_match:?}."); - self.x_match_free_list.lock().unwrap().push(_index); - x_match.clone() - } else { - tracing::debug!(target: "store", "interring {x_match:?}."); - self.x_match.write().unwrap()[_index] = Some(x_match.clone()); - x_match - } - } - - /// Exhume (get) [`XMatch`] from the store. - /// - #[inline] - pub fn exhume_x_match(&self, id: &usize) -> Option>> { - match self.x_match.read().unwrap().get(*id) { - Some(x_match) => x_match.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XMatch`] from the store. - /// - #[inline] - pub fn exorcise_x_match(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_match slot: {id}."); - let result = self.x_match.write().unwrap()[*id].take(); - self.x_match_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XMatch>`. - /// - #[inline] - pub fn iter_x_match(&self) -> impl Iterator>> + '_ { - let len = self.x_match.read().unwrap().len(); - (0..len) - .filter(|i| self.x_match.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_match.read().unwrap()[i] - .as_ref() - .map(|x_match| x_match.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`MethodCall`] into the store. - /// - #[inline] - pub fn inter_method_call(&mut self, method_call: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.method_call_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.method_call.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.method_call.write().unwrap().push(None); - _index - }; - - let method_call = method_call(_index); - - let found = if let Some(method_call) = - self.method_call.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *method_call.read().unwrap() - } else { - false - } - }) { - method_call.clone() - } else { - None - }; - - if let Some(method_call) = found { - tracing::debug!(target: "store", "found duplicate {method_call:?}."); - self.method_call_free_list.lock().unwrap().push(_index); - method_call.clone() - } else { - tracing::debug!(target: "store", "interring {method_call:?}."); - self.method_call.write().unwrap()[_index] = Some(method_call.clone()); - method_call - } - } - - /// Exhume (get) [`MethodCall`] from the store. - /// - #[inline] - pub fn exhume_method_call(&self, id: &usize) -> Option>> { - match self.method_call.read().unwrap().get(*id) { - Some(method_call) => method_call.clone(), - None => None, - } - } - - /// Exorcise (remove) [`MethodCall`] from the store. - /// - #[inline] - pub fn exorcise_method_call(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising method_call slot: {id}."); - let result = self.method_call.write().unwrap()[*id].take(); - self.method_call_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, MethodCall>`. - /// - #[inline] - pub fn iter_method_call(&self) -> impl Iterator>> + '_ { - let len = self.method_call.read().unwrap().len(); - (0..len) - .filter(|i| self.method_call.read().unwrap()[*i].is_some()) - .map(move |i| { - self.method_call.read().unwrap()[i] - .as_ref() - .map(|method_call| method_call.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`NamedFieldExpression`] into the store. - /// - #[inline] - pub fn inter_named_field_expression( - &mut self, - named_field_expression: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = - if let Some(_index) = self.named_field_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.named_field_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.named_field_expression.write().unwrap().push(None); - _index - }; - - let named_field_expression = named_field_expression(_index); - - let found = if let Some(named_field_expression) = self - .named_field_expression - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *named_field_expression.read().unwrap() - } else { - false - } - }) { - named_field_expression.clone() - } else { - None - }; - - if let Some(named_field_expression) = found { - tracing::debug!(target: "store", "found duplicate {named_field_expression:?}."); - self.named_field_expression_free_list - .lock() - .unwrap() - .push(_index); - named_field_expression.clone() - } else { - tracing::debug!(target: "store", "interring {named_field_expression:?}."); - self.named_field_expression.write().unwrap()[_index] = - Some(named_field_expression.clone()); - named_field_expression - } - } - - /// Exhume (get) [`NamedFieldExpression`] from the store. - /// - #[inline] - pub fn exhume_named_field_expression( - &self, - id: &usize, - ) -> Option>> { - match self.named_field_expression.read().unwrap().get(*id) { - Some(named_field_expression) => named_field_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`NamedFieldExpression`] from the store. - /// - #[inline] - pub fn exorcise_named_field_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising named_field_expression slot: {id}."); - let result = self.named_field_expression.write().unwrap()[*id].take(); - self.named_field_expression_free_list - .lock() - .unwrap() - .push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, NamedFieldExpression>`. - /// - #[inline] - pub fn iter_named_field_expression( - &self, - ) -> impl Iterator>> + '_ { - let len = self.named_field_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.named_field_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.named_field_expression.read().unwrap()[i] - .as_ref() - .map(|named_field_expression| named_field_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ZObjectStore`] into the store. - /// - #[inline] - pub fn inter_z_object_store(&mut self, z_object_store: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.z_object_store_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.z_object_store.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.z_object_store.write().unwrap().push(None); - _index - }; - - let z_object_store = z_object_store(_index); - - let found = if let Some(z_object_store) = - self.z_object_store.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *z_object_store.read().unwrap() - } else { - false - } - }) { - z_object_store.clone() - } else { - None - }; - - let z_object_store = if let Some(z_object_store) = found { - tracing::debug!(target: "store", "found duplicate {z_object_store:?}."); - self.z_object_store_free_list.lock().unwrap().push(_index); - z_object_store.clone() - } else { - tracing::debug!(target: "store", "interring {z_object_store:?}."); - self.z_object_store.write().unwrap()[_index] = Some(z_object_store.clone()); - z_object_store - }; - self.z_object_store_id_by_name.write().unwrap().insert( - z_object_store.read().unwrap().name.to_owned(), - z_object_store.read().unwrap().id, - ); - z_object_store - } - - /// Exhume (get) [`ZObjectStore`] from the store. - /// - #[inline] - pub fn exhume_z_object_store(&self, id: &usize) -> Option>> { - match self.z_object_store.read().unwrap().get(*id) { - Some(z_object_store) => z_object_store.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ZObjectStore`] from the store. - /// - #[inline] - pub fn exorcise_z_object_store(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising z_object_store slot: {id}."); - let result = self.z_object_store.write().unwrap()[*id].take(); - self.z_object_store_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`ZObjectStore`] id from the store by name. - /// - #[inline] - pub fn exhume_z_object_store_id_by_name(&self, name: &str) -> Option { - self.z_object_store_id_by_name - .read() - .unwrap() - .get(name) - .map(|z_object_store| *z_object_store) - } - - /// Get an iterator over the internal `HashMap<&Uuid, ZObjectStore>`. - /// - #[inline] - pub fn iter_z_object_store(&self) -> impl Iterator>> + '_ { - let len = self.z_object_store.read().unwrap().len(); - (0..len) - .filter(|i| self.z_object_store.read().unwrap()[*i].is_some()) - .map(move |i| { - self.z_object_store.read().unwrap()[i] - .as_ref() - .map(|z_object_store| z_object_store.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ObjectWrapper`] into the store. - /// - #[inline] - pub fn inter_object_wrapper(&mut self, object_wrapper: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.object_wrapper_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.object_wrapper.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.object_wrapper.write().unwrap().push(None); - _index - }; - - let object_wrapper = object_wrapper(_index); - - let found = if let Some(object_wrapper) = - self.object_wrapper.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *object_wrapper.read().unwrap() - } else { - false - } - }) { - object_wrapper.clone() - } else { - None - }; - - if let Some(object_wrapper) = found { - tracing::debug!(target: "store", "found duplicate {object_wrapper:?}."); - self.object_wrapper_free_list.lock().unwrap().push(_index); - object_wrapper.clone() - } else { - tracing::debug!(target: "store", "interring {object_wrapper:?}."); - self.object_wrapper.write().unwrap()[_index] = Some(object_wrapper.clone()); - object_wrapper - } - } - - /// Exhume (get) [`ObjectWrapper`] from the store. - /// - #[inline] - pub fn exhume_object_wrapper(&self, id: &usize) -> Option>> { - match self.object_wrapper.read().unwrap().get(*id) { - Some(object_wrapper) => object_wrapper.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ObjectWrapper`] from the store. - /// - #[inline] - pub fn exorcise_object_wrapper(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising object_wrapper slot: {id}."); - let result = self.object_wrapper.write().unwrap()[*id].take(); - self.object_wrapper_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ObjectWrapper>`. - /// - #[inline] - pub fn iter_object_wrapper(&self) -> impl Iterator>> + '_ { - let len = self.object_wrapper.read().unwrap().len(); - (0..len) - .filter(|i| self.object_wrapper.read().unwrap()[*i].is_some()) - .map(move |i| { - self.object_wrapper.read().unwrap()[i] - .as_ref() - .map(|object_wrapper| object_wrapper.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Operator`] into the store. - /// - #[inline] - pub fn inter_operator(&mut self, operator: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.operator_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.operator.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.operator.write().unwrap().push(None); - _index - }; - - let operator = operator(_index); - - let found = if let Some(operator) = self.operator.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *operator.read().unwrap() - } else { - false - } - }) { - operator.clone() - } else { - None - }; - - if let Some(operator) = found { - tracing::debug!(target: "store", "found duplicate {operator:?}."); - self.operator_free_list.lock().unwrap().push(_index); - operator.clone() - } else { - tracing::debug!(target: "store", "interring {operator:?}."); - self.operator.write().unwrap()[_index] = Some(operator.clone()); - operator - } - } - - /// Exhume (get) [`Operator`] from the store. - /// - #[inline] - pub fn exhume_operator(&self, id: &usize) -> Option>> { - match self.operator.read().unwrap().get(*id) { - Some(operator) => operator.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Operator`] from the store. - /// - #[inline] - pub fn exorcise_operator(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising operator slot: {id}."); - let result = self.operator.write().unwrap()[*id].take(); - self.operator_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Operator>`. - /// - #[inline] - pub fn iter_operator(&self) -> impl Iterator>> + '_ { - let len = self.operator.read().unwrap().len(); - (0..len) - .filter(|i| self.operator.read().unwrap()[*i].is_some()) - .map(move |i| { - self.operator.read().unwrap()[i] - .as_ref() - .map(|operator| operator.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Parameter`] into the store. - /// - #[inline] - pub fn inter_parameter(&mut self, parameter: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.parameter_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.parameter.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.parameter.write().unwrap().push(None); - _index - }; - - let parameter = parameter(_index); - - let found = if let Some(parameter) = self.parameter.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *parameter.read().unwrap() - } else { - false - } - }) { - parameter.clone() - } else { - None - }; - - if let Some(parameter) = found { - tracing::debug!(target: "store", "found duplicate {parameter:?}."); - self.parameter_free_list.lock().unwrap().push(_index); - parameter.clone() - } else { - tracing::debug!(target: "store", "interring {parameter:?}."); - self.parameter.write().unwrap()[_index] = Some(parameter.clone()); - parameter - } - } - - /// Exhume (get) [`Parameter`] from the store. - /// - #[inline] - pub fn exhume_parameter(&self, id: &usize) -> Option>> { - match self.parameter.read().unwrap().get(*id) { - Some(parameter) => parameter.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Parameter`] from the store. - /// - #[inline] - pub fn exorcise_parameter(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising parameter slot: {id}."); - let result = self.parameter.write().unwrap()[*id].take(); - self.parameter_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Parameter>`. - /// - #[inline] - pub fn iter_parameter(&self) -> impl Iterator>> + '_ { - let len = self.parameter.read().unwrap().len(); - (0..len) - .filter(|i| self.parameter.read().unwrap()[*i].is_some()) - .map(move |i| { - self.parameter.read().unwrap()[i] - .as_ref() - .map(|parameter| parameter.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XPath`] into the store. - /// - #[inline] - pub fn inter_x_path(&mut self, x_path: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_path_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_path.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_path.write().unwrap().push(None); - _index - }; - - let x_path = x_path(_index); - - let found = if let Some(x_path) = self.x_path.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_path.read().unwrap() - } else { - false - } - }) { - x_path.clone() - } else { - None - }; - - if let Some(x_path) = found { - tracing::debug!(target: "store", "found duplicate {x_path:?}."); - self.x_path_free_list.lock().unwrap().push(_index); - x_path.clone() - } else { - tracing::debug!(target: "store", "interring {x_path:?}."); - self.x_path.write().unwrap()[_index] = Some(x_path.clone()); - x_path - } - } - - /// Exhume (get) [`XPath`] from the store. - /// - #[inline] - pub fn exhume_x_path(&self, id: &usize) -> Option>> { - match self.x_path.read().unwrap().get(*id) { - Some(x_path) => x_path.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XPath`] from the store. - /// - #[inline] - pub fn exorcise_x_path(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_path slot: {id}."); - let result = self.x_path.write().unwrap()[*id].take(); - self.x_path_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XPath>`. - /// - #[inline] - pub fn iter_x_path(&self) -> impl Iterator>> + '_ { - let len = self.x_path.read().unwrap().len(); - (0..len) - .filter(|i| self.x_path.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_path.read().unwrap()[i] - .as_ref() - .map(|x_path| x_path.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`PathElement`] into the store. - /// - #[inline] - pub fn inter_path_element(&mut self, path_element: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.path_element_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.path_element.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.path_element.write().unwrap().push(None); - _index - }; - - let path_element = path_element(_index); - - let found = if let Some(path_element) = - self.path_element.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *path_element.read().unwrap() - } else { - false - } - }) { - path_element.clone() - } else { - None - }; - - if let Some(path_element) = found { - tracing::debug!(target: "store", "found duplicate {path_element:?}."); - self.path_element_free_list.lock().unwrap().push(_index); - path_element.clone() - } else { - tracing::debug!(target: "store", "interring {path_element:?}."); - self.path_element.write().unwrap()[_index] = Some(path_element.clone()); - path_element - } - } - - /// Exhume (get) [`PathElement`] from the store. - /// - #[inline] - pub fn exhume_path_element(&self, id: &usize) -> Option>> { - match self.path_element.read().unwrap().get(*id) { - Some(path_element) => path_element.clone(), - None => None, - } - } - - /// Exorcise (remove) [`PathElement`] from the store. - /// - #[inline] - pub fn exorcise_path_element(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising path_element slot: {id}."); - let result = self.path_element.write().unwrap()[*id].take(); - self.path_element_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, PathElement>`. - /// - #[inline] - pub fn iter_path_element(&self) -> impl Iterator>> + '_ { - let len = self.path_element.read().unwrap().len(); - (0..len) - .filter(|i| self.path_element.read().unwrap()[*i].is_some()) - .map(move |i| { - self.path_element.read().unwrap()[i] - .as_ref() - .map(|path_element| path_element.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Pattern`] into the store. - /// - #[inline] - pub fn inter_pattern(&mut self, pattern: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.pattern_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.pattern.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.pattern.write().unwrap().push(None); - _index - }; - - let pattern = pattern(_index); - - let found = if let Some(pattern) = self.pattern.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *pattern.read().unwrap() - } else { - false - } - }) { - pattern.clone() - } else { - None - }; - - if let Some(pattern) = found { - tracing::debug!(target: "store", "found duplicate {pattern:?}."); - self.pattern_free_list.lock().unwrap().push(_index); - pattern.clone() - } else { - tracing::debug!(target: "store", "interring {pattern:?}."); - self.pattern.write().unwrap()[_index] = Some(pattern.clone()); - pattern - } - } - - /// Exhume (get) [`Pattern`] from the store. - /// - #[inline] - pub fn exhume_pattern(&self, id: &usize) -> Option>> { - match self.pattern.read().unwrap().get(*id) { - Some(pattern) => pattern.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Pattern`] from the store. - /// - #[inline] - pub fn exorcise_pattern(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising pattern slot: {id}."); - let result = self.pattern.write().unwrap()[*id].take(); - self.pattern_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Pattern>`. - /// - #[inline] - pub fn iter_pattern(&self) -> impl Iterator>> + '_ { - let len = self.pattern.read().unwrap().len(); - (0..len) - .filter(|i| self.pattern.read().unwrap()[*i].is_some()) - .map(move |i| { - self.pattern.read().unwrap()[i] - .as_ref() - .map(|pattern| pattern.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XPlugin`] into the store. - /// - #[inline] - pub fn inter_x_plugin(&mut self, x_plugin: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_plugin_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_plugin.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_plugin.write().unwrap().push(None); - _index - }; - - let x_plugin = x_plugin(_index); - - let found = if let Some(x_plugin) = self.x_plugin.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_plugin.read().unwrap() - } else { - false - } - }) { - x_plugin.clone() - } else { - None - }; - - let x_plugin = if let Some(x_plugin) = found { - tracing::debug!(target: "store", "found duplicate {x_plugin:?}."); - self.x_plugin_free_list.lock().unwrap().push(_index); - x_plugin.clone() - } else { - tracing::debug!(target: "store", "interring {x_plugin:?}."); - self.x_plugin.write().unwrap()[_index] = Some(x_plugin.clone()); - x_plugin - }; - self.x_plugin_id_by_name.write().unwrap().insert( - x_plugin.read().unwrap().name.to_owned(), - x_plugin.read().unwrap().id, - ); - x_plugin - } - - /// Exhume (get) [`XPlugin`] from the store. - /// - #[inline] - pub fn exhume_x_plugin(&self, id: &usize) -> Option>> { - match self.x_plugin.read().unwrap().get(*id) { - Some(x_plugin) => x_plugin.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XPlugin`] from the store. - /// - #[inline] - pub fn exorcise_x_plugin(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_plugin slot: {id}."); - let result = self.x_plugin.write().unwrap()[*id].take(); - self.x_plugin_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`XPlugin`] id from the store by name. - /// - #[inline] - pub fn exhume_x_plugin_id_by_name(&self, name: &str) -> Option { - self.x_plugin_id_by_name - .read() - .unwrap() - .get(name) - .map(|x_plugin| *x_plugin) - } - - /// Get an iterator over the internal `HashMap<&Uuid, XPlugin>`. - /// - #[inline] - pub fn iter_x_plugin(&self) -> impl Iterator>> + '_ { - let len = self.x_plugin.read().unwrap().len(); - (0..len) - .filter(|i| self.x_plugin.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_plugin.read().unwrap()[i] - .as_ref() - .map(|x_plugin| x_plugin.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XPrint`] into the store. - /// - #[inline] - pub fn inter_x_print(&mut self, x_print: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_print_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_print.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_print.write().unwrap().push(None); - _index - }; - - let x_print = x_print(_index); - - let found = if let Some(x_print) = self.x_print.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_print.read().unwrap() - } else { - false - } - }) { - x_print.clone() - } else { - None - }; - - if let Some(x_print) = found { - tracing::debug!(target: "store", "found duplicate {x_print:?}."); - self.x_print_free_list.lock().unwrap().push(_index); - x_print.clone() - } else { - tracing::debug!(target: "store", "interring {x_print:?}."); - self.x_print.write().unwrap()[_index] = Some(x_print.clone()); - x_print - } - } - - /// Exhume (get) [`XPrint`] from the store. - /// - #[inline] - pub fn exhume_x_print(&self, id: &usize) -> Option>> { - match self.x_print.read().unwrap().get(*id) { - Some(x_print) => x_print.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XPrint`] from the store. - /// - #[inline] - pub fn exorcise_x_print(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_print slot: {id}."); - let result = self.x_print.write().unwrap()[*id].take(); - self.x_print_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XPrint>`. - /// - #[inline] - pub fn iter_x_print(&self) -> impl Iterator>> + '_ { - let len = self.x_print.read().unwrap().len(); - (0..len) - .filter(|i| self.x_print.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_print.read().unwrap()[i] - .as_ref() - .map(|x_print| x_print.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`RangeExpression`] into the store. - /// - #[inline] - pub fn inter_range_expression(&mut self, range_expression: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.range_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.range_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.range_expression.write().unwrap().push(None); - _index - }; - - let range_expression = range_expression(_index); - - let found = if let Some(range_expression) = - self.range_expression.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *range_expression.read().unwrap() - } else { - false - } - }) { - range_expression.clone() - } else { - None - }; - - if let Some(range_expression) = found { - tracing::debug!(target: "store", "found duplicate {range_expression:?}."); - self.range_expression_free_list.lock().unwrap().push(_index); - range_expression.clone() - } else { - tracing::debug!(target: "store", "interring {range_expression:?}."); - self.range_expression.write().unwrap()[_index] = Some(range_expression.clone()); - range_expression - } - } - - /// Exhume (get) [`RangeExpression`] from the store. - /// - #[inline] - pub fn exhume_range_expression(&self, id: &usize) -> Option>> { - match self.range_expression.read().unwrap().get(*id) { - Some(range_expression) => range_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`RangeExpression`] from the store. - /// - #[inline] - pub fn exorcise_range_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising range_expression slot: {id}."); - let result = self.range_expression.write().unwrap()[*id].take(); - self.range_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, RangeExpression>`. - /// - #[inline] - pub fn iter_range_expression(&self) -> impl Iterator>> + '_ { - let len = self.range_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.range_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.range_expression.read().unwrap()[i] - .as_ref() - .map(|range_expression| range_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ResultStatement`] into the store. - /// - #[inline] - pub fn inter_result_statement(&mut self, result_statement: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.result_statement_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.result_statement.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.result_statement.write().unwrap().push(None); - _index - }; - - let result_statement = result_statement(_index); - - let found = if let Some(result_statement) = - self.result_statement.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *result_statement.read().unwrap() - } else { - false - } - }) { - result_statement.clone() - } else { - None - }; - - if let Some(result_statement) = found { - tracing::debug!(target: "store", "found duplicate {result_statement:?}."); - self.result_statement_free_list.lock().unwrap().push(_index); - result_statement.clone() - } else { - tracing::debug!(target: "store", "interring {result_statement:?}."); - self.result_statement.write().unwrap()[_index] = Some(result_statement.clone()); - result_statement - } - } - - /// Exhume (get) [`ResultStatement`] from the store. - /// - #[inline] - pub fn exhume_result_statement(&self, id: &usize) -> Option>> { - match self.result_statement.read().unwrap().get(*id) { - Some(result_statement) => result_statement.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ResultStatement`] from the store. - /// - #[inline] - pub fn exorcise_result_statement( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising result_statement slot: {id}."); - let result = self.result_statement.write().unwrap()[*id].take(); - self.result_statement_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ResultStatement>`. - /// - #[inline] - pub fn iter_result_statement(&self) -> impl Iterator>> + '_ { - let len = self.result_statement.read().unwrap().len(); - (0..len) - .filter(|i| self.result_statement.read().unwrap()[*i].is_some()) - .map(move |i| { - self.result_statement.read().unwrap()[i] - .as_ref() - .map(|result_statement| result_statement.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XReturn`] into the store. - /// - #[inline] - pub fn inter_x_return(&mut self, x_return: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_return_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_return.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_return.write().unwrap().push(None); - _index - }; - - let x_return = x_return(_index); - - let found = if let Some(x_return) = self.x_return.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_return.read().unwrap() - } else { - false - } - }) { - x_return.clone() - } else { - None - }; - - if let Some(x_return) = found { - tracing::debug!(target: "store", "found duplicate {x_return:?}."); - self.x_return_free_list.lock().unwrap().push(_index); - x_return.clone() - } else { - tracing::debug!(target: "store", "interring {x_return:?}."); - self.x_return.write().unwrap()[_index] = Some(x_return.clone()); - x_return - } - } - - /// Exhume (get) [`XReturn`] from the store. - /// - #[inline] - pub fn exhume_x_return(&self, id: &usize) -> Option>> { - match self.x_return.read().unwrap().get(*id) { - Some(x_return) => x_return.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XReturn`] from the store. - /// - #[inline] - pub fn exorcise_x_return(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_return slot: {id}."); - let result = self.x_return.write().unwrap()[*id].take(); - self.x_return_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XReturn>`. - /// - #[inline] - pub fn iter_x_return(&self) -> impl Iterator>> + '_ { - let len = self.x_return.read().unwrap().len(); - (0..len) - .filter(|i| self.x_return.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_return.read().unwrap()[i] - .as_ref() - .map(|x_return| x_return.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Span`] into the store. - /// - #[inline] - pub fn inter_span(&mut self, span: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.span_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.span.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.span.write().unwrap().push(None); - _index - }; - - let span = span(_index); - - let found = if let Some(span) = self.span.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *span.read().unwrap() - } else { - false - } - }) { - span.clone() - } else { - None - }; - - if let Some(span) = found { - tracing::debug!(target: "store", "found duplicate {span:?}."); - self.span_free_list.lock().unwrap().push(_index); - span.clone() - } else { - tracing::debug!(target: "store", "interring {span:?}."); - self.span.write().unwrap()[_index] = Some(span.clone()); - span - } - } - - /// Exhume (get) [`Span`] from the store. - /// - #[inline] - pub fn exhume_span(&self, id: &usize) -> Option>> { - match self.span.read().unwrap().get(*id) { - Some(span) => span.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Span`] from the store. - /// - #[inline] - pub fn exorcise_span(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising span slot: {id}."); - let result = self.span.write().unwrap()[*id].take(); - self.span_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Span>`. - /// - #[inline] - pub fn iter_span(&self) -> impl Iterator>> + '_ { - let len = self.span.read().unwrap().len(); - (0..len) - .filter(|i| self.span.read().unwrap()[*i].is_some()) - .map(move |i| { - self.span.read().unwrap()[i] - .as_ref() - .map(|span| span.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Statement`] into the store. - /// - #[inline] - pub fn inter_statement(&mut self, statement: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.statement_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.statement.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.statement.write().unwrap().push(None); - _index - }; - - let statement = statement(_index); - - let found = if let Some(statement) = self.statement.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *statement.read().unwrap() - } else { - false - } - }) { - statement.clone() - } else { - None - }; - - if let Some(statement) = found { - tracing::debug!(target: "store", "found duplicate {statement:?}."); - self.statement_free_list.lock().unwrap().push(_index); - statement.clone() - } else { - tracing::debug!(target: "store", "interring {statement:?}."); - self.statement.write().unwrap()[_index] = Some(statement.clone()); - statement - } - } - - /// Exhume (get) [`Statement`] from the store. - /// - #[inline] - pub fn exhume_statement(&self, id: &usize) -> Option>> { - match self.statement.read().unwrap().get(*id) { - Some(statement) => statement.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Statement`] from the store. - /// - #[inline] - pub fn exorcise_statement(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising statement slot: {id}."); - let result = self.statement.write().unwrap()[*id].take(); - self.statement_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Statement>`. - /// - #[inline] - pub fn iter_statement(&self) -> impl Iterator>> + '_ { - let len = self.statement.read().unwrap().len(); - (0..len) - .filter(|i| self.statement.read().unwrap()[*i].is_some()) - .map(move |i| { - self.statement.read().unwrap()[i] - .as_ref() - .map(|statement| statement.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StaticMethodCall`] into the store. - /// - #[inline] - pub fn inter_static_method_call( - &mut self, - static_method_call: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.static_method_call_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.static_method_call.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.static_method_call.write().unwrap().push(None); - _index - }; - - let static_method_call = static_method_call(_index); - - let found = if let Some(static_method_call) = self - .static_method_call - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *static_method_call.read().unwrap() - } else { - false - } - }) { - static_method_call.clone() - } else { - None - }; - - if let Some(static_method_call) = found { - tracing::debug!(target: "store", "found duplicate {static_method_call:?}."); - self.static_method_call_free_list - .lock() - .unwrap() - .push(_index); - static_method_call.clone() - } else { - tracing::debug!(target: "store", "interring {static_method_call:?}."); - self.static_method_call.write().unwrap()[_index] = Some(static_method_call.clone()); - static_method_call - } - } - - /// Exhume (get) [`StaticMethodCall`] from the store. - /// - #[inline] - pub fn exhume_static_method_call(&self, id: &usize) -> Option>> { - match self.static_method_call.read().unwrap().get(*id) { - Some(static_method_call) => static_method_call.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StaticMethodCall`] from the store. - /// - #[inline] - pub fn exorcise_static_method_call( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising static_method_call slot: {id}."); - let result = self.static_method_call.write().unwrap()[*id].take(); - self.static_method_call_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StaticMethodCall>`. - /// - #[inline] - pub fn iter_static_method_call( - &self, - ) -> impl Iterator>> + '_ { - let len = self.static_method_call.read().unwrap().len(); - (0..len) - .filter(|i| self.static_method_call.read().unwrap()[*i].is_some()) - .map(move |i| { - self.static_method_call.read().unwrap()[i] - .as_ref() - .map(|static_method_call| static_method_call.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StringBit`] into the store. - /// - #[inline] - pub fn inter_string_bit(&mut self, string_bit: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.string_bit_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.string_bit.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.string_bit.write().unwrap().push(None); - _index - }; - - let string_bit = string_bit(_index); - - let found = if let Some(string_bit) = - self.string_bit.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *string_bit.read().unwrap() - } else { - false - } - }) { - string_bit.clone() - } else { - None - }; - - if let Some(string_bit) = found { - tracing::debug!(target: "store", "found duplicate {string_bit:?}."); - self.string_bit_free_list.lock().unwrap().push(_index); - string_bit.clone() - } else { - tracing::debug!(target: "store", "interring {string_bit:?}."); - self.string_bit.write().unwrap()[_index] = Some(string_bit.clone()); - string_bit - } - } - - /// Exhume (get) [`StringBit`] from the store. - /// - #[inline] - pub fn exhume_string_bit(&self, id: &usize) -> Option>> { - match self.string_bit.read().unwrap().get(*id) { - Some(string_bit) => string_bit.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StringBit`] from the store. - /// - #[inline] - pub fn exorcise_string_bit(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising string_bit slot: {id}."); - let result = self.string_bit.write().unwrap()[*id].take(); - self.string_bit_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StringBit>`. - /// - #[inline] - pub fn iter_string_bit(&self) -> impl Iterator>> + '_ { - let len = self.string_bit.read().unwrap().len(); - (0..len) - .filter(|i| self.string_bit.read().unwrap()[*i].is_some()) - .map(move |i| { - self.string_bit.read().unwrap()[i] - .as_ref() - .map(|string_bit| string_bit.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StringLiteral`] into the store. - /// - #[inline] - pub fn inter_string_literal(&mut self, string_literal: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.string_literal_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.string_literal.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.string_literal.write().unwrap().push(None); - _index - }; - - let string_literal = string_literal(_index); - - let found = if let Some(string_literal) = - self.string_literal.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *string_literal.read().unwrap() - } else { - false - } - }) { - string_literal.clone() - } else { - None - }; - - if let Some(string_literal) = found { - tracing::debug!(target: "store", "found duplicate {string_literal:?}."); - self.string_literal_free_list.lock().unwrap().push(_index); - string_literal.clone() - } else { - tracing::debug!(target: "store", "interring {string_literal:?}."); - self.string_literal.write().unwrap()[_index] = Some(string_literal.clone()); - string_literal - } - } - - /// Exhume (get) [`StringLiteral`] from the store. - /// - #[inline] - pub fn exhume_string_literal(&self, id: &usize) -> Option>> { - match self.string_literal.read().unwrap().get(*id) { - Some(string_literal) => string_literal.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StringLiteral`] from the store. - /// - #[inline] - pub fn exorcise_string_literal(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising string_literal slot: {id}."); - let result = self.string_literal.write().unwrap()[*id].take(); - self.string_literal_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StringLiteral>`. - /// - #[inline] - pub fn iter_string_literal(&self) -> impl Iterator>> + '_ { - let len = self.string_literal.read().unwrap().len(); - (0..len) - .filter(|i| self.string_literal.read().unwrap()[*i].is_some()) - .map(move |i| { - self.string_literal.read().unwrap()[i] - .as_ref() - .map(|string_literal| string_literal.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`WoogStruct`] into the store. - /// - #[inline] - pub fn inter_woog_struct(&mut self, woog_struct: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.woog_struct_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.woog_struct.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.woog_struct.write().unwrap().push(None); - _index - }; - - let woog_struct = woog_struct(_index); - - let found = if let Some(woog_struct) = - self.woog_struct.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *woog_struct.read().unwrap() - } else { - false - } - }) { - woog_struct.clone() - } else { - None - }; - - let woog_struct = if let Some(woog_struct) = found { - tracing::debug!(target: "store", "found duplicate {woog_struct:?}."); - self.woog_struct_free_list.lock().unwrap().push(_index); - woog_struct.clone() - } else { - tracing::debug!(target: "store", "interring {woog_struct:?}."); - self.woog_struct.write().unwrap()[_index] = Some(woog_struct.clone()); - woog_struct - }; - self.woog_struct_id_by_name.write().unwrap().insert( - woog_struct.read().unwrap().name.to_owned(), - woog_struct.read().unwrap().id, - ); - woog_struct - } - - /// Exhume (get) [`WoogStruct`] from the store. - /// - #[inline] - pub fn exhume_woog_struct(&self, id: &usize) -> Option>> { - match self.woog_struct.read().unwrap().get(*id) { - Some(woog_struct) => woog_struct.clone(), - None => None, - } - } - - /// Exorcise (remove) [`WoogStruct`] from the store. - /// - #[inline] - pub fn exorcise_woog_struct(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising woog_struct slot: {id}."); - let result = self.woog_struct.write().unwrap()[*id].take(); - self.woog_struct_free_list.lock().unwrap().push(*id); - result - } - - /// Exorcise [`WoogStruct`] id from the store by name. - /// - #[inline] - pub fn exhume_woog_struct_id_by_name(&self, name: &str) -> Option { - self.woog_struct_id_by_name - .read() - .unwrap() - .get(name) - .map(|woog_struct| *woog_struct) - } - - /// Get an iterator over the internal `HashMap<&Uuid, WoogStruct>`. - /// - #[inline] - pub fn iter_woog_struct(&self) -> impl Iterator>> + '_ { - let len = self.woog_struct.read().unwrap().len(); - (0..len) - .filter(|i| self.woog_struct.read().unwrap()[*i].is_some()) - .map(move |i| { - self.woog_struct.read().unwrap()[i] - .as_ref() - .map(|woog_struct| woog_struct.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StructExpression`] into the store. - /// - #[inline] - pub fn inter_struct_expression( - &mut self, - struct_expression: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.struct_expression_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.struct_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.struct_expression.write().unwrap().push(None); - _index - }; - - let struct_expression = struct_expression(_index); - - let found = if let Some(struct_expression) = self - .struct_expression - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *struct_expression.read().unwrap() - } else { - false - } - }) { - struct_expression.clone() - } else { - None - }; - - if let Some(struct_expression) = found { - tracing::debug!(target: "store", "found duplicate {struct_expression:?}."); - self.struct_expression_free_list - .lock() - .unwrap() - .push(_index); - struct_expression.clone() - } else { - tracing::debug!(target: "store", "interring {struct_expression:?}."); - self.struct_expression.write().unwrap()[_index] = Some(struct_expression.clone()); - struct_expression - } - } - - /// Exhume (get) [`StructExpression`] from the store. - /// - #[inline] - pub fn exhume_struct_expression(&self, id: &usize) -> Option>> { - match self.struct_expression.read().unwrap().get(*id) { - Some(struct_expression) => struct_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StructExpression`] from the store. - /// - #[inline] - pub fn exorcise_struct_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising struct_expression slot: {id}."); - let result = self.struct_expression.write().unwrap()[*id].take(); - self.struct_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StructExpression>`. - /// - #[inline] - pub fn iter_struct_expression( - &self, - ) -> impl Iterator>> + '_ { - let len = self.struct_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.struct_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.struct_expression.read().unwrap()[i] - .as_ref() - .map(|struct_expression| struct_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StructField`] into the store. - /// - #[inline] - pub fn inter_struct_field(&mut self, struct_field: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.struct_field_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.struct_field.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.struct_field.write().unwrap().push(None); - _index - }; - - let struct_field = struct_field(_index); - - let found = if let Some(struct_field) = - self.struct_field.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *struct_field.read().unwrap() - } else { - false - } - }) { - struct_field.clone() - } else { - None - }; - - if let Some(struct_field) = found { - tracing::debug!(target: "store", "found duplicate {struct_field:?}."); - self.struct_field_free_list.lock().unwrap().push(_index); - struct_field.clone() - } else { - tracing::debug!(target: "store", "interring {struct_field:?}."); - self.struct_field.write().unwrap()[_index] = Some(struct_field.clone()); - struct_field - } - } - - /// Exhume (get) [`StructField`] from the store. - /// - #[inline] - pub fn exhume_struct_field(&self, id: &usize) -> Option>> { - match self.struct_field.read().unwrap().get(*id) { - Some(struct_field) => struct_field.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StructField`] from the store. - /// - #[inline] - pub fn exorcise_struct_field(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising struct_field slot: {id}."); - let result = self.struct_field.write().unwrap()[*id].take(); - self.struct_field_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StructField>`. - /// - #[inline] - pub fn iter_struct_field(&self) -> impl Iterator>> + '_ { - let len = self.struct_field.read().unwrap().len(); - (0..len) - .filter(|i| self.struct_field.read().unwrap()[*i].is_some()) - .map(move |i| { - self.struct_field.read().unwrap()[i] - .as_ref() - .map(|struct_field| struct_field.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`StructGeneric`] into the store. - /// - #[inline] - pub fn inter_struct_generic(&mut self, struct_generic: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.struct_generic_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.struct_generic.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.struct_generic.write().unwrap().push(None); - _index - }; - - let struct_generic = struct_generic(_index); - - let found = if let Some(struct_generic) = - self.struct_generic.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *struct_generic.read().unwrap() - } else { - false - } - }) { - struct_generic.clone() - } else { - None - }; - - if let Some(struct_generic) = found { - tracing::debug!(target: "store", "found duplicate {struct_generic:?}."); - self.struct_generic_free_list.lock().unwrap().push(_index); - struct_generic.clone() - } else { - tracing::debug!(target: "store", "interring {struct_generic:?}."); - self.struct_generic.write().unwrap()[_index] = Some(struct_generic.clone()); - struct_generic - } - } - - /// Exhume (get) [`StructGeneric`] from the store. - /// - #[inline] - pub fn exhume_struct_generic(&self, id: &usize) -> Option>> { - match self.struct_generic.read().unwrap().get(*id) { - Some(struct_generic) => struct_generic.clone(), - None => None, - } - } - - /// Exorcise (remove) [`StructGeneric`] from the store. - /// - #[inline] - pub fn exorcise_struct_generic(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising struct_generic slot: {id}."); - let result = self.struct_generic.write().unwrap()[*id].take(); - self.struct_generic_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, StructGeneric>`. - /// - #[inline] - pub fn iter_struct_generic(&self) -> impl Iterator>> + '_ { - let len = self.struct_generic.read().unwrap().len(); - (0..len) - .filter(|i| self.struct_generic.read().unwrap()[*i].is_some()) - .map(move |i| { - self.struct_generic.read().unwrap()[i] - .as_ref() - .map(|struct_generic| struct_generic.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`TupleField`] into the store. - /// - #[inline] - pub fn inter_tuple_field(&mut self, tuple_field: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.tuple_field_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.tuple_field.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.tuple_field.write().unwrap().push(None); - _index - }; - - let tuple_field = tuple_field(_index); - - let found = if let Some(tuple_field) = - self.tuple_field.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *tuple_field.read().unwrap() - } else { - false - } - }) { - tuple_field.clone() - } else { - None - }; - - if let Some(tuple_field) = found { - tracing::debug!(target: "store", "found duplicate {tuple_field:?}."); - self.tuple_field_free_list.lock().unwrap().push(_index); - tuple_field.clone() - } else { - tracing::debug!(target: "store", "interring {tuple_field:?}."); - self.tuple_field.write().unwrap()[_index] = Some(tuple_field.clone()); - tuple_field - } - } - - /// Exhume (get) [`TupleField`] from the store. - /// - #[inline] - pub fn exhume_tuple_field(&self, id: &usize) -> Option>> { - match self.tuple_field.read().unwrap().get(*id) { - Some(tuple_field) => tuple_field.clone(), - None => None, - } - } - - /// Exorcise (remove) [`TupleField`] from the store. - /// - #[inline] - pub fn exorcise_tuple_field(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising tuple_field slot: {id}."); - let result = self.tuple_field.write().unwrap()[*id].take(); - self.tuple_field_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, TupleField>`. - /// - #[inline] - pub fn iter_tuple_field(&self) -> impl Iterator>> + '_ { - let len = self.tuple_field.read().unwrap().len(); - (0..len) - .filter(|i| self.tuple_field.read().unwrap()[*i].is_some()) - .map(move |i| { - self.tuple_field.read().unwrap()[i] - .as_ref() - .map(|tuple_field| tuple_field.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`TypeCast`] into the store. - /// - #[inline] - pub fn inter_type_cast(&mut self, type_cast: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.type_cast_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.type_cast.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.type_cast.write().unwrap().push(None); - _index - }; - - let type_cast = type_cast(_index); - - let found = if let Some(type_cast) = self.type_cast.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *type_cast.read().unwrap() - } else { - false - } - }) { - type_cast.clone() - } else { - None - }; - - if let Some(type_cast) = found { - tracing::debug!(target: "store", "found duplicate {type_cast:?}."); - self.type_cast_free_list.lock().unwrap().push(_index); - type_cast.clone() - } else { - tracing::debug!(target: "store", "interring {type_cast:?}."); - self.type_cast.write().unwrap()[_index] = Some(type_cast.clone()); - type_cast - } - } - - /// Exhume (get) [`TypeCast`] from the store. - /// - #[inline] - pub fn exhume_type_cast(&self, id: &usize) -> Option>> { - match self.type_cast.read().unwrap().get(*id) { - Some(type_cast) => type_cast.clone(), - None => None, - } - } - - /// Exorcise (remove) [`TypeCast`] from the store. - /// - #[inline] - pub fn exorcise_type_cast(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising type_cast slot: {id}."); - let result = self.type_cast.write().unwrap()[*id].take(); - self.type_cast_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, TypeCast>`. - /// - #[inline] - pub fn iter_type_cast(&self) -> impl Iterator>> + '_ { - let len = self.type_cast.read().unwrap().len(); - (0..len) - .filter(|i| self.type_cast.read().unwrap()[*i].is_some()) - .map(move |i| { - self.type_cast.read().unwrap()[i] - .as_ref() - .map(|type_cast| type_cast.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Unary`] into the store. - /// - #[inline] - pub fn inter_unary(&mut self, unary: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.unary_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.unary.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.unary.write().unwrap().push(None); - _index - }; - - let unary = unary(_index); - - let found = if let Some(unary) = self.unary.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *unary.read().unwrap() - } else { - false - } - }) { - unary.clone() - } else { - None - }; - - if let Some(unary) = found { - tracing::debug!(target: "store", "found duplicate {unary:?}."); - self.unary_free_list.lock().unwrap().push(_index); - unary.clone() - } else { - tracing::debug!(target: "store", "interring {unary:?}."); - self.unary.write().unwrap()[_index] = Some(unary.clone()); - unary - } - } - - /// Exhume (get) [`Unary`] from the store. - /// - #[inline] - pub fn exhume_unary(&self, id: &usize) -> Option>> { - match self.unary.read().unwrap().get(*id) { - Some(unary) => unary.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Unary`] from the store. - /// - #[inline] - pub fn exorcise_unary(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising unary slot: {id}."); - let result = self.unary.write().unwrap()[*id].take(); - self.unary_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Unary>`. - /// - #[inline] - pub fn iter_unary(&self) -> impl Iterator>> + '_ { - let len = self.unary.read().unwrap().len(); - (0..len) - .filter(|i| self.unary.read().unwrap()[*i].is_some()) - .map(move |i| { - self.unary.read().unwrap()[i] - .as_ref() - .map(|unary| unary.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Unit`] into the store. - /// - #[inline] - pub fn inter_unit(&mut self, unit: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.unit_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.unit.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.unit.write().unwrap().push(None); - _index - }; - - let unit = unit(_index); - - let found = if let Some(unit) = self.unit.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *unit.read().unwrap() - } else { - false - } - }) { - unit.clone() - } else { - None - }; - - if let Some(unit) = found { - tracing::debug!(target: "store", "found duplicate {unit:?}."); - self.unit_free_list.lock().unwrap().push(_index); - unit.clone() - } else { - tracing::debug!(target: "store", "interring {unit:?}."); - self.unit.write().unwrap()[_index] = Some(unit.clone()); - unit - } - } - - /// Exhume (get) [`Unit`] from the store. - /// - #[inline] - pub fn exhume_unit(&self, id: &usize) -> Option>> { - match self.unit.read().unwrap().get(*id) { - Some(unit) => unit.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Unit`] from the store. - /// - #[inline] - pub fn exorcise_unit(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising unit slot: {id}."); - let result = self.unit.write().unwrap()[*id].take(); - self.unit_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Unit>`. - /// - #[inline] - pub fn iter_unit(&self) -> impl Iterator>> + '_ { - let len = self.unit.read().unwrap().len(); - (0..len) - .filter(|i| self.unit.read().unwrap()[*i].is_some()) - .map(move |i| { - self.unit.read().unwrap()[i] - .as_ref() - .map(|unit| unit.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`UnnamedFieldExpression`] into the store. - /// - #[inline] - pub fn inter_unnamed_field_expression( - &mut self, - unnamed_field_expression: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self - .unnamed_field_expression_free_list - .lock() - .unwrap() - .pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.unnamed_field_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.unnamed_field_expression.write().unwrap().push(None); - _index - }; - - let unnamed_field_expression = unnamed_field_expression(_index); - - let found = if let Some(unnamed_field_expression) = self - .unnamed_field_expression - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *unnamed_field_expression.read().unwrap() - } else { - false - } - }) { - unnamed_field_expression.clone() - } else { - None - }; - - if let Some(unnamed_field_expression) = found { - tracing::debug!(target: "store", "found duplicate {unnamed_field_expression:?}."); - self.unnamed_field_expression_free_list - .lock() - .unwrap() - .push(_index); - unnamed_field_expression.clone() - } else { - tracing::debug!(target: "store", "interring {unnamed_field_expression:?}."); - self.unnamed_field_expression.write().unwrap()[_index] = - Some(unnamed_field_expression.clone()); - unnamed_field_expression - } - } - - /// Exhume (get) [`UnnamedFieldExpression`] from the store. - /// - #[inline] - pub fn exhume_unnamed_field_expression( - &self, - id: &usize, - ) -> Option>> { - match self.unnamed_field_expression.read().unwrap().get(*id) { - Some(unnamed_field_expression) => unnamed_field_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`UnnamedFieldExpression`] from the store. - /// - #[inline] - pub fn exorcise_unnamed_field_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising unnamed_field_expression slot: {id}."); - let result = self.unnamed_field_expression.write().unwrap()[*id].take(); - self.unnamed_field_expression_free_list - .lock() - .unwrap() - .push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, UnnamedFieldExpression>`. - /// - #[inline] - pub fn iter_unnamed_field_expression( - &self, - ) -> impl Iterator>> + '_ { - let len = self.unnamed_field_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.unnamed_field_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.unnamed_field_expression.read().unwrap()[i] - .as_ref() - .map(|unnamed_field_expression| unnamed_field_expression.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`XValue`] into the store. - /// - #[inline] - pub fn inter_x_value(&mut self, x_value: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.x_value_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.x_value.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.x_value.write().unwrap().push(None); - _index - }; - - let x_value = x_value(_index); - - let found = if let Some(x_value) = self.x_value.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *x_value.read().unwrap() - } else { - false - } - }) { - x_value.clone() - } else { - None - }; - - if let Some(x_value) = found { - tracing::debug!(target: "store", "found duplicate {x_value:?}."); - self.x_value_free_list.lock().unwrap().push(_index); - x_value.clone() - } else { - tracing::debug!(target: "store", "interring {x_value:?}."); - self.x_value.write().unwrap()[_index] = Some(x_value.clone()); - x_value - } - } - - /// Exhume (get) [`XValue`] from the store. - /// - #[inline] - pub fn exhume_x_value(&self, id: &usize) -> Option>> { - match self.x_value.read().unwrap().get(*id) { - Some(x_value) => x_value.clone(), - None => None, - } - } - - /// Exorcise (remove) [`XValue`] from the store. - /// - #[inline] - pub fn exorcise_x_value(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising x_value slot: {id}."); - let result = self.x_value.write().unwrap()[*id].take(); - self.x_value_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, XValue>`. - /// - #[inline] - pub fn iter_x_value(&self) -> impl Iterator>> + '_ { - let len = self.x_value.read().unwrap().len(); - (0..len) - .filter(|i| self.x_value.read().unwrap()[*i].is_some()) - .map(move |i| { - self.x_value.read().unwrap()[i] - .as_ref() - .map(|x_value| x_value.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`ValueType`] into the store. - /// - #[inline] - pub fn inter_value_type(&mut self, value_type: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.value_type_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.value_type.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.value_type.write().unwrap().push(None); - _index - }; - - let value_type = value_type(_index); - - let found = if let Some(value_type) = - self.value_type.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *value_type.read().unwrap() - } else { - false - } - }) { - value_type.clone() - } else { - None - }; - - if let Some(value_type) = found { - tracing::debug!(target: "store", "found duplicate {value_type:?}."); - self.value_type_free_list.lock().unwrap().push(_index); - value_type.clone() - } else { - tracing::debug!(target: "store", "interring {value_type:?}."); - self.value_type.write().unwrap()[_index] = Some(value_type.clone()); - value_type - } - } - - /// Exhume (get) [`ValueType`] from the store. - /// - #[inline] - pub fn exhume_value_type(&self, id: &usize) -> Option>> { - match self.value_type.read().unwrap().get(*id) { - Some(value_type) => value_type.clone(), - None => None, - } - } - - /// Exorcise (remove) [`ValueType`] from the store. - /// - #[inline] - pub fn exorcise_value_type(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising value_type slot: {id}."); - let result = self.value_type.write().unwrap()[*id].take(); - self.value_type_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, ValueType>`. - /// - #[inline] - pub fn iter_value_type(&self) -> impl Iterator>> + '_ { - let len = self.value_type.read().unwrap().len(); - (0..len) - .filter(|i| self.value_type.read().unwrap()[*i].is_some()) - .map(move |i| { - self.value_type.read().unwrap()[i] - .as_ref() - .map(|value_type| value_type.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`Variable`] into the store. - /// - #[inline] - pub fn inter_variable(&mut self, variable: F) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.variable_free_list.lock().unwrap().pop() { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.variable.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.variable.write().unwrap().push(None); - _index - }; - - let variable = variable(_index); - - let found = if let Some(variable) = self.variable.read().unwrap().iter().find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *variable.read().unwrap() - } else { - false - } - }) { - variable.clone() - } else { - None - }; - - if let Some(variable) = found { - tracing::debug!(target: "store", "found duplicate {variable:?}."); - self.variable_free_list.lock().unwrap().push(_index); - variable.clone() - } else { - tracing::debug!(target: "store", "interring {variable:?}."); - self.variable.write().unwrap()[_index] = Some(variable.clone()); - variable - } - } - - /// Exhume (get) [`Variable`] from the store. - /// - #[inline] - pub fn exhume_variable(&self, id: &usize) -> Option>> { - match self.variable.read().unwrap().get(*id) { - Some(variable) => variable.clone(), - None => None, - } - } - - /// Exorcise (remove) [`Variable`] from the store. - /// - #[inline] - pub fn exorcise_variable(&mut self, id: &usize) -> Option>> { - tracing::debug!(target: "store", "exorcising variable slot: {id}."); - let result = self.variable.write().unwrap()[*id].take(); - self.variable_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, Variable>`. - /// - #[inline] - pub fn iter_variable(&self) -> impl Iterator>> + '_ { - let len = self.variable.read().unwrap().len(); - (0..len) - .filter(|i| self.variable.read().unwrap()[*i].is_some()) - .map(move |i| { - self.variable.read().unwrap()[i] - .as_ref() - .map(|variable| variable.clone()) - .unwrap() - }) - } - - /// Inter (insert) [`VariableExpression`] into the store. - /// - #[inline] - pub fn inter_variable_expression( - &mut self, - variable_expression: F, - ) -> Arc> - where - F: Fn(usize) -> Arc>, - { - let _index = if let Some(_index) = self.variable_expression_free_list.lock().unwrap().pop() - { - tracing::trace!(target: "store", "recycling block {_index}."); - _index - } else { - let _index = self.variable_expression.read().unwrap().len(); - tracing::trace!(target: "store", "allocating block {_index}."); - self.variable_expression.write().unwrap().push(None); - _index - }; - - let variable_expression = variable_expression(_index); - - let found = if let Some(variable_expression) = self - .variable_expression - .read() - .unwrap() - .iter() - .find(|stored| { - if let Some(stored) = stored { - *stored.read().unwrap() == *variable_expression.read().unwrap() - } else { - false - } - }) { - variable_expression.clone() - } else { - None - }; - - if let Some(variable_expression) = found { - tracing::debug!(target: "store", "found duplicate {variable_expression:?}."); - self.variable_expression_free_list - .lock() - .unwrap() - .push(_index); - variable_expression.clone() - } else { - tracing::debug!(target: "store", "interring {variable_expression:?}."); - self.variable_expression.write().unwrap()[_index] = Some(variable_expression.clone()); - variable_expression - } - } - - /// Exhume (get) [`VariableExpression`] from the store. - /// - #[inline] - pub fn exhume_variable_expression( - &self, - id: &usize, - ) -> Option>> { - match self.variable_expression.read().unwrap().get(*id) { - Some(variable_expression) => variable_expression.clone(), - None => None, - } - } - - /// Exorcise (remove) [`VariableExpression`] from the store. - /// - #[inline] - pub fn exorcise_variable_expression( - &mut self, - id: &usize, - ) -> Option>> { - tracing::debug!(target: "store", "exorcising variable_expression slot: {id}."); - let result = self.variable_expression.write().unwrap()[*id].take(); - self.variable_expression_free_list.lock().unwrap().push(*id); - result - } - - /// Get an iterator over the internal `HashMap<&Uuid, VariableExpression>`. - /// - #[inline] - pub fn iter_variable_expression( - &self, - ) -> impl Iterator>> + '_ { - let len = self.variable_expression.read().unwrap().len(); - (0..len) - .filter(|i| self.variable_expression.read().unwrap()[*i].is_some()) - .map(move |i| { - self.variable_expression.read().unwrap()[i] - .as_ref() - .map(|variable_expression| variable_expression.clone()) - .unwrap() - }) - } - - // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} - // {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-persistence"}}} - // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} + +} +pub fn new() -> Self { +let mut store = Self { +argument_free_list: std::sync::Mutex::new(Vec::new()), +argument: Arc::new(RwLock::new(Vec::new())), +a_wait_free_list: std::sync::Mutex::new(Vec::new()), +a_wait: Arc::new(RwLock::new(Vec::new())), +binary_free_list: std::sync::Mutex::new(Vec::new()), +binary: Arc::new(RwLock::new(Vec::new())), +block_free_list: std::sync::Mutex::new(Vec::new()), +block: Arc::new(RwLock::new(Vec::new())), +body_free_list: std::sync::Mutex::new(Vec::new()), +body: Arc::new(RwLock::new(Vec::new())), +boolean_literal_free_list: std::sync::Mutex::new(Vec::new()), +boolean_literal: Arc::new(RwLock::new(Vec::new())), +boolean_operator_free_list: std::sync::Mutex::new(Vec::new()), +boolean_operator: Arc::new(RwLock::new(Vec::new())), +call_free_list: std::sync::Mutex::new(Vec::new()), +call: Arc::new(RwLock::new(Vec::new())), +char_literal_free_list: std::sync::Mutex::new(Vec::new()), +char_literal: Arc::new(RwLock::new(Vec::new())), +comparison_free_list: std::sync::Mutex::new(Vec::new()), +comparison: Arc::new(RwLock::new(Vec::new())), +data_structure_free_list: std::sync::Mutex::new(Vec::new()), +data_structure: Arc::new(RwLock::new(Vec::new())), +dwarf_source_file_free_list: std::sync::Mutex::new(Vec::new()), +dwarf_source_file: Arc::new(RwLock::new(Vec::new())), +enum_field_free_list: std::sync::Mutex::new(Vec::new()), +enum_field: Arc::new(RwLock::new(Vec::new())), +enum_generic_free_list: std::sync::Mutex::new(Vec::new()), +enum_generic: Arc::new(RwLock::new(Vec::new())), +enum_generic_type_free_list: std::sync::Mutex::new(Vec::new()), +enum_generic_type: Arc::new(RwLock::new(Vec::new())), +enumeration_free_list: std::sync::Mutex::new(Vec::new()), +enumeration: Arc::new(RwLock::new(Vec::new())), +enumeration_id_by_name: Arc::new(RwLock::new(HashMap::default())), +expression_free_list: std::sync::Mutex::new(Vec::new()), +expression: Arc::new(RwLock::new(Vec::new())), +expression_bit_free_list: std::sync::Mutex::new(Vec::new()), +expression_bit: Arc::new(RwLock::new(Vec::new())), +expression_statement_free_list: std::sync::Mutex::new(Vec::new()), +expression_statement: Arc::new(RwLock::new(Vec::new())), +external_implementation_free_list: std::sync::Mutex::new(Vec::new()), +external_implementation: Arc::new(RwLock::new(Vec::new())), +field_free_list: std::sync::Mutex::new(Vec::new()), +field: Arc::new(RwLock::new(Vec::new())), +field_id_by_name: Arc::new(RwLock::new(HashMap::default())), +field_access_free_list: std::sync::Mutex::new(Vec::new()), +field_access: Arc::new(RwLock::new(Vec::new())), +field_access_target_free_list: std::sync::Mutex::new(Vec::new()), +field_access_target: Arc::new(RwLock::new(Vec::new())), +field_expression_free_list: std::sync::Mutex::new(Vec::new()), +field_expression: Arc::new(RwLock::new(Vec::new())), +float_literal_free_list: std::sync::Mutex::new(Vec::new()), +float_literal: Arc::new(RwLock::new(Vec::new())), +for_loop_free_list: std::sync::Mutex::new(Vec::new()), +for_loop: Arc::new(RwLock::new(Vec::new())), +format_bit_free_list: std::sync::Mutex::new(Vec::new()), +format_bit: Arc::new(RwLock::new(Vec::new())), +format_string_free_list: std::sync::Mutex::new(Vec::new()), +format_string: Arc::new(RwLock::new(Vec::new())), +func_generic_free_list: std::sync::Mutex::new(Vec::new()), +func_generic: Arc::new(RwLock::new(Vec::new())), +function_free_list: std::sync::Mutex::new(Vec::new()), +function: Arc::new(RwLock::new(Vec::new())), +function_id_by_name: Arc::new(RwLock::new(HashMap::default())), +function_call_free_list: std::sync::Mutex::new(Vec::new()), +function_call: Arc::new(RwLock::new(Vec::new())), +x_future_free_list: std::sync::Mutex::new(Vec::new()), +x_future: Arc::new(RwLock::new(Vec::new())), +grouped_free_list: std::sync::Mutex::new(Vec::new()), +grouped: Arc::new(RwLock::new(Vec::new())), +halt_and_catch_fire_free_list: std::sync::Mutex::new(Vec::new()), +halt_and_catch_fire: Arc::new(RwLock::new(Vec::new())), +x_if_free_list: std::sync::Mutex::new(Vec::new()), +x_if: Arc::new(RwLock::new(Vec::new())), +implementation_block_free_list: std::sync::Mutex::new(Vec::new()), +implementation_block: Arc::new(RwLock::new(Vec::new())), +import_free_list: std::sync::Mutex::new(Vec::new()), +import: Arc::new(RwLock::new(Vec::new())), +index_free_list: std::sync::Mutex::new(Vec::new()), +index: Arc::new(RwLock::new(Vec::new())), +integer_literal_free_list: std::sync::Mutex::new(Vec::new()), +integer_literal: Arc::new(RwLock::new(Vec::new())), +item_free_list: std::sync::Mutex::new(Vec::new()), +item: Arc::new(RwLock::new(Vec::new())), +lambda_free_list: std::sync::Mutex::new(Vec::new()), +lambda: Arc::new(RwLock::new(Vec::new())), +lambda_parameter_free_list: std::sync::Mutex::new(Vec::new()), +lambda_parameter: Arc::new(RwLock::new(Vec::new())), +let_statement_free_list: std::sync::Mutex::new(Vec::new()), +let_statement: Arc::new(RwLock::new(Vec::new())), +list_free_list: std::sync::Mutex::new(Vec::new()), +list: Arc::new(RwLock::new(Vec::new())), +list_element_free_list: std::sync::Mutex::new(Vec::new()), +list_element: Arc::new(RwLock::new(Vec::new())), +list_expression_free_list: std::sync::Mutex::new(Vec::new()), +list_expression: Arc::new(RwLock::new(Vec::new())), +literal_free_list: std::sync::Mutex::new(Vec::new()), +literal: Arc::new(RwLock::new(Vec::new())), +local_variable_free_list: std::sync::Mutex::new(Vec::new()), +local_variable: Arc::new(RwLock::new(Vec::new())), +x_macro_free_list: std::sync::Mutex::new(Vec::new()), +x_macro: Arc::new(RwLock::new(Vec::new())), +map_free_list: std::sync::Mutex::new(Vec::new()), +map: Arc::new(RwLock::new(Vec::new())), +map_element_free_list: std::sync::Mutex::new(Vec::new()), +map_element: Arc::new(RwLock::new(Vec::new())), +map_expression_free_list: std::sync::Mutex::new(Vec::new()), +map_expression: Arc::new(RwLock::new(Vec::new())), +x_match_free_list: std::sync::Mutex::new(Vec::new()), +x_match: Arc::new(RwLock::new(Vec::new())), +method_call_free_list: std::sync::Mutex::new(Vec::new()), +method_call: Arc::new(RwLock::new(Vec::new())), +named_field_expression_free_list: std::sync::Mutex::new(Vec::new()), +named_field_expression: Arc::new(RwLock::new(Vec::new())), +z_object_store_free_list: std::sync::Mutex::new(Vec::new()), +z_object_store: Arc::new(RwLock::new(Vec::new())), +z_object_store_id_by_name: Arc::new(RwLock::new(HashMap::default())), +object_wrapper_free_list: std::sync::Mutex::new(Vec::new()), +object_wrapper: Arc::new(RwLock::new(Vec::new())), +operator_free_list: std::sync::Mutex::new(Vec::new()), +operator: Arc::new(RwLock::new(Vec::new())), +parameter_free_list: std::sync::Mutex::new(Vec::new()), +parameter: Arc::new(RwLock::new(Vec::new())), +x_path_free_list: std::sync::Mutex::new(Vec::new()), +x_path: Arc::new(RwLock::new(Vec::new())), +path_element_free_list: std::sync::Mutex::new(Vec::new()), +path_element: Arc::new(RwLock::new(Vec::new())), +pattern_free_list: std::sync::Mutex::new(Vec::new()), +pattern: Arc::new(RwLock::new(Vec::new())), +x_plugin_free_list: std::sync::Mutex::new(Vec::new()), +x_plugin: Arc::new(RwLock::new(Vec::new())), +x_plugin_id_by_name: Arc::new(RwLock::new(HashMap::default())), +x_print_free_list: std::sync::Mutex::new(Vec::new()), +x_print: Arc::new(RwLock::new(Vec::new())), +range_expression_free_list: std::sync::Mutex::new(Vec::new()), +range_expression: Arc::new(RwLock::new(Vec::new())), +result_statement_free_list: std::sync::Mutex::new(Vec::new()), +result_statement: Arc::new(RwLock::new(Vec::new())), +x_return_free_list: std::sync::Mutex::new(Vec::new()), +x_return: Arc::new(RwLock::new(Vec::new())), +span_free_list: std::sync::Mutex::new(Vec::new()), +span: Arc::new(RwLock::new(Vec::new())), +statement_free_list: std::sync::Mutex::new(Vec::new()), +statement: Arc::new(RwLock::new(Vec::new())), +static_method_call_free_list: std::sync::Mutex::new(Vec::new()), +static_method_call: Arc::new(RwLock::new(Vec::new())), +string_bit_free_list: std::sync::Mutex::new(Vec::new()), +string_bit: Arc::new(RwLock::new(Vec::new())), +string_literal_free_list: std::sync::Mutex::new(Vec::new()), +string_literal: Arc::new(RwLock::new(Vec::new())), +woog_struct_free_list: std::sync::Mutex::new(Vec::new()), +woog_struct: Arc::new(RwLock::new(Vec::new())), +woog_struct_id_by_name: Arc::new(RwLock::new(HashMap::default())), +struct_expression_free_list: std::sync::Mutex::new(Vec::new()), +struct_expression: Arc::new(RwLock::new(Vec::new())), +struct_field_free_list: std::sync::Mutex::new(Vec::new()), +struct_field: Arc::new(RwLock::new(Vec::new())), +struct_generic_free_list: std::sync::Mutex::new(Vec::new()), +struct_generic: Arc::new(RwLock::new(Vec::new())), +tuple_field_free_list: std::sync::Mutex::new(Vec::new()), +tuple_field: Arc::new(RwLock::new(Vec::new())), +type_cast_free_list: std::sync::Mutex::new(Vec::new()), +type_cast: Arc::new(RwLock::new(Vec::new())), +unary_free_list: std::sync::Mutex::new(Vec::new()), +unary: Arc::new(RwLock::new(Vec::new())), +unit_free_list: std::sync::Mutex::new(Vec::new()), +unit: Arc::new(RwLock::new(Vec::new())), +unnamed_field_expression_free_list: std::sync::Mutex::new(Vec::new()), +unnamed_field_expression: Arc::new(RwLock::new(Vec::new())), +x_value_free_list: std::sync::Mutex::new(Vec::new()), +x_value: Arc::new(RwLock::new(Vec::new())), +value_type_free_list: std::sync::Mutex::new(Vec::new()), +value_type: Arc::new(RwLock::new(Vec::new())), +variable_free_list: std::sync::Mutex::new(Vec::new()), +variable: Arc::new(RwLock::new(Vec::new())), +variable_expression_free_list: std::sync::Mutex::new(Vec::new()), +variable_expression: Arc::new(RwLock::new(Vec::new())), +}; + +// Initialize Singleton Subtypes +// 💥 Look at how beautiful this generated code is for super/sub-type graphs! +// I remember having a bit of a struggle making it work. It's recursive, with +// a lot of special cases, and I think it calls other recursive functions...💥 + +store +} + +// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"v2::lu_dog_ndrwlock_vec-object-store-methods"}}} +/// Inter (insert) [`Argument`] into the store. +/// +#[inline] +pub fn inter_argument(&mut self, argument: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.argument_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.argument.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.argument.write().unwrap().push(None); +_index +}; + +let argument = argument(_index); + +let found = if let Some(argument) = self.argument.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *argument.read().unwrap() +} else { +false +} +}) { +argument.clone() +} else { +None +}; + +if let Some(argument) = found { +tracing::debug!(target: "store", "found duplicate {argument:?}."); +self.argument_free_list.lock().unwrap().push(_index); +argument.clone() +} else { +tracing::debug!(target: "store", "interring {argument:?}."); +self.argument.write().unwrap()[_index] = Some(argument.clone()); +argument +} +} + +/// Exhume (get) [`Argument`] from the store. +/// +#[inline] +pub fn exhume_argument(&self, id: &usize) -> Option>> { +match self.argument.read().unwrap().get(*id) { +Some(argument) => argument.clone(), +None => None +} +} + +/// Exorcise (remove) [`Argument`] from the store. +/// +#[inline] +pub fn exorcise_argument(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising argument slot: {id}."); +let result = self.argument.write().unwrap()[*id].take(); +self.argument_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Argument>`. +/// +#[inline] +pub fn iter_argument(&self) -> impl Iterator>> + '_ { +let len = self.argument.read().unwrap().len(); +(0..len).filter(|i| self.argument.read().unwrap()[*i].is_some()).map(move|i|{self.argument.read().unwrap()[i].as_ref().map(|argument| argument.clone()).unwrap()}) +} + +/// Inter (insert) [`AWait`] into the store. +/// +#[inline] +pub fn inter_a_wait(&mut self, a_wait: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.a_wait_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.a_wait.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.a_wait.write().unwrap().push(None); +_index +}; + +let a_wait = a_wait(_index); + +let found = if let Some(a_wait) = self.a_wait.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *a_wait.read().unwrap() +} else { +false +} +}) { +a_wait.clone() +} else { +None +}; + +if let Some(a_wait) = found { +tracing::debug!(target: "store", "found duplicate {a_wait:?}."); +self.a_wait_free_list.lock().unwrap().push(_index); +a_wait.clone() +} else { +tracing::debug!(target: "store", "interring {a_wait:?}."); +self.a_wait.write().unwrap()[_index] = Some(a_wait.clone()); +a_wait +} +} + +/// Exhume (get) [`AWait`] from the store. +/// +#[inline] +pub fn exhume_a_wait(&self, id: &usize) -> Option>> { +match self.a_wait.read().unwrap().get(*id) { +Some(a_wait) => a_wait.clone(), +None => None +} +} + +/// Exorcise (remove) [`AWait`] from the store. +/// +#[inline] +pub fn exorcise_a_wait(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising a_wait slot: {id}."); +let result = self.a_wait.write().unwrap()[*id].take(); +self.a_wait_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, AWait>`. +/// +#[inline] +pub fn iter_a_wait(&self) -> impl Iterator>> + '_ { +let len = self.a_wait.read().unwrap().len(); +(0..len).filter(|i| self.a_wait.read().unwrap()[*i].is_some()).map(move|i|{self.a_wait.read().unwrap()[i].as_ref().map(|a_wait| a_wait.clone()).unwrap()}) +} + +/// Inter (insert) [`Binary`] into the store. +/// +#[inline] +pub fn inter_binary(&mut self, binary: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.binary_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.binary.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.binary.write().unwrap().push(None); +_index +}; + +let binary = binary(_index); + +let found = if let Some(binary) = self.binary.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *binary.read().unwrap() +} else { +false +} +}) { +binary.clone() +} else { +None +}; + +if let Some(binary) = found { +tracing::debug!(target: "store", "found duplicate {binary:?}."); +self.binary_free_list.lock().unwrap().push(_index); +binary.clone() +} else { +tracing::debug!(target: "store", "interring {binary:?}."); +self.binary.write().unwrap()[_index] = Some(binary.clone()); +binary +} +} + +/// Exhume (get) [`Binary`] from the store. +/// +#[inline] +pub fn exhume_binary(&self, id: &usize) -> Option>> { +match self.binary.read().unwrap().get(*id) { +Some(binary) => binary.clone(), +None => None +} +} + +/// Exorcise (remove) [`Binary`] from the store. +/// +#[inline] +pub fn exorcise_binary(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising binary slot: {id}."); +let result = self.binary.write().unwrap()[*id].take(); +self.binary_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Binary>`. +/// +#[inline] +pub fn iter_binary(&self) -> impl Iterator>> + '_ { +let len = self.binary.read().unwrap().len(); +(0..len).filter(|i| self.binary.read().unwrap()[*i].is_some()).map(move|i|{self.binary.read().unwrap()[i].as_ref().map(|binary| binary.clone()).unwrap()}) +} + +/// Inter (insert) [`Block`] into the store. +/// +#[inline] +pub fn inter_block(&mut self, block: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.block_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.block.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.block.write().unwrap().push(None); +_index +}; + +let block = block(_index); + +let found = if let Some(block) = self.block.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *block.read().unwrap() +} else { +false +} +}) { +block.clone() +} else { +None +}; + +if let Some(block) = found { +tracing::debug!(target: "store", "found duplicate {block:?}."); +self.block_free_list.lock().unwrap().push(_index); +block.clone() +} else { +tracing::debug!(target: "store", "interring {block:?}."); +self.block.write().unwrap()[_index] = Some(block.clone()); +block +} +} + +/// Exhume (get) [`Block`] from the store. +/// +#[inline] +pub fn exhume_block(&self, id: &usize) -> Option>> { +match self.block.read().unwrap().get(*id) { +Some(block) => block.clone(), +None => None +} +} + +/// Exorcise (remove) [`Block`] from the store. +/// +#[inline] +pub fn exorcise_block(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising block slot: {id}."); +let result = self.block.write().unwrap()[*id].take(); +self.block_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Block>`. +/// +#[inline] +pub fn iter_block(&self) -> impl Iterator>> + '_ { +let len = self.block.read().unwrap().len(); +(0..len).filter(|i| self.block.read().unwrap()[*i].is_some()).map(move|i|{self.block.read().unwrap()[i].as_ref().map(|block| block.clone()).unwrap()}) +} + +/// Inter (insert) [`Body`] into the store. +/// +#[inline] +pub fn inter_body(&mut self, body: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.body_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.body.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.body.write().unwrap().push(None); +_index +}; + +let body = body(_index); + +let found = if let Some(body) = self.body.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *body.read().unwrap() +} else { +false +} +}) { +body.clone() +} else { +None +}; + +if let Some(body) = found { +tracing::debug!(target: "store", "found duplicate {body:?}."); +self.body_free_list.lock().unwrap().push(_index); +body.clone() +} else { +tracing::debug!(target: "store", "interring {body:?}."); +self.body.write().unwrap()[_index] = Some(body.clone()); +body +} +} + +/// Exhume (get) [`Body`] from the store. +/// +#[inline] +pub fn exhume_body(&self, id: &usize) -> Option>> { +match self.body.read().unwrap().get(*id) { +Some(body) => body.clone(), +None => None +} +} + +/// Exorcise (remove) [`Body`] from the store. +/// +#[inline] +pub fn exorcise_body(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising body slot: {id}."); +let result = self.body.write().unwrap()[*id].take(); +self.body_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Body>`. +/// +#[inline] +pub fn iter_body(&self) -> impl Iterator>> + '_ { +let len = self.body.read().unwrap().len(); +(0..len).filter(|i| self.body.read().unwrap()[*i].is_some()).map(move|i|{self.body.read().unwrap()[i].as_ref().map(|body| body.clone()).unwrap()}) +} + +/// Inter (insert) [`BooleanLiteral`] into the store. +/// +#[inline] +pub fn inter_boolean_literal(&mut self, boolean_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.boolean_literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.boolean_literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.boolean_literal.write().unwrap().push(None); +_index +}; + +let boolean_literal = boolean_literal(_index); + +let found = if let Some(boolean_literal) = self.boolean_literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *boolean_literal.read().unwrap() +} else { +false +} +}) { +boolean_literal.clone() +} else { +None +}; + +if let Some(boolean_literal) = found { +tracing::debug!(target: "store", "found duplicate {boolean_literal:?}."); +self.boolean_literal_free_list.lock().unwrap().push(_index); +boolean_literal.clone() +} else { +tracing::debug!(target: "store", "interring {boolean_literal:?}."); +self.boolean_literal.write().unwrap()[_index] = Some(boolean_literal.clone()); +boolean_literal +} +} + +/// Exhume (get) [`BooleanLiteral`] from the store. +/// +#[inline] +pub fn exhume_boolean_literal(&self, id: &usize) -> Option>> { +match self.boolean_literal.read().unwrap().get(*id) { +Some(boolean_literal) => boolean_literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`BooleanLiteral`] from the store. +/// +#[inline] +pub fn exorcise_boolean_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising boolean_literal slot: {id}."); +let result = self.boolean_literal.write().unwrap()[*id].take(); +self.boolean_literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, BooleanLiteral>`. +/// +#[inline] +pub fn iter_boolean_literal(&self) -> impl Iterator>> + '_ { +let len = self.boolean_literal.read().unwrap().len(); +(0..len).filter(|i| self.boolean_literal.read().unwrap()[*i].is_some()).map(move|i|{self.boolean_literal.read().unwrap()[i].as_ref().map(|boolean_literal| boolean_literal.clone()).unwrap()}) +} + +/// Inter (insert) [`BooleanOperator`] into the store. +/// +#[inline] +pub fn inter_boolean_operator(&mut self, boolean_operator: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.boolean_operator_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.boolean_operator.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.boolean_operator.write().unwrap().push(None); +_index +}; + +let boolean_operator = boolean_operator(_index); + +let found = if let Some(boolean_operator) = self.boolean_operator.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *boolean_operator.read().unwrap() +} else { +false +} +}) { +boolean_operator.clone() +} else { +None +}; + +if let Some(boolean_operator) = found { +tracing::debug!(target: "store", "found duplicate {boolean_operator:?}."); +self.boolean_operator_free_list.lock().unwrap().push(_index); +boolean_operator.clone() +} else { +tracing::debug!(target: "store", "interring {boolean_operator:?}."); +self.boolean_operator.write().unwrap()[_index] = Some(boolean_operator.clone()); +boolean_operator +} +} + +/// Exhume (get) [`BooleanOperator`] from the store. +/// +#[inline] +pub fn exhume_boolean_operator(&self, id: &usize) -> Option>> { +match self.boolean_operator.read().unwrap().get(*id) { +Some(boolean_operator) => boolean_operator.clone(), +None => None +} +} + +/// Exorcise (remove) [`BooleanOperator`] from the store. +/// +#[inline] +pub fn exorcise_boolean_operator(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising boolean_operator slot: {id}."); +let result = self.boolean_operator.write().unwrap()[*id].take(); +self.boolean_operator_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, BooleanOperator>`. +/// +#[inline] +pub fn iter_boolean_operator(&self) -> impl Iterator>> + '_ { +let len = self.boolean_operator.read().unwrap().len(); +(0..len).filter(|i| self.boolean_operator.read().unwrap()[*i].is_some()).map(move|i|{self.boolean_operator.read().unwrap()[i].as_ref().map(|boolean_operator| boolean_operator.clone()).unwrap()}) +} + +/// Inter (insert) [`Call`] into the store. +/// +#[inline] +pub fn inter_call(&mut self, call: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.call_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.call.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.call.write().unwrap().push(None); +_index +}; + +let call = call(_index); + +let found = if let Some(call) = self.call.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *call.read().unwrap() +} else { +false +} +}) { +call.clone() +} else { +None +}; + +if let Some(call) = found { +tracing::debug!(target: "store", "found duplicate {call:?}."); +self.call_free_list.lock().unwrap().push(_index); +call.clone() +} else { +tracing::debug!(target: "store", "interring {call:?}."); +self.call.write().unwrap()[_index] = Some(call.clone()); +call +} +} + +/// Exhume (get) [`Call`] from the store. +/// +#[inline] +pub fn exhume_call(&self, id: &usize) -> Option>> { +match self.call.read().unwrap().get(*id) { +Some(call) => call.clone(), +None => None +} +} + +/// Exorcise (remove) [`Call`] from the store. +/// +#[inline] +pub fn exorcise_call(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising call slot: {id}."); +let result = self.call.write().unwrap()[*id].take(); +self.call_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Call>`. +/// +#[inline] +pub fn iter_call(&self) -> impl Iterator>> + '_ { +let len = self.call.read().unwrap().len(); +(0..len).filter(|i| self.call.read().unwrap()[*i].is_some()).map(move|i|{self.call.read().unwrap()[i].as_ref().map(|call| call.clone()).unwrap()}) +} + +/// Inter (insert) [`CharLiteral`] into the store. +/// +#[inline] +pub fn inter_char_literal(&mut self, char_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.char_literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.char_literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.char_literal.write().unwrap().push(None); +_index +}; + +let char_literal = char_literal(_index); + +let found = if let Some(char_literal) = self.char_literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *char_literal.read().unwrap() +} else { +false +} +}) { +char_literal.clone() +} else { +None +}; + +if let Some(char_literal) = found { +tracing::debug!(target: "store", "found duplicate {char_literal:?}."); +self.char_literal_free_list.lock().unwrap().push(_index); +char_literal.clone() +} else { +tracing::debug!(target: "store", "interring {char_literal:?}."); +self.char_literal.write().unwrap()[_index] = Some(char_literal.clone()); +char_literal +} +} + +/// Exhume (get) [`CharLiteral`] from the store. +/// +#[inline] +pub fn exhume_char_literal(&self, id: &usize) -> Option>> { +match self.char_literal.read().unwrap().get(*id) { +Some(char_literal) => char_literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`CharLiteral`] from the store. +/// +#[inline] +pub fn exorcise_char_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising char_literal slot: {id}."); +let result = self.char_literal.write().unwrap()[*id].take(); +self.char_literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, CharLiteral>`. +/// +#[inline] +pub fn iter_char_literal(&self) -> impl Iterator>> + '_ { +let len = self.char_literal.read().unwrap().len(); +(0..len).filter(|i| self.char_literal.read().unwrap()[*i].is_some()).map(move|i|{self.char_literal.read().unwrap()[i].as_ref().map(|char_literal| char_literal.clone()).unwrap()}) +} + +/// Inter (insert) [`Comparison`] into the store. +/// +#[inline] +pub fn inter_comparison(&mut self, comparison: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.comparison_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.comparison.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.comparison.write().unwrap().push(None); +_index +}; + +let comparison = comparison(_index); + +let found = if let Some(comparison) = self.comparison.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *comparison.read().unwrap() +} else { +false +} +}) { +comparison.clone() +} else { +None +}; + +if let Some(comparison) = found { +tracing::debug!(target: "store", "found duplicate {comparison:?}."); +self.comparison_free_list.lock().unwrap().push(_index); +comparison.clone() +} else { +tracing::debug!(target: "store", "interring {comparison:?}."); +self.comparison.write().unwrap()[_index] = Some(comparison.clone()); +comparison +} +} + +/// Exhume (get) [`Comparison`] from the store. +/// +#[inline] +pub fn exhume_comparison(&self, id: &usize) -> Option>> { +match self.comparison.read().unwrap().get(*id) { +Some(comparison) => comparison.clone(), +None => None +} +} + +/// Exorcise (remove) [`Comparison`] from the store. +/// +#[inline] +pub fn exorcise_comparison(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising comparison slot: {id}."); +let result = self.comparison.write().unwrap()[*id].take(); +self.comparison_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Comparison>`. +/// +#[inline] +pub fn iter_comparison(&self) -> impl Iterator>> + '_ { +let len = self.comparison.read().unwrap().len(); +(0..len).filter(|i| self.comparison.read().unwrap()[*i].is_some()).map(move|i|{self.comparison.read().unwrap()[i].as_ref().map(|comparison| comparison.clone()).unwrap()}) +} + +/// Inter (insert) [`DataStructure`] into the store. +/// +#[inline] +pub fn inter_data_structure(&mut self, data_structure: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.data_structure_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.data_structure.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.data_structure.write().unwrap().push(None); +_index +}; + +let data_structure = data_structure(_index); + +let found = if let Some(data_structure) = self.data_structure.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *data_structure.read().unwrap() +} else { +false +} +}) { +data_structure.clone() +} else { +None +}; + +if let Some(data_structure) = found { +tracing::debug!(target: "store", "found duplicate {data_structure:?}."); +self.data_structure_free_list.lock().unwrap().push(_index); +data_structure.clone() +} else { +tracing::debug!(target: "store", "interring {data_structure:?}."); +self.data_structure.write().unwrap()[_index] = Some(data_structure.clone()); +data_structure +} +} + +/// Exhume (get) [`DataStructure`] from the store. +/// +#[inline] +pub fn exhume_data_structure(&self, id: &usize) -> Option>> { +match self.data_structure.read().unwrap().get(*id) { +Some(data_structure) => data_structure.clone(), +None => None +} +} + +/// Exorcise (remove) [`DataStructure`] from the store. +/// +#[inline] +pub fn exorcise_data_structure(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising data_structure slot: {id}."); +let result = self.data_structure.write().unwrap()[*id].take(); +self.data_structure_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, DataStructure>`. +/// +#[inline] +pub fn iter_data_structure(&self) -> impl Iterator>> + '_ { +let len = self.data_structure.read().unwrap().len(); +(0..len).filter(|i| self.data_structure.read().unwrap()[*i].is_some()).map(move|i|{self.data_structure.read().unwrap()[i].as_ref().map(|data_structure| data_structure.clone()).unwrap()}) +} + +/// Inter (insert) [`DwarfSourceFile`] into the store. +/// +#[inline] +pub fn inter_dwarf_source_file(&mut self, dwarf_source_file: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.dwarf_source_file_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.dwarf_source_file.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.dwarf_source_file.write().unwrap().push(None); +_index +}; + +let dwarf_source_file = dwarf_source_file(_index); + +let found = if let Some(dwarf_source_file) = self.dwarf_source_file.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *dwarf_source_file.read().unwrap() +} else { +false +} +}) { +dwarf_source_file.clone() +} else { +None +}; + +if let Some(dwarf_source_file) = found { +tracing::debug!(target: "store", "found duplicate {dwarf_source_file:?}."); +self.dwarf_source_file_free_list.lock().unwrap().push(_index); +dwarf_source_file.clone() +} else { +tracing::debug!(target: "store", "interring {dwarf_source_file:?}."); +self.dwarf_source_file.write().unwrap()[_index] = Some(dwarf_source_file.clone()); +dwarf_source_file +} +} + +/// Exhume (get) [`DwarfSourceFile`] from the store. +/// +#[inline] +pub fn exhume_dwarf_source_file(&self, id: &usize) -> Option>> { +match self.dwarf_source_file.read().unwrap().get(*id) { +Some(dwarf_source_file) => dwarf_source_file.clone(), +None => None +} +} + +/// Exorcise (remove) [`DwarfSourceFile`] from the store. +/// +#[inline] +pub fn exorcise_dwarf_source_file(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising dwarf_source_file slot: {id}."); +let result = self.dwarf_source_file.write().unwrap()[*id].take(); +self.dwarf_source_file_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, DwarfSourceFile>`. +/// +#[inline] +pub fn iter_dwarf_source_file(&self) -> impl Iterator>> + '_ { +let len = self.dwarf_source_file.read().unwrap().len(); +(0..len).filter(|i| self.dwarf_source_file.read().unwrap()[*i].is_some()).map(move|i|{self.dwarf_source_file.read().unwrap()[i].as_ref().map(|dwarf_source_file| dwarf_source_file.clone()).unwrap()}) +} + +/// Inter (insert) [`EnumField`] into the store. +/// +#[inline] +pub fn inter_enum_field(&mut self, enum_field: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.enum_field_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.enum_field.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.enum_field.write().unwrap().push(None); +_index +}; + +let enum_field = enum_field(_index); + +let found = if let Some(enum_field) = self.enum_field.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *enum_field.read().unwrap() +} else { +false +} +}) { +enum_field.clone() +} else { +None +}; + +if let Some(enum_field) = found { +tracing::debug!(target: "store", "found duplicate {enum_field:?}."); +self.enum_field_free_list.lock().unwrap().push(_index); +enum_field.clone() +} else { +tracing::debug!(target: "store", "interring {enum_field:?}."); +self.enum_field.write().unwrap()[_index] = Some(enum_field.clone()); +enum_field +} +} + +/// Exhume (get) [`EnumField`] from the store. +/// +#[inline] +pub fn exhume_enum_field(&self, id: &usize) -> Option>> { +match self.enum_field.read().unwrap().get(*id) { +Some(enum_field) => enum_field.clone(), +None => None +} +} + +/// Exorcise (remove) [`EnumField`] from the store. +/// +#[inline] +pub fn exorcise_enum_field(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising enum_field slot: {id}."); +let result = self.enum_field.write().unwrap()[*id].take(); +self.enum_field_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, EnumField>`. +/// +#[inline] +pub fn iter_enum_field(&self) -> impl Iterator>> + '_ { +let len = self.enum_field.read().unwrap().len(); +(0..len).filter(|i| self.enum_field.read().unwrap()[*i].is_some()).map(move|i|{self.enum_field.read().unwrap()[i].as_ref().map(|enum_field| enum_field.clone()).unwrap()}) +} + +/// Inter (insert) [`EnumGeneric`] into the store. +/// +#[inline] +pub fn inter_enum_generic(&mut self, enum_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.enum_generic_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.enum_generic.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.enum_generic.write().unwrap().push(None); +_index +}; + +let enum_generic = enum_generic(_index); + +let found = if let Some(enum_generic) = self.enum_generic.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *enum_generic.read().unwrap() +} else { +false +} +}) { +enum_generic.clone() +} else { +None +}; + +if let Some(enum_generic) = found { +tracing::debug!(target: "store", "found duplicate {enum_generic:?}."); +self.enum_generic_free_list.lock().unwrap().push(_index); +enum_generic.clone() +} else { +tracing::debug!(target: "store", "interring {enum_generic:?}."); +self.enum_generic.write().unwrap()[_index] = Some(enum_generic.clone()); +enum_generic +} +} + +/// Exhume (get) [`EnumGeneric`] from the store. +/// +#[inline] +pub fn exhume_enum_generic(&self, id: &usize) -> Option>> { +match self.enum_generic.read().unwrap().get(*id) { +Some(enum_generic) => enum_generic.clone(), +None => None +} +} + +/// Exorcise (remove) [`EnumGeneric`] from the store. +/// +#[inline] +pub fn exorcise_enum_generic(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising enum_generic slot: {id}."); +let result = self.enum_generic.write().unwrap()[*id].take(); +self.enum_generic_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, EnumGeneric>`. +/// +#[inline] +pub fn iter_enum_generic(&self) -> impl Iterator>> + '_ { +let len = self.enum_generic.read().unwrap().len(); +(0..len).filter(|i| self.enum_generic.read().unwrap()[*i].is_some()).map(move|i|{self.enum_generic.read().unwrap()[i].as_ref().map(|enum_generic| enum_generic.clone()).unwrap()}) +} + +/// Inter (insert) [`EnumGenericType`] into the store. +/// +#[inline] +pub fn inter_enum_generic_type(&mut self, enum_generic_type: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.enum_generic_type_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.enum_generic_type.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.enum_generic_type.write().unwrap().push(None); +_index +}; + +let enum_generic_type = enum_generic_type(_index); + +let found = if let Some(enum_generic_type) = self.enum_generic_type.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *enum_generic_type.read().unwrap() +} else { +false +} +}) { +enum_generic_type.clone() +} else { +None +}; + +if let Some(enum_generic_type) = found { +tracing::debug!(target: "store", "found duplicate {enum_generic_type:?}."); +self.enum_generic_type_free_list.lock().unwrap().push(_index); +enum_generic_type.clone() +} else { +tracing::debug!(target: "store", "interring {enum_generic_type:?}."); +self.enum_generic_type.write().unwrap()[_index] = Some(enum_generic_type.clone()); +enum_generic_type +} +} + +/// Exhume (get) [`EnumGenericType`] from the store. +/// +#[inline] +pub fn exhume_enum_generic_type(&self, id: &usize) -> Option>> { +match self.enum_generic_type.read().unwrap().get(*id) { +Some(enum_generic_type) => enum_generic_type.clone(), +None => None +} +} + +/// Exorcise (remove) [`EnumGenericType`] from the store. +/// +#[inline] +pub fn exorcise_enum_generic_type(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising enum_generic_type slot: {id}."); +let result = self.enum_generic_type.write().unwrap()[*id].take(); +self.enum_generic_type_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, EnumGenericType>`. +/// +#[inline] +pub fn iter_enum_generic_type(&self) -> impl Iterator>> + '_ { +let len = self.enum_generic_type.read().unwrap().len(); +(0..len).filter(|i| self.enum_generic_type.read().unwrap()[*i].is_some()).map(move|i|{self.enum_generic_type.read().unwrap()[i].as_ref().map(|enum_generic_type| enum_generic_type.clone()).unwrap()}) +} + +/// Inter (insert) [`Enumeration`] into the store. +/// +#[inline] +pub fn inter_enumeration(&mut self, enumeration: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.enumeration_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.enumeration.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.enumeration.write().unwrap().push(None); +_index +}; + +let enumeration = enumeration(_index); + +let found = if let Some(enumeration) = self.enumeration.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *enumeration.read().unwrap() +} else { +false +} +}) { +enumeration.clone() +} else { +None +}; + +let enumeration = +if let Some(enumeration) = found { +tracing::debug!(target: "store", "found duplicate {enumeration:?}."); +self.enumeration_free_list.lock().unwrap().push(_index); +enumeration.clone() +} else { +tracing::debug!(target: "store", "interring {enumeration:?}."); +self.enumeration.write().unwrap()[_index] = Some(enumeration.clone()); +enumeration +} +; +self.enumeration_id_by_name.write().unwrap().insert(enumeration.read().unwrap().name.to_owned(), enumeration.read().unwrap().id); +enumeration +} + +/// Exhume (get) [`Enumeration`] from the store. +/// +#[inline] +pub fn exhume_enumeration(&self, id: &usize) -> Option>> { +match self.enumeration.read().unwrap().get(*id) { +Some(enumeration) => enumeration.clone(), +None => None +} +} + +/// Exorcise (remove) [`Enumeration`] from the store. +/// +#[inline] +pub fn exorcise_enumeration(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising enumeration slot: {id}."); +let result = self.enumeration.write().unwrap()[*id].take(); +self.enumeration_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`Enumeration`] id from the store by name. +/// +#[inline] +pub fn exhume_enumeration_id_by_name(&self, name: &str) -> Option { +self.enumeration_id_by_name.read().unwrap().get(name).map(|enumeration| *enumeration) +} + +/// Get an iterator over the internal `HashMap<&Uuid, Enumeration>`. +/// +#[inline] +pub fn iter_enumeration(&self) -> impl Iterator>> + '_ { +let len = self.enumeration.read().unwrap().len(); +(0..len).filter(|i| self.enumeration.read().unwrap()[*i].is_some()).map(move|i|{self.enumeration.read().unwrap()[i].as_ref().map(|enumeration| enumeration.clone()).unwrap()}) +} + +/// Inter (insert) [`Expression`] into the store. +/// +#[inline] +pub fn inter_expression(&mut self, expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.expression.write().unwrap().push(None); +_index +}; + +let expression = expression(_index); + +let found = if let Some(expression) = self.expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *expression.read().unwrap() +} else { +false +} +}) { +expression.clone() +} else { +None +}; + +if let Some(expression) = found { +tracing::debug!(target: "store", "found duplicate {expression:?}."); +self.expression_free_list.lock().unwrap().push(_index); +expression.clone() +} else { +tracing::debug!(target: "store", "interring {expression:?}."); +self.expression.write().unwrap()[_index] = Some(expression.clone()); +expression +} +} + +/// Exhume (get) [`Expression`] from the store. +/// +#[inline] +pub fn exhume_expression(&self, id: &usize) -> Option>> { +match self.expression.read().unwrap().get(*id) { +Some(expression) => expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`Expression`] from the store. +/// +#[inline] +pub fn exorcise_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising expression slot: {id}."); +let result = self.expression.write().unwrap()[*id].take(); +self.expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Expression>`. +/// +#[inline] +pub fn iter_expression(&self) -> impl Iterator>> + '_ { +let len = self.expression.read().unwrap().len(); +(0..len).filter(|i| self.expression.read().unwrap()[*i].is_some()).map(move|i|{self.expression.read().unwrap()[i].as_ref().map(|expression| expression.clone()).unwrap()}) +} + +/// Inter (insert) [`ExpressionBit`] into the store. +/// +#[inline] +pub fn inter_expression_bit(&mut self, expression_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.expression_bit_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.expression_bit.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.expression_bit.write().unwrap().push(None); +_index +}; + +let expression_bit = expression_bit(_index); + +let found = if let Some(expression_bit) = self.expression_bit.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *expression_bit.read().unwrap() +} else { +false +} +}) { +expression_bit.clone() +} else { +None +}; + +if let Some(expression_bit) = found { +tracing::debug!(target: "store", "found duplicate {expression_bit:?}."); +self.expression_bit_free_list.lock().unwrap().push(_index); +expression_bit.clone() +} else { +tracing::debug!(target: "store", "interring {expression_bit:?}."); +self.expression_bit.write().unwrap()[_index] = Some(expression_bit.clone()); +expression_bit +} +} + +/// Exhume (get) [`ExpressionBit`] from the store. +/// +#[inline] +pub fn exhume_expression_bit(&self, id: &usize) -> Option>> { +match self.expression_bit.read().unwrap().get(*id) { +Some(expression_bit) => expression_bit.clone(), +None => None +} +} + +/// Exorcise (remove) [`ExpressionBit`] from the store. +/// +#[inline] +pub fn exorcise_expression_bit(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising expression_bit slot: {id}."); +let result = self.expression_bit.write().unwrap()[*id].take(); +self.expression_bit_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ExpressionBit>`. +/// +#[inline] +pub fn iter_expression_bit(&self) -> impl Iterator>> + '_ { +let len = self.expression_bit.read().unwrap().len(); +(0..len).filter(|i| self.expression_bit.read().unwrap()[*i].is_some()).map(move|i|{self.expression_bit.read().unwrap()[i].as_ref().map(|expression_bit| expression_bit.clone()).unwrap()}) +} + +/// Inter (insert) [`ExpressionStatement`] into the store. +/// +#[inline] +pub fn inter_expression_statement(&mut self, expression_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.expression_statement_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.expression_statement.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.expression_statement.write().unwrap().push(None); +_index +}; + +let expression_statement = expression_statement(_index); + +let found = if let Some(expression_statement) = self.expression_statement.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *expression_statement.read().unwrap() +} else { +false +} +}) { +expression_statement.clone() +} else { +None +}; + +if let Some(expression_statement) = found { +tracing::debug!(target: "store", "found duplicate {expression_statement:?}."); +self.expression_statement_free_list.lock().unwrap().push(_index); +expression_statement.clone() +} else { +tracing::debug!(target: "store", "interring {expression_statement:?}."); +self.expression_statement.write().unwrap()[_index] = Some(expression_statement.clone()); +expression_statement +} +} + +/// Exhume (get) [`ExpressionStatement`] from the store. +/// +#[inline] +pub fn exhume_expression_statement(&self, id: &usize) -> Option>> { +match self.expression_statement.read().unwrap().get(*id) { +Some(expression_statement) => expression_statement.clone(), +None => None +} +} + +/// Exorcise (remove) [`ExpressionStatement`] from the store. +/// +#[inline] +pub fn exorcise_expression_statement(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising expression_statement slot: {id}."); +let result = self.expression_statement.write().unwrap()[*id].take(); +self.expression_statement_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ExpressionStatement>`. +/// +#[inline] +pub fn iter_expression_statement(&self) -> impl Iterator>> + '_ { +let len = self.expression_statement.read().unwrap().len(); +(0..len).filter(|i| self.expression_statement.read().unwrap()[*i].is_some()).map(move|i|{self.expression_statement.read().unwrap()[i].as_ref().map(|expression_statement| expression_statement.clone()).unwrap()}) +} + +/// Inter (insert) [`ExternalImplementation`] into the store. +/// +#[inline] +pub fn inter_external_implementation(&mut self, external_implementation: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.external_implementation_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.external_implementation.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.external_implementation.write().unwrap().push(None); +_index +}; + +let external_implementation = external_implementation(_index); + +let found = if let Some(external_implementation) = self.external_implementation.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *external_implementation.read().unwrap() +} else { +false +} +}) { +external_implementation.clone() +} else { +None +}; + +if let Some(external_implementation) = found { +tracing::debug!(target: "store", "found duplicate {external_implementation:?}."); +self.external_implementation_free_list.lock().unwrap().push(_index); +external_implementation.clone() +} else { +tracing::debug!(target: "store", "interring {external_implementation:?}."); +self.external_implementation.write().unwrap()[_index] = Some(external_implementation.clone()); +external_implementation +} +} + +/// Exhume (get) [`ExternalImplementation`] from the store. +/// +#[inline] +pub fn exhume_external_implementation(&self, id: &usize) -> Option>> { +match self.external_implementation.read().unwrap().get(*id) { +Some(external_implementation) => external_implementation.clone(), +None => None +} +} + +/// Exorcise (remove) [`ExternalImplementation`] from the store. +/// +#[inline] +pub fn exorcise_external_implementation(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising external_implementation slot: {id}."); +let result = self.external_implementation.write().unwrap()[*id].take(); +self.external_implementation_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ExternalImplementation>`. +/// +#[inline] +pub fn iter_external_implementation(&self) -> impl Iterator>> + '_ { +let len = self.external_implementation.read().unwrap().len(); +(0..len).filter(|i| self.external_implementation.read().unwrap()[*i].is_some()).map(move|i|{self.external_implementation.read().unwrap()[i].as_ref().map(|external_implementation| external_implementation.clone()).unwrap()}) +} + +/// Inter (insert) [`Field`] into the store. +/// +#[inline] +pub fn inter_field(&mut self, field: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.field_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.field.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.field.write().unwrap().push(None); +_index +}; + +let field = field(_index); + +let found = if let Some(field) = self.field.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *field.read().unwrap() +} else { +false +} +}) { +field.clone() +} else { +None +}; + +let field = +if let Some(field) = found { +tracing::debug!(target: "store", "found duplicate {field:?}."); +self.field_free_list.lock().unwrap().push(_index); +field.clone() +} else { +tracing::debug!(target: "store", "interring {field:?}."); +self.field.write().unwrap()[_index] = Some(field.clone()); +field +} +; +self.field_id_by_name.write().unwrap().insert(field.read().unwrap().name.to_owned(), field.read().unwrap().id); +field +} + +/// Exhume (get) [`Field`] from the store. +/// +#[inline] +pub fn exhume_field(&self, id: &usize) -> Option>> { +match self.field.read().unwrap().get(*id) { +Some(field) => field.clone(), +None => None +} +} + +/// Exorcise (remove) [`Field`] from the store. +/// +#[inline] +pub fn exorcise_field(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising field slot: {id}."); +let result = self.field.write().unwrap()[*id].take(); +self.field_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`Field`] id from the store by name. +/// +#[inline] +pub fn exhume_field_id_by_name(&self, name: &str) -> Option { +self.field_id_by_name.read().unwrap().get(name).map(|field| *field) +} + +/// Get an iterator over the internal `HashMap<&Uuid, Field>`. +/// +#[inline] +pub fn iter_field(&self) -> impl Iterator>> + '_ { +let len = self.field.read().unwrap().len(); +(0..len).filter(|i| self.field.read().unwrap()[*i].is_some()).map(move|i|{self.field.read().unwrap()[i].as_ref().map(|field| field.clone()).unwrap()}) +} + +/// Inter (insert) [`FieldAccess`] into the store. +/// +#[inline] +pub fn inter_field_access(&mut self, field_access: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.field_access_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.field_access.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.field_access.write().unwrap().push(None); +_index +}; + +let field_access = field_access(_index); + +let found = if let Some(field_access) = self.field_access.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *field_access.read().unwrap() +} else { +false +} +}) { +field_access.clone() +} else { +None +}; + +if let Some(field_access) = found { +tracing::debug!(target: "store", "found duplicate {field_access:?}."); +self.field_access_free_list.lock().unwrap().push(_index); +field_access.clone() +} else { +tracing::debug!(target: "store", "interring {field_access:?}."); +self.field_access.write().unwrap()[_index] = Some(field_access.clone()); +field_access +} +} + +/// Exhume (get) [`FieldAccess`] from the store. +/// +#[inline] +pub fn exhume_field_access(&self, id: &usize) -> Option>> { +match self.field_access.read().unwrap().get(*id) { +Some(field_access) => field_access.clone(), +None => None +} +} + +/// Exorcise (remove) [`FieldAccess`] from the store. +/// +#[inline] +pub fn exorcise_field_access(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising field_access slot: {id}."); +let result = self.field_access.write().unwrap()[*id].take(); +self.field_access_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FieldAccess>`. +/// +#[inline] +pub fn iter_field_access(&self) -> impl Iterator>> + '_ { +let len = self.field_access.read().unwrap().len(); +(0..len).filter(|i| self.field_access.read().unwrap()[*i].is_some()).map(move|i|{self.field_access.read().unwrap()[i].as_ref().map(|field_access| field_access.clone()).unwrap()}) +} + +/// Inter (insert) [`FieldAccessTarget`] into the store. +/// +#[inline] +pub fn inter_field_access_target(&mut self, field_access_target: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.field_access_target_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.field_access_target.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.field_access_target.write().unwrap().push(None); +_index +}; + +let field_access_target = field_access_target(_index); + +let found = if let Some(field_access_target) = self.field_access_target.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *field_access_target.read().unwrap() +} else { +false +} +}) { +field_access_target.clone() +} else { +None +}; + +if let Some(field_access_target) = found { +tracing::debug!(target: "store", "found duplicate {field_access_target:?}."); +self.field_access_target_free_list.lock().unwrap().push(_index); +field_access_target.clone() +} else { +tracing::debug!(target: "store", "interring {field_access_target:?}."); +self.field_access_target.write().unwrap()[_index] = Some(field_access_target.clone()); +field_access_target +} +} + +/// Exhume (get) [`FieldAccessTarget`] from the store. +/// +#[inline] +pub fn exhume_field_access_target(&self, id: &usize) -> Option>> { +match self.field_access_target.read().unwrap().get(*id) { +Some(field_access_target) => field_access_target.clone(), +None => None +} +} + +/// Exorcise (remove) [`FieldAccessTarget`] from the store. +/// +#[inline] +pub fn exorcise_field_access_target(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising field_access_target slot: {id}."); +let result = self.field_access_target.write().unwrap()[*id].take(); +self.field_access_target_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FieldAccessTarget>`. +/// +#[inline] +pub fn iter_field_access_target(&self) -> impl Iterator>> + '_ { +let len = self.field_access_target.read().unwrap().len(); +(0..len).filter(|i| self.field_access_target.read().unwrap()[*i].is_some()).map(move|i|{self.field_access_target.read().unwrap()[i].as_ref().map(|field_access_target| field_access_target.clone()).unwrap()}) +} + +/// Inter (insert) [`FieldExpression`] into the store. +/// +#[inline] +pub fn inter_field_expression(&mut self, field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.field_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.field_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.field_expression.write().unwrap().push(None); +_index +}; + +let field_expression = field_expression(_index); + +let found = if let Some(field_expression) = self.field_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *field_expression.read().unwrap() +} else { +false +} +}) { +field_expression.clone() +} else { +None +}; + +if let Some(field_expression) = found { +tracing::debug!(target: "store", "found duplicate {field_expression:?}."); +self.field_expression_free_list.lock().unwrap().push(_index); +field_expression.clone() +} else { +tracing::debug!(target: "store", "interring {field_expression:?}."); +self.field_expression.write().unwrap()[_index] = Some(field_expression.clone()); +field_expression +} +} + +/// Exhume (get) [`FieldExpression`] from the store. +/// +#[inline] +pub fn exhume_field_expression(&self, id: &usize) -> Option>> { +match self.field_expression.read().unwrap().get(*id) { +Some(field_expression) => field_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`FieldExpression`] from the store. +/// +#[inline] +pub fn exorcise_field_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising field_expression slot: {id}."); +let result = self.field_expression.write().unwrap()[*id].take(); +self.field_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FieldExpression>`. +/// +#[inline] +pub fn iter_field_expression(&self) -> impl Iterator>> + '_ { +let len = self.field_expression.read().unwrap().len(); +(0..len).filter(|i| self.field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.field_expression.read().unwrap()[i].as_ref().map(|field_expression| field_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`FloatLiteral`] into the store. +/// +#[inline] +pub fn inter_float_literal(&mut self, float_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.float_literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.float_literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.float_literal.write().unwrap().push(None); +_index +}; + +let float_literal = float_literal(_index); + +let found = if let Some(float_literal) = self.float_literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *float_literal.read().unwrap() +} else { +false +} +}) { +float_literal.clone() +} else { +None +}; + +if let Some(float_literal) = found { +tracing::debug!(target: "store", "found duplicate {float_literal:?}."); +self.float_literal_free_list.lock().unwrap().push(_index); +float_literal.clone() +} else { +tracing::debug!(target: "store", "interring {float_literal:?}."); +self.float_literal.write().unwrap()[_index] = Some(float_literal.clone()); +float_literal +} +} + +/// Exhume (get) [`FloatLiteral`] from the store. +/// +#[inline] +pub fn exhume_float_literal(&self, id: &usize) -> Option>> { +match self.float_literal.read().unwrap().get(*id) { +Some(float_literal) => float_literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`FloatLiteral`] from the store. +/// +#[inline] +pub fn exorcise_float_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising float_literal slot: {id}."); +let result = self.float_literal.write().unwrap()[*id].take(); +self.float_literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FloatLiteral>`. +/// +#[inline] +pub fn iter_float_literal(&self) -> impl Iterator>> + '_ { +let len = self.float_literal.read().unwrap().len(); +(0..len).filter(|i| self.float_literal.read().unwrap()[*i].is_some()).map(move|i|{self.float_literal.read().unwrap()[i].as_ref().map(|float_literal| float_literal.clone()).unwrap()}) +} + +/// Inter (insert) [`ForLoop`] into the store. +/// +#[inline] +pub fn inter_for_loop(&mut self, for_loop: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.for_loop_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.for_loop.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.for_loop.write().unwrap().push(None); +_index +}; + +let for_loop = for_loop(_index); + +let found = if let Some(for_loop) = self.for_loop.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *for_loop.read().unwrap() +} else { +false +} +}) { +for_loop.clone() +} else { +None +}; + +if let Some(for_loop) = found { +tracing::debug!(target: "store", "found duplicate {for_loop:?}."); +self.for_loop_free_list.lock().unwrap().push(_index); +for_loop.clone() +} else { +tracing::debug!(target: "store", "interring {for_loop:?}."); +self.for_loop.write().unwrap()[_index] = Some(for_loop.clone()); +for_loop +} +} + +/// Exhume (get) [`ForLoop`] from the store. +/// +#[inline] +pub fn exhume_for_loop(&self, id: &usize) -> Option>> { +match self.for_loop.read().unwrap().get(*id) { +Some(for_loop) => for_loop.clone(), +None => None +} +} + +/// Exorcise (remove) [`ForLoop`] from the store. +/// +#[inline] +pub fn exorcise_for_loop(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising for_loop slot: {id}."); +let result = self.for_loop.write().unwrap()[*id].take(); +self.for_loop_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ForLoop>`. +/// +#[inline] +pub fn iter_for_loop(&self) -> impl Iterator>> + '_ { +let len = self.for_loop.read().unwrap().len(); +(0..len).filter(|i| self.for_loop.read().unwrap()[*i].is_some()).map(move|i|{self.for_loop.read().unwrap()[i].as_ref().map(|for_loop| for_loop.clone()).unwrap()}) +} + +/// Inter (insert) [`FormatBit`] into the store. +/// +#[inline] +pub fn inter_format_bit(&mut self, format_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.format_bit_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.format_bit.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.format_bit.write().unwrap().push(None); +_index +}; + +let format_bit = format_bit(_index); + +let found = if let Some(format_bit) = self.format_bit.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *format_bit.read().unwrap() +} else { +false +} +}) { +format_bit.clone() +} else { +None +}; + +if let Some(format_bit) = found { +tracing::debug!(target: "store", "found duplicate {format_bit:?}."); +self.format_bit_free_list.lock().unwrap().push(_index); +format_bit.clone() +} else { +tracing::debug!(target: "store", "interring {format_bit:?}."); +self.format_bit.write().unwrap()[_index] = Some(format_bit.clone()); +format_bit +} +} + +/// Exhume (get) [`FormatBit`] from the store. +/// +#[inline] +pub fn exhume_format_bit(&self, id: &usize) -> Option>> { +match self.format_bit.read().unwrap().get(*id) { +Some(format_bit) => format_bit.clone(), +None => None +} +} + +/// Exorcise (remove) [`FormatBit`] from the store. +/// +#[inline] +pub fn exorcise_format_bit(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising format_bit slot: {id}."); +let result = self.format_bit.write().unwrap()[*id].take(); +self.format_bit_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FormatBit>`. +/// +#[inline] +pub fn iter_format_bit(&self) -> impl Iterator>> + '_ { +let len = self.format_bit.read().unwrap().len(); +(0..len).filter(|i| self.format_bit.read().unwrap()[*i].is_some()).map(move|i|{self.format_bit.read().unwrap()[i].as_ref().map(|format_bit| format_bit.clone()).unwrap()}) +} + +/// Inter (insert) [`FormatString`] into the store. +/// +#[inline] +pub fn inter_format_string(&mut self, format_string: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.format_string_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.format_string.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.format_string.write().unwrap().push(None); +_index +}; + +let format_string = format_string(_index); + +let found = if let Some(format_string) = self.format_string.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *format_string.read().unwrap() +} else { +false +} +}) { +format_string.clone() +} else { +None +}; + +if let Some(format_string) = found { +tracing::debug!(target: "store", "found duplicate {format_string:?}."); +self.format_string_free_list.lock().unwrap().push(_index); +format_string.clone() +} else { +tracing::debug!(target: "store", "interring {format_string:?}."); +self.format_string.write().unwrap()[_index] = Some(format_string.clone()); +format_string +} +} + +/// Exhume (get) [`FormatString`] from the store. +/// +#[inline] +pub fn exhume_format_string(&self, id: &usize) -> Option>> { +match self.format_string.read().unwrap().get(*id) { +Some(format_string) => format_string.clone(), +None => None +} +} + +/// Exorcise (remove) [`FormatString`] from the store. +/// +#[inline] +pub fn exorcise_format_string(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising format_string slot: {id}."); +let result = self.format_string.write().unwrap()[*id].take(); +self.format_string_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FormatString>`. +/// +#[inline] +pub fn iter_format_string(&self) -> impl Iterator>> + '_ { +let len = self.format_string.read().unwrap().len(); +(0..len).filter(|i| self.format_string.read().unwrap()[*i].is_some()).map(move|i|{self.format_string.read().unwrap()[i].as_ref().map(|format_string| format_string.clone()).unwrap()}) +} + +/// Inter (insert) [`FuncGeneric`] into the store. +/// +#[inline] +pub fn inter_func_generic(&mut self, func_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.func_generic_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.func_generic.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.func_generic.write().unwrap().push(None); +_index +}; + +let func_generic = func_generic(_index); + +let found = if let Some(func_generic) = self.func_generic.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *func_generic.read().unwrap() +} else { +false +} +}) { +func_generic.clone() +} else { +None +}; + +if let Some(func_generic) = found { +tracing::debug!(target: "store", "found duplicate {func_generic:?}."); +self.func_generic_free_list.lock().unwrap().push(_index); +func_generic.clone() +} else { +tracing::debug!(target: "store", "interring {func_generic:?}."); +self.func_generic.write().unwrap()[_index] = Some(func_generic.clone()); +func_generic +} +} + +/// Exhume (get) [`FuncGeneric`] from the store. +/// +#[inline] +pub fn exhume_func_generic(&self, id: &usize) -> Option>> { +match self.func_generic.read().unwrap().get(*id) { +Some(func_generic) => func_generic.clone(), +None => None +} +} + +/// Exorcise (remove) [`FuncGeneric`] from the store. +/// +#[inline] +pub fn exorcise_func_generic(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising func_generic slot: {id}."); +let result = self.func_generic.write().unwrap()[*id].take(); +self.func_generic_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FuncGeneric>`. +/// +#[inline] +pub fn iter_func_generic(&self) -> impl Iterator>> + '_ { +let len = self.func_generic.read().unwrap().len(); +(0..len).filter(|i| self.func_generic.read().unwrap()[*i].is_some()).map(move|i|{self.func_generic.read().unwrap()[i].as_ref().map(|func_generic| func_generic.clone()).unwrap()}) +} + +/// Inter (insert) [`Function`] into the store. +/// +#[inline] +pub fn inter_function(&mut self, function: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.function_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.function.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.function.write().unwrap().push(None); +_index +}; + +let function = function(_index); + +let found = if let Some(function) = self.function.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *function.read().unwrap() +} else { +false +} +}) { +function.clone() +} else { +None +}; + +let function = +if let Some(function) = found { +tracing::debug!(target: "store", "found duplicate {function:?}."); +self.function_free_list.lock().unwrap().push(_index); +function.clone() +} else { +tracing::debug!(target: "store", "interring {function:?}."); +self.function.write().unwrap()[_index] = Some(function.clone()); +function +} +; +self.function_id_by_name.write().unwrap().insert(function.read().unwrap().name.to_owned(), function.read().unwrap().id); +function +} + +/// Exhume (get) [`Function`] from the store. +/// +#[inline] +pub fn exhume_function(&self, id: &usize) -> Option>> { +match self.function.read().unwrap().get(*id) { +Some(function) => function.clone(), +None => None +} +} + +/// Exorcise (remove) [`Function`] from the store. +/// +#[inline] +pub fn exorcise_function(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising function slot: {id}."); +let result = self.function.write().unwrap()[*id].take(); +self.function_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`Function`] id from the store by name. +/// +#[inline] +pub fn exhume_function_id_by_name(&self, name: &str) -> Option { +self.function_id_by_name.read().unwrap().get(name).map(|function| *function) +} + +/// Get an iterator over the internal `HashMap<&Uuid, Function>`. +/// +#[inline] +pub fn iter_function(&self) -> impl Iterator>> + '_ { +let len = self.function.read().unwrap().len(); +(0..len).filter(|i| self.function.read().unwrap()[*i].is_some()).map(move|i|{self.function.read().unwrap()[i].as_ref().map(|function| function.clone()).unwrap()}) +} + +/// Inter (insert) [`FunctionCall`] into the store. +/// +#[inline] +pub fn inter_function_call(&mut self, function_call: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.function_call_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.function_call.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.function_call.write().unwrap().push(None); +_index +}; + +let function_call = function_call(_index); + +let found = if let Some(function_call) = self.function_call.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *function_call.read().unwrap() +} else { +false +} +}) { +function_call.clone() +} else { +None +}; + +if let Some(function_call) = found { +tracing::debug!(target: "store", "found duplicate {function_call:?}."); +self.function_call_free_list.lock().unwrap().push(_index); +function_call.clone() +} else { +tracing::debug!(target: "store", "interring {function_call:?}."); +self.function_call.write().unwrap()[_index] = Some(function_call.clone()); +function_call +} +} + +/// Exhume (get) [`FunctionCall`] from the store. +/// +#[inline] +pub fn exhume_function_call(&self, id: &usize) -> Option>> { +match self.function_call.read().unwrap().get(*id) { +Some(function_call) => function_call.clone(), +None => None +} +} + +/// Exorcise (remove) [`FunctionCall`] from the store. +/// +#[inline] +pub fn exorcise_function_call(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising function_call slot: {id}."); +let result = self.function_call.write().unwrap()[*id].take(); +self.function_call_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, FunctionCall>`. +/// +#[inline] +pub fn iter_function_call(&self) -> impl Iterator>> + '_ { +let len = self.function_call.read().unwrap().len(); +(0..len).filter(|i| self.function_call.read().unwrap()[*i].is_some()).map(move|i|{self.function_call.read().unwrap()[i].as_ref().map(|function_call| function_call.clone()).unwrap()}) +} + +/// Inter (insert) [`XFuture`] into the store. +/// +#[inline] +pub fn inter_x_future(&mut self, x_future: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_future_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_future.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_future.write().unwrap().push(None); +_index +}; + +let x_future = x_future(_index); + +let found = if let Some(x_future) = self.x_future.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_future.read().unwrap() +} else { +false +} +}) { +x_future.clone() +} else { +None +}; + +if let Some(x_future) = found { +tracing::debug!(target: "store", "found duplicate {x_future:?}."); +self.x_future_free_list.lock().unwrap().push(_index); +x_future.clone() +} else { +tracing::debug!(target: "store", "interring {x_future:?}."); +self.x_future.write().unwrap()[_index] = Some(x_future.clone()); +x_future +} +} + +/// Exhume (get) [`XFuture`] from the store. +/// +#[inline] +pub fn exhume_x_future(&self, id: &usize) -> Option>> { +match self.x_future.read().unwrap().get(*id) { +Some(x_future) => x_future.clone(), +None => None +} +} + +/// Exorcise (remove) [`XFuture`] from the store. +/// +#[inline] +pub fn exorcise_x_future(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_future slot: {id}."); +let result = self.x_future.write().unwrap()[*id].take(); +self.x_future_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XFuture>`. +/// +#[inline] +pub fn iter_x_future(&self) -> impl Iterator>> + '_ { +let len = self.x_future.read().unwrap().len(); +(0..len).filter(|i| self.x_future.read().unwrap()[*i].is_some()).map(move|i|{self.x_future.read().unwrap()[i].as_ref().map(|x_future| x_future.clone()).unwrap()}) +} + +/// Inter (insert) [`Grouped`] into the store. +/// +#[inline] +pub fn inter_grouped(&mut self, grouped: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.grouped_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.grouped.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.grouped.write().unwrap().push(None); +_index +}; + +let grouped = grouped(_index); + +let found = if let Some(grouped) = self.grouped.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *grouped.read().unwrap() +} else { +false +} +}) { +grouped.clone() +} else { +None +}; + +if let Some(grouped) = found { +tracing::debug!(target: "store", "found duplicate {grouped:?}."); +self.grouped_free_list.lock().unwrap().push(_index); +grouped.clone() +} else { +tracing::debug!(target: "store", "interring {grouped:?}."); +self.grouped.write().unwrap()[_index] = Some(grouped.clone()); +grouped +} +} + +/// Exhume (get) [`Grouped`] from the store. +/// +#[inline] +pub fn exhume_grouped(&self, id: &usize) -> Option>> { +match self.grouped.read().unwrap().get(*id) { +Some(grouped) => grouped.clone(), +None => None +} +} + +/// Exorcise (remove) [`Grouped`] from the store. +/// +#[inline] +pub fn exorcise_grouped(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising grouped slot: {id}."); +let result = self.grouped.write().unwrap()[*id].take(); +self.grouped_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Grouped>`. +/// +#[inline] +pub fn iter_grouped(&self) -> impl Iterator>> + '_ { +let len = self.grouped.read().unwrap().len(); +(0..len).filter(|i| self.grouped.read().unwrap()[*i].is_some()).map(move|i|{self.grouped.read().unwrap()[i].as_ref().map(|grouped| grouped.clone()).unwrap()}) +} + +/// Inter (insert) [`HaltAndCatchFire`] into the store. +/// +#[inline] +pub fn inter_halt_and_catch_fire(&mut self, halt_and_catch_fire: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.halt_and_catch_fire_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.halt_and_catch_fire.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.halt_and_catch_fire.write().unwrap().push(None); +_index +}; + +let halt_and_catch_fire = halt_and_catch_fire(_index); + +let found = if let Some(halt_and_catch_fire) = self.halt_and_catch_fire.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *halt_and_catch_fire.read().unwrap() +} else { +false +} +}) { +halt_and_catch_fire.clone() +} else { +None +}; + +if let Some(halt_and_catch_fire) = found { +tracing::debug!(target: "store", "found duplicate {halt_and_catch_fire:?}."); +self.halt_and_catch_fire_free_list.lock().unwrap().push(_index); +halt_and_catch_fire.clone() +} else { +tracing::debug!(target: "store", "interring {halt_and_catch_fire:?}."); +self.halt_and_catch_fire.write().unwrap()[_index] = Some(halt_and_catch_fire.clone()); +halt_and_catch_fire +} +} + +/// Exhume (get) [`HaltAndCatchFire`] from the store. +/// +#[inline] +pub fn exhume_halt_and_catch_fire(&self, id: &usize) -> Option>> { +match self.halt_and_catch_fire.read().unwrap().get(*id) { +Some(halt_and_catch_fire) => halt_and_catch_fire.clone(), +None => None +} +} + +/// Exorcise (remove) [`HaltAndCatchFire`] from the store. +/// +#[inline] +pub fn exorcise_halt_and_catch_fire(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising halt_and_catch_fire slot: {id}."); +let result = self.halt_and_catch_fire.write().unwrap()[*id].take(); +self.halt_and_catch_fire_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, HaltAndCatchFire>`. +/// +#[inline] +pub fn iter_halt_and_catch_fire(&self) -> impl Iterator>> + '_ { +let len = self.halt_and_catch_fire.read().unwrap().len(); +(0..len).filter(|i| self.halt_and_catch_fire.read().unwrap()[*i].is_some()).map(move|i|{self.halt_and_catch_fire.read().unwrap()[i].as_ref().map(|halt_and_catch_fire| halt_and_catch_fire.clone()).unwrap()}) +} + +/// Inter (insert) [`XIf`] into the store. +/// +#[inline] +pub fn inter_x_if(&mut self, x_if: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_if_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_if.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_if.write().unwrap().push(None); +_index +}; + +let x_if = x_if(_index); + +let found = if let Some(x_if) = self.x_if.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_if.read().unwrap() +} else { +false +} +}) { +x_if.clone() +} else { +None +}; + +if let Some(x_if) = found { +tracing::debug!(target: "store", "found duplicate {x_if:?}."); +self.x_if_free_list.lock().unwrap().push(_index); +x_if.clone() +} else { +tracing::debug!(target: "store", "interring {x_if:?}."); +self.x_if.write().unwrap()[_index] = Some(x_if.clone()); +x_if +} +} + +/// Exhume (get) [`XIf`] from the store. +/// +#[inline] +pub fn exhume_x_if(&self, id: &usize) -> Option>> { +match self.x_if.read().unwrap().get(*id) { +Some(x_if) => x_if.clone(), +None => None +} +} + +/// Exorcise (remove) [`XIf`] from the store. +/// +#[inline] +pub fn exorcise_x_if(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_if slot: {id}."); +let result = self.x_if.write().unwrap()[*id].take(); +self.x_if_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XIf>`. +/// +#[inline] +pub fn iter_x_if(&self) -> impl Iterator>> + '_ { +let len = self.x_if.read().unwrap().len(); +(0..len).filter(|i| self.x_if.read().unwrap()[*i].is_some()).map(move|i|{self.x_if.read().unwrap()[i].as_ref().map(|x_if| x_if.clone()).unwrap()}) +} + +/// Inter (insert) [`ImplementationBlock`] into the store. +/// +#[inline] +pub fn inter_implementation_block(&mut self, implementation_block: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.implementation_block_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.implementation_block.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.implementation_block.write().unwrap().push(None); +_index +}; + +let implementation_block = implementation_block(_index); + +let found = if let Some(implementation_block) = self.implementation_block.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *implementation_block.read().unwrap() +} else { +false +} +}) { +implementation_block.clone() +} else { +None +}; + +if let Some(implementation_block) = found { +tracing::debug!(target: "store", "found duplicate {implementation_block:?}."); +self.implementation_block_free_list.lock().unwrap().push(_index); +implementation_block.clone() +} else { +tracing::debug!(target: "store", "interring {implementation_block:?}."); +self.implementation_block.write().unwrap()[_index] = Some(implementation_block.clone()); +implementation_block +} +} + +/// Exhume (get) [`ImplementationBlock`] from the store. +/// +#[inline] +pub fn exhume_implementation_block(&self, id: &usize) -> Option>> { +match self.implementation_block.read().unwrap().get(*id) { +Some(implementation_block) => implementation_block.clone(), +None => None +} +} + +/// Exorcise (remove) [`ImplementationBlock`] from the store. +/// +#[inline] +pub fn exorcise_implementation_block(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising implementation_block slot: {id}."); +let result = self.implementation_block.write().unwrap()[*id].take(); +self.implementation_block_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ImplementationBlock>`. +/// +#[inline] +pub fn iter_implementation_block(&self) -> impl Iterator>> + '_ { +let len = self.implementation_block.read().unwrap().len(); +(0..len).filter(|i| self.implementation_block.read().unwrap()[*i].is_some()).map(move|i|{self.implementation_block.read().unwrap()[i].as_ref().map(|implementation_block| implementation_block.clone()).unwrap()}) +} + +/// Inter (insert) [`Import`] into the store. +/// +#[inline] +pub fn inter_import(&mut self, import: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.import_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.import.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.import.write().unwrap().push(None); +_index +}; + +let import = import(_index); + +let found = if let Some(import) = self.import.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *import.read().unwrap() +} else { +false +} +}) { +import.clone() +} else { +None +}; + +if let Some(import) = found { +tracing::debug!(target: "store", "found duplicate {import:?}."); +self.import_free_list.lock().unwrap().push(_index); +import.clone() +} else { +tracing::debug!(target: "store", "interring {import:?}."); +self.import.write().unwrap()[_index] = Some(import.clone()); +import +} +} + +/// Exhume (get) [`Import`] from the store. +/// +#[inline] +pub fn exhume_import(&self, id: &usize) -> Option>> { +match self.import.read().unwrap().get(*id) { +Some(import) => import.clone(), +None => None +} +} + +/// Exorcise (remove) [`Import`] from the store. +/// +#[inline] +pub fn exorcise_import(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising import slot: {id}."); +let result = self.import.write().unwrap()[*id].take(); +self.import_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Import>`. +/// +#[inline] +pub fn iter_import(&self) -> impl Iterator>> + '_ { +let len = self.import.read().unwrap().len(); +(0..len).filter(|i| self.import.read().unwrap()[*i].is_some()).map(move|i|{self.import.read().unwrap()[i].as_ref().map(|import| import.clone()).unwrap()}) +} + +/// Inter (insert) [`Index`] into the store. +/// +#[inline] +pub fn inter_index(&mut self, index: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.index_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.index.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.index.write().unwrap().push(None); +_index +}; + +let index = index(_index); + +let found = if let Some(index) = self.index.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *index.read().unwrap() +} else { +false +} +}) { +index.clone() +} else { +None +}; + +if let Some(index) = found { +tracing::debug!(target: "store", "found duplicate {index:?}."); +self.index_free_list.lock().unwrap().push(_index); +index.clone() +} else { +tracing::debug!(target: "store", "interring {index:?}."); +self.index.write().unwrap()[_index] = Some(index.clone()); +index +} +} + +/// Exhume (get) [`Index`] from the store. +/// +#[inline] +pub fn exhume_index(&self, id: &usize) -> Option>> { +match self.index.read().unwrap().get(*id) { +Some(index) => index.clone(), +None => None +} +} + +/// Exorcise (remove) [`Index`] from the store. +/// +#[inline] +pub fn exorcise_index(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising index slot: {id}."); +let result = self.index.write().unwrap()[*id].take(); +self.index_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Index>`. +/// +#[inline] +pub fn iter_index(&self) -> impl Iterator>> + '_ { +let len = self.index.read().unwrap().len(); +(0..len).filter(|i| self.index.read().unwrap()[*i].is_some()).map(move|i|{self.index.read().unwrap()[i].as_ref().map(|index| index.clone()).unwrap()}) +} + +/// Inter (insert) [`IntegerLiteral`] into the store. +/// +#[inline] +pub fn inter_integer_literal(&mut self, integer_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.integer_literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.integer_literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.integer_literal.write().unwrap().push(None); +_index +}; + +let integer_literal = integer_literal(_index); + +let found = if let Some(integer_literal) = self.integer_literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *integer_literal.read().unwrap() +} else { +false +} +}) { +integer_literal.clone() +} else { +None +}; + +if let Some(integer_literal) = found { +tracing::debug!(target: "store", "found duplicate {integer_literal:?}."); +self.integer_literal_free_list.lock().unwrap().push(_index); +integer_literal.clone() +} else { +tracing::debug!(target: "store", "interring {integer_literal:?}."); +self.integer_literal.write().unwrap()[_index] = Some(integer_literal.clone()); +integer_literal +} +} + +/// Exhume (get) [`IntegerLiteral`] from the store. +/// +#[inline] +pub fn exhume_integer_literal(&self, id: &usize) -> Option>> { +match self.integer_literal.read().unwrap().get(*id) { +Some(integer_literal) => integer_literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`IntegerLiteral`] from the store. +/// +#[inline] +pub fn exorcise_integer_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising integer_literal slot: {id}."); +let result = self.integer_literal.write().unwrap()[*id].take(); +self.integer_literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, IntegerLiteral>`. +/// +#[inline] +pub fn iter_integer_literal(&self) -> impl Iterator>> + '_ { +let len = self.integer_literal.read().unwrap().len(); +(0..len).filter(|i| self.integer_literal.read().unwrap()[*i].is_some()).map(move|i|{self.integer_literal.read().unwrap()[i].as_ref().map(|integer_literal| integer_literal.clone()).unwrap()}) +} + +/// Inter (insert) [`Item`] into the store. +/// +#[inline] +pub fn inter_item(&mut self, item: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.item_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.item.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.item.write().unwrap().push(None); +_index +}; + +let item = item(_index); + +let found = if let Some(item) = self.item.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *item.read().unwrap() +} else { +false +} +}) { +item.clone() +} else { +None +}; + +if let Some(item) = found { +tracing::debug!(target: "store", "found duplicate {item:?}."); +self.item_free_list.lock().unwrap().push(_index); +item.clone() +} else { +tracing::debug!(target: "store", "interring {item:?}."); +self.item.write().unwrap()[_index] = Some(item.clone()); +item +} +} + +/// Exhume (get) [`Item`] from the store. +/// +#[inline] +pub fn exhume_item(&self, id: &usize) -> Option>> { +match self.item.read().unwrap().get(*id) { +Some(item) => item.clone(), +None => None +} +} + +/// Exorcise (remove) [`Item`] from the store. +/// +#[inline] +pub fn exorcise_item(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising item slot: {id}."); +let result = self.item.write().unwrap()[*id].take(); +self.item_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Item>`. +/// +#[inline] +pub fn iter_item(&self) -> impl Iterator>> + '_ { +let len = self.item.read().unwrap().len(); +(0..len).filter(|i| self.item.read().unwrap()[*i].is_some()).map(move|i|{self.item.read().unwrap()[i].as_ref().map(|item| item.clone()).unwrap()}) +} + +/// Inter (insert) [`Lambda`] into the store. +/// +#[inline] +pub fn inter_lambda(&mut self, lambda: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.lambda_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.lambda.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.lambda.write().unwrap().push(None); +_index +}; + +let lambda = lambda(_index); + +let found = if let Some(lambda) = self.lambda.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *lambda.read().unwrap() +} else { +false +} +}) { +lambda.clone() +} else { +None +}; + +if let Some(lambda) = found { +tracing::debug!(target: "store", "found duplicate {lambda:?}."); +self.lambda_free_list.lock().unwrap().push(_index); +lambda.clone() +} else { +tracing::debug!(target: "store", "interring {lambda:?}."); +self.lambda.write().unwrap()[_index] = Some(lambda.clone()); +lambda +} +} + +/// Exhume (get) [`Lambda`] from the store. +/// +#[inline] +pub fn exhume_lambda(&self, id: &usize) -> Option>> { +match self.lambda.read().unwrap().get(*id) { +Some(lambda) => lambda.clone(), +None => None +} +} + +/// Exorcise (remove) [`Lambda`] from the store. +/// +#[inline] +pub fn exorcise_lambda(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising lambda slot: {id}."); +let result = self.lambda.write().unwrap()[*id].take(); +self.lambda_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Lambda>`. +/// +#[inline] +pub fn iter_lambda(&self) -> impl Iterator>> + '_ { +let len = self.lambda.read().unwrap().len(); +(0..len).filter(|i| self.lambda.read().unwrap()[*i].is_some()).map(move|i|{self.lambda.read().unwrap()[i].as_ref().map(|lambda| lambda.clone()).unwrap()}) +} + +/// Inter (insert) [`LambdaParameter`] into the store. +/// +#[inline] +pub fn inter_lambda_parameter(&mut self, lambda_parameter: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.lambda_parameter_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.lambda_parameter.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.lambda_parameter.write().unwrap().push(None); +_index +}; + +let lambda_parameter = lambda_parameter(_index); + +let found = if let Some(lambda_parameter) = self.lambda_parameter.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *lambda_parameter.read().unwrap() +} else { +false +} +}) { +lambda_parameter.clone() +} else { +None +}; + +if let Some(lambda_parameter) = found { +tracing::debug!(target: "store", "found duplicate {lambda_parameter:?}."); +self.lambda_parameter_free_list.lock().unwrap().push(_index); +lambda_parameter.clone() +} else { +tracing::debug!(target: "store", "interring {lambda_parameter:?}."); +self.lambda_parameter.write().unwrap()[_index] = Some(lambda_parameter.clone()); +lambda_parameter +} +} + +/// Exhume (get) [`LambdaParameter`] from the store. +/// +#[inline] +pub fn exhume_lambda_parameter(&self, id: &usize) -> Option>> { +match self.lambda_parameter.read().unwrap().get(*id) { +Some(lambda_parameter) => lambda_parameter.clone(), +None => None +} +} + +/// Exorcise (remove) [`LambdaParameter`] from the store. +/// +#[inline] +pub fn exorcise_lambda_parameter(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising lambda_parameter slot: {id}."); +let result = self.lambda_parameter.write().unwrap()[*id].take(); +self.lambda_parameter_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, LambdaParameter>`. +/// +#[inline] +pub fn iter_lambda_parameter(&self) -> impl Iterator>> + '_ { +let len = self.lambda_parameter.read().unwrap().len(); +(0..len).filter(|i| self.lambda_parameter.read().unwrap()[*i].is_some()).map(move|i|{self.lambda_parameter.read().unwrap()[i].as_ref().map(|lambda_parameter| lambda_parameter.clone()).unwrap()}) +} + +/// Inter (insert) [`LetStatement`] into the store. +/// +#[inline] +pub fn inter_let_statement(&mut self, let_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.let_statement_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.let_statement.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.let_statement.write().unwrap().push(None); +_index +}; + +let let_statement = let_statement(_index); + +let found = if let Some(let_statement) = self.let_statement.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *let_statement.read().unwrap() +} else { +false +} +}) { +let_statement.clone() +} else { +None +}; + +if let Some(let_statement) = found { +tracing::debug!(target: "store", "found duplicate {let_statement:?}."); +self.let_statement_free_list.lock().unwrap().push(_index); +let_statement.clone() +} else { +tracing::debug!(target: "store", "interring {let_statement:?}."); +self.let_statement.write().unwrap()[_index] = Some(let_statement.clone()); +let_statement +} +} + +/// Exhume (get) [`LetStatement`] from the store. +/// +#[inline] +pub fn exhume_let_statement(&self, id: &usize) -> Option>> { +match self.let_statement.read().unwrap().get(*id) { +Some(let_statement) => let_statement.clone(), +None => None +} +} + +/// Exorcise (remove) [`LetStatement`] from the store. +/// +#[inline] +pub fn exorcise_let_statement(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising let_statement slot: {id}."); +let result = self.let_statement.write().unwrap()[*id].take(); +self.let_statement_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, LetStatement>`. +/// +#[inline] +pub fn iter_let_statement(&self) -> impl Iterator>> + '_ { +let len = self.let_statement.read().unwrap().len(); +(0..len).filter(|i| self.let_statement.read().unwrap()[*i].is_some()).map(move|i|{self.let_statement.read().unwrap()[i].as_ref().map(|let_statement| let_statement.clone()).unwrap()}) +} + +/// Inter (insert) [`List`] into the store. +/// +#[inline] +pub fn inter_list(&mut self, list: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.list_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.list.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.list.write().unwrap().push(None); +_index +}; + +let list = list(_index); + +let found = if let Some(list) = self.list.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *list.read().unwrap() +} else { +false +} +}) { +list.clone() +} else { +None +}; + +if let Some(list) = found { +tracing::debug!(target: "store", "found duplicate {list:?}."); +self.list_free_list.lock().unwrap().push(_index); +list.clone() +} else { +tracing::debug!(target: "store", "interring {list:?}."); +self.list.write().unwrap()[_index] = Some(list.clone()); +list +} +} + +/// Exhume (get) [`List`] from the store. +/// +#[inline] +pub fn exhume_list(&self, id: &usize) -> Option>> { +match self.list.read().unwrap().get(*id) { +Some(list) => list.clone(), +None => None +} +} + +/// Exorcise (remove) [`List`] from the store. +/// +#[inline] +pub fn exorcise_list(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising list slot: {id}."); +let result = self.list.write().unwrap()[*id].take(); +self.list_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, List>`. +/// +#[inline] +pub fn iter_list(&self) -> impl Iterator>> + '_ { +let len = self.list.read().unwrap().len(); +(0..len).filter(|i| self.list.read().unwrap()[*i].is_some()).map(move|i|{self.list.read().unwrap()[i].as_ref().map(|list| list.clone()).unwrap()}) +} + +/// Inter (insert) [`ListElement`] into the store. +/// +#[inline] +pub fn inter_list_element(&mut self, list_element: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.list_element_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.list_element.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.list_element.write().unwrap().push(None); +_index +}; + +let list_element = list_element(_index); + +let found = if let Some(list_element) = self.list_element.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *list_element.read().unwrap() +} else { +false +} +}) { +list_element.clone() +} else { +None +}; + +if let Some(list_element) = found { +tracing::debug!(target: "store", "found duplicate {list_element:?}."); +self.list_element_free_list.lock().unwrap().push(_index); +list_element.clone() +} else { +tracing::debug!(target: "store", "interring {list_element:?}."); +self.list_element.write().unwrap()[_index] = Some(list_element.clone()); +list_element +} +} + +/// Exhume (get) [`ListElement`] from the store. +/// +#[inline] +pub fn exhume_list_element(&self, id: &usize) -> Option>> { +match self.list_element.read().unwrap().get(*id) { +Some(list_element) => list_element.clone(), +None => None +} +} + +/// Exorcise (remove) [`ListElement`] from the store. +/// +#[inline] +pub fn exorcise_list_element(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising list_element slot: {id}."); +let result = self.list_element.write().unwrap()[*id].take(); +self.list_element_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ListElement>`. +/// +#[inline] +pub fn iter_list_element(&self) -> impl Iterator>> + '_ { +let len = self.list_element.read().unwrap().len(); +(0..len).filter(|i| self.list_element.read().unwrap()[*i].is_some()).map(move|i|{self.list_element.read().unwrap()[i].as_ref().map(|list_element| list_element.clone()).unwrap()}) +} + +/// Inter (insert) [`ListExpression`] into the store. +/// +#[inline] +pub fn inter_list_expression(&mut self, list_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.list_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.list_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.list_expression.write().unwrap().push(None); +_index +}; + +let list_expression = list_expression(_index); + +let found = if let Some(list_expression) = self.list_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *list_expression.read().unwrap() +} else { +false +} +}) { +list_expression.clone() +} else { +None +}; + +if let Some(list_expression) = found { +tracing::debug!(target: "store", "found duplicate {list_expression:?}."); +self.list_expression_free_list.lock().unwrap().push(_index); +list_expression.clone() +} else { +tracing::debug!(target: "store", "interring {list_expression:?}."); +self.list_expression.write().unwrap()[_index] = Some(list_expression.clone()); +list_expression +} +} + +/// Exhume (get) [`ListExpression`] from the store. +/// +#[inline] +pub fn exhume_list_expression(&self, id: &usize) -> Option>> { +match self.list_expression.read().unwrap().get(*id) { +Some(list_expression) => list_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`ListExpression`] from the store. +/// +#[inline] +pub fn exorcise_list_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising list_expression slot: {id}."); +let result = self.list_expression.write().unwrap()[*id].take(); +self.list_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ListExpression>`. +/// +#[inline] +pub fn iter_list_expression(&self) -> impl Iterator>> + '_ { +let len = self.list_expression.read().unwrap().len(); +(0..len).filter(|i| self.list_expression.read().unwrap()[*i].is_some()).map(move|i|{self.list_expression.read().unwrap()[i].as_ref().map(|list_expression| list_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`Literal`] into the store. +/// +#[inline] +pub fn inter_literal(&mut self, literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.literal.write().unwrap().push(None); +_index +}; + +let literal = literal(_index); + +let found = if let Some(literal) = self.literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *literal.read().unwrap() +} else { +false +} +}) { +literal.clone() +} else { +None +}; + +if let Some(literal) = found { +tracing::debug!(target: "store", "found duplicate {literal:?}."); +self.literal_free_list.lock().unwrap().push(_index); +literal.clone() +} else { +tracing::debug!(target: "store", "interring {literal:?}."); +self.literal.write().unwrap()[_index] = Some(literal.clone()); +literal +} +} + +/// Exhume (get) [`Literal`] from the store. +/// +#[inline] +pub fn exhume_literal(&self, id: &usize) -> Option>> { +match self.literal.read().unwrap().get(*id) { +Some(literal) => literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`Literal`] from the store. +/// +#[inline] +pub fn exorcise_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising literal slot: {id}."); +let result = self.literal.write().unwrap()[*id].take(); +self.literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Literal>`. +/// +#[inline] +pub fn iter_literal(&self) -> impl Iterator>> + '_ { +let len = self.literal.read().unwrap().len(); +(0..len).filter(|i| self.literal.read().unwrap()[*i].is_some()).map(move|i|{self.literal.read().unwrap()[i].as_ref().map(|literal| literal.clone()).unwrap()}) +} + +/// Inter (insert) [`LocalVariable`] into the store. +/// +#[inline] +pub fn inter_local_variable(&mut self, local_variable: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.local_variable_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.local_variable.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.local_variable.write().unwrap().push(None); +_index +}; + +let local_variable = local_variable(_index); + +let found = if let Some(local_variable) = self.local_variable.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *local_variable.read().unwrap() +} else { +false +} +}) { +local_variable.clone() +} else { +None +}; + +if let Some(local_variable) = found { +tracing::debug!(target: "store", "found duplicate {local_variable:?}."); +self.local_variable_free_list.lock().unwrap().push(_index); +local_variable.clone() +} else { +tracing::debug!(target: "store", "interring {local_variable:?}."); +self.local_variable.write().unwrap()[_index] = Some(local_variable.clone()); +local_variable +} +} + +/// Exhume (get) [`LocalVariable`] from the store. +/// +#[inline] +pub fn exhume_local_variable(&self, id: &usize) -> Option>> { +match self.local_variable.read().unwrap().get(*id) { +Some(local_variable) => local_variable.clone(), +None => None +} +} + +/// Exorcise (remove) [`LocalVariable`] from the store. +/// +#[inline] +pub fn exorcise_local_variable(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising local_variable slot: {id}."); +let result = self.local_variable.write().unwrap()[*id].take(); +self.local_variable_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, LocalVariable>`. +/// +#[inline] +pub fn iter_local_variable(&self) -> impl Iterator>> + '_ { +let len = self.local_variable.read().unwrap().len(); +(0..len).filter(|i| self.local_variable.read().unwrap()[*i].is_some()).map(move|i|{self.local_variable.read().unwrap()[i].as_ref().map(|local_variable| local_variable.clone()).unwrap()}) +} + +/// Inter (insert) [`XMacro`] into the store. +/// +#[inline] +pub fn inter_x_macro(&mut self, x_macro: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_macro_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_macro.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_macro.write().unwrap().push(None); +_index +}; + +let x_macro = x_macro(_index); + +let found = if let Some(x_macro) = self.x_macro.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_macro.read().unwrap() +} else { +false +} +}) { +x_macro.clone() +} else { +None +}; + +if let Some(x_macro) = found { +tracing::debug!(target: "store", "found duplicate {x_macro:?}."); +self.x_macro_free_list.lock().unwrap().push(_index); +x_macro.clone() +} else { +tracing::debug!(target: "store", "interring {x_macro:?}."); +self.x_macro.write().unwrap()[_index] = Some(x_macro.clone()); +x_macro +} +} + +/// Exhume (get) [`XMacro`] from the store. +/// +#[inline] +pub fn exhume_x_macro(&self, id: &usize) -> Option>> { +match self.x_macro.read().unwrap().get(*id) { +Some(x_macro) => x_macro.clone(), +None => None +} +} + +/// Exorcise (remove) [`XMacro`] from the store. +/// +#[inline] +pub fn exorcise_x_macro(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_macro slot: {id}."); +let result = self.x_macro.write().unwrap()[*id].take(); +self.x_macro_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XMacro>`. +/// +#[inline] +pub fn iter_x_macro(&self) -> impl Iterator>> + '_ { +let len = self.x_macro.read().unwrap().len(); +(0..len).filter(|i| self.x_macro.read().unwrap()[*i].is_some()).map(move|i|{self.x_macro.read().unwrap()[i].as_ref().map(|x_macro| x_macro.clone()).unwrap()}) +} + +/// Inter (insert) [`Map`] into the store. +/// +#[inline] +pub fn inter_map(&mut self, map: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.map_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.map.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.map.write().unwrap().push(None); +_index +}; + +let map = map(_index); + +let found = if let Some(map) = self.map.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *map.read().unwrap() +} else { +false +} +}) { +map.clone() +} else { +None +}; + +if let Some(map) = found { +tracing::debug!(target: "store", "found duplicate {map:?}."); +self.map_free_list.lock().unwrap().push(_index); +map.clone() +} else { +tracing::debug!(target: "store", "interring {map:?}."); +self.map.write().unwrap()[_index] = Some(map.clone()); +map +} +} + +/// Exhume (get) [`Map`] from the store. +/// +#[inline] +pub fn exhume_map(&self, id: &usize) -> Option>> { +match self.map.read().unwrap().get(*id) { +Some(map) => map.clone(), +None => None +} +} + +/// Exorcise (remove) [`Map`] from the store. +/// +#[inline] +pub fn exorcise_map(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising map slot: {id}."); +let result = self.map.write().unwrap()[*id].take(); +self.map_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Map>`. +/// +#[inline] +pub fn iter_map(&self) -> impl Iterator>> + '_ { +let len = self.map.read().unwrap().len(); +(0..len).filter(|i| self.map.read().unwrap()[*i].is_some()).map(move|i|{self.map.read().unwrap()[i].as_ref().map(|map| map.clone()).unwrap()}) +} + +/// Inter (insert) [`MapElement`] into the store. +/// +#[inline] +pub fn inter_map_element(&mut self, map_element: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.map_element_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.map_element.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.map_element.write().unwrap().push(None); +_index +}; + +let map_element = map_element(_index); + +let found = if let Some(map_element) = self.map_element.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *map_element.read().unwrap() +} else { +false +} +}) { +map_element.clone() +} else { +None +}; + +if let Some(map_element) = found { +tracing::debug!(target: "store", "found duplicate {map_element:?}."); +self.map_element_free_list.lock().unwrap().push(_index); +map_element.clone() +} else { +tracing::debug!(target: "store", "interring {map_element:?}."); +self.map_element.write().unwrap()[_index] = Some(map_element.clone()); +map_element +} +} + +/// Exhume (get) [`MapElement`] from the store. +/// +#[inline] +pub fn exhume_map_element(&self, id: &usize) -> Option>> { +match self.map_element.read().unwrap().get(*id) { +Some(map_element) => map_element.clone(), +None => None +} +} + +/// Exorcise (remove) [`MapElement`] from the store. +/// +#[inline] +pub fn exorcise_map_element(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising map_element slot: {id}."); +let result = self.map_element.write().unwrap()[*id].take(); +self.map_element_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, MapElement>`. +/// +#[inline] +pub fn iter_map_element(&self) -> impl Iterator>> + '_ { +let len = self.map_element.read().unwrap().len(); +(0..len).filter(|i| self.map_element.read().unwrap()[*i].is_some()).map(move|i|{self.map_element.read().unwrap()[i].as_ref().map(|map_element| map_element.clone()).unwrap()}) +} + +/// Inter (insert) [`MapExpression`] into the store. +/// +#[inline] +pub fn inter_map_expression(&mut self, map_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.map_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.map_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.map_expression.write().unwrap().push(None); +_index +}; + +let map_expression = map_expression(_index); + +let found = if let Some(map_expression) = self.map_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *map_expression.read().unwrap() +} else { +false +} +}) { +map_expression.clone() +} else { +None +}; + +if let Some(map_expression) = found { +tracing::debug!(target: "store", "found duplicate {map_expression:?}."); +self.map_expression_free_list.lock().unwrap().push(_index); +map_expression.clone() +} else { +tracing::debug!(target: "store", "interring {map_expression:?}."); +self.map_expression.write().unwrap()[_index] = Some(map_expression.clone()); +map_expression +} +} + +/// Exhume (get) [`MapExpression`] from the store. +/// +#[inline] +pub fn exhume_map_expression(&self, id: &usize) -> Option>> { +match self.map_expression.read().unwrap().get(*id) { +Some(map_expression) => map_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`MapExpression`] from the store. +/// +#[inline] +pub fn exorcise_map_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising map_expression slot: {id}."); +let result = self.map_expression.write().unwrap()[*id].take(); +self.map_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, MapExpression>`. +/// +#[inline] +pub fn iter_map_expression(&self) -> impl Iterator>> + '_ { +let len = self.map_expression.read().unwrap().len(); +(0..len).filter(|i| self.map_expression.read().unwrap()[*i].is_some()).map(move|i|{self.map_expression.read().unwrap()[i].as_ref().map(|map_expression| map_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`XMatch`] into the store. +/// +#[inline] +pub fn inter_x_match(&mut self, x_match: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_match_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_match.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_match.write().unwrap().push(None); +_index +}; + +let x_match = x_match(_index); + +let found = if let Some(x_match) = self.x_match.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_match.read().unwrap() +} else { +false +} +}) { +x_match.clone() +} else { +None +}; + +if let Some(x_match) = found { +tracing::debug!(target: "store", "found duplicate {x_match:?}."); +self.x_match_free_list.lock().unwrap().push(_index); +x_match.clone() +} else { +tracing::debug!(target: "store", "interring {x_match:?}."); +self.x_match.write().unwrap()[_index] = Some(x_match.clone()); +x_match +} +} + +/// Exhume (get) [`XMatch`] from the store. +/// +#[inline] +pub fn exhume_x_match(&self, id: &usize) -> Option>> { +match self.x_match.read().unwrap().get(*id) { +Some(x_match) => x_match.clone(), +None => None +} +} + +/// Exorcise (remove) [`XMatch`] from the store. +/// +#[inline] +pub fn exorcise_x_match(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_match slot: {id}."); +let result = self.x_match.write().unwrap()[*id].take(); +self.x_match_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XMatch>`. +/// +#[inline] +pub fn iter_x_match(&self) -> impl Iterator>> + '_ { +let len = self.x_match.read().unwrap().len(); +(0..len).filter(|i| self.x_match.read().unwrap()[*i].is_some()).map(move|i|{self.x_match.read().unwrap()[i].as_ref().map(|x_match| x_match.clone()).unwrap()}) +} + +/// Inter (insert) [`MethodCall`] into the store. +/// +#[inline] +pub fn inter_method_call(&mut self, method_call: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.method_call_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.method_call.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.method_call.write().unwrap().push(None); +_index +}; + +let method_call = method_call(_index); + +let found = if let Some(method_call) = self.method_call.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *method_call.read().unwrap() +} else { +false +} +}) { +method_call.clone() +} else { +None +}; + +if let Some(method_call) = found { +tracing::debug!(target: "store", "found duplicate {method_call:?}."); +self.method_call_free_list.lock().unwrap().push(_index); +method_call.clone() +} else { +tracing::debug!(target: "store", "interring {method_call:?}."); +self.method_call.write().unwrap()[_index] = Some(method_call.clone()); +method_call +} +} + +/// Exhume (get) [`MethodCall`] from the store. +/// +#[inline] +pub fn exhume_method_call(&self, id: &usize) -> Option>> { +match self.method_call.read().unwrap().get(*id) { +Some(method_call) => method_call.clone(), +None => None +} +} + +/// Exorcise (remove) [`MethodCall`] from the store. +/// +#[inline] +pub fn exorcise_method_call(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising method_call slot: {id}."); +let result = self.method_call.write().unwrap()[*id].take(); +self.method_call_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, MethodCall>`. +/// +#[inline] +pub fn iter_method_call(&self) -> impl Iterator>> + '_ { +let len = self.method_call.read().unwrap().len(); +(0..len).filter(|i| self.method_call.read().unwrap()[*i].is_some()).map(move|i|{self.method_call.read().unwrap()[i].as_ref().map(|method_call| method_call.clone()).unwrap()}) +} + +/// Inter (insert) [`NamedFieldExpression`] into the store. +/// +#[inline] +pub fn inter_named_field_expression(&mut self, named_field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.named_field_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.named_field_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.named_field_expression.write().unwrap().push(None); +_index +}; + +let named_field_expression = named_field_expression(_index); + +let found = if let Some(named_field_expression) = self.named_field_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *named_field_expression.read().unwrap() +} else { +false +} +}) { +named_field_expression.clone() +} else { +None +}; + +if let Some(named_field_expression) = found { +tracing::debug!(target: "store", "found duplicate {named_field_expression:?}."); +self.named_field_expression_free_list.lock().unwrap().push(_index); +named_field_expression.clone() +} else { +tracing::debug!(target: "store", "interring {named_field_expression:?}."); +self.named_field_expression.write().unwrap()[_index] = Some(named_field_expression.clone()); +named_field_expression +} +} + +/// Exhume (get) [`NamedFieldExpression`] from the store. +/// +#[inline] +pub fn exhume_named_field_expression(&self, id: &usize) -> Option>> { +match self.named_field_expression.read().unwrap().get(*id) { +Some(named_field_expression) => named_field_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`NamedFieldExpression`] from the store. +/// +#[inline] +pub fn exorcise_named_field_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising named_field_expression slot: {id}."); +let result = self.named_field_expression.write().unwrap()[*id].take(); +self.named_field_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, NamedFieldExpression>`. +/// +#[inline] +pub fn iter_named_field_expression(&self) -> impl Iterator>> + '_ { +let len = self.named_field_expression.read().unwrap().len(); +(0..len).filter(|i| self.named_field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.named_field_expression.read().unwrap()[i].as_ref().map(|named_field_expression| named_field_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`ZObjectStore`] into the store. +/// +#[inline] +pub fn inter_z_object_store(&mut self, z_object_store: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.z_object_store_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.z_object_store.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.z_object_store.write().unwrap().push(None); +_index +}; + +let z_object_store = z_object_store(_index); + +let found = if let Some(z_object_store) = self.z_object_store.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *z_object_store.read().unwrap() +} else { +false +} +}) { +z_object_store.clone() +} else { +None +}; + +let z_object_store = +if let Some(z_object_store) = found { +tracing::debug!(target: "store", "found duplicate {z_object_store:?}."); +self.z_object_store_free_list.lock().unwrap().push(_index); +z_object_store.clone() +} else { +tracing::debug!(target: "store", "interring {z_object_store:?}."); +self.z_object_store.write().unwrap()[_index] = Some(z_object_store.clone()); +z_object_store +} +; +self.z_object_store_id_by_name.write().unwrap().insert(z_object_store.read().unwrap().name.to_owned(), z_object_store.read().unwrap().id); +z_object_store +} + +/// Exhume (get) [`ZObjectStore`] from the store. +/// +#[inline] +pub fn exhume_z_object_store(&self, id: &usize) -> Option>> { +match self.z_object_store.read().unwrap().get(*id) { +Some(z_object_store) => z_object_store.clone(), +None => None +} +} + +/// Exorcise (remove) [`ZObjectStore`] from the store. +/// +#[inline] +pub fn exorcise_z_object_store(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising z_object_store slot: {id}."); +let result = self.z_object_store.write().unwrap()[*id].take(); +self.z_object_store_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`ZObjectStore`] id from the store by name. +/// +#[inline] +pub fn exhume_z_object_store_id_by_name(&self, name: &str) -> Option { +self.z_object_store_id_by_name.read().unwrap().get(name).map(|z_object_store| *z_object_store) +} + +/// Get an iterator over the internal `HashMap<&Uuid, ZObjectStore>`. +/// +#[inline] +pub fn iter_z_object_store(&self) -> impl Iterator>> + '_ { +let len = self.z_object_store.read().unwrap().len(); +(0..len).filter(|i| self.z_object_store.read().unwrap()[*i].is_some()).map(move|i|{self.z_object_store.read().unwrap()[i].as_ref().map(|z_object_store| z_object_store.clone()).unwrap()}) +} + +/// Inter (insert) [`ObjectWrapper`] into the store. +/// +#[inline] +pub fn inter_object_wrapper(&mut self, object_wrapper: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.object_wrapper_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.object_wrapper.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.object_wrapper.write().unwrap().push(None); +_index +}; + +let object_wrapper = object_wrapper(_index); + +let found = if let Some(object_wrapper) = self.object_wrapper.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *object_wrapper.read().unwrap() +} else { +false +} +}) { +object_wrapper.clone() +} else { +None +}; + +if let Some(object_wrapper) = found { +tracing::debug!(target: "store", "found duplicate {object_wrapper:?}."); +self.object_wrapper_free_list.lock().unwrap().push(_index); +object_wrapper.clone() +} else { +tracing::debug!(target: "store", "interring {object_wrapper:?}."); +self.object_wrapper.write().unwrap()[_index] = Some(object_wrapper.clone()); +object_wrapper +} +} + +/// Exhume (get) [`ObjectWrapper`] from the store. +/// +#[inline] +pub fn exhume_object_wrapper(&self, id: &usize) -> Option>> { +match self.object_wrapper.read().unwrap().get(*id) { +Some(object_wrapper) => object_wrapper.clone(), +None => None +} +} + +/// Exorcise (remove) [`ObjectWrapper`] from the store. +/// +#[inline] +pub fn exorcise_object_wrapper(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising object_wrapper slot: {id}."); +let result = self.object_wrapper.write().unwrap()[*id].take(); +self.object_wrapper_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ObjectWrapper>`. +/// +#[inline] +pub fn iter_object_wrapper(&self) -> impl Iterator>> + '_ { +let len = self.object_wrapper.read().unwrap().len(); +(0..len).filter(|i| self.object_wrapper.read().unwrap()[*i].is_some()).map(move|i|{self.object_wrapper.read().unwrap()[i].as_ref().map(|object_wrapper| object_wrapper.clone()).unwrap()}) +} + +/// Inter (insert) [`Operator`] into the store. +/// +#[inline] +pub fn inter_operator(&mut self, operator: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.operator_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.operator.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.operator.write().unwrap().push(None); +_index +}; + +let operator = operator(_index); + +let found = if let Some(operator) = self.operator.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *operator.read().unwrap() +} else { +false +} +}) { +operator.clone() +} else { +None +}; + +if let Some(operator) = found { +tracing::debug!(target: "store", "found duplicate {operator:?}."); +self.operator_free_list.lock().unwrap().push(_index); +operator.clone() +} else { +tracing::debug!(target: "store", "interring {operator:?}."); +self.operator.write().unwrap()[_index] = Some(operator.clone()); +operator +} +} + +/// Exhume (get) [`Operator`] from the store. +/// +#[inline] +pub fn exhume_operator(&self, id: &usize) -> Option>> { +match self.operator.read().unwrap().get(*id) { +Some(operator) => operator.clone(), +None => None +} +} + +/// Exorcise (remove) [`Operator`] from the store. +/// +#[inline] +pub fn exorcise_operator(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising operator slot: {id}."); +let result = self.operator.write().unwrap()[*id].take(); +self.operator_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Operator>`. +/// +#[inline] +pub fn iter_operator(&self) -> impl Iterator>> + '_ { +let len = self.operator.read().unwrap().len(); +(0..len).filter(|i| self.operator.read().unwrap()[*i].is_some()).map(move|i|{self.operator.read().unwrap()[i].as_ref().map(|operator| operator.clone()).unwrap()}) +} + +/// Inter (insert) [`Parameter`] into the store. +/// +#[inline] +pub fn inter_parameter(&mut self, parameter: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.parameter_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.parameter.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.parameter.write().unwrap().push(None); +_index +}; + +let parameter = parameter(_index); + +let found = if let Some(parameter) = self.parameter.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *parameter.read().unwrap() +} else { +false +} +}) { +parameter.clone() +} else { +None +}; + +if let Some(parameter) = found { +tracing::debug!(target: "store", "found duplicate {parameter:?}."); +self.parameter_free_list.lock().unwrap().push(_index); +parameter.clone() +} else { +tracing::debug!(target: "store", "interring {parameter:?}."); +self.parameter.write().unwrap()[_index] = Some(parameter.clone()); +parameter +} +} + +/// Exhume (get) [`Parameter`] from the store. +/// +#[inline] +pub fn exhume_parameter(&self, id: &usize) -> Option>> { +match self.parameter.read().unwrap().get(*id) { +Some(parameter) => parameter.clone(), +None => None +} +} + +/// Exorcise (remove) [`Parameter`] from the store. +/// +#[inline] +pub fn exorcise_parameter(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising parameter slot: {id}."); +let result = self.parameter.write().unwrap()[*id].take(); +self.parameter_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Parameter>`. +/// +#[inline] +pub fn iter_parameter(&self) -> impl Iterator>> + '_ { +let len = self.parameter.read().unwrap().len(); +(0..len).filter(|i| self.parameter.read().unwrap()[*i].is_some()).map(move|i|{self.parameter.read().unwrap()[i].as_ref().map(|parameter| parameter.clone()).unwrap()}) +} + +/// Inter (insert) [`XPath`] into the store. +/// +#[inline] +pub fn inter_x_path(&mut self, x_path: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_path_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_path.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_path.write().unwrap().push(None); +_index +}; + +let x_path = x_path(_index); + +let found = if let Some(x_path) = self.x_path.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_path.read().unwrap() +} else { +false +} +}) { +x_path.clone() +} else { +None +}; + +if let Some(x_path) = found { +tracing::debug!(target: "store", "found duplicate {x_path:?}."); +self.x_path_free_list.lock().unwrap().push(_index); +x_path.clone() +} else { +tracing::debug!(target: "store", "interring {x_path:?}."); +self.x_path.write().unwrap()[_index] = Some(x_path.clone()); +x_path +} +} + +/// Exhume (get) [`XPath`] from the store. +/// +#[inline] +pub fn exhume_x_path(&self, id: &usize) -> Option>> { +match self.x_path.read().unwrap().get(*id) { +Some(x_path) => x_path.clone(), +None => None +} +} + +/// Exorcise (remove) [`XPath`] from the store. +/// +#[inline] +pub fn exorcise_x_path(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_path slot: {id}."); +let result = self.x_path.write().unwrap()[*id].take(); +self.x_path_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XPath>`. +/// +#[inline] +pub fn iter_x_path(&self) -> impl Iterator>> + '_ { +let len = self.x_path.read().unwrap().len(); +(0..len).filter(|i| self.x_path.read().unwrap()[*i].is_some()).map(move|i|{self.x_path.read().unwrap()[i].as_ref().map(|x_path| x_path.clone()).unwrap()}) +} + +/// Inter (insert) [`PathElement`] into the store. +/// +#[inline] +pub fn inter_path_element(&mut self, path_element: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.path_element_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.path_element.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.path_element.write().unwrap().push(None); +_index +}; + +let path_element = path_element(_index); + +let found = if let Some(path_element) = self.path_element.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *path_element.read().unwrap() +} else { +false +} +}) { +path_element.clone() +} else { +None +}; + +if let Some(path_element) = found { +tracing::debug!(target: "store", "found duplicate {path_element:?}."); +self.path_element_free_list.lock().unwrap().push(_index); +path_element.clone() +} else { +tracing::debug!(target: "store", "interring {path_element:?}."); +self.path_element.write().unwrap()[_index] = Some(path_element.clone()); +path_element +} +} + +/// Exhume (get) [`PathElement`] from the store. +/// +#[inline] +pub fn exhume_path_element(&self, id: &usize) -> Option>> { +match self.path_element.read().unwrap().get(*id) { +Some(path_element) => path_element.clone(), +None => None +} +} + +/// Exorcise (remove) [`PathElement`] from the store. +/// +#[inline] +pub fn exorcise_path_element(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising path_element slot: {id}."); +let result = self.path_element.write().unwrap()[*id].take(); +self.path_element_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, PathElement>`. +/// +#[inline] +pub fn iter_path_element(&self) -> impl Iterator>> + '_ { +let len = self.path_element.read().unwrap().len(); +(0..len).filter(|i| self.path_element.read().unwrap()[*i].is_some()).map(move|i|{self.path_element.read().unwrap()[i].as_ref().map(|path_element| path_element.clone()).unwrap()}) +} + +/// Inter (insert) [`Pattern`] into the store. +/// +#[inline] +pub fn inter_pattern(&mut self, pattern: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.pattern_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.pattern.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.pattern.write().unwrap().push(None); +_index +}; + +let pattern = pattern(_index); + +let found = if let Some(pattern) = self.pattern.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *pattern.read().unwrap() +} else { +false +} +}) { +pattern.clone() +} else { +None +}; + +if let Some(pattern) = found { +tracing::debug!(target: "store", "found duplicate {pattern:?}."); +self.pattern_free_list.lock().unwrap().push(_index); +pattern.clone() +} else { +tracing::debug!(target: "store", "interring {pattern:?}."); +self.pattern.write().unwrap()[_index] = Some(pattern.clone()); +pattern +} +} + +/// Exhume (get) [`Pattern`] from the store. +/// +#[inline] +pub fn exhume_pattern(&self, id: &usize) -> Option>> { +match self.pattern.read().unwrap().get(*id) { +Some(pattern) => pattern.clone(), +None => None +} +} + +/// Exorcise (remove) [`Pattern`] from the store. +/// +#[inline] +pub fn exorcise_pattern(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising pattern slot: {id}."); +let result = self.pattern.write().unwrap()[*id].take(); +self.pattern_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Pattern>`. +/// +#[inline] +pub fn iter_pattern(&self) -> impl Iterator>> + '_ { +let len = self.pattern.read().unwrap().len(); +(0..len).filter(|i| self.pattern.read().unwrap()[*i].is_some()).map(move|i|{self.pattern.read().unwrap()[i].as_ref().map(|pattern| pattern.clone()).unwrap()}) +} + +/// Inter (insert) [`XPlugin`] into the store. +/// +#[inline] +pub fn inter_x_plugin(&mut self, x_plugin: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_plugin_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_plugin.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_plugin.write().unwrap().push(None); +_index +}; + +let x_plugin = x_plugin(_index); + +let found = if let Some(x_plugin) = self.x_plugin.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_plugin.read().unwrap() +} else { +false +} +}) { +x_plugin.clone() +} else { +None +}; + +let x_plugin = +if let Some(x_plugin) = found { +tracing::debug!(target: "store", "found duplicate {x_plugin:?}."); +self.x_plugin_free_list.lock().unwrap().push(_index); +x_plugin.clone() +} else { +tracing::debug!(target: "store", "interring {x_plugin:?}."); +self.x_plugin.write().unwrap()[_index] = Some(x_plugin.clone()); +x_plugin +} +; +self.x_plugin_id_by_name.write().unwrap().insert(x_plugin.read().unwrap().name.to_owned(), x_plugin.read().unwrap().id); +x_plugin +} + +/// Exhume (get) [`XPlugin`] from the store. +/// +#[inline] +pub fn exhume_x_plugin(&self, id: &usize) -> Option>> { +match self.x_plugin.read().unwrap().get(*id) { +Some(x_plugin) => x_plugin.clone(), +None => None +} +} + +/// Exorcise (remove) [`XPlugin`] from the store. +/// +#[inline] +pub fn exorcise_x_plugin(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_plugin slot: {id}."); +let result = self.x_plugin.write().unwrap()[*id].take(); +self.x_plugin_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`XPlugin`] id from the store by name. +/// +#[inline] +pub fn exhume_x_plugin_id_by_name(&self, name: &str) -> Option { +self.x_plugin_id_by_name.read().unwrap().get(name).map(|x_plugin| *x_plugin) +} + +/// Get an iterator over the internal `HashMap<&Uuid, XPlugin>`. +/// +#[inline] +pub fn iter_x_plugin(&self) -> impl Iterator>> + '_ { +let len = self.x_plugin.read().unwrap().len(); +(0..len).filter(|i| self.x_plugin.read().unwrap()[*i].is_some()).map(move|i|{self.x_plugin.read().unwrap()[i].as_ref().map(|x_plugin| x_plugin.clone()).unwrap()}) +} + +/// Inter (insert) [`XPrint`] into the store. +/// +#[inline] +pub fn inter_x_print(&mut self, x_print: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_print_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_print.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_print.write().unwrap().push(None); +_index +}; + +let x_print = x_print(_index); + +let found = if let Some(x_print) = self.x_print.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_print.read().unwrap() +} else { +false +} +}) { +x_print.clone() +} else { +None +}; + +if let Some(x_print) = found { +tracing::debug!(target: "store", "found duplicate {x_print:?}."); +self.x_print_free_list.lock().unwrap().push(_index); +x_print.clone() +} else { +tracing::debug!(target: "store", "interring {x_print:?}."); +self.x_print.write().unwrap()[_index] = Some(x_print.clone()); +x_print +} +} + +/// Exhume (get) [`XPrint`] from the store. +/// +#[inline] +pub fn exhume_x_print(&self, id: &usize) -> Option>> { +match self.x_print.read().unwrap().get(*id) { +Some(x_print) => x_print.clone(), +None => None +} +} + +/// Exorcise (remove) [`XPrint`] from the store. +/// +#[inline] +pub fn exorcise_x_print(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_print slot: {id}."); +let result = self.x_print.write().unwrap()[*id].take(); +self.x_print_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XPrint>`. +/// +#[inline] +pub fn iter_x_print(&self) -> impl Iterator>> + '_ { +let len = self.x_print.read().unwrap().len(); +(0..len).filter(|i| self.x_print.read().unwrap()[*i].is_some()).map(move|i|{self.x_print.read().unwrap()[i].as_ref().map(|x_print| x_print.clone()).unwrap()}) +} + +/// Inter (insert) [`RangeExpression`] into the store. +/// +#[inline] +pub fn inter_range_expression(&mut self, range_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.range_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.range_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.range_expression.write().unwrap().push(None); +_index +}; + +let range_expression = range_expression(_index); + +let found = if let Some(range_expression) = self.range_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *range_expression.read().unwrap() +} else { +false +} +}) { +range_expression.clone() +} else { +None +}; + +if let Some(range_expression) = found { +tracing::debug!(target: "store", "found duplicate {range_expression:?}."); +self.range_expression_free_list.lock().unwrap().push(_index); +range_expression.clone() +} else { +tracing::debug!(target: "store", "interring {range_expression:?}."); +self.range_expression.write().unwrap()[_index] = Some(range_expression.clone()); +range_expression +} +} + +/// Exhume (get) [`RangeExpression`] from the store. +/// +#[inline] +pub fn exhume_range_expression(&self, id: &usize) -> Option>> { +match self.range_expression.read().unwrap().get(*id) { +Some(range_expression) => range_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`RangeExpression`] from the store. +/// +#[inline] +pub fn exorcise_range_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising range_expression slot: {id}."); +let result = self.range_expression.write().unwrap()[*id].take(); +self.range_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, RangeExpression>`. +/// +#[inline] +pub fn iter_range_expression(&self) -> impl Iterator>> + '_ { +let len = self.range_expression.read().unwrap().len(); +(0..len).filter(|i| self.range_expression.read().unwrap()[*i].is_some()).map(move|i|{self.range_expression.read().unwrap()[i].as_ref().map(|range_expression| range_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`ResultStatement`] into the store. +/// +#[inline] +pub fn inter_result_statement(&mut self, result_statement: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.result_statement_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.result_statement.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.result_statement.write().unwrap().push(None); +_index +}; + +let result_statement = result_statement(_index); + +let found = if let Some(result_statement) = self.result_statement.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *result_statement.read().unwrap() +} else { +false +} +}) { +result_statement.clone() +} else { +None +}; + +if let Some(result_statement) = found { +tracing::debug!(target: "store", "found duplicate {result_statement:?}."); +self.result_statement_free_list.lock().unwrap().push(_index); +result_statement.clone() +} else { +tracing::debug!(target: "store", "interring {result_statement:?}."); +self.result_statement.write().unwrap()[_index] = Some(result_statement.clone()); +result_statement +} +} + +/// Exhume (get) [`ResultStatement`] from the store. +/// +#[inline] +pub fn exhume_result_statement(&self, id: &usize) -> Option>> { +match self.result_statement.read().unwrap().get(*id) { +Some(result_statement) => result_statement.clone(), +None => None +} +} + +/// Exorcise (remove) [`ResultStatement`] from the store. +/// +#[inline] +pub fn exorcise_result_statement(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising result_statement slot: {id}."); +let result = self.result_statement.write().unwrap()[*id].take(); +self.result_statement_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ResultStatement>`. +/// +#[inline] +pub fn iter_result_statement(&self) -> impl Iterator>> + '_ { +let len = self.result_statement.read().unwrap().len(); +(0..len).filter(|i| self.result_statement.read().unwrap()[*i].is_some()).map(move|i|{self.result_statement.read().unwrap()[i].as_ref().map(|result_statement| result_statement.clone()).unwrap()}) +} + +/// Inter (insert) [`XReturn`] into the store. +/// +#[inline] +pub fn inter_x_return(&mut self, x_return: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_return_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_return.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_return.write().unwrap().push(None); +_index +}; + +let x_return = x_return(_index); + +let found = if let Some(x_return) = self.x_return.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_return.read().unwrap() +} else { +false +} +}) { +x_return.clone() +} else { +None +}; + +if let Some(x_return) = found { +tracing::debug!(target: "store", "found duplicate {x_return:?}."); +self.x_return_free_list.lock().unwrap().push(_index); +x_return.clone() +} else { +tracing::debug!(target: "store", "interring {x_return:?}."); +self.x_return.write().unwrap()[_index] = Some(x_return.clone()); +x_return +} +} + +/// Exhume (get) [`XReturn`] from the store. +/// +#[inline] +pub fn exhume_x_return(&self, id: &usize) -> Option>> { +match self.x_return.read().unwrap().get(*id) { +Some(x_return) => x_return.clone(), +None => None +} +} + +/// Exorcise (remove) [`XReturn`] from the store. +/// +#[inline] +pub fn exorcise_x_return(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_return slot: {id}."); +let result = self.x_return.write().unwrap()[*id].take(); +self.x_return_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XReturn>`. +/// +#[inline] +pub fn iter_x_return(&self) -> impl Iterator>> + '_ { +let len = self.x_return.read().unwrap().len(); +(0..len).filter(|i| self.x_return.read().unwrap()[*i].is_some()).map(move|i|{self.x_return.read().unwrap()[i].as_ref().map(|x_return| x_return.clone()).unwrap()}) +} + +/// Inter (insert) [`Span`] into the store. +/// +#[inline] +pub fn inter_span(&mut self, span: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.span_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.span.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.span.write().unwrap().push(None); +_index +}; + +let span = span(_index); + +let found = if let Some(span) = self.span.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *span.read().unwrap() +} else { +false +} +}) { +span.clone() +} else { +None +}; + +if let Some(span) = found { +tracing::debug!(target: "store", "found duplicate {span:?}."); +self.span_free_list.lock().unwrap().push(_index); +span.clone() +} else { +tracing::debug!(target: "store", "interring {span:?}."); +self.span.write().unwrap()[_index] = Some(span.clone()); +span +} +} + +/// Exhume (get) [`Span`] from the store. +/// +#[inline] +pub fn exhume_span(&self, id: &usize) -> Option>> { +match self.span.read().unwrap().get(*id) { +Some(span) => span.clone(), +None => None +} +} + +/// Exorcise (remove) [`Span`] from the store. +/// +#[inline] +pub fn exorcise_span(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising span slot: {id}."); +let result = self.span.write().unwrap()[*id].take(); +self.span_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Span>`. +/// +#[inline] +pub fn iter_span(&self) -> impl Iterator>> + '_ { +let len = self.span.read().unwrap().len(); +(0..len).filter(|i| self.span.read().unwrap()[*i].is_some()).map(move|i|{self.span.read().unwrap()[i].as_ref().map(|span| span.clone()).unwrap()}) +} + +/// Inter (insert) [`Statement`] into the store. +/// +#[inline] +pub fn inter_statement(&mut self, statement: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.statement_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.statement.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.statement.write().unwrap().push(None); +_index +}; + +let statement = statement(_index); + +let found = if let Some(statement) = self.statement.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *statement.read().unwrap() +} else { +false +} +}) { +statement.clone() +} else { +None +}; + +if let Some(statement) = found { +tracing::debug!(target: "store", "found duplicate {statement:?}."); +self.statement_free_list.lock().unwrap().push(_index); +statement.clone() +} else { +tracing::debug!(target: "store", "interring {statement:?}."); +self.statement.write().unwrap()[_index] = Some(statement.clone()); +statement +} +} + +/// Exhume (get) [`Statement`] from the store. +/// +#[inline] +pub fn exhume_statement(&self, id: &usize) -> Option>> { +match self.statement.read().unwrap().get(*id) { +Some(statement) => statement.clone(), +None => None +} +} + +/// Exorcise (remove) [`Statement`] from the store. +/// +#[inline] +pub fn exorcise_statement(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising statement slot: {id}."); +let result = self.statement.write().unwrap()[*id].take(); +self.statement_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Statement>`. +/// +#[inline] +pub fn iter_statement(&self) -> impl Iterator>> + '_ { +let len = self.statement.read().unwrap().len(); +(0..len).filter(|i| self.statement.read().unwrap()[*i].is_some()).map(move|i|{self.statement.read().unwrap()[i].as_ref().map(|statement| statement.clone()).unwrap()}) +} + +/// Inter (insert) [`StaticMethodCall`] into the store. +/// +#[inline] +pub fn inter_static_method_call(&mut self, static_method_call: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.static_method_call_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.static_method_call.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.static_method_call.write().unwrap().push(None); +_index +}; + +let static_method_call = static_method_call(_index); + +let found = if let Some(static_method_call) = self.static_method_call.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *static_method_call.read().unwrap() +} else { +false +} +}) { +static_method_call.clone() +} else { +None +}; + +if let Some(static_method_call) = found { +tracing::debug!(target: "store", "found duplicate {static_method_call:?}."); +self.static_method_call_free_list.lock().unwrap().push(_index); +static_method_call.clone() +} else { +tracing::debug!(target: "store", "interring {static_method_call:?}."); +self.static_method_call.write().unwrap()[_index] = Some(static_method_call.clone()); +static_method_call +} +} + +/// Exhume (get) [`StaticMethodCall`] from the store. +/// +#[inline] +pub fn exhume_static_method_call(&self, id: &usize) -> Option>> { +match self.static_method_call.read().unwrap().get(*id) { +Some(static_method_call) => static_method_call.clone(), +None => None +} +} + +/// Exorcise (remove) [`StaticMethodCall`] from the store. +/// +#[inline] +pub fn exorcise_static_method_call(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising static_method_call slot: {id}."); +let result = self.static_method_call.write().unwrap()[*id].take(); +self.static_method_call_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StaticMethodCall>`. +/// +#[inline] +pub fn iter_static_method_call(&self) -> impl Iterator>> + '_ { +let len = self.static_method_call.read().unwrap().len(); +(0..len).filter(|i| self.static_method_call.read().unwrap()[*i].is_some()).map(move|i|{self.static_method_call.read().unwrap()[i].as_ref().map(|static_method_call| static_method_call.clone()).unwrap()}) +} + +/// Inter (insert) [`StringBit`] into the store. +/// +#[inline] +pub fn inter_string_bit(&mut self, string_bit: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.string_bit_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.string_bit.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.string_bit.write().unwrap().push(None); +_index +}; + +let string_bit = string_bit(_index); + +let found = if let Some(string_bit) = self.string_bit.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *string_bit.read().unwrap() +} else { +false +} +}) { +string_bit.clone() +} else { +None +}; + +if let Some(string_bit) = found { +tracing::debug!(target: "store", "found duplicate {string_bit:?}."); +self.string_bit_free_list.lock().unwrap().push(_index); +string_bit.clone() +} else { +tracing::debug!(target: "store", "interring {string_bit:?}."); +self.string_bit.write().unwrap()[_index] = Some(string_bit.clone()); +string_bit +} +} + +/// Exhume (get) [`StringBit`] from the store. +/// +#[inline] +pub fn exhume_string_bit(&self, id: &usize) -> Option>> { +match self.string_bit.read().unwrap().get(*id) { +Some(string_bit) => string_bit.clone(), +None => None +} +} + +/// Exorcise (remove) [`StringBit`] from the store. +/// +#[inline] +pub fn exorcise_string_bit(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising string_bit slot: {id}."); +let result = self.string_bit.write().unwrap()[*id].take(); +self.string_bit_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StringBit>`. +/// +#[inline] +pub fn iter_string_bit(&self) -> impl Iterator>> + '_ { +let len = self.string_bit.read().unwrap().len(); +(0..len).filter(|i| self.string_bit.read().unwrap()[*i].is_some()).map(move|i|{self.string_bit.read().unwrap()[i].as_ref().map(|string_bit| string_bit.clone()).unwrap()}) +} + +/// Inter (insert) [`StringLiteral`] into the store. +/// +#[inline] +pub fn inter_string_literal(&mut self, string_literal: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.string_literal_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.string_literal.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.string_literal.write().unwrap().push(None); +_index +}; + +let string_literal = string_literal(_index); + +let found = if let Some(string_literal) = self.string_literal.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *string_literal.read().unwrap() +} else { +false +} +}) { +string_literal.clone() +} else { +None +}; + +if let Some(string_literal) = found { +tracing::debug!(target: "store", "found duplicate {string_literal:?}."); +self.string_literal_free_list.lock().unwrap().push(_index); +string_literal.clone() +} else { +tracing::debug!(target: "store", "interring {string_literal:?}."); +self.string_literal.write().unwrap()[_index] = Some(string_literal.clone()); +string_literal +} +} + +/// Exhume (get) [`StringLiteral`] from the store. +/// +#[inline] +pub fn exhume_string_literal(&self, id: &usize) -> Option>> { +match self.string_literal.read().unwrap().get(*id) { +Some(string_literal) => string_literal.clone(), +None => None +} +} + +/// Exorcise (remove) [`StringLiteral`] from the store. +/// +#[inline] +pub fn exorcise_string_literal(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising string_literal slot: {id}."); +let result = self.string_literal.write().unwrap()[*id].take(); +self.string_literal_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StringLiteral>`. +/// +#[inline] +pub fn iter_string_literal(&self) -> impl Iterator>> + '_ { +let len = self.string_literal.read().unwrap().len(); +(0..len).filter(|i| self.string_literal.read().unwrap()[*i].is_some()).map(move|i|{self.string_literal.read().unwrap()[i].as_ref().map(|string_literal| string_literal.clone()).unwrap()}) +} + +/// Inter (insert) [`WoogStruct`] into the store. +/// +#[inline] +pub fn inter_woog_struct(&mut self, woog_struct: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.woog_struct_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.woog_struct.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.woog_struct.write().unwrap().push(None); +_index +}; + +let woog_struct = woog_struct(_index); + +let found = if let Some(woog_struct) = self.woog_struct.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *woog_struct.read().unwrap() +} else { +false +} +}) { +woog_struct.clone() +} else { +None +}; + +let woog_struct = +if let Some(woog_struct) = found { +tracing::debug!(target: "store", "found duplicate {woog_struct:?}."); +self.woog_struct_free_list.lock().unwrap().push(_index); +woog_struct.clone() +} else { +tracing::debug!(target: "store", "interring {woog_struct:?}."); +self.woog_struct.write().unwrap()[_index] = Some(woog_struct.clone()); +woog_struct +} +; +self.woog_struct_id_by_name.write().unwrap().insert(woog_struct.read().unwrap().name.to_owned(), woog_struct.read().unwrap().id); +woog_struct +} + +/// Exhume (get) [`WoogStruct`] from the store. +/// +#[inline] +pub fn exhume_woog_struct(&self, id: &usize) -> Option>> { +match self.woog_struct.read().unwrap().get(*id) { +Some(woog_struct) => woog_struct.clone(), +None => None +} +} + +/// Exorcise (remove) [`WoogStruct`] from the store. +/// +#[inline] +pub fn exorcise_woog_struct(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising woog_struct slot: {id}."); +let result = self.woog_struct.write().unwrap()[*id].take(); +self.woog_struct_free_list.lock().unwrap().push(*id); +result +} + +/// Exorcise [`WoogStruct`] id from the store by name. +/// +#[inline] +pub fn exhume_woog_struct_id_by_name(&self, name: &str) -> Option { +self.woog_struct_id_by_name.read().unwrap().get(name).map(|woog_struct| *woog_struct) +} + +/// Get an iterator over the internal `HashMap<&Uuid, WoogStruct>`. +/// +#[inline] +pub fn iter_woog_struct(&self) -> impl Iterator>> + '_ { +let len = self.woog_struct.read().unwrap().len(); +(0..len).filter(|i| self.woog_struct.read().unwrap()[*i].is_some()).map(move|i|{self.woog_struct.read().unwrap()[i].as_ref().map(|woog_struct| woog_struct.clone()).unwrap()}) +} + +/// Inter (insert) [`StructExpression`] into the store. +/// +#[inline] +pub fn inter_struct_expression(&mut self, struct_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.struct_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.struct_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.struct_expression.write().unwrap().push(None); +_index +}; + +let struct_expression = struct_expression(_index); + +let found = if let Some(struct_expression) = self.struct_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *struct_expression.read().unwrap() +} else { +false +} +}) { +struct_expression.clone() +} else { +None +}; + +if let Some(struct_expression) = found { +tracing::debug!(target: "store", "found duplicate {struct_expression:?}."); +self.struct_expression_free_list.lock().unwrap().push(_index); +struct_expression.clone() +} else { +tracing::debug!(target: "store", "interring {struct_expression:?}."); +self.struct_expression.write().unwrap()[_index] = Some(struct_expression.clone()); +struct_expression +} +} + +/// Exhume (get) [`StructExpression`] from the store. +/// +#[inline] +pub fn exhume_struct_expression(&self, id: &usize) -> Option>> { +match self.struct_expression.read().unwrap().get(*id) { +Some(struct_expression) => struct_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`StructExpression`] from the store. +/// +#[inline] +pub fn exorcise_struct_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising struct_expression slot: {id}."); +let result = self.struct_expression.write().unwrap()[*id].take(); +self.struct_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StructExpression>`. +/// +#[inline] +pub fn iter_struct_expression(&self) -> impl Iterator>> + '_ { +let len = self.struct_expression.read().unwrap().len(); +(0..len).filter(|i| self.struct_expression.read().unwrap()[*i].is_some()).map(move|i|{self.struct_expression.read().unwrap()[i].as_ref().map(|struct_expression| struct_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`StructField`] into the store. +/// +#[inline] +pub fn inter_struct_field(&mut self, struct_field: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.struct_field_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.struct_field.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.struct_field.write().unwrap().push(None); +_index +}; + +let struct_field = struct_field(_index); + +let found = if let Some(struct_field) = self.struct_field.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *struct_field.read().unwrap() +} else { +false +} +}) { +struct_field.clone() +} else { +None +}; + +if let Some(struct_field) = found { +tracing::debug!(target: "store", "found duplicate {struct_field:?}."); +self.struct_field_free_list.lock().unwrap().push(_index); +struct_field.clone() +} else { +tracing::debug!(target: "store", "interring {struct_field:?}."); +self.struct_field.write().unwrap()[_index] = Some(struct_field.clone()); +struct_field +} +} + +/// Exhume (get) [`StructField`] from the store. +/// +#[inline] +pub fn exhume_struct_field(&self, id: &usize) -> Option>> { +match self.struct_field.read().unwrap().get(*id) { +Some(struct_field) => struct_field.clone(), +None => None +} +} + +/// Exorcise (remove) [`StructField`] from the store. +/// +#[inline] +pub fn exorcise_struct_field(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising struct_field slot: {id}."); +let result = self.struct_field.write().unwrap()[*id].take(); +self.struct_field_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StructField>`. +/// +#[inline] +pub fn iter_struct_field(&self) -> impl Iterator>> + '_ { +let len = self.struct_field.read().unwrap().len(); +(0..len).filter(|i| self.struct_field.read().unwrap()[*i].is_some()).map(move|i|{self.struct_field.read().unwrap()[i].as_ref().map(|struct_field| struct_field.clone()).unwrap()}) +} + +/// Inter (insert) [`StructGeneric`] into the store. +/// +#[inline] +pub fn inter_struct_generic(&mut self, struct_generic: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.struct_generic_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.struct_generic.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.struct_generic.write().unwrap().push(None); +_index +}; + +let struct_generic = struct_generic(_index); + +let found = if let Some(struct_generic) = self.struct_generic.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *struct_generic.read().unwrap() +} else { +false +} +}) { +struct_generic.clone() +} else { +None +}; + +if let Some(struct_generic) = found { +tracing::debug!(target: "store", "found duplicate {struct_generic:?}."); +self.struct_generic_free_list.lock().unwrap().push(_index); +struct_generic.clone() +} else { +tracing::debug!(target: "store", "interring {struct_generic:?}."); +self.struct_generic.write().unwrap()[_index] = Some(struct_generic.clone()); +struct_generic +} +} + +/// Exhume (get) [`StructGeneric`] from the store. +/// +#[inline] +pub fn exhume_struct_generic(&self, id: &usize) -> Option>> { +match self.struct_generic.read().unwrap().get(*id) { +Some(struct_generic) => struct_generic.clone(), +None => None +} +} + +/// Exorcise (remove) [`StructGeneric`] from the store. +/// +#[inline] +pub fn exorcise_struct_generic(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising struct_generic slot: {id}."); +let result = self.struct_generic.write().unwrap()[*id].take(); +self.struct_generic_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, StructGeneric>`. +/// +#[inline] +pub fn iter_struct_generic(&self) -> impl Iterator>> + '_ { +let len = self.struct_generic.read().unwrap().len(); +(0..len).filter(|i| self.struct_generic.read().unwrap()[*i].is_some()).map(move|i|{self.struct_generic.read().unwrap()[i].as_ref().map(|struct_generic| struct_generic.clone()).unwrap()}) +} + +/// Inter (insert) [`TupleField`] into the store. +/// +#[inline] +pub fn inter_tuple_field(&mut self, tuple_field: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.tuple_field_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.tuple_field.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.tuple_field.write().unwrap().push(None); +_index +}; + +let tuple_field = tuple_field(_index); + +let found = if let Some(tuple_field) = self.tuple_field.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *tuple_field.read().unwrap() +} else { +false +} +}) { +tuple_field.clone() +} else { +None +}; + +if let Some(tuple_field) = found { +tracing::debug!(target: "store", "found duplicate {tuple_field:?}."); +self.tuple_field_free_list.lock().unwrap().push(_index); +tuple_field.clone() +} else { +tracing::debug!(target: "store", "interring {tuple_field:?}."); +self.tuple_field.write().unwrap()[_index] = Some(tuple_field.clone()); +tuple_field +} +} + +/// Exhume (get) [`TupleField`] from the store. +/// +#[inline] +pub fn exhume_tuple_field(&self, id: &usize) -> Option>> { +match self.tuple_field.read().unwrap().get(*id) { +Some(tuple_field) => tuple_field.clone(), +None => None +} +} + +/// Exorcise (remove) [`TupleField`] from the store. +/// +#[inline] +pub fn exorcise_tuple_field(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising tuple_field slot: {id}."); +let result = self.tuple_field.write().unwrap()[*id].take(); +self.tuple_field_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, TupleField>`. +/// +#[inline] +pub fn iter_tuple_field(&self) -> impl Iterator>> + '_ { +let len = self.tuple_field.read().unwrap().len(); +(0..len).filter(|i| self.tuple_field.read().unwrap()[*i].is_some()).map(move|i|{self.tuple_field.read().unwrap()[i].as_ref().map(|tuple_field| tuple_field.clone()).unwrap()}) +} + +/// Inter (insert) [`TypeCast`] into the store. +/// +#[inline] +pub fn inter_type_cast(&mut self, type_cast: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.type_cast_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.type_cast.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.type_cast.write().unwrap().push(None); +_index +}; + +let type_cast = type_cast(_index); + +let found = if let Some(type_cast) = self.type_cast.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *type_cast.read().unwrap() +} else { +false +} +}) { +type_cast.clone() +} else { +None +}; + +if let Some(type_cast) = found { +tracing::debug!(target: "store", "found duplicate {type_cast:?}."); +self.type_cast_free_list.lock().unwrap().push(_index); +type_cast.clone() +} else { +tracing::debug!(target: "store", "interring {type_cast:?}."); +self.type_cast.write().unwrap()[_index] = Some(type_cast.clone()); +type_cast +} +} + +/// Exhume (get) [`TypeCast`] from the store. +/// +#[inline] +pub fn exhume_type_cast(&self, id: &usize) -> Option>> { +match self.type_cast.read().unwrap().get(*id) { +Some(type_cast) => type_cast.clone(), +None => None +} +} + +/// Exorcise (remove) [`TypeCast`] from the store. +/// +#[inline] +pub fn exorcise_type_cast(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising type_cast slot: {id}."); +let result = self.type_cast.write().unwrap()[*id].take(); +self.type_cast_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, TypeCast>`. +/// +#[inline] +pub fn iter_type_cast(&self) -> impl Iterator>> + '_ { +let len = self.type_cast.read().unwrap().len(); +(0..len).filter(|i| self.type_cast.read().unwrap()[*i].is_some()).map(move|i|{self.type_cast.read().unwrap()[i].as_ref().map(|type_cast| type_cast.clone()).unwrap()}) +} + +/// Inter (insert) [`Unary`] into the store. +/// +#[inline] +pub fn inter_unary(&mut self, unary: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.unary_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.unary.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.unary.write().unwrap().push(None); +_index +}; + +let unary = unary(_index); + +let found = if let Some(unary) = self.unary.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *unary.read().unwrap() +} else { +false +} +}) { +unary.clone() +} else { +None +}; + +if let Some(unary) = found { +tracing::debug!(target: "store", "found duplicate {unary:?}."); +self.unary_free_list.lock().unwrap().push(_index); +unary.clone() +} else { +tracing::debug!(target: "store", "interring {unary:?}."); +self.unary.write().unwrap()[_index] = Some(unary.clone()); +unary +} +} + +/// Exhume (get) [`Unary`] from the store. +/// +#[inline] +pub fn exhume_unary(&self, id: &usize) -> Option>> { +match self.unary.read().unwrap().get(*id) { +Some(unary) => unary.clone(), +None => None +} +} + +/// Exorcise (remove) [`Unary`] from the store. +/// +#[inline] +pub fn exorcise_unary(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising unary slot: {id}."); +let result = self.unary.write().unwrap()[*id].take(); +self.unary_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Unary>`. +/// +#[inline] +pub fn iter_unary(&self) -> impl Iterator>> + '_ { +let len = self.unary.read().unwrap().len(); +(0..len).filter(|i| self.unary.read().unwrap()[*i].is_some()).map(move|i|{self.unary.read().unwrap()[i].as_ref().map(|unary| unary.clone()).unwrap()}) +} + +/// Inter (insert) [`Unit`] into the store. +/// +#[inline] +pub fn inter_unit(&mut self, unit: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.unit_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.unit.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.unit.write().unwrap().push(None); +_index +}; + +let unit = unit(_index); + +let found = if let Some(unit) = self.unit.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *unit.read().unwrap() +} else { +false +} +}) { +unit.clone() +} else { +None +}; + +if let Some(unit) = found { +tracing::debug!(target: "store", "found duplicate {unit:?}."); +self.unit_free_list.lock().unwrap().push(_index); +unit.clone() +} else { +tracing::debug!(target: "store", "interring {unit:?}."); +self.unit.write().unwrap()[_index] = Some(unit.clone()); +unit +} +} + +/// Exhume (get) [`Unit`] from the store. +/// +#[inline] +pub fn exhume_unit(&self, id: &usize) -> Option>> { +match self.unit.read().unwrap().get(*id) { +Some(unit) => unit.clone(), +None => None +} +} + +/// Exorcise (remove) [`Unit`] from the store. +/// +#[inline] +pub fn exorcise_unit(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising unit slot: {id}."); +let result = self.unit.write().unwrap()[*id].take(); +self.unit_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Unit>`. +/// +#[inline] +pub fn iter_unit(&self) -> impl Iterator>> + '_ { +let len = self.unit.read().unwrap().len(); +(0..len).filter(|i| self.unit.read().unwrap()[*i].is_some()).map(move|i|{self.unit.read().unwrap()[i].as_ref().map(|unit| unit.clone()).unwrap()}) +} + +/// Inter (insert) [`UnnamedFieldExpression`] into the store. +/// +#[inline] +pub fn inter_unnamed_field_expression(&mut self, unnamed_field_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.unnamed_field_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.unnamed_field_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.unnamed_field_expression.write().unwrap().push(None); +_index +}; + +let unnamed_field_expression = unnamed_field_expression(_index); + +let found = if let Some(unnamed_field_expression) = self.unnamed_field_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *unnamed_field_expression.read().unwrap() +} else { +false +} +}) { +unnamed_field_expression.clone() +} else { +None +}; + +if let Some(unnamed_field_expression) = found { +tracing::debug!(target: "store", "found duplicate {unnamed_field_expression:?}."); +self.unnamed_field_expression_free_list.lock().unwrap().push(_index); +unnamed_field_expression.clone() +} else { +tracing::debug!(target: "store", "interring {unnamed_field_expression:?}."); +self.unnamed_field_expression.write().unwrap()[_index] = Some(unnamed_field_expression.clone()); +unnamed_field_expression +} +} + +/// Exhume (get) [`UnnamedFieldExpression`] from the store. +/// +#[inline] +pub fn exhume_unnamed_field_expression(&self, id: &usize) -> Option>> { +match self.unnamed_field_expression.read().unwrap().get(*id) { +Some(unnamed_field_expression) => unnamed_field_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`UnnamedFieldExpression`] from the store. +/// +#[inline] +pub fn exorcise_unnamed_field_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising unnamed_field_expression slot: {id}."); +let result = self.unnamed_field_expression.write().unwrap()[*id].take(); +self.unnamed_field_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, UnnamedFieldExpression>`. +/// +#[inline] +pub fn iter_unnamed_field_expression(&self) -> impl Iterator>> + '_ { +let len = self.unnamed_field_expression.read().unwrap().len(); +(0..len).filter(|i| self.unnamed_field_expression.read().unwrap()[*i].is_some()).map(move|i|{self.unnamed_field_expression.read().unwrap()[i].as_ref().map(|unnamed_field_expression| unnamed_field_expression.clone()).unwrap()}) +} + +/// Inter (insert) [`XValue`] into the store. +/// +#[inline] +pub fn inter_x_value(&mut self, x_value: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.x_value_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.x_value.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.x_value.write().unwrap().push(None); +_index +}; + +let x_value = x_value(_index); + +let found = if let Some(x_value) = self.x_value.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *x_value.read().unwrap() +} else { +false +} +}) { +x_value.clone() +} else { +None +}; + +if let Some(x_value) = found { +tracing::debug!(target: "store", "found duplicate {x_value:?}."); +self.x_value_free_list.lock().unwrap().push(_index); +x_value.clone() +} else { +tracing::debug!(target: "store", "interring {x_value:?}."); +self.x_value.write().unwrap()[_index] = Some(x_value.clone()); +x_value +} +} + +/// Exhume (get) [`XValue`] from the store. +/// +#[inline] +pub fn exhume_x_value(&self, id: &usize) -> Option>> { +match self.x_value.read().unwrap().get(*id) { +Some(x_value) => x_value.clone(), +None => None +} +} + +/// Exorcise (remove) [`XValue`] from the store. +/// +#[inline] +pub fn exorcise_x_value(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising x_value slot: {id}."); +let result = self.x_value.write().unwrap()[*id].take(); +self.x_value_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, XValue>`. +/// +#[inline] +pub fn iter_x_value(&self) -> impl Iterator>> + '_ { +let len = self.x_value.read().unwrap().len(); +(0..len).filter(|i| self.x_value.read().unwrap()[*i].is_some()).map(move|i|{self.x_value.read().unwrap()[i].as_ref().map(|x_value| x_value.clone()).unwrap()}) +} + +/// Inter (insert) [`ValueType`] into the store. +/// +#[inline] +pub fn inter_value_type(&mut self, value_type: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.value_type_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.value_type.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.value_type.write().unwrap().push(None); +_index +}; + +let value_type = value_type(_index); + +let found = if let Some(value_type) = self.value_type.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *value_type.read().unwrap() +} else { +false +} +}) { +value_type.clone() +} else { +None +}; + +if let Some(value_type) = found { +tracing::debug!(target: "store", "found duplicate {value_type:?}."); +self.value_type_free_list.lock().unwrap().push(_index); +value_type.clone() +} else { +tracing::debug!(target: "store", "interring {value_type:?}."); +self.value_type.write().unwrap()[_index] = Some(value_type.clone()); +value_type +} +} + +/// Exhume (get) [`ValueType`] from the store. +/// +#[inline] +pub fn exhume_value_type(&self, id: &usize) -> Option>> { +match self.value_type.read().unwrap().get(*id) { +Some(value_type) => value_type.clone(), +None => None +} +} + +/// Exorcise (remove) [`ValueType`] from the store. +/// +#[inline] +pub fn exorcise_value_type(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising value_type slot: {id}."); +let result = self.value_type.write().unwrap()[*id].take(); +self.value_type_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, ValueType>`. +/// +#[inline] +pub fn iter_value_type(&self) -> impl Iterator>> + '_ { +let len = self.value_type.read().unwrap().len(); +(0..len).filter(|i| self.value_type.read().unwrap()[*i].is_some()).map(move|i|{self.value_type.read().unwrap()[i].as_ref().map(|value_type| value_type.clone()).unwrap()}) +} + +/// Inter (insert) [`Variable`] into the store. +/// +#[inline] +pub fn inter_variable(&mut self, variable: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.variable_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.variable.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.variable.write().unwrap().push(None); +_index +}; + +let variable = variable(_index); + +let found = if let Some(variable) = self.variable.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *variable.read().unwrap() +} else { +false +} +}) { +variable.clone() +} else { +None +}; + +if let Some(variable) = found { +tracing::debug!(target: "store", "found duplicate {variable:?}."); +self.variable_free_list.lock().unwrap().push(_index); +variable.clone() +} else { +tracing::debug!(target: "store", "interring {variable:?}."); +self.variable.write().unwrap()[_index] = Some(variable.clone()); +variable +} +} + +/// Exhume (get) [`Variable`] from the store. +/// +#[inline] +pub fn exhume_variable(&self, id: &usize) -> Option>> { +match self.variable.read().unwrap().get(*id) { +Some(variable) => variable.clone(), +None => None +} +} + +/// Exorcise (remove) [`Variable`] from the store. +/// +#[inline] +pub fn exorcise_variable(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising variable slot: {id}."); +let result = self.variable.write().unwrap()[*id].take(); +self.variable_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, Variable>`. +/// +#[inline] +pub fn iter_variable(&self) -> impl Iterator>> + '_ { +let len = self.variable.read().unwrap().len(); +(0..len).filter(|i| self.variable.read().unwrap()[*i].is_some()).map(move|i|{self.variable.read().unwrap()[i].as_ref().map(|variable| variable.clone()).unwrap()}) +} + +/// Inter (insert) [`VariableExpression`] into the store. +/// +#[inline] +pub fn inter_variable_expression(&mut self, variable_expression: F) -> Arc> where F: Fn(usize) -> Arc>, { +let _index = if let Some(_index) = self.variable_expression_free_list.lock().unwrap().pop() { +tracing::trace!(target: "store", "recycling block {_index}."); +_index +} else { +let _index = self.variable_expression.read().unwrap().len(); +tracing::trace!(target: "store", "allocating block {_index}."); +self.variable_expression.write().unwrap().push(None); +_index +}; + +let variable_expression = variable_expression(_index); + +let found = if let Some(variable_expression) = self.variable_expression.read().unwrap().iter().find(|stored| { +if let Some(stored) = stored { +*stored.read().unwrap() == *variable_expression.read().unwrap() +} else { +false +} +}) { +variable_expression.clone() +} else { +None +}; + +if let Some(variable_expression) = found { +tracing::debug!(target: "store", "found duplicate {variable_expression:?}."); +self.variable_expression_free_list.lock().unwrap().push(_index); +variable_expression.clone() +} else { +tracing::debug!(target: "store", "interring {variable_expression:?}."); +self.variable_expression.write().unwrap()[_index] = Some(variable_expression.clone()); +variable_expression +} +} + +/// Exhume (get) [`VariableExpression`] from the store. +/// +#[inline] +pub fn exhume_variable_expression(&self, id: &usize) -> Option>> { +match self.variable_expression.read().unwrap().get(*id) { +Some(variable_expression) => variable_expression.clone(), +None => None +} +} + +/// Exorcise (remove) [`VariableExpression`] from the store. +/// +#[inline] +pub fn exorcise_variable_expression(&mut self, id: &usize) -> Option>> { +tracing::debug!(target: "store", "exorcising variable_expression slot: {id}."); +let result = self.variable_expression.write().unwrap()[*id].take(); +self.variable_expression_free_list.lock().unwrap().push(*id); +result +} + +/// Get an iterator over the internal `HashMap<&Uuid, VariableExpression>`. +/// +#[inline] +pub fn iter_variable_expression(&self) -> impl Iterator>> + '_ { +let len = self.variable_expression.read().unwrap().len(); +(0..len).filter(|i| self.variable_expression.read().unwrap()[*i].is_some()).map(move|i|{self.variable_expression.read().unwrap()[i].as_ref().map(|variable_expression| variable_expression.clone()).unwrap()}) +} + +// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} + } // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} // {"magic":"","directive":{"End":{"directive":"ignore-orig"}}} diff --git a/src/v2/lu_dog_pl_vec/store.rs b/src/v2/lu_dog_pl_vec/store.rs index b4ce8610..558be798 100644 --- a/src/v2/lu_dog_pl_vec/store.rs +++ b/src/v2/lu_dog_pl_vec/store.rs @@ -587,16 +587,16 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap(); - other.argument.read().unwrap().iter().for_each(|x| { + if self.argument.read().len() != other.argument.read().len() { + let mut argument = self.argument.write(); + other.argument.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in argument, if it's not there add it to argument. if argument .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -604,8 +604,8 @@ impl ObjectStore { .is_none() { let _index_ = argument.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } argument.push(Some(x.clone())); } @@ -613,16 +613,16 @@ impl ObjectStore { }); } - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap(); - other.a_wait.read().unwrap().iter().for_each(|x| { + if self.a_wait.read().len() != other.a_wait.read().len() { + let mut a_wait = self.a_wait.write(); + other.a_wait.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in a_wait, if it's not there add it to a_wait. if a_wait .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -630,8 +630,8 @@ impl ObjectStore { .is_none() { let _index_ = a_wait.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } a_wait.push(Some(x.clone())); } @@ -639,16 +639,16 @@ impl ObjectStore { }); } - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap(); - other.binary.read().unwrap().iter().for_each(|x| { + if self.binary.read().len() != other.binary.read().len() { + let mut binary = self.binary.write(); + other.binary.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in binary, if it's not there add it to binary. if binary .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -656,8 +656,8 @@ impl ObjectStore { .is_none() { let _index_ = binary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } binary.push(Some(x.clone())); } @@ -665,16 +665,16 @@ impl ObjectStore { }); } - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap(); - other.block.read().unwrap().iter().for_each(|x| { + if self.block.read().len() != other.block.read().len() { + let mut block = self.block.write(); + other.block.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in block, if it's not there add it to block. if block .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -682,8 +682,8 @@ impl ObjectStore { .is_none() { let _index_ = block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } block.push(Some(x.clone())); } @@ -691,16 +691,16 @@ impl ObjectStore { }); } - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap(); - other.body.read().unwrap().iter().for_each(|x| { + if self.body.read().len() != other.body.read().len() { + let mut body = self.body.write(); + other.body.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in body, if it's not there add it to body. if body .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -708,8 +708,8 @@ impl ObjectStore { .is_none() { let _index_ = body.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } body.push(Some(x.clone())); } @@ -717,17 +717,16 @@ impl ObjectStore { }); } - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() - { - let mut boolean_literal = self.boolean_literal.write().unwrap(); - other.boolean_literal.read().unwrap().iter().for_each(|x| { + if self.boolean_literal.read().len() != other.boolean_literal.read().len() { + let mut boolean_literal = self.boolean_literal.write(); + other.boolean_literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_literal, if it's not there add it to boolean_literal. if boolean_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -735,8 +734,8 @@ impl ObjectStore { .is_none() { let _index_ = boolean_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } boolean_literal.push(Some(x.clone())); } @@ -744,18 +743,16 @@ impl ObjectStore { }); } - if self.boolean_operator.read().unwrap().len() - != other.boolean_operator.read().unwrap().len() - { - let mut boolean_operator = self.boolean_operator.write().unwrap(); - other.boolean_operator.read().unwrap().iter().for_each(|x| { + if self.boolean_operator.read().len() != other.boolean_operator.read().len() { + let mut boolean_operator = self.boolean_operator.write(); + other.boolean_operator.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_operator, if it's not there add it to boolean_operator. if boolean_operator .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -763,8 +760,8 @@ impl ObjectStore { .is_none() { let _index_ = boolean_operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } boolean_operator.push(Some(x.clone())); } @@ -772,16 +769,16 @@ impl ObjectStore { }); } - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - let mut call = self.call.write().unwrap(); - other.call.read().unwrap().iter().for_each(|x| { + if self.call.read().len() != other.call.read().len() { + let mut call = self.call.write(); + other.call.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in call, if it's not there add it to call. if call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -789,8 +786,8 @@ impl ObjectStore { .is_none() { let _index_ = call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } call.push(Some(x.clone())); } @@ -798,16 +795,16 @@ impl ObjectStore { }); } - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - let mut char_literal = self.char_literal.write().unwrap(); - other.char_literal.read().unwrap().iter().for_each(|x| { + if self.char_literal.read().len() != other.char_literal.read().len() { + let mut char_literal = self.char_literal.write(); + other.char_literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in char_literal, if it's not there add it to char_literal. if char_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -815,8 +812,8 @@ impl ObjectStore { .is_none() { let _index_ = char_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } char_literal.push(Some(x.clone())); } @@ -824,16 +821,16 @@ impl ObjectStore { }); } - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - let mut comparison = self.comparison.write().unwrap(); - other.comparison.read().unwrap().iter().for_each(|x| { + if self.comparison.read().len() != other.comparison.read().len() { + let mut comparison = self.comparison.write(); + other.comparison.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in comparison, if it's not there add it to comparison. if comparison .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -841,8 +838,8 @@ impl ObjectStore { .is_none() { let _index_ = comparison.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } comparison.push(Some(x.clone())); } @@ -850,16 +847,16 @@ impl ObjectStore { }); } - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - let mut data_structure = self.data_structure.write().unwrap(); - other.data_structure.read().unwrap().iter().for_each(|x| { + if self.data_structure.read().len() != other.data_structure.read().len() { + let mut data_structure = self.data_structure.write(); + other.data_structure.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in data_structure, if it's not there add it to data_structure. if data_structure .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -867,8 +864,8 @@ impl ObjectStore { .is_none() { let _index_ = data_structure.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } data_structure.push(Some(x.clone())); } @@ -876,49 +873,42 @@ impl ObjectStore { }); } - if self.dwarf_source_file.read().unwrap().len() - != other.dwarf_source_file.read().unwrap().len() - { - let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); - other - .dwarf_source_file - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. - if dwarf_source_file - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.dwarf_source_file.read().len() != other.dwarf_source_file.read().len() { + let mut dwarf_source_file = self.dwarf_source_file.write(); + other.dwarf_source_file.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - dwarf_source_file.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + dwarf_source_file.push(Some(x.clone())); } - }); + } + }); } - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - let mut enum_field = self.enum_field.write().unwrap(); - other.enum_field.read().unwrap().iter().for_each(|x| { + if self.enum_field.read().len() != other.enum_field.read().len() { + let mut enum_field = self.enum_field.write(); + other.enum_field.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_field, if it's not there add it to enum_field. if enum_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -926,8 +916,8 @@ impl ObjectStore { .is_none() { let _index_ = enum_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } enum_field.push(Some(x.clone())); } @@ -935,16 +925,16 @@ impl ObjectStore { }); } - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - let mut enum_generic = self.enum_generic.write().unwrap(); - other.enum_generic.read().unwrap().iter().for_each(|x| { + if self.enum_generic.read().len() != other.enum_generic.read().len() { + let mut enum_generic = self.enum_generic.write(); + other.enum_generic.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_generic, if it's not there add it to enum_generic. if enum_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -952,8 +942,8 @@ impl ObjectStore { .is_none() { let _index_ = enum_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } enum_generic.push(Some(x.clone())); } @@ -961,49 +951,42 @@ impl ObjectStore { }); } - if self.enum_generic_type.read().unwrap().len() - != other.enum_generic_type.read().unwrap().len() - { - let mut enum_generic_type = self.enum_generic_type.write().unwrap(); - other - .enum_generic_type - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.enum_generic_type.read().len() != other.enum_generic_type.read().len() { + let mut enum_generic_type = self.enum_generic_type.write(); + other.enum_generic_type.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if enum_generic_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - enum_generic_type.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = enum_generic_type.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + enum_generic_type.push(Some(x.clone())); } - }); + } + }); } - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - let mut enumeration = self.enumeration.write().unwrap(); - other.enumeration.read().unwrap().iter().for_each(|x| { + if self.enumeration.read().len() != other.enumeration.read().len() { + let mut enumeration = self.enumeration.write(); + other.enumeration.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in enumeration, if it's not there add it to enumeration. if enumeration .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1011,8 +994,8 @@ impl ObjectStore { .is_none() { let _index_ = enumeration.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } enumeration.push(Some(x.clone())); } @@ -1020,16 +1003,16 @@ impl ObjectStore { }); } - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - let mut expression = self.expression.write().unwrap(); - other.expression.read().unwrap().iter().for_each(|x| { + if self.expression.read().len() != other.expression.read().len() { + let mut expression = self.expression.write(); + other.expression.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in expression, if it's not there add it to expression. if expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1037,8 +1020,8 @@ impl ObjectStore { .is_none() { let _index_ = expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } expression.push(Some(x.clone())); } @@ -1046,16 +1029,16 @@ impl ObjectStore { }); } - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - let mut expression_bit = self.expression_bit.write().unwrap(); - other.expression_bit.read().unwrap().iter().for_each(|x| { + if self.expression_bit.read().len() != other.expression_bit.read().len() { + let mut expression_bit = self.expression_bit.write(); + other.expression_bit.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in expression_bit, if it's not there add it to expression_bit. if expression_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1063,8 +1046,8 @@ impl ObjectStore { .is_none() { let _index_ = expression_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } expression_bit.push(Some(x.clone())); } @@ -1072,82 +1055,68 @@ impl ObjectStore { }); } - if self.expression_statement.read().unwrap().len() - != other.expression_statement.read().unwrap().len() - { - let mut expression_statement = self.expression_statement.write().unwrap(); - other - .expression_statement - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in expression_statement, if it's not there add it to expression_statement. - if expression_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.expression_statement.read().len() != other.expression_statement.read().len() { + let mut expression_statement = self.expression_statement.write(); + other.expression_statement.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - expression_statement.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + expression_statement.push(Some(x.clone())); } - }); + } + }); } - if self.external_implementation.read().unwrap().len() - != other.external_implementation.read().unwrap().len() - { - let mut external_implementation = self.external_implementation.write().unwrap(); - other - .external_implementation - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in external_implementation, if it's not there add it to external_implementation. - if external_implementation - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.external_implementation.read().len() != other.external_implementation.read().len() { + let mut external_implementation = self.external_implementation.write(); + other.external_implementation.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - external_implementation.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + external_implementation.push(Some(x.clone())); } - }); + } + }); } - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - let mut field = self.field.write().unwrap(); - other.field.read().unwrap().iter().for_each(|x| { + if self.field.read().len() != other.field.read().len() { + let mut field = self.field.write(); + other.field.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in field, if it's not there add it to field. if field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1155,8 +1124,8 @@ impl ObjectStore { .is_none() { let _index_ = field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } field.push(Some(x.clone())); } @@ -1164,16 +1133,16 @@ impl ObjectStore { }); } - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - let mut field_access = self.field_access.write().unwrap(); - other.field_access.read().unwrap().iter().for_each(|x| { + if self.field_access.read().len() != other.field_access.read().len() { + let mut field_access = self.field_access.write(); + other.field_access.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in field_access, if it's not there add it to field_access. if field_access .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1181,8 +1150,8 @@ impl ObjectStore { .is_none() { let _index_ = field_access.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } field_access.push(Some(x.clone())); } @@ -1190,51 +1159,42 @@ impl ObjectStore { }); } - if self.field_access_target.read().unwrap().len() - != other.field_access_target.read().unwrap().len() - { - let mut field_access_target = self.field_access_target.write().unwrap(); - other - .field_access_target - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in field_access_target, if it's not there add it to field_access_target. - if field_access_target - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.field_access_target.read().len() != other.field_access_target.read().len() { + let mut field_access_target = self.field_access_target.write(); + other.field_access_target.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - field_access_target.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + field_access_target.push(Some(x.clone())); } - }); + } + }); } - if self.field_expression.read().unwrap().len() - != other.field_expression.read().unwrap().len() - { - let mut field_expression = self.field_expression.write().unwrap(); - other.field_expression.read().unwrap().iter().for_each(|x| { + if self.field_expression.read().len() != other.field_expression.read().len() { + let mut field_expression = self.field_expression.write(); + other.field_expression.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in field_expression, if it's not there add it to field_expression. if field_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1242,8 +1202,8 @@ impl ObjectStore { .is_none() { let _index_ = field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } field_expression.push(Some(x.clone())); } @@ -1251,16 +1211,16 @@ impl ObjectStore { }); } - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - let mut float_literal = self.float_literal.write().unwrap(); - other.float_literal.read().unwrap().iter().for_each(|x| { + if self.float_literal.read().len() != other.float_literal.read().len() { + let mut float_literal = self.float_literal.write(); + other.float_literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in float_literal, if it's not there add it to float_literal. if float_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1268,8 +1228,8 @@ impl ObjectStore { .is_none() { let _index_ = float_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } float_literal.push(Some(x.clone())); } @@ -1277,16 +1237,16 @@ impl ObjectStore { }); } - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - let mut for_loop = self.for_loop.write().unwrap(); - other.for_loop.read().unwrap().iter().for_each(|x| { + if self.for_loop.read().len() != other.for_loop.read().len() { + let mut for_loop = self.for_loop.write(); + other.for_loop.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in for_loop, if it's not there add it to for_loop. if for_loop .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1294,8 +1254,8 @@ impl ObjectStore { .is_none() { let _index_ = for_loop.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } for_loop.push(Some(x.clone())); } @@ -1303,16 +1263,16 @@ impl ObjectStore { }); } - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - let mut format_bit = self.format_bit.write().unwrap(); - other.format_bit.read().unwrap().iter().for_each(|x| { + if self.format_bit.read().len() != other.format_bit.read().len() { + let mut format_bit = self.format_bit.write(); + other.format_bit.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in format_bit, if it's not there add it to format_bit. if format_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1320,8 +1280,8 @@ impl ObjectStore { .is_none() { let _index_ = format_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } format_bit.push(Some(x.clone())); } @@ -1329,16 +1289,16 @@ impl ObjectStore { }); } - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - let mut format_string = self.format_string.write().unwrap(); - other.format_string.read().unwrap().iter().for_each(|x| { + if self.format_string.read().len() != other.format_string.read().len() { + let mut format_string = self.format_string.write(); + other.format_string.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in format_string, if it's not there add it to format_string. if format_string .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1346,8 +1306,8 @@ impl ObjectStore { .is_none() { let _index_ = format_string.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } format_string.push(Some(x.clone())); } @@ -1355,16 +1315,16 @@ impl ObjectStore { }); } - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - let mut func_generic = self.func_generic.write().unwrap(); - other.func_generic.read().unwrap().iter().for_each(|x| { + if self.func_generic.read().len() != other.func_generic.read().len() { + let mut func_generic = self.func_generic.write(); + other.func_generic.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in func_generic, if it's not there add it to func_generic. if func_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1372,8 +1332,8 @@ impl ObjectStore { .is_none() { let _index_ = func_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } func_generic.push(Some(x.clone())); } @@ -1381,16 +1341,16 @@ impl ObjectStore { }); } - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - let mut function = self.function.write().unwrap(); - other.function.read().unwrap().iter().for_each(|x| { + if self.function.read().len() != other.function.read().len() { + let mut function = self.function.write(); + other.function.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in function, if it's not there add it to function. if function .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1398,8 +1358,8 @@ impl ObjectStore { .is_none() { let _index_ = function.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } function.push(Some(x.clone())); } @@ -1407,16 +1367,16 @@ impl ObjectStore { }); } - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - let mut function_call = self.function_call.write().unwrap(); - other.function_call.read().unwrap().iter().for_each(|x| { + if self.function_call.read().len() != other.function_call.read().len() { + let mut function_call = self.function_call.write(); + other.function_call.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in function_call, if it's not there add it to function_call. if function_call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1424,8 +1384,8 @@ impl ObjectStore { .is_none() { let _index_ = function_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } function_call.push(Some(x.clone())); } @@ -1433,16 +1393,16 @@ impl ObjectStore { }); } - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - let mut x_future = self.x_future.write().unwrap(); - other.x_future.read().unwrap().iter().for_each(|x| { + if self.x_future.read().len() != other.x_future.read().len() { + let mut x_future = self.x_future.write(); + other.x_future.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_future, if it's not there add it to x_future. if x_future .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1450,8 +1410,8 @@ impl ObjectStore { .is_none() { let _index_ = x_future.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_future.push(Some(x.clone())); } @@ -1459,16 +1419,16 @@ impl ObjectStore { }); } - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - let mut grouped = self.grouped.write().unwrap(); - other.grouped.read().unwrap().iter().for_each(|x| { + if self.grouped.read().len() != other.grouped.read().len() { + let mut grouped = self.grouped.write(); + other.grouped.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in grouped, if it's not there add it to grouped. if grouped .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1476,8 +1436,8 @@ impl ObjectStore { .is_none() { let _index_ = grouped.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } grouped.push(Some(x.clone())); } @@ -1485,49 +1445,42 @@ impl ObjectStore { }); } - if self.halt_and_catch_fire.read().unwrap().len() - != other.halt_and_catch_fire.read().unwrap().len() - { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); - other - .halt_and_catch_fire - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. - if halt_and_catch_fire - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.halt_and_catch_fire.read().len() != other.halt_and_catch_fire.read().len() { + let mut halt_and_catch_fire = self.halt_and_catch_fire.write(); + other.halt_and_catch_fire.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - halt_and_catch_fire.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + halt_and_catch_fire.push(Some(x.clone())); } - }); + } + }); } - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - let mut x_if = self.x_if.write().unwrap(); - other.x_if.read().unwrap().iter().for_each(|x| { + if self.x_if.read().len() != other.x_if.read().len() { + let mut x_if = self.x_if.write(); + other.x_if.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_if, if it's not there add it to x_if. if x_if .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1535,8 +1488,8 @@ impl ObjectStore { .is_none() { let _index_ = x_if.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_if.push(Some(x.clone())); } @@ -1544,49 +1497,42 @@ impl ObjectStore { }); } - if self.implementation_block.read().unwrap().len() - != other.implementation_block.read().unwrap().len() - { - let mut implementation_block = self.implementation_block.write().unwrap(); - other - .implementation_block - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in implementation_block, if it's not there add it to implementation_block. - if implementation_block - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.implementation_block.read().len() != other.implementation_block.read().len() { + let mut implementation_block = self.implementation_block.write(); + other.implementation_block.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - implementation_block.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + implementation_block.push(Some(x.clone())); } - }); + } + }); } - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - let mut import = self.import.write().unwrap(); - other.import.read().unwrap().iter().for_each(|x| { + if self.import.read().len() != other.import.read().len() { + let mut import = self.import.write(); + other.import.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in import, if it's not there add it to import. if import .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1594,8 +1540,8 @@ impl ObjectStore { .is_none() { let _index_ = import.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } import.push(Some(x.clone())); } @@ -1603,16 +1549,16 @@ impl ObjectStore { }); } - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - let mut index = self.index.write().unwrap(); - other.index.read().unwrap().iter().for_each(|x| { + if self.index.read().len() != other.index.read().len() { + let mut index = self.index.write(); + other.index.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in index, if it's not there add it to index. if index .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1620,8 +1566,8 @@ impl ObjectStore { .is_none() { let _index_ = index.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } index.push(Some(x.clone())); } @@ -1629,17 +1575,16 @@ impl ObjectStore { }); } - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() - { - let mut integer_literal = self.integer_literal.write().unwrap(); - other.integer_literal.read().unwrap().iter().for_each(|x| { + if self.integer_literal.read().len() != other.integer_literal.read().len() { + let mut integer_literal = self.integer_literal.write(); + other.integer_literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in integer_literal, if it's not there add it to integer_literal. if integer_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1647,8 +1592,8 @@ impl ObjectStore { .is_none() { let _index_ = integer_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } integer_literal.push(Some(x.clone())); } @@ -1656,16 +1601,16 @@ impl ObjectStore { }); } - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - let mut item = self.item.write().unwrap(); - other.item.read().unwrap().iter().for_each(|x| { + if self.item.read().len() != other.item.read().len() { + let mut item = self.item.write(); + other.item.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in item, if it's not there add it to item. if item .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1673,8 +1618,8 @@ impl ObjectStore { .is_none() { let _index_ = item.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } item.push(Some(x.clone())); } @@ -1682,16 +1627,16 @@ impl ObjectStore { }); } - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - let mut lambda = self.lambda.write().unwrap(); - other.lambda.read().unwrap().iter().for_each(|x| { + if self.lambda.read().len() != other.lambda.read().len() { + let mut lambda = self.lambda.write(); + other.lambda.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda, if it's not there add it to lambda. if lambda .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1699,8 +1644,8 @@ impl ObjectStore { .is_none() { let _index_ = lambda.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } lambda.push(Some(x.clone())); } @@ -1708,18 +1653,16 @@ impl ObjectStore { }); } - if self.lambda_parameter.read().unwrap().len() - != other.lambda_parameter.read().unwrap().len() - { - let mut lambda_parameter = self.lambda_parameter.write().unwrap(); - other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if self.lambda_parameter.read().len() != other.lambda_parameter.read().len() { + let mut lambda_parameter = self.lambda_parameter.write(); + other.lambda_parameter.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. if lambda_parameter .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1727,8 +1670,8 @@ impl ObjectStore { .is_none() { let _index_ = lambda_parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } lambda_parameter.push(Some(x.clone())); } @@ -1736,16 +1679,16 @@ impl ObjectStore { }); } - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - let mut let_statement = self.let_statement.write().unwrap(); - other.let_statement.read().unwrap().iter().for_each(|x| { + if self.let_statement.read().len() != other.let_statement.read().len() { + let mut let_statement = self.let_statement.write(); + other.let_statement.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in let_statement, if it's not there add it to let_statement. if let_statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1753,8 +1696,8 @@ impl ObjectStore { .is_none() { let _index_ = let_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } let_statement.push(Some(x.clone())); } @@ -1762,16 +1705,16 @@ impl ObjectStore { }); } - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - let mut list = self.list.write().unwrap(); - other.list.read().unwrap().iter().for_each(|x| { + if self.list.read().len() != other.list.read().len() { + let mut list = self.list.write(); + other.list.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in list, if it's not there add it to list. if list .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1779,8 +1722,8 @@ impl ObjectStore { .is_none() { let _index_ = list.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } list.push(Some(x.clone())); } @@ -1788,16 +1731,16 @@ impl ObjectStore { }); } - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - let mut list_element = self.list_element.write().unwrap(); - other.list_element.read().unwrap().iter().for_each(|x| { + if self.list_element.read().len() != other.list_element.read().len() { + let mut list_element = self.list_element.write(); + other.list_element.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in list_element, if it's not there add it to list_element. if list_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1805,8 +1748,8 @@ impl ObjectStore { .is_none() { let _index_ = list_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } list_element.push(Some(x.clone())); } @@ -1814,17 +1757,16 @@ impl ObjectStore { }); } - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() - { - let mut list_expression = self.list_expression.write().unwrap(); - other.list_expression.read().unwrap().iter().for_each(|x| { + if self.list_expression.read().len() != other.list_expression.read().len() { + let mut list_expression = self.list_expression.write(); + other.list_expression.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in list_expression, if it's not there add it to list_expression. if list_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1832,8 +1774,8 @@ impl ObjectStore { .is_none() { let _index_ = list_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } list_expression.push(Some(x.clone())); } @@ -1841,16 +1783,16 @@ impl ObjectStore { }); } - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - let mut literal = self.literal.write().unwrap(); - other.literal.read().unwrap().iter().for_each(|x| { + if self.literal.read().len() != other.literal.read().len() { + let mut literal = self.literal.write(); + other.literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in literal, if it's not there add it to literal. if literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1858,8 +1800,8 @@ impl ObjectStore { .is_none() { let _index_ = literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } literal.push(Some(x.clone())); } @@ -1867,16 +1809,16 @@ impl ObjectStore { }); } - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - let mut local_variable = self.local_variable.write().unwrap(); - other.local_variable.read().unwrap().iter().for_each(|x| { + if self.local_variable.read().len() != other.local_variable.read().len() { + let mut local_variable = self.local_variable.write(); + other.local_variable.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in local_variable, if it's not there add it to local_variable. if local_variable .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1884,8 +1826,8 @@ impl ObjectStore { .is_none() { let _index_ = local_variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } local_variable.push(Some(x.clone())); } @@ -1893,16 +1835,16 @@ impl ObjectStore { }); } - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - let mut x_macro = self.x_macro.write().unwrap(); - other.x_macro.read().unwrap().iter().for_each(|x| { + if self.x_macro.read().len() != other.x_macro.read().len() { + let mut x_macro = self.x_macro.write(); + other.x_macro.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_macro, if it's not there add it to x_macro. if x_macro .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1910,8 +1852,8 @@ impl ObjectStore { .is_none() { let _index_ = x_macro.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_macro.push(Some(x.clone())); } @@ -1919,16 +1861,16 @@ impl ObjectStore { }); } - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - let mut map = self.map.write().unwrap(); - other.map.read().unwrap().iter().for_each(|x| { + if self.map.read().len() != other.map.read().len() { + let mut map = self.map.write(); + other.map.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in map, if it's not there add it to map. if map .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1936,8 +1878,8 @@ impl ObjectStore { .is_none() { let _index_ = map.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } map.push(Some(x.clone())); } @@ -1945,16 +1887,16 @@ impl ObjectStore { }); } - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - let mut map_element = self.map_element.write().unwrap(); - other.map_element.read().unwrap().iter().for_each(|x| { + if self.map_element.read().len() != other.map_element.read().len() { + let mut map_element = self.map_element.write(); + other.map_element.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in map_element, if it's not there add it to map_element. if map_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1962,8 +1904,8 @@ impl ObjectStore { .is_none() { let _index_ = map_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } map_element.push(Some(x.clone())); } @@ -1971,16 +1913,16 @@ impl ObjectStore { }); } - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - let mut map_expression = self.map_expression.write().unwrap(); - other.map_expression.read().unwrap().iter().for_each(|x| { + if self.map_expression.read().len() != other.map_expression.read().len() { + let mut map_expression = self.map_expression.write(); + other.map_expression.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in map_expression, if it's not there add it to map_expression. if map_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -1988,8 +1930,8 @@ impl ObjectStore { .is_none() { let _index_ = map_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } map_expression.push(Some(x.clone())); } @@ -1997,16 +1939,16 @@ impl ObjectStore { }); } - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - let mut x_match = self.x_match.write().unwrap(); - other.x_match.read().unwrap().iter().for_each(|x| { + if self.x_match.read().len() != other.x_match.read().len() { + let mut x_match = self.x_match.write(); + other.x_match.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_match, if it's not there add it to x_match. if x_match .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2014,8 +1956,8 @@ impl ObjectStore { .is_none() { let _index_ = x_match.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_match.push(Some(x.clone())); } @@ -2023,16 +1965,16 @@ impl ObjectStore { }); } - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap(); - other.method_call.read().unwrap().iter().for_each(|x| { + if self.method_call.read().len() != other.method_call.read().len() { + let mut method_call = self.method_call.write(); + other.method_call.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in method_call, if it's not there add it to method_call. if method_call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2040,8 +1982,8 @@ impl ObjectStore { .is_none() { let _index_ = method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } method_call.push(Some(x.clone())); } @@ -2049,49 +1991,42 @@ impl ObjectStore { }); } - if self.named_field_expression.read().unwrap().len() - != other.named_field_expression.read().unwrap().len() - { - let mut named_field_expression = self.named_field_expression.write().unwrap(); - other - .named_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in named_field_expression, if it's not there add it to named_field_expression. - if named_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.named_field_expression.read().len() != other.named_field_expression.read().len() { + let mut named_field_expression = self.named_field_expression.write(); + other.named_field_expression.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - named_field_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + named_field_expression.push(Some(x.clone())); } - }); + } + }); } - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - let mut z_object_store = self.z_object_store.write().unwrap(); - other.z_object_store.read().unwrap().iter().for_each(|x| { + if self.z_object_store.read().len() != other.z_object_store.read().len() { + let mut z_object_store = self.z_object_store.write(); + other.z_object_store.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in z_object_store, if it's not there add it to z_object_store. if z_object_store .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2099,8 +2034,8 @@ impl ObjectStore { .is_none() { let _index_ = z_object_store.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } z_object_store.push(Some(x.clone())); } @@ -2108,16 +2043,16 @@ impl ObjectStore { }); } - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - let mut object_wrapper = self.object_wrapper.write().unwrap(); - other.object_wrapper.read().unwrap().iter().for_each(|x| { + if self.object_wrapper.read().len() != other.object_wrapper.read().len() { + let mut object_wrapper = self.object_wrapper.write(); + other.object_wrapper.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in object_wrapper, if it's not there add it to object_wrapper. if object_wrapper .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2125,8 +2060,8 @@ impl ObjectStore { .is_none() { let _index_ = object_wrapper.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } object_wrapper.push(Some(x.clone())); } @@ -2134,16 +2069,16 @@ impl ObjectStore { }); } - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - let mut operator = self.operator.write().unwrap(); - other.operator.read().unwrap().iter().for_each(|x| { + if self.operator.read().len() != other.operator.read().len() { + let mut operator = self.operator.write(); + other.operator.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in operator, if it's not there add it to operator. if operator .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2151,8 +2086,8 @@ impl ObjectStore { .is_none() { let _index_ = operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } operator.push(Some(x.clone())); } @@ -2160,16 +2095,16 @@ impl ObjectStore { }); } - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - let mut parameter = self.parameter.write().unwrap(); - other.parameter.read().unwrap().iter().for_each(|x| { + if self.parameter.read().len() != other.parameter.read().len() { + let mut parameter = self.parameter.write(); + other.parameter.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in parameter, if it's not there add it to parameter. if parameter .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2177,8 +2112,8 @@ impl ObjectStore { .is_none() { let _index_ = parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } parameter.push(Some(x.clone())); } @@ -2186,16 +2121,16 @@ impl ObjectStore { }); } - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - let mut x_path = self.x_path.write().unwrap(); - other.x_path.read().unwrap().iter().for_each(|x| { + if self.x_path.read().len() != other.x_path.read().len() { + let mut x_path = self.x_path.write(); + other.x_path.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_path, if it's not there add it to x_path. if x_path .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2203,8 +2138,8 @@ impl ObjectStore { .is_none() { let _index_ = x_path.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_path.push(Some(x.clone())); } @@ -2212,16 +2147,16 @@ impl ObjectStore { }); } - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - let mut path_element = self.path_element.write().unwrap(); - other.path_element.read().unwrap().iter().for_each(|x| { + if self.path_element.read().len() != other.path_element.read().len() { + let mut path_element = self.path_element.write(); + other.path_element.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in path_element, if it's not there add it to path_element. if path_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2229,8 +2164,8 @@ impl ObjectStore { .is_none() { let _index_ = path_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } path_element.push(Some(x.clone())); } @@ -2238,16 +2173,16 @@ impl ObjectStore { }); } - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - let mut pattern = self.pattern.write().unwrap(); - other.pattern.read().unwrap().iter().for_each(|x| { + if self.pattern.read().len() != other.pattern.read().len() { + let mut pattern = self.pattern.write(); + other.pattern.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in pattern, if it's not there add it to pattern. if pattern .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2255,8 +2190,8 @@ impl ObjectStore { .is_none() { let _index_ = pattern.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } pattern.push(Some(x.clone())); } @@ -2264,16 +2199,16 @@ impl ObjectStore { }); } - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - let mut x_plugin = self.x_plugin.write().unwrap(); - other.x_plugin.read().unwrap().iter().for_each(|x| { + if self.x_plugin.read().len() != other.x_plugin.read().len() { + let mut x_plugin = self.x_plugin.write(); + other.x_plugin.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_plugin, if it's not there add it to x_plugin. if x_plugin .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2281,8 +2216,8 @@ impl ObjectStore { .is_none() { let _index_ = x_plugin.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_plugin.push(Some(x.clone())); } @@ -2290,16 +2225,16 @@ impl ObjectStore { }); } - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - let mut x_print = self.x_print.write().unwrap(); - other.x_print.read().unwrap().iter().for_each(|x| { + if self.x_print.read().len() != other.x_print.read().len() { + let mut x_print = self.x_print.write(); + other.x_print.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_print, if it's not there add it to x_print. if x_print .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2307,8 +2242,8 @@ impl ObjectStore { .is_none() { let _index_ = x_print.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_print.push(Some(x.clone())); } @@ -2316,18 +2251,16 @@ impl ObjectStore { }); } - if self.range_expression.read().unwrap().len() - != other.range_expression.read().unwrap().len() - { - let mut range_expression = self.range_expression.write().unwrap(); - other.range_expression.read().unwrap().iter().for_each(|x| { + if self.range_expression.read().len() != other.range_expression.read().len() { + let mut range_expression = self.range_expression.write(); + other.range_expression.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in range_expression, if it's not there add it to range_expression. if range_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2335,8 +2268,8 @@ impl ObjectStore { .is_none() { let _index_ = range_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } range_expression.push(Some(x.clone())); } @@ -2344,18 +2277,16 @@ impl ObjectStore { }); } - if self.result_statement.read().unwrap().len() - != other.result_statement.read().unwrap().len() - { - let mut result_statement = self.result_statement.write().unwrap(); - other.result_statement.read().unwrap().iter().for_each(|x| { + if self.result_statement.read().len() != other.result_statement.read().len() { + let mut result_statement = self.result_statement.write(); + other.result_statement.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in result_statement, if it's not there add it to result_statement. if result_statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2363,8 +2294,8 @@ impl ObjectStore { .is_none() { let _index_ = result_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } result_statement.push(Some(x.clone())); } @@ -2372,16 +2303,16 @@ impl ObjectStore { }); } - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - let mut x_return = self.x_return.write().unwrap(); - other.x_return.read().unwrap().iter().for_each(|x| { + if self.x_return.read().len() != other.x_return.read().len() { + let mut x_return = self.x_return.write(); + other.x_return.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_return, if it's not there add it to x_return. if x_return .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2389,8 +2320,8 @@ impl ObjectStore { .is_none() { let _index_ = x_return.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_return.push(Some(x.clone())); } @@ -2398,16 +2329,16 @@ impl ObjectStore { }); } - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - let mut span = self.span.write().unwrap(); - other.span.read().unwrap().iter().for_each(|x| { + if self.span.read().len() != other.span.read().len() { + let mut span = self.span.write(); + other.span.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in span, if it's not there add it to span. if span .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2415,8 +2346,8 @@ impl ObjectStore { .is_none() { let _index_ = span.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } span.push(Some(x.clone())); } @@ -2424,16 +2355,16 @@ impl ObjectStore { }); } - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap(); - other.statement.read().unwrap().iter().for_each(|x| { + if self.statement.read().len() != other.statement.read().len() { + let mut statement = self.statement.write(); + other.statement.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in statement, if it's not there add it to statement. if statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2441,8 +2372,8 @@ impl ObjectStore { .is_none() { let _index_ = statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } statement.push(Some(x.clone())); } @@ -2450,49 +2381,42 @@ impl ObjectStore { }); } - if self.static_method_call.read().unwrap().len() - != other.static_method_call.read().unwrap().len() - { - let mut static_method_call = self.static_method_call.write().unwrap(); - other - .static_method_call - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in static_method_call, if it's not there add it to static_method_call. - if static_method_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.static_method_call.read().len() != other.static_method_call.read().len() { + let mut static_method_call = self.static_method_call.write(); + other.static_method_call.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - static_method_call.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + static_method_call.push(Some(x.clone())); } - }); + } + }); } - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - let mut string_bit = self.string_bit.write().unwrap(); - other.string_bit.read().unwrap().iter().for_each(|x| { + if self.string_bit.read().len() != other.string_bit.read().len() { + let mut string_bit = self.string_bit.write(); + other.string_bit.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in string_bit, if it's not there add it to string_bit. if string_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2500,8 +2424,8 @@ impl ObjectStore { .is_none() { let _index_ = string_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } string_bit.push(Some(x.clone())); } @@ -2509,16 +2433,16 @@ impl ObjectStore { }); } - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - let mut string_literal = self.string_literal.write().unwrap(); - other.string_literal.read().unwrap().iter().for_each(|x| { + if self.string_literal.read().len() != other.string_literal.read().len() { + let mut string_literal = self.string_literal.write(); + other.string_literal.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in string_literal, if it's not there add it to string_literal. if string_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2526,8 +2450,8 @@ impl ObjectStore { .is_none() { let _index_ = string_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } string_literal.push(Some(x.clone())); } @@ -2535,16 +2459,16 @@ impl ObjectStore { }); } - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap(); - other.woog_struct.read().unwrap().iter().for_each(|x| { + if self.woog_struct.read().len() != other.woog_struct.read().len() { + let mut woog_struct = self.woog_struct.write(); + other.woog_struct.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in woog_struct, if it's not there add it to woog_struct. if woog_struct .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2552,8 +2476,8 @@ impl ObjectStore { .is_none() { let _index_ = woog_struct.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } woog_struct.push(Some(x.clone())); } @@ -2561,49 +2485,42 @@ impl ObjectStore { }); } - if self.struct_expression.read().unwrap().len() - != other.struct_expression.read().unwrap().len() - { - let mut struct_expression = self.struct_expression.write().unwrap(); - other - .struct_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in struct_expression, if it's not there add it to struct_expression. - if struct_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.struct_expression.read().len() != other.struct_expression.read().len() { + let mut struct_expression = self.struct_expression.write(); + other.struct_expression.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - struct_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + struct_expression.push(Some(x.clone())); } - }); + } + }); } - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - let mut struct_field = self.struct_field.write().unwrap(); - other.struct_field.read().unwrap().iter().for_each(|x| { + if self.struct_field.read().len() != other.struct_field.read().len() { + let mut struct_field = self.struct_field.write(); + other.struct_field.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_field, if it's not there add it to struct_field. if struct_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2611,8 +2528,8 @@ impl ObjectStore { .is_none() { let _index_ = struct_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } struct_field.push(Some(x.clone())); } @@ -2620,16 +2537,16 @@ impl ObjectStore { }); } - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - let mut struct_generic = self.struct_generic.write().unwrap(); - other.struct_generic.read().unwrap().iter().for_each(|x| { + if self.struct_generic.read().len() != other.struct_generic.read().len() { + let mut struct_generic = self.struct_generic.write(); + other.struct_generic.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_generic, if it's not there add it to struct_generic. if struct_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2637,8 +2554,8 @@ impl ObjectStore { .is_none() { let _index_ = struct_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } struct_generic.push(Some(x.clone())); } @@ -2646,16 +2563,16 @@ impl ObjectStore { }); } - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - let mut tuple_field = self.tuple_field.write().unwrap(); - other.tuple_field.read().unwrap().iter().for_each(|x| { + if self.tuple_field.read().len() != other.tuple_field.read().len() { + let mut tuple_field = self.tuple_field.write(); + other.tuple_field.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in tuple_field, if it's not there add it to tuple_field. if tuple_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2663,8 +2580,8 @@ impl ObjectStore { .is_none() { let _index_ = tuple_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } tuple_field.push(Some(x.clone())); } @@ -2672,16 +2589,16 @@ impl ObjectStore { }); } - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - let mut type_cast = self.type_cast.write().unwrap(); - other.type_cast.read().unwrap().iter().for_each(|x| { + if self.type_cast.read().len() != other.type_cast.read().len() { + let mut type_cast = self.type_cast.write(); + other.type_cast.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in type_cast, if it's not there add it to type_cast. if type_cast .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2689,8 +2606,8 @@ impl ObjectStore { .is_none() { let _index_ = type_cast.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } type_cast.push(Some(x.clone())); } @@ -2698,16 +2615,16 @@ impl ObjectStore { }); } - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - let mut unary = self.unary.write().unwrap(); - other.unary.read().unwrap().iter().for_each(|x| { + if self.unary.read().len() != other.unary.read().len() { + let mut unary = self.unary.write(); + other.unary.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in unary, if it's not there add it to unary. if unary .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2715,8 +2632,8 @@ impl ObjectStore { .is_none() { let _index_ = unary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } unary.push(Some(x.clone())); } @@ -2724,16 +2641,16 @@ impl ObjectStore { }); } - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap(); - other.unit.read().unwrap().iter().for_each(|x| { + if self.unit.read().len() != other.unit.read().len() { + let mut unit = self.unit.write(); + other.unit.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in unit, if it's not there add it to unit. if unit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2741,8 +2658,8 @@ impl ObjectStore { .is_none() { let _index_ = unit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } unit.push(Some(x.clone())); } @@ -2750,49 +2667,43 @@ impl ObjectStore { }); } - if self.unnamed_field_expression.read().unwrap().len() - != other.unnamed_field_expression.read().unwrap().len() + if self.unnamed_field_expression.read().len() != other.unnamed_field_expression.read().len() { - let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); - other - .unnamed_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. - if unnamed_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + let mut unnamed_field_expression = self.unnamed_field_expression.write(); + other.unnamed_field_expression.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - unnamed_field_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + unnamed_field_expression.push(Some(x.clone())); } - }); + } + }); } - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - let mut x_value = self.x_value.write().unwrap(); - other.x_value.read().unwrap().iter().for_each(|x| { + if self.x_value.read().len() != other.x_value.read().len() { + let mut x_value = self.x_value.write(); + other.x_value.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_value, if it's not there add it to x_value. if x_value .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2800,8 +2711,8 @@ impl ObjectStore { .is_none() { let _index_ = x_value.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } x_value.push(Some(x.clone())); } @@ -2809,16 +2720,16 @@ impl ObjectStore { }); } - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - let mut value_type = self.value_type.write().unwrap(); - other.value_type.read().unwrap().iter().for_each(|x| { + if self.value_type.read().len() != other.value_type.read().len() { + let mut value_type = self.value_type.write(); + other.value_type.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in value_type, if it's not there add it to value_type. if value_type .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2826,8 +2737,8 @@ impl ObjectStore { .is_none() { let _index_ = value_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } value_type.push(Some(x.clone())); } @@ -2835,16 +2746,16 @@ impl ObjectStore { }); } - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap(); - other.variable.read().unwrap().iter().for_each(|x| { + if self.variable.read().len() != other.variable.read().len() { + let mut variable = self.variable.write(); + other.variable.read().iter().for_each(|x| { if let Some(x) = x { // Look for other in variable, if it's not there add it to variable. if variable .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.read() == *x.read() } else { false } @@ -2852,8 +2763,8 @@ impl ObjectStore { .is_none() { let _index_ = variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.read().id != _index_ { + x.write().id = _index_; } variable.push(Some(x.clone())); } @@ -2861,37 +2772,30 @@ impl ObjectStore { }); } - if self.variable_expression.read().unwrap().len() - != other.variable_expression.read().unwrap().len() - { - let mut variable_expression = self.variable_expression.write().unwrap(); - other - .variable_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in variable_expression, if it's not there add it to variable_expression. - if variable_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.variable_expression.read().len() != other.variable_expression.read().len() { + let mut variable_expression = self.variable_expression.write(); + other.variable_expression.read().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.read() == *x.read() + } else { + false } - variable_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.read().id != _index_ { + x.write().id = _index_; } + variable_expression.push(Some(x.clone())); } - }); + } + }); } } pub fn new() -> Self { diff --git a/src/v2/lu_dog_vec/store.rs b/src/v2/lu_dog_vec/store.rs index d6f07816..1433e587 100644 --- a/src/v2/lu_dog_vec/store.rs +++ b/src/v2/lu_dog_vec/store.rs @@ -489,25 +489,19 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap(); - other.argument.read().unwrap().iter().for_each(|x| { + if self.argument.len() != other.argument.len() { + let mut argument = &mut self.argument; + other.argument.iter().for_each(|x| { if let Some(x) = x { // Look for other in argument, if it's not there add it to argument. if argument .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = argument.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } argument.push(Some(x.clone())); } @@ -515,25 +509,19 @@ impl ObjectStore { }); } - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap(); - other.a_wait.read().unwrap().iter().for_each(|x| { + if self.a_wait.len() != other.a_wait.len() { + let mut a_wait = &mut self.a_wait; + other.a_wait.iter().for_each(|x| { if let Some(x) = x { // Look for other in a_wait, if it's not there add it to a_wait. if a_wait .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = a_wait.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } a_wait.push(Some(x.clone())); } @@ -541,25 +529,19 @@ impl ObjectStore { }); } - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap(); - other.binary.read().unwrap().iter().for_each(|x| { + if self.binary.len() != other.binary.len() { + let mut binary = &mut self.binary; + other.binary.iter().for_each(|x| { if let Some(x) = x { // Look for other in binary, if it's not there add it to binary. if binary .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = binary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } binary.push(Some(x.clone())); } @@ -567,25 +549,19 @@ impl ObjectStore { }); } - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap(); - other.block.read().unwrap().iter().for_each(|x| { + if self.block.len() != other.block.len() { + let mut block = &mut self.block; + other.block.iter().for_each(|x| { if let Some(x) = x { // Look for other in block, if it's not there add it to block. if block .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } block.push(Some(x.clone())); } @@ -593,25 +569,19 @@ impl ObjectStore { }); } - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap(); - other.body.read().unwrap().iter().for_each(|x| { + if self.body.len() != other.body.len() { + let mut body = &mut self.body; + other.body.iter().for_each(|x| { if let Some(x) = x { // Look for other in body, if it's not there add it to body. if body .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = body.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } body.push(Some(x.clone())); } @@ -619,26 +589,19 @@ impl ObjectStore { }); } - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() - { - let mut boolean_literal = self.boolean_literal.write().unwrap(); - other.boolean_literal.read().unwrap().iter().for_each(|x| { + if self.boolean_literal.len() != other.boolean_literal.len() { + let mut boolean_literal = &mut self.boolean_literal; + other.boolean_literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_literal, if it's not there add it to boolean_literal. if boolean_literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = boolean_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } boolean_literal.push(Some(x.clone())); } @@ -646,27 +609,19 @@ impl ObjectStore { }); } - if self.boolean_operator.read().unwrap().len() - != other.boolean_operator.read().unwrap().len() - { - let mut boolean_operator = self.boolean_operator.write().unwrap(); - other.boolean_operator.read().unwrap().iter().for_each(|x| { + if self.boolean_operator.len() != other.boolean_operator.len() { + let mut boolean_operator = &mut self.boolean_operator; + other.boolean_operator.iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_operator, if it's not there add it to boolean_operator. if boolean_operator .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = boolean_operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } boolean_operator.push(Some(x.clone())); } @@ -674,25 +629,19 @@ impl ObjectStore { }); } - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - let mut call = self.call.write().unwrap(); - other.call.read().unwrap().iter().for_each(|x| { + if self.call.len() != other.call.len() { + let mut call = &mut self.call; + other.call.iter().for_each(|x| { if let Some(x) = x { // Look for other in call, if it's not there add it to call. if call .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } call.push(Some(x.clone())); } @@ -700,25 +649,19 @@ impl ObjectStore { }); } - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - let mut char_literal = self.char_literal.write().unwrap(); - other.char_literal.read().unwrap().iter().for_each(|x| { + if self.char_literal.len() != other.char_literal.len() { + let mut char_literal = &mut self.char_literal; + other.char_literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in char_literal, if it's not there add it to char_literal. if char_literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = char_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } char_literal.push(Some(x.clone())); } @@ -726,25 +669,19 @@ impl ObjectStore { }); } - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - let mut comparison = self.comparison.write().unwrap(); - other.comparison.read().unwrap().iter().for_each(|x| { + if self.comparison.len() != other.comparison.len() { + let mut comparison = &mut self.comparison; + other.comparison.iter().for_each(|x| { if let Some(x) = x { // Look for other in comparison, if it's not there add it to comparison. if comparison .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = comparison.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } comparison.push(Some(x.clone())); } @@ -752,25 +689,19 @@ impl ObjectStore { }); } - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - let mut data_structure = self.data_structure.write().unwrap(); - other.data_structure.read().unwrap().iter().for_each(|x| { + if self.data_structure.len() != other.data_structure.len() { + let mut data_structure = &mut self.data_structure; + other.data_structure.iter().for_each(|x| { if let Some(x) = x { // Look for other in data_structure, if it's not there add it to data_structure. if data_structure .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = data_structure.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } data_structure.push(Some(x.clone())); } @@ -778,58 +709,39 @@ impl ObjectStore { }); } - if self.dwarf_source_file.read().unwrap().len() - != other.dwarf_source_file.read().unwrap().len() - { - let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); - other - .dwarf_source_file - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. - if dwarf_source_file - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - dwarf_source_file.push(Some(x.clone())); + if self.dwarf_source_file.len() != other.dwarf_source_file.len() { + let mut dwarf_source_file = &mut self.dwarf_source_file; + other.dwarf_source_file.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + dwarf_source_file.push(Some(x.clone())); } - }); + } + }); } - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - let mut enum_field = self.enum_field.write().unwrap(); - other.enum_field.read().unwrap().iter().for_each(|x| { + if self.enum_field.len() != other.enum_field.len() { + let mut enum_field = &mut self.enum_field; + other.enum_field.iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_field, if it's not there add it to enum_field. if enum_field .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = enum_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enum_field.push(Some(x.clone())); } @@ -837,25 +749,19 @@ impl ObjectStore { }); } - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - let mut enum_generic = self.enum_generic.write().unwrap(); - other.enum_generic.read().unwrap().iter().for_each(|x| { + if self.enum_generic.len() != other.enum_generic.len() { + let mut enum_generic = &mut self.enum_generic; + other.enum_generic.iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_generic, if it's not there add it to enum_generic. if enum_generic .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = enum_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enum_generic.push(Some(x.clone())); } @@ -863,58 +769,39 @@ impl ObjectStore { }); } - if self.enum_generic_type.read().unwrap().len() - != other.enum_generic_type.read().unwrap().len() - { - let mut enum_generic_type = self.enum_generic_type.write().unwrap(); - other - .enum_generic_type - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - enum_generic_type.push(Some(x.clone())); + if self.enum_generic_type.len() != other.enum_generic_type.len() { + let mut enum_generic_type = &mut self.enum_generic_type; + other.enum_generic_type.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if enum_generic_type + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = enum_generic_type.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + enum_generic_type.push(Some(x.clone())); } - }); + } + }); } - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - let mut enumeration = self.enumeration.write().unwrap(); - other.enumeration.read().unwrap().iter().for_each(|x| { + if self.enumeration.len() != other.enumeration.len() { + let mut enumeration = &mut self.enumeration; + other.enumeration.iter().for_each(|x| { if let Some(x) = x { // Look for other in enumeration, if it's not there add it to enumeration. if enumeration .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = enumeration.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enumeration.push(Some(x.clone())); } @@ -922,25 +809,19 @@ impl ObjectStore { }); } - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - let mut expression = self.expression.write().unwrap(); - other.expression.read().unwrap().iter().for_each(|x| { + if self.expression.len() != other.expression.len() { + let mut expression = &mut self.expression; + other.expression.iter().for_each(|x| { if let Some(x) = x { // Look for other in expression, if it's not there add it to expression. if expression .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } expression.push(Some(x.clone())); } @@ -948,25 +829,19 @@ impl ObjectStore { }); } - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - let mut expression_bit = self.expression_bit.write().unwrap(); - other.expression_bit.read().unwrap().iter().for_each(|x| { + if self.expression_bit.len() != other.expression_bit.len() { + let mut expression_bit = &mut self.expression_bit; + other.expression_bit.iter().for_each(|x| { if let Some(x) = x { // Look for other in expression_bit, if it's not there add it to expression_bit. if expression_bit .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = expression_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } expression_bit.push(Some(x.clone())); } @@ -974,91 +849,59 @@ impl ObjectStore { }); } - if self.expression_statement.read().unwrap().len() - != other.expression_statement.read().unwrap().len() - { - let mut expression_statement = self.expression_statement.write().unwrap(); - other - .expression_statement - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in expression_statement, if it's not there add it to expression_statement. - if expression_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - expression_statement.push(Some(x.clone())); + if self.expression_statement.len() != other.expression_statement.len() { + let mut expression_statement = &mut self.expression_statement; + other.expression_statement.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + expression_statement.push(Some(x.clone())); } - }); - } - - if self.external_implementation.read().unwrap().len() - != other.external_implementation.read().unwrap().len() - { - let mut external_implementation = self.external_implementation.write().unwrap(); - other - .external_implementation - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in external_implementation, if it's not there add it to external_implementation. - if external_implementation - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - external_implementation.push(Some(x.clone())); + } + }); + } + + if self.external_implementation.len() != other.external_implementation.len() { + let mut external_implementation = &mut self.external_implementation; + other.external_implementation.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + external_implementation.push(Some(x.clone())); } - }); + } + }); } - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - let mut field = self.field.write().unwrap(); - other.field.read().unwrap().iter().for_each(|x| { + if self.field.len() != other.field.len() { + let mut field = &mut self.field; + other.field.iter().for_each(|x| { if let Some(x) = x { // Look for other in field, if it's not there add it to field. if field .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field.push(Some(x.clone())); } @@ -1066,25 +909,19 @@ impl ObjectStore { }); } - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - let mut field_access = self.field_access.write().unwrap(); - other.field_access.read().unwrap().iter().for_each(|x| { + if self.field_access.len() != other.field_access.len() { + let mut field_access = &mut self.field_access; + other.field_access.iter().for_each(|x| { if let Some(x) = x { // Look for other in field_access, if it's not there add it to field_access. if field_access .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = field_access.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field_access.push(Some(x.clone())); } @@ -1092,60 +929,39 @@ impl ObjectStore { }); } - if self.field_access_target.read().unwrap().len() - != other.field_access_target.read().unwrap().len() - { - let mut field_access_target = self.field_access_target.write().unwrap(); - other - .field_access_target - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in field_access_target, if it's not there add it to field_access_target. - if field_access_target - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - field_access_target.push(Some(x.clone())); + if self.field_access_target.len() != other.field_access_target.len() { + let mut field_access_target = &mut self.field_access_target; + other.field_access_target.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + field_access_target.push(Some(x.clone())); } - }); + } + }); } - if self.field_expression.read().unwrap().len() - != other.field_expression.read().unwrap().len() - { - let mut field_expression = self.field_expression.write().unwrap(); - other.field_expression.read().unwrap().iter().for_each(|x| { + if self.field_expression.len() != other.field_expression.len() { + let mut field_expression = &mut self.field_expression; + other.field_expression.iter().for_each(|x| { if let Some(x) = x { // Look for other in field_expression, if it's not there add it to field_expression. if field_expression .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field_expression.push(Some(x.clone())); } @@ -1153,25 +969,19 @@ impl ObjectStore { }); } - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - let mut float_literal = self.float_literal.write().unwrap(); - other.float_literal.read().unwrap().iter().for_each(|x| { + if self.float_literal.len() != other.float_literal.len() { + let mut float_literal = &mut self.float_literal; + other.float_literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in float_literal, if it's not there add it to float_literal. if float_literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = float_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } float_literal.push(Some(x.clone())); } @@ -1179,25 +989,19 @@ impl ObjectStore { }); } - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - let mut for_loop = self.for_loop.write().unwrap(); - other.for_loop.read().unwrap().iter().for_each(|x| { + if self.for_loop.len() != other.for_loop.len() { + let mut for_loop = &mut self.for_loop; + other.for_loop.iter().for_each(|x| { if let Some(x) = x { // Look for other in for_loop, if it's not there add it to for_loop. if for_loop .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = for_loop.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } for_loop.push(Some(x.clone())); } @@ -1205,25 +1009,19 @@ impl ObjectStore { }); } - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - let mut format_bit = self.format_bit.write().unwrap(); - other.format_bit.read().unwrap().iter().for_each(|x| { + if self.format_bit.len() != other.format_bit.len() { + let mut format_bit = &mut self.format_bit; + other.format_bit.iter().for_each(|x| { if let Some(x) = x { // Look for other in format_bit, if it's not there add it to format_bit. if format_bit .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = format_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } format_bit.push(Some(x.clone())); } @@ -1231,25 +1029,19 @@ impl ObjectStore { }); } - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - let mut format_string = self.format_string.write().unwrap(); - other.format_string.read().unwrap().iter().for_each(|x| { + if self.format_string.len() != other.format_string.len() { + let mut format_string = &mut self.format_string; + other.format_string.iter().for_each(|x| { if let Some(x) = x { // Look for other in format_string, if it's not there add it to format_string. if format_string .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = format_string.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } format_string.push(Some(x.clone())); } @@ -1257,25 +1049,19 @@ impl ObjectStore { }); } - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - let mut func_generic = self.func_generic.write().unwrap(); - other.func_generic.read().unwrap().iter().for_each(|x| { + if self.func_generic.len() != other.func_generic.len() { + let mut func_generic = &mut self.func_generic; + other.func_generic.iter().for_each(|x| { if let Some(x) = x { // Look for other in func_generic, if it's not there add it to func_generic. if func_generic .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = func_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } func_generic.push(Some(x.clone())); } @@ -1283,25 +1069,19 @@ impl ObjectStore { }); } - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - let mut function = self.function.write().unwrap(); - other.function.read().unwrap().iter().for_each(|x| { + if self.function.len() != other.function.len() { + let mut function = &mut self.function; + other.function.iter().for_each(|x| { if let Some(x) = x { // Look for other in function, if it's not there add it to function. if function .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = function.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } function.push(Some(x.clone())); } @@ -1309,25 +1089,19 @@ impl ObjectStore { }); } - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - let mut function_call = self.function_call.write().unwrap(); - other.function_call.read().unwrap().iter().for_each(|x| { + if self.function_call.len() != other.function_call.len() { + let mut function_call = &mut self.function_call; + other.function_call.iter().for_each(|x| { if let Some(x) = x { // Look for other in function_call, if it's not there add it to function_call. if function_call .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = function_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } function_call.push(Some(x.clone())); } @@ -1335,25 +1109,19 @@ impl ObjectStore { }); } - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - let mut x_future = self.x_future.write().unwrap(); - other.x_future.read().unwrap().iter().for_each(|x| { + if self.x_future.len() != other.x_future.len() { + let mut x_future = &mut self.x_future; + other.x_future.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_future, if it's not there add it to x_future. if x_future .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_future.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_future.push(Some(x.clone())); } @@ -1361,25 +1129,19 @@ impl ObjectStore { }); } - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - let mut grouped = self.grouped.write().unwrap(); - other.grouped.read().unwrap().iter().for_each(|x| { + if self.grouped.len() != other.grouped.len() { + let mut grouped = &mut self.grouped; + other.grouped.iter().for_each(|x| { if let Some(x) = x { // Look for other in grouped, if it's not there add it to grouped. if grouped .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = grouped.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } grouped.push(Some(x.clone())); } @@ -1387,58 +1149,39 @@ impl ObjectStore { }); } - if self.halt_and_catch_fire.read().unwrap().len() - != other.halt_and_catch_fire.read().unwrap().len() - { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); - other - .halt_and_catch_fire - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. - if halt_and_catch_fire - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - halt_and_catch_fire.push(Some(x.clone())); + if self.halt_and_catch_fire.len() != other.halt_and_catch_fire.len() { + let mut halt_and_catch_fire = &mut self.halt_and_catch_fire; + other.halt_and_catch_fire.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + halt_and_catch_fire.push(Some(x.clone())); } - }); + } + }); } - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - let mut x_if = self.x_if.write().unwrap(); - other.x_if.read().unwrap().iter().for_each(|x| { + if self.x_if.len() != other.x_if.len() { + let mut x_if = &mut self.x_if; + other.x_if.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_if, if it's not there add it to x_if. if x_if .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_if.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_if.push(Some(x.clone())); } @@ -1446,58 +1189,39 @@ impl ObjectStore { }); } - if self.implementation_block.read().unwrap().len() - != other.implementation_block.read().unwrap().len() - { - let mut implementation_block = self.implementation_block.write().unwrap(); - other - .implementation_block - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in implementation_block, if it's not there add it to implementation_block. - if implementation_block - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - implementation_block.push(Some(x.clone())); + if self.implementation_block.len() != other.implementation_block.len() { + let mut implementation_block = &mut self.implementation_block; + other.implementation_block.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + implementation_block.push(Some(x.clone())); } - }); + } + }); } - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - let mut import = self.import.write().unwrap(); - other.import.read().unwrap().iter().for_each(|x| { + if self.import.len() != other.import.len() { + let mut import = &mut self.import; + other.import.iter().for_each(|x| { if let Some(x) = x { // Look for other in import, if it's not there add it to import. if import .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = import.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } import.push(Some(x.clone())); } @@ -1505,25 +1229,19 @@ impl ObjectStore { }); } - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - let mut index = self.index.write().unwrap(); - other.index.read().unwrap().iter().for_each(|x| { + if self.index.len() != other.index.len() { + let mut index = &mut self.index; + other.index.iter().for_each(|x| { if let Some(x) = x { // Look for other in index, if it's not there add it to index. if index .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = index.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } index.push(Some(x.clone())); } @@ -1531,26 +1249,19 @@ impl ObjectStore { }); } - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() - { - let mut integer_literal = self.integer_literal.write().unwrap(); - other.integer_literal.read().unwrap().iter().for_each(|x| { + if self.integer_literal.len() != other.integer_literal.len() { + let mut integer_literal = &mut self.integer_literal; + other.integer_literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in integer_literal, if it's not there add it to integer_literal. if integer_literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = integer_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } integer_literal.push(Some(x.clone())); } @@ -1558,25 +1269,19 @@ impl ObjectStore { }); } - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - let mut item = self.item.write().unwrap(); - other.item.read().unwrap().iter().for_each(|x| { + if self.item.len() != other.item.len() { + let mut item = &mut self.item; + other.item.iter().for_each(|x| { if let Some(x) = x { // Look for other in item, if it's not there add it to item. if item .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = item.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } item.push(Some(x.clone())); } @@ -1584,25 +1289,19 @@ impl ObjectStore { }); } - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - let mut lambda = self.lambda.write().unwrap(); - other.lambda.read().unwrap().iter().for_each(|x| { + if self.lambda.len() != other.lambda.len() { + let mut lambda = &mut self.lambda; + other.lambda.iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda, if it's not there add it to lambda. if lambda .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = lambda.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } lambda.push(Some(x.clone())); } @@ -1610,27 +1309,19 @@ impl ObjectStore { }); } - if self.lambda_parameter.read().unwrap().len() - != other.lambda_parameter.read().unwrap().len() - { - let mut lambda_parameter = self.lambda_parameter.write().unwrap(); - other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if self.lambda_parameter.len() != other.lambda_parameter.len() { + let mut lambda_parameter = &mut self.lambda_parameter; + other.lambda_parameter.iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. if lambda_parameter .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = lambda_parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } lambda_parameter.push(Some(x.clone())); } @@ -1638,25 +1329,19 @@ impl ObjectStore { }); } - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - let mut let_statement = self.let_statement.write().unwrap(); - other.let_statement.read().unwrap().iter().for_each(|x| { + if self.let_statement.len() != other.let_statement.len() { + let mut let_statement = &mut self.let_statement; + other.let_statement.iter().for_each(|x| { if let Some(x) = x { // Look for other in let_statement, if it's not there add it to let_statement. if let_statement .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = let_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } let_statement.push(Some(x.clone())); } @@ -1664,25 +1349,19 @@ impl ObjectStore { }); } - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - let mut list = self.list.write().unwrap(); - other.list.read().unwrap().iter().for_each(|x| { + if self.list.len() != other.list.len() { + let mut list = &mut self.list; + other.list.iter().for_each(|x| { if let Some(x) = x { // Look for other in list, if it's not there add it to list. if list .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = list.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list.push(Some(x.clone())); } @@ -1690,25 +1369,19 @@ impl ObjectStore { }); } - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - let mut list_element = self.list_element.write().unwrap(); - other.list_element.read().unwrap().iter().for_each(|x| { + if self.list_element.len() != other.list_element.len() { + let mut list_element = &mut self.list_element; + other.list_element.iter().for_each(|x| { if let Some(x) = x { // Look for other in list_element, if it's not there add it to list_element. if list_element .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = list_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list_element.push(Some(x.clone())); } @@ -1716,26 +1389,19 @@ impl ObjectStore { }); } - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() - { - let mut list_expression = self.list_expression.write().unwrap(); - other.list_expression.read().unwrap().iter().for_each(|x| { + if self.list_expression.len() != other.list_expression.len() { + let mut list_expression = &mut self.list_expression; + other.list_expression.iter().for_each(|x| { if let Some(x) = x { // Look for other in list_expression, if it's not there add it to list_expression. if list_expression .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = list_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list_expression.push(Some(x.clone())); } @@ -1743,25 +1409,19 @@ impl ObjectStore { }); } - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - let mut literal = self.literal.write().unwrap(); - other.literal.read().unwrap().iter().for_each(|x| { + if self.literal.len() != other.literal.len() { + let mut literal = &mut self.literal; + other.literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in literal, if it's not there add it to literal. if literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } literal.push(Some(x.clone())); } @@ -1769,25 +1429,19 @@ impl ObjectStore { }); } - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - let mut local_variable = self.local_variable.write().unwrap(); - other.local_variable.read().unwrap().iter().for_each(|x| { + if self.local_variable.len() != other.local_variable.len() { + let mut local_variable = &mut self.local_variable; + other.local_variable.iter().for_each(|x| { if let Some(x) = x { // Look for other in local_variable, if it's not there add it to local_variable. if local_variable .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = local_variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } local_variable.push(Some(x.clone())); } @@ -1795,25 +1449,19 @@ impl ObjectStore { }); } - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - let mut x_macro = self.x_macro.write().unwrap(); - other.x_macro.read().unwrap().iter().for_each(|x| { + if self.x_macro.len() != other.x_macro.len() { + let mut x_macro = &mut self.x_macro; + other.x_macro.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_macro, if it's not there add it to x_macro. if x_macro .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_macro.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_macro.push(Some(x.clone())); } @@ -1821,25 +1469,19 @@ impl ObjectStore { }); } - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - let mut map = self.map.write().unwrap(); - other.map.read().unwrap().iter().for_each(|x| { + if self.map.len() != other.map.len() { + let mut map = &mut self.map; + other.map.iter().for_each(|x| { if let Some(x) = x { // Look for other in map, if it's not there add it to map. if map .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = map.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map.push(Some(x.clone())); } @@ -1847,25 +1489,19 @@ impl ObjectStore { }); } - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - let mut map_element = self.map_element.write().unwrap(); - other.map_element.read().unwrap().iter().for_each(|x| { + if self.map_element.len() != other.map_element.len() { + let mut map_element = &mut self.map_element; + other.map_element.iter().for_each(|x| { if let Some(x) = x { // Look for other in map_element, if it's not there add it to map_element. if map_element .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = map_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map_element.push(Some(x.clone())); } @@ -1873,25 +1509,19 @@ impl ObjectStore { }); } - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - let mut map_expression = self.map_expression.write().unwrap(); - other.map_expression.read().unwrap().iter().for_each(|x| { + if self.map_expression.len() != other.map_expression.len() { + let mut map_expression = &mut self.map_expression; + other.map_expression.iter().for_each(|x| { if let Some(x) = x { // Look for other in map_expression, if it's not there add it to map_expression. if map_expression .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = map_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map_expression.push(Some(x.clone())); } @@ -1899,25 +1529,19 @@ impl ObjectStore { }); } - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - let mut x_match = self.x_match.write().unwrap(); - other.x_match.read().unwrap().iter().for_each(|x| { + if self.x_match.len() != other.x_match.len() { + let mut x_match = &mut self.x_match; + other.x_match.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_match, if it's not there add it to x_match. if x_match .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_match.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_match.push(Some(x.clone())); } @@ -1925,25 +1549,19 @@ impl ObjectStore { }); } - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap(); - other.method_call.read().unwrap().iter().for_each(|x| { + if self.method_call.len() != other.method_call.len() { + let mut method_call = &mut self.method_call; + other.method_call.iter().for_each(|x| { if let Some(x) = x { // Look for other in method_call, if it's not there add it to method_call. if method_call .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } method_call.push(Some(x.clone())); } @@ -1951,58 +1569,39 @@ impl ObjectStore { }); } - if self.named_field_expression.read().unwrap().len() - != other.named_field_expression.read().unwrap().len() - { - let mut named_field_expression = self.named_field_expression.write().unwrap(); - other - .named_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in named_field_expression, if it's not there add it to named_field_expression. - if named_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - named_field_expression.push(Some(x.clone())); + if self.named_field_expression.len() != other.named_field_expression.len() { + let mut named_field_expression = &mut self.named_field_expression; + other.named_field_expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + named_field_expression.push(Some(x.clone())); } - }); + } + }); } - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - let mut z_object_store = self.z_object_store.write().unwrap(); - other.z_object_store.read().unwrap().iter().for_each(|x| { + if self.z_object_store.len() != other.z_object_store.len() { + let mut z_object_store = &mut self.z_object_store; + other.z_object_store.iter().for_each(|x| { if let Some(x) = x { // Look for other in z_object_store, if it's not there add it to z_object_store. if z_object_store .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = z_object_store.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } z_object_store.push(Some(x.clone())); } @@ -2010,25 +1609,19 @@ impl ObjectStore { }); } - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - let mut object_wrapper = self.object_wrapper.write().unwrap(); - other.object_wrapper.read().unwrap().iter().for_each(|x| { + if self.object_wrapper.len() != other.object_wrapper.len() { + let mut object_wrapper = &mut self.object_wrapper; + other.object_wrapper.iter().for_each(|x| { if let Some(x) = x { // Look for other in object_wrapper, if it's not there add it to object_wrapper. if object_wrapper .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = object_wrapper.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } object_wrapper.push(Some(x.clone())); } @@ -2036,25 +1629,19 @@ impl ObjectStore { }); } - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - let mut operator = self.operator.write().unwrap(); - other.operator.read().unwrap().iter().for_each(|x| { + if self.operator.len() != other.operator.len() { + let mut operator = &mut self.operator; + other.operator.iter().for_each(|x| { if let Some(x) = x { // Look for other in operator, if it's not there add it to operator. if operator .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } operator.push(Some(x.clone())); } @@ -2062,25 +1649,19 @@ impl ObjectStore { }); } - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - let mut parameter = self.parameter.write().unwrap(); - other.parameter.read().unwrap().iter().for_each(|x| { + if self.parameter.len() != other.parameter.len() { + let mut parameter = &mut self.parameter; + other.parameter.iter().for_each(|x| { if let Some(x) = x { // Look for other in parameter, if it's not there add it to parameter. if parameter .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } parameter.push(Some(x.clone())); } @@ -2088,25 +1669,19 @@ impl ObjectStore { }); } - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - let mut x_path = self.x_path.write().unwrap(); - other.x_path.read().unwrap().iter().for_each(|x| { + if self.x_path.len() != other.x_path.len() { + let mut x_path = &mut self.x_path; + other.x_path.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_path, if it's not there add it to x_path. if x_path .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_path.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_path.push(Some(x.clone())); } @@ -2114,25 +1689,19 @@ impl ObjectStore { }); } - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - let mut path_element = self.path_element.write().unwrap(); - other.path_element.read().unwrap().iter().for_each(|x| { + if self.path_element.len() != other.path_element.len() { + let mut path_element = &mut self.path_element; + other.path_element.iter().for_each(|x| { if let Some(x) = x { // Look for other in path_element, if it's not there add it to path_element. if path_element .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = path_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } path_element.push(Some(x.clone())); } @@ -2140,25 +1709,19 @@ impl ObjectStore { }); } - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - let mut pattern = self.pattern.write().unwrap(); - other.pattern.read().unwrap().iter().for_each(|x| { + if self.pattern.len() != other.pattern.len() { + let mut pattern = &mut self.pattern; + other.pattern.iter().for_each(|x| { if let Some(x) = x { // Look for other in pattern, if it's not there add it to pattern. if pattern .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = pattern.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } pattern.push(Some(x.clone())); } @@ -2166,25 +1729,19 @@ impl ObjectStore { }); } - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - let mut x_plugin = self.x_plugin.write().unwrap(); - other.x_plugin.read().unwrap().iter().for_each(|x| { + if self.x_plugin.len() != other.x_plugin.len() { + let mut x_plugin = &mut self.x_plugin; + other.x_plugin.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_plugin, if it's not there add it to x_plugin. if x_plugin .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_plugin.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_plugin.push(Some(x.clone())); } @@ -2192,25 +1749,19 @@ impl ObjectStore { }); } - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - let mut x_print = self.x_print.write().unwrap(); - other.x_print.read().unwrap().iter().for_each(|x| { + if self.x_print.len() != other.x_print.len() { + let mut x_print = &mut self.x_print; + other.x_print.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_print, if it's not there add it to x_print. if x_print .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_print.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_print.push(Some(x.clone())); } @@ -2218,27 +1769,19 @@ impl ObjectStore { }); } - if self.range_expression.read().unwrap().len() - != other.range_expression.read().unwrap().len() - { - let mut range_expression = self.range_expression.write().unwrap(); - other.range_expression.read().unwrap().iter().for_each(|x| { + if self.range_expression.len() != other.range_expression.len() { + let mut range_expression = &mut self.range_expression; + other.range_expression.iter().for_each(|x| { if let Some(x) = x { // Look for other in range_expression, if it's not there add it to range_expression. if range_expression .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = range_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } range_expression.push(Some(x.clone())); } @@ -2246,27 +1789,19 @@ impl ObjectStore { }); } - if self.result_statement.read().unwrap().len() - != other.result_statement.read().unwrap().len() - { - let mut result_statement = self.result_statement.write().unwrap(); - other.result_statement.read().unwrap().iter().for_each(|x| { + if self.result_statement.len() != other.result_statement.len() { + let mut result_statement = &mut self.result_statement; + other.result_statement.iter().for_each(|x| { if let Some(x) = x { // Look for other in result_statement, if it's not there add it to result_statement. if result_statement .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = result_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } result_statement.push(Some(x.clone())); } @@ -2274,25 +1809,19 @@ impl ObjectStore { }); } - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - let mut x_return = self.x_return.write().unwrap(); - other.x_return.read().unwrap().iter().for_each(|x| { + if self.x_return.len() != other.x_return.len() { + let mut x_return = &mut self.x_return; + other.x_return.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_return, if it's not there add it to x_return. if x_return .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_return.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_return.push(Some(x.clone())); } @@ -2300,25 +1829,19 @@ impl ObjectStore { }); } - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - let mut span = self.span.write().unwrap(); - other.span.read().unwrap().iter().for_each(|x| { + if self.span.len() != other.span.len() { + let mut span = &mut self.span; + other.span.iter().for_each(|x| { if let Some(x) = x { // Look for other in span, if it's not there add it to span. if span .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = span.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } span.push(Some(x.clone())); } @@ -2326,25 +1849,19 @@ impl ObjectStore { }); } - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap(); - other.statement.read().unwrap().iter().for_each(|x| { + if self.statement.len() != other.statement.len() { + let mut statement = &mut self.statement; + other.statement.iter().for_each(|x| { if let Some(x) = x { // Look for other in statement, if it's not there add it to statement. if statement .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } statement.push(Some(x.clone())); } @@ -2352,58 +1869,39 @@ impl ObjectStore { }); } - if self.static_method_call.read().unwrap().len() - != other.static_method_call.read().unwrap().len() - { - let mut static_method_call = self.static_method_call.write().unwrap(); - other - .static_method_call - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in static_method_call, if it's not there add it to static_method_call. - if static_method_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - static_method_call.push(Some(x.clone())); + if self.static_method_call.len() != other.static_method_call.len() { + let mut static_method_call = &mut self.static_method_call; + other.static_method_call.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + static_method_call.push(Some(x.clone())); } - }); + } + }); } - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - let mut string_bit = self.string_bit.write().unwrap(); - other.string_bit.read().unwrap().iter().for_each(|x| { + if self.string_bit.len() != other.string_bit.len() { + let mut string_bit = &mut self.string_bit; + other.string_bit.iter().for_each(|x| { if let Some(x) = x { // Look for other in string_bit, if it's not there add it to string_bit. if string_bit .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = string_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } string_bit.push(Some(x.clone())); } @@ -2411,25 +1909,19 @@ impl ObjectStore { }); } - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - let mut string_literal = self.string_literal.write().unwrap(); - other.string_literal.read().unwrap().iter().for_each(|x| { + if self.string_literal.len() != other.string_literal.len() { + let mut string_literal = &mut self.string_literal; + other.string_literal.iter().for_each(|x| { if let Some(x) = x { // Look for other in string_literal, if it's not there add it to string_literal. if string_literal .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = string_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } string_literal.push(Some(x.clone())); } @@ -2437,25 +1929,19 @@ impl ObjectStore { }); } - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap(); - other.woog_struct.read().unwrap().iter().for_each(|x| { + if self.woog_struct.len() != other.woog_struct.len() { + let mut woog_struct = &mut self.woog_struct; + other.woog_struct.iter().for_each(|x| { if let Some(x) = x { // Look for other in woog_struct, if it's not there add it to woog_struct. if woog_struct .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = woog_struct.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } woog_struct.push(Some(x.clone())); } @@ -2463,58 +1949,39 @@ impl ObjectStore { }); } - if self.struct_expression.read().unwrap().len() - != other.struct_expression.read().unwrap().len() - { - let mut struct_expression = self.struct_expression.write().unwrap(); - other - .struct_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in struct_expression, if it's not there add it to struct_expression. - if struct_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - struct_expression.push(Some(x.clone())); + if self.struct_expression.len() != other.struct_expression.len() { + let mut struct_expression = &mut self.struct_expression; + other.struct_expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + struct_expression.push(Some(x.clone())); } - }); + } + }); } - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - let mut struct_field = self.struct_field.write().unwrap(); - other.struct_field.read().unwrap().iter().for_each(|x| { + if self.struct_field.len() != other.struct_field.len() { + let mut struct_field = &mut self.struct_field; + other.struct_field.iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_field, if it's not there add it to struct_field. if struct_field .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = struct_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } struct_field.push(Some(x.clone())); } @@ -2522,25 +1989,19 @@ impl ObjectStore { }); } - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - let mut struct_generic = self.struct_generic.write().unwrap(); - other.struct_generic.read().unwrap().iter().for_each(|x| { + if self.struct_generic.len() != other.struct_generic.len() { + let mut struct_generic = &mut self.struct_generic; + other.struct_generic.iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_generic, if it's not there add it to struct_generic. if struct_generic .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = struct_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } struct_generic.push(Some(x.clone())); } @@ -2548,25 +2009,19 @@ impl ObjectStore { }); } - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - let mut tuple_field = self.tuple_field.write().unwrap(); - other.tuple_field.read().unwrap().iter().for_each(|x| { + if self.tuple_field.len() != other.tuple_field.len() { + let mut tuple_field = &mut self.tuple_field; + other.tuple_field.iter().for_each(|x| { if let Some(x) = x { // Look for other in tuple_field, if it's not there add it to tuple_field. if tuple_field .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = tuple_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } tuple_field.push(Some(x.clone())); } @@ -2574,25 +2029,19 @@ impl ObjectStore { }); } - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - let mut type_cast = self.type_cast.write().unwrap(); - other.type_cast.read().unwrap().iter().for_each(|x| { + if self.type_cast.len() != other.type_cast.len() { + let mut type_cast = &mut self.type_cast; + other.type_cast.iter().for_each(|x| { if let Some(x) = x { // Look for other in type_cast, if it's not there add it to type_cast. if type_cast .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = type_cast.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } type_cast.push(Some(x.clone())); } @@ -2600,25 +2049,19 @@ impl ObjectStore { }); } - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - let mut unary = self.unary.write().unwrap(); - other.unary.read().unwrap().iter().for_each(|x| { + if self.unary.len() != other.unary.len() { + let mut unary = &mut self.unary; + other.unary.iter().for_each(|x| { if let Some(x) = x { // Look for other in unary, if it's not there add it to unary. if unary .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = unary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } unary.push(Some(x.clone())); } @@ -2626,25 +2069,19 @@ impl ObjectStore { }); } - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap(); - other.unit.read().unwrap().iter().for_each(|x| { + if self.unit.len() != other.unit.len() { + let mut unit = &mut self.unit; + other.unit.iter().for_each(|x| { if let Some(x) = x { // Look for other in unit, if it's not there add it to unit. if unit .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = unit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } unit.push(Some(x.clone())); } @@ -2652,58 +2089,39 @@ impl ObjectStore { }); } - if self.unnamed_field_expression.read().unwrap().len() - != other.unnamed_field_expression.read().unwrap().len() - { - let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); - other - .unnamed_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. - if unnamed_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = unnamed_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - unnamed_field_expression.push(Some(x.clone())); + if self.unnamed_field_expression.len() != other.unnamed_field_expression.len() { + let mut unnamed_field_expression = &mut self.unnamed_field_expression; + other.unnamed_field_expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in unnamed_field_expression, if it's not there add it to unnamed_field_expression. + if unnamed_field_expression + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = unnamed_field_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + unnamed_field_expression.push(Some(x.clone())); } - }); + } + }); } - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - let mut x_value = self.x_value.write().unwrap(); - other.x_value.read().unwrap().iter().for_each(|x| { + if self.x_value.len() != other.x_value.len() { + let mut x_value = &mut self.x_value; + other.x_value.iter().for_each(|x| { if let Some(x) = x { // Look for other in x_value, if it's not there add it to x_value. if x_value .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = x_value.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_value.push(Some(x.clone())); } @@ -2711,25 +2129,19 @@ impl ObjectStore { }); } - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - let mut value_type = self.value_type.write().unwrap(); - other.value_type.read().unwrap().iter().for_each(|x| { + if self.value_type.len() != other.value_type.len() { + let mut value_type = &mut self.value_type; + other.value_type.iter().for_each(|x| { if let Some(x) = x { // Look for other in value_type, if it's not there add it to value_type. if value_type .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = value_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } value_type.push(Some(x.clone())); } @@ -2737,25 +2149,19 @@ impl ObjectStore { }); } - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap(); - other.variable.read().unwrap().iter().for_each(|x| { + if self.variable.len() != other.variable.len() { + let mut variable = &mut self.variable; + other.variable.iter().for_each(|x| { if let Some(x) = x { // Look for other in variable, if it's not there add it to variable. if variable .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) + .find(|&y| if let Some(y) = y { *y == *x } else { false }) .is_none() { let _index_ = variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } variable.push(Some(x.clone())); } @@ -2763,37 +2169,24 @@ impl ObjectStore { }); } - if self.variable_expression.read().unwrap().len() - != other.variable_expression.read().unwrap().len() - { - let mut variable_expression = self.variable_expression.write().unwrap(); - other - .variable_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in variable_expression, if it's not there add it to variable_expression. - if variable_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; - } - variable_expression.push(Some(x.clone())); + if self.variable_expression.len() != other.variable_expression.len() { + let mut variable_expression = &mut self.variable_expression; + other.variable_expression.iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| if let Some(y) = y { *y == *x } else { false }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + variable_expression.push(Some(x.clone())); } - }); + } + }); } } pub fn new() -> Self { diff --git a/src/v2/lu_dog_vec_tracy/store.rs b/src/v2/lu_dog_vec_tracy/store.rs index 65fa06a5..d279b3d4 100644 --- a/src/v2/lu_dog_vec_tracy/store.rs +++ b/src/v2/lu_dog_vec_tracy/store.rs @@ -489,16 +489,16 @@ impl Clone for ObjectStore { } impl ObjectStore { pub fn merge(&mut self, other: &ObjectStore) { - if self.argument.read().unwrap().len() != other.argument.read().unwrap().len() { - let mut argument = self.argument.write().unwrap(); - other.argument.read().unwrap().iter().for_each(|x| { + if self.argument.borrow().len() != other.argument.borrow().len() { + let mut argument = self.argument.borrow_mut(); + other.argument.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in argument, if it's not there add it to argument. if argument .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -506,8 +506,8 @@ impl ObjectStore { .is_none() { let _index_ = argument.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } argument.push(Some(x.clone())); } @@ -515,16 +515,16 @@ impl ObjectStore { }); } - if self.a_wait.read().unwrap().len() != other.a_wait.read().unwrap().len() { - let mut a_wait = self.a_wait.write().unwrap(); - other.a_wait.read().unwrap().iter().for_each(|x| { + if self.a_wait.borrow().len() != other.a_wait.borrow().len() { + let mut a_wait = self.a_wait.borrow_mut(); + other.a_wait.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in a_wait, if it's not there add it to a_wait. if a_wait .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -532,8 +532,8 @@ impl ObjectStore { .is_none() { let _index_ = a_wait.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } a_wait.push(Some(x.clone())); } @@ -541,16 +541,16 @@ impl ObjectStore { }); } - if self.binary.read().unwrap().len() != other.binary.read().unwrap().len() { - let mut binary = self.binary.write().unwrap(); - other.binary.read().unwrap().iter().for_each(|x| { + if self.binary.borrow().len() != other.binary.borrow().len() { + let mut binary = self.binary.borrow_mut(); + other.binary.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in binary, if it's not there add it to binary. if binary .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -558,8 +558,8 @@ impl ObjectStore { .is_none() { let _index_ = binary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } binary.push(Some(x.clone())); } @@ -567,16 +567,16 @@ impl ObjectStore { }); } - if self.block.read().unwrap().len() != other.block.read().unwrap().len() { - let mut block = self.block.write().unwrap(); - other.block.read().unwrap().iter().for_each(|x| { + if self.block.borrow().len() != other.block.borrow().len() { + let mut block = self.block.borrow_mut(); + other.block.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in block, if it's not there add it to block. if block .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -584,8 +584,8 @@ impl ObjectStore { .is_none() { let _index_ = block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } block.push(Some(x.clone())); } @@ -593,16 +593,16 @@ impl ObjectStore { }); } - if self.body.read().unwrap().len() != other.body.read().unwrap().len() { - let mut body = self.body.write().unwrap(); - other.body.read().unwrap().iter().for_each(|x| { + if self.body.borrow().len() != other.body.borrow().len() { + let mut body = self.body.borrow_mut(); + other.body.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in body, if it's not there add it to body. if body .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -610,8 +610,8 @@ impl ObjectStore { .is_none() { let _index_ = body.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } body.push(Some(x.clone())); } @@ -619,17 +619,16 @@ impl ObjectStore { }); } - if self.boolean_literal.read().unwrap().len() != other.boolean_literal.read().unwrap().len() - { - let mut boolean_literal = self.boolean_literal.write().unwrap(); - other.boolean_literal.read().unwrap().iter().for_each(|x| { + if self.boolean_literal.borrow().len() != other.boolean_literal.borrow().len() { + let mut boolean_literal = self.boolean_literal.borrow_mut(); + other.boolean_literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_literal, if it's not there add it to boolean_literal. if boolean_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -637,8 +636,8 @@ impl ObjectStore { .is_none() { let _index_ = boolean_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } boolean_literal.push(Some(x.clone())); } @@ -646,18 +645,16 @@ impl ObjectStore { }); } - if self.boolean_operator.read().unwrap().len() - != other.boolean_operator.read().unwrap().len() - { - let mut boolean_operator = self.boolean_operator.write().unwrap(); - other.boolean_operator.read().unwrap().iter().for_each(|x| { + if self.boolean_operator.borrow().len() != other.boolean_operator.borrow().len() { + let mut boolean_operator = self.boolean_operator.borrow_mut(); + other.boolean_operator.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in boolean_operator, if it's not there add it to boolean_operator. if boolean_operator .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -665,8 +662,8 @@ impl ObjectStore { .is_none() { let _index_ = boolean_operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } boolean_operator.push(Some(x.clone())); } @@ -674,16 +671,16 @@ impl ObjectStore { }); } - if self.call.read().unwrap().len() != other.call.read().unwrap().len() { - let mut call = self.call.write().unwrap(); - other.call.read().unwrap().iter().for_each(|x| { + if self.call.borrow().len() != other.call.borrow().len() { + let mut call = self.call.borrow_mut(); + other.call.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in call, if it's not there add it to call. if call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -691,8 +688,8 @@ impl ObjectStore { .is_none() { let _index_ = call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } call.push(Some(x.clone())); } @@ -700,16 +697,16 @@ impl ObjectStore { }); } - if self.char_literal.read().unwrap().len() != other.char_literal.read().unwrap().len() { - let mut char_literal = self.char_literal.write().unwrap(); - other.char_literal.read().unwrap().iter().for_each(|x| { + if self.char_literal.borrow().len() != other.char_literal.borrow().len() { + let mut char_literal = self.char_literal.borrow_mut(); + other.char_literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in char_literal, if it's not there add it to char_literal. if char_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -717,8 +714,8 @@ impl ObjectStore { .is_none() { let _index_ = char_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } char_literal.push(Some(x.clone())); } @@ -726,16 +723,16 @@ impl ObjectStore { }); } - if self.comparison.read().unwrap().len() != other.comparison.read().unwrap().len() { - let mut comparison = self.comparison.write().unwrap(); - other.comparison.read().unwrap().iter().for_each(|x| { + if self.comparison.borrow().len() != other.comparison.borrow().len() { + let mut comparison = self.comparison.borrow_mut(); + other.comparison.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in comparison, if it's not there add it to comparison. if comparison .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -743,8 +740,8 @@ impl ObjectStore { .is_none() { let _index_ = comparison.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } comparison.push(Some(x.clone())); } @@ -752,16 +749,16 @@ impl ObjectStore { }); } - if self.data_structure.read().unwrap().len() != other.data_structure.read().unwrap().len() { - let mut data_structure = self.data_structure.write().unwrap(); - other.data_structure.read().unwrap().iter().for_each(|x| { + if self.data_structure.borrow().len() != other.data_structure.borrow().len() { + let mut data_structure = self.data_structure.borrow_mut(); + other.data_structure.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in data_structure, if it's not there add it to data_structure. if data_structure .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -769,8 +766,8 @@ impl ObjectStore { .is_none() { let _index_ = data_structure.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } data_structure.push(Some(x.clone())); } @@ -778,49 +775,42 @@ impl ObjectStore { }); } - if self.dwarf_source_file.read().unwrap().len() - != other.dwarf_source_file.read().unwrap().len() - { - let mut dwarf_source_file = self.dwarf_source_file.write().unwrap(); - other - .dwarf_source_file - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. - if dwarf_source_file - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = dwarf_source_file.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.dwarf_source_file.borrow().len() != other.dwarf_source_file.borrow().len() { + let mut dwarf_source_file = self.dwarf_source_file.borrow_mut(); + other.dwarf_source_file.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in dwarf_source_file, if it's not there add it to dwarf_source_file. + if dwarf_source_file + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - dwarf_source_file.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = dwarf_source_file.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + dwarf_source_file.push(Some(x.clone())); } - }); + } + }); } - if self.enum_field.read().unwrap().len() != other.enum_field.read().unwrap().len() { - let mut enum_field = self.enum_field.write().unwrap(); - other.enum_field.read().unwrap().iter().for_each(|x| { + if self.enum_field.borrow().len() != other.enum_field.borrow().len() { + let mut enum_field = self.enum_field.borrow_mut(); + other.enum_field.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_field, if it's not there add it to enum_field. if enum_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -828,8 +818,8 @@ impl ObjectStore { .is_none() { let _index_ = enum_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enum_field.push(Some(x.clone())); } @@ -837,16 +827,16 @@ impl ObjectStore { }); } - if self.enum_generic.read().unwrap().len() != other.enum_generic.read().unwrap().len() { - let mut enum_generic = self.enum_generic.write().unwrap(); - other.enum_generic.read().unwrap().iter().for_each(|x| { + if self.enum_generic.borrow().len() != other.enum_generic.borrow().len() { + let mut enum_generic = self.enum_generic.borrow_mut(); + other.enum_generic.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in enum_generic, if it's not there add it to enum_generic. if enum_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -854,8 +844,8 @@ impl ObjectStore { .is_none() { let _index_ = enum_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enum_generic.push(Some(x.clone())); } @@ -863,49 +853,42 @@ impl ObjectStore { }); } - if self.enum_generic_type.read().unwrap().len() - != other.enum_generic_type.read().unwrap().len() - { - let mut enum_generic_type = self.enum_generic_type.write().unwrap(); - other - .enum_generic_type - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. - if enum_generic_type - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = enum_generic_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.enum_generic_type.borrow().len() != other.enum_generic_type.borrow().len() { + let mut enum_generic_type = self.enum_generic_type.borrow_mut(); + other.enum_generic_type.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in enum_generic_type, if it's not there add it to enum_generic_type. + if enum_generic_type + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - enum_generic_type.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = enum_generic_type.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + enum_generic_type.push(Some(x.clone())); } - }); + } + }); } - if self.enumeration.read().unwrap().len() != other.enumeration.read().unwrap().len() { - let mut enumeration = self.enumeration.write().unwrap(); - other.enumeration.read().unwrap().iter().for_each(|x| { + if self.enumeration.borrow().len() != other.enumeration.borrow().len() { + let mut enumeration = self.enumeration.borrow_mut(); + other.enumeration.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in enumeration, if it's not there add it to enumeration. if enumeration .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -913,8 +896,8 @@ impl ObjectStore { .is_none() { let _index_ = enumeration.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } enumeration.push(Some(x.clone())); } @@ -922,16 +905,16 @@ impl ObjectStore { }); } - if self.expression.read().unwrap().len() != other.expression.read().unwrap().len() { - let mut expression = self.expression.write().unwrap(); - other.expression.read().unwrap().iter().for_each(|x| { + if self.expression.borrow().len() != other.expression.borrow().len() { + let mut expression = self.expression.borrow_mut(); + other.expression.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in expression, if it's not there add it to expression. if expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -939,8 +922,8 @@ impl ObjectStore { .is_none() { let _index_ = expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } expression.push(Some(x.clone())); } @@ -948,16 +931,16 @@ impl ObjectStore { }); } - if self.expression_bit.read().unwrap().len() != other.expression_bit.read().unwrap().len() { - let mut expression_bit = self.expression_bit.write().unwrap(); - other.expression_bit.read().unwrap().iter().for_each(|x| { + if self.expression_bit.borrow().len() != other.expression_bit.borrow().len() { + let mut expression_bit = self.expression_bit.borrow_mut(); + other.expression_bit.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in expression_bit, if it's not there add it to expression_bit. if expression_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -965,8 +948,8 @@ impl ObjectStore { .is_none() { let _index_ = expression_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } expression_bit.push(Some(x.clone())); } @@ -974,82 +957,70 @@ impl ObjectStore { }); } - if self.expression_statement.read().unwrap().len() - != other.expression_statement.read().unwrap().len() - { - let mut expression_statement = self.expression_statement.write().unwrap(); - other - .expression_statement - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in expression_statement, if it's not there add it to expression_statement. - if expression_statement - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = expression_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.expression_statement.borrow().len() != other.expression_statement.borrow().len() { + let mut expression_statement = self.expression_statement.borrow_mut(); + other.expression_statement.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in expression_statement, if it's not there add it to expression_statement. + if expression_statement + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - expression_statement.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = expression_statement.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + expression_statement.push(Some(x.clone())); } - }); + } + }); } - if self.external_implementation.read().unwrap().len() - != other.external_implementation.read().unwrap().len() + if self.external_implementation.borrow().len() + != other.external_implementation.borrow().len() { - let mut external_implementation = self.external_implementation.write().unwrap(); - other - .external_implementation - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in external_implementation, if it's not there add it to external_implementation. - if external_implementation - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = external_implementation.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + let mut external_implementation = self.external_implementation.borrow_mut(); + other.external_implementation.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in external_implementation, if it's not there add it to external_implementation. + if external_implementation + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - external_implementation.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = external_implementation.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + external_implementation.push(Some(x.clone())); } - }); + } + }); } - if self.field.read().unwrap().len() != other.field.read().unwrap().len() { - let mut field = self.field.write().unwrap(); - other.field.read().unwrap().iter().for_each(|x| { + if self.field.borrow().len() != other.field.borrow().len() { + let mut field = self.field.borrow_mut(); + other.field.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in field, if it's not there add it to field. if field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1057,8 +1028,8 @@ impl ObjectStore { .is_none() { let _index_ = field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field.push(Some(x.clone())); } @@ -1066,16 +1037,16 @@ impl ObjectStore { }); } - if self.field_access.read().unwrap().len() != other.field_access.read().unwrap().len() { - let mut field_access = self.field_access.write().unwrap(); - other.field_access.read().unwrap().iter().for_each(|x| { + if self.field_access.borrow().len() != other.field_access.borrow().len() { + let mut field_access = self.field_access.borrow_mut(); + other.field_access.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in field_access, if it's not there add it to field_access. if field_access .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1083,8 +1054,8 @@ impl ObjectStore { .is_none() { let _index_ = field_access.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field_access.push(Some(x.clone())); } @@ -1092,51 +1063,42 @@ impl ObjectStore { }); } - if self.field_access_target.read().unwrap().len() - != other.field_access_target.read().unwrap().len() - { - let mut field_access_target = self.field_access_target.write().unwrap(); - other - .field_access_target - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in field_access_target, if it's not there add it to field_access_target. - if field_access_target - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = field_access_target.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.field_access_target.borrow().len() != other.field_access_target.borrow().len() { + let mut field_access_target = self.field_access_target.borrow_mut(); + other.field_access_target.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in field_access_target, if it's not there add it to field_access_target. + if field_access_target + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - field_access_target.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = field_access_target.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + field_access_target.push(Some(x.clone())); } - }); + } + }); } - if self.field_expression.read().unwrap().len() - != other.field_expression.read().unwrap().len() - { - let mut field_expression = self.field_expression.write().unwrap(); - other.field_expression.read().unwrap().iter().for_each(|x| { + if self.field_expression.borrow().len() != other.field_expression.borrow().len() { + let mut field_expression = self.field_expression.borrow_mut(); + other.field_expression.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in field_expression, if it's not there add it to field_expression. if field_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1144,8 +1106,8 @@ impl ObjectStore { .is_none() { let _index_ = field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } field_expression.push(Some(x.clone())); } @@ -1153,16 +1115,16 @@ impl ObjectStore { }); } - if self.float_literal.read().unwrap().len() != other.float_literal.read().unwrap().len() { - let mut float_literal = self.float_literal.write().unwrap(); - other.float_literal.read().unwrap().iter().for_each(|x| { + if self.float_literal.borrow().len() != other.float_literal.borrow().len() { + let mut float_literal = self.float_literal.borrow_mut(); + other.float_literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in float_literal, if it's not there add it to float_literal. if float_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1170,8 +1132,8 @@ impl ObjectStore { .is_none() { let _index_ = float_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } float_literal.push(Some(x.clone())); } @@ -1179,16 +1141,16 @@ impl ObjectStore { }); } - if self.for_loop.read().unwrap().len() != other.for_loop.read().unwrap().len() { - let mut for_loop = self.for_loop.write().unwrap(); - other.for_loop.read().unwrap().iter().for_each(|x| { + if self.for_loop.borrow().len() != other.for_loop.borrow().len() { + let mut for_loop = self.for_loop.borrow_mut(); + other.for_loop.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in for_loop, if it's not there add it to for_loop. if for_loop .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1196,8 +1158,8 @@ impl ObjectStore { .is_none() { let _index_ = for_loop.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } for_loop.push(Some(x.clone())); } @@ -1205,16 +1167,16 @@ impl ObjectStore { }); } - if self.format_bit.read().unwrap().len() != other.format_bit.read().unwrap().len() { - let mut format_bit = self.format_bit.write().unwrap(); - other.format_bit.read().unwrap().iter().for_each(|x| { + if self.format_bit.borrow().len() != other.format_bit.borrow().len() { + let mut format_bit = self.format_bit.borrow_mut(); + other.format_bit.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in format_bit, if it's not there add it to format_bit. if format_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1222,8 +1184,8 @@ impl ObjectStore { .is_none() { let _index_ = format_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } format_bit.push(Some(x.clone())); } @@ -1231,16 +1193,16 @@ impl ObjectStore { }); } - if self.format_string.read().unwrap().len() != other.format_string.read().unwrap().len() { - let mut format_string = self.format_string.write().unwrap(); - other.format_string.read().unwrap().iter().for_each(|x| { + if self.format_string.borrow().len() != other.format_string.borrow().len() { + let mut format_string = self.format_string.borrow_mut(); + other.format_string.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in format_string, if it's not there add it to format_string. if format_string .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1248,8 +1210,8 @@ impl ObjectStore { .is_none() { let _index_ = format_string.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } format_string.push(Some(x.clone())); } @@ -1257,16 +1219,16 @@ impl ObjectStore { }); } - if self.func_generic.read().unwrap().len() != other.func_generic.read().unwrap().len() { - let mut func_generic = self.func_generic.write().unwrap(); - other.func_generic.read().unwrap().iter().for_each(|x| { + if self.func_generic.borrow().len() != other.func_generic.borrow().len() { + let mut func_generic = self.func_generic.borrow_mut(); + other.func_generic.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in func_generic, if it's not there add it to func_generic. if func_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1274,8 +1236,8 @@ impl ObjectStore { .is_none() { let _index_ = func_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } func_generic.push(Some(x.clone())); } @@ -1283,16 +1245,16 @@ impl ObjectStore { }); } - if self.function.read().unwrap().len() != other.function.read().unwrap().len() { - let mut function = self.function.write().unwrap(); - other.function.read().unwrap().iter().for_each(|x| { + if self.function.borrow().len() != other.function.borrow().len() { + let mut function = self.function.borrow_mut(); + other.function.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in function, if it's not there add it to function. if function .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1300,8 +1262,8 @@ impl ObjectStore { .is_none() { let _index_ = function.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } function.push(Some(x.clone())); } @@ -1309,16 +1271,16 @@ impl ObjectStore { }); } - if self.function_call.read().unwrap().len() != other.function_call.read().unwrap().len() { - let mut function_call = self.function_call.write().unwrap(); - other.function_call.read().unwrap().iter().for_each(|x| { + if self.function_call.borrow().len() != other.function_call.borrow().len() { + let mut function_call = self.function_call.borrow_mut(); + other.function_call.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in function_call, if it's not there add it to function_call. if function_call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1326,8 +1288,8 @@ impl ObjectStore { .is_none() { let _index_ = function_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } function_call.push(Some(x.clone())); } @@ -1335,16 +1297,16 @@ impl ObjectStore { }); } - if self.x_future.read().unwrap().len() != other.x_future.read().unwrap().len() { - let mut x_future = self.x_future.write().unwrap(); - other.x_future.read().unwrap().iter().for_each(|x| { + if self.x_future.borrow().len() != other.x_future.borrow().len() { + let mut x_future = self.x_future.borrow_mut(); + other.x_future.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_future, if it's not there add it to x_future. if x_future .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1352,8 +1314,8 @@ impl ObjectStore { .is_none() { let _index_ = x_future.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_future.push(Some(x.clone())); } @@ -1361,16 +1323,16 @@ impl ObjectStore { }); } - if self.grouped.read().unwrap().len() != other.grouped.read().unwrap().len() { - let mut grouped = self.grouped.write().unwrap(); - other.grouped.read().unwrap().iter().for_each(|x| { + if self.grouped.borrow().len() != other.grouped.borrow().len() { + let mut grouped = self.grouped.borrow_mut(); + other.grouped.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in grouped, if it's not there add it to grouped. if grouped .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1378,8 +1340,8 @@ impl ObjectStore { .is_none() { let _index_ = grouped.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } grouped.push(Some(x.clone())); } @@ -1387,49 +1349,42 @@ impl ObjectStore { }); } - if self.halt_and_catch_fire.read().unwrap().len() - != other.halt_and_catch_fire.read().unwrap().len() - { - let mut halt_and_catch_fire = self.halt_and_catch_fire.write().unwrap(); - other - .halt_and_catch_fire - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. - if halt_and_catch_fire - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = halt_and_catch_fire.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.halt_and_catch_fire.borrow().len() != other.halt_and_catch_fire.borrow().len() { + let mut halt_and_catch_fire = self.halt_and_catch_fire.borrow_mut(); + other.halt_and_catch_fire.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in halt_and_catch_fire, if it's not there add it to halt_and_catch_fire. + if halt_and_catch_fire + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - halt_and_catch_fire.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = halt_and_catch_fire.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + halt_and_catch_fire.push(Some(x.clone())); } - }); + } + }); } - if self.x_if.read().unwrap().len() != other.x_if.read().unwrap().len() { - let mut x_if = self.x_if.write().unwrap(); - other.x_if.read().unwrap().iter().for_each(|x| { + if self.x_if.borrow().len() != other.x_if.borrow().len() { + let mut x_if = self.x_if.borrow_mut(); + other.x_if.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_if, if it's not there add it to x_if. if x_if .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1437,8 +1392,8 @@ impl ObjectStore { .is_none() { let _index_ = x_if.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_if.push(Some(x.clone())); } @@ -1446,49 +1401,42 @@ impl ObjectStore { }); } - if self.implementation_block.read().unwrap().len() - != other.implementation_block.read().unwrap().len() - { - let mut implementation_block = self.implementation_block.write().unwrap(); - other - .implementation_block - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in implementation_block, if it's not there add it to implementation_block. - if implementation_block - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = implementation_block.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.implementation_block.borrow().len() != other.implementation_block.borrow().len() { + let mut implementation_block = self.implementation_block.borrow_mut(); + other.implementation_block.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in implementation_block, if it's not there add it to implementation_block. + if implementation_block + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - implementation_block.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = implementation_block.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + implementation_block.push(Some(x.clone())); } - }); + } + }); } - if self.import.read().unwrap().len() != other.import.read().unwrap().len() { - let mut import = self.import.write().unwrap(); - other.import.read().unwrap().iter().for_each(|x| { + if self.import.borrow().len() != other.import.borrow().len() { + let mut import = self.import.borrow_mut(); + other.import.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in import, if it's not there add it to import. if import .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1496,8 +1444,8 @@ impl ObjectStore { .is_none() { let _index_ = import.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } import.push(Some(x.clone())); } @@ -1505,16 +1453,16 @@ impl ObjectStore { }); } - if self.index.read().unwrap().len() != other.index.read().unwrap().len() { - let mut index = self.index.write().unwrap(); - other.index.read().unwrap().iter().for_each(|x| { + if self.index.borrow().len() != other.index.borrow().len() { + let mut index = self.index.borrow_mut(); + other.index.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in index, if it's not there add it to index. if index .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1522,8 +1470,8 @@ impl ObjectStore { .is_none() { let _index_ = index.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } index.push(Some(x.clone())); } @@ -1531,17 +1479,16 @@ impl ObjectStore { }); } - if self.integer_literal.read().unwrap().len() != other.integer_literal.read().unwrap().len() - { - let mut integer_literal = self.integer_literal.write().unwrap(); - other.integer_literal.read().unwrap().iter().for_each(|x| { + if self.integer_literal.borrow().len() != other.integer_literal.borrow().len() { + let mut integer_literal = self.integer_literal.borrow_mut(); + other.integer_literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in integer_literal, if it's not there add it to integer_literal. if integer_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1549,8 +1496,8 @@ impl ObjectStore { .is_none() { let _index_ = integer_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } integer_literal.push(Some(x.clone())); } @@ -1558,16 +1505,16 @@ impl ObjectStore { }); } - if self.item.read().unwrap().len() != other.item.read().unwrap().len() { - let mut item = self.item.write().unwrap(); - other.item.read().unwrap().iter().for_each(|x| { + if self.item.borrow().len() != other.item.borrow().len() { + let mut item = self.item.borrow_mut(); + other.item.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in item, if it's not there add it to item. if item .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1575,8 +1522,8 @@ impl ObjectStore { .is_none() { let _index_ = item.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } item.push(Some(x.clone())); } @@ -1584,16 +1531,16 @@ impl ObjectStore { }); } - if self.lambda.read().unwrap().len() != other.lambda.read().unwrap().len() { - let mut lambda = self.lambda.write().unwrap(); - other.lambda.read().unwrap().iter().for_each(|x| { + if self.lambda.borrow().len() != other.lambda.borrow().len() { + let mut lambda = self.lambda.borrow_mut(); + other.lambda.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda, if it's not there add it to lambda. if lambda .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1601,8 +1548,8 @@ impl ObjectStore { .is_none() { let _index_ = lambda.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } lambda.push(Some(x.clone())); } @@ -1610,18 +1557,16 @@ impl ObjectStore { }); } - if self.lambda_parameter.read().unwrap().len() - != other.lambda_parameter.read().unwrap().len() - { - let mut lambda_parameter = self.lambda_parameter.write().unwrap(); - other.lambda_parameter.read().unwrap().iter().for_each(|x| { + if self.lambda_parameter.borrow().len() != other.lambda_parameter.borrow().len() { + let mut lambda_parameter = self.lambda_parameter.borrow_mut(); + other.lambda_parameter.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in lambda_parameter, if it's not there add it to lambda_parameter. if lambda_parameter .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1629,8 +1574,8 @@ impl ObjectStore { .is_none() { let _index_ = lambda_parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } lambda_parameter.push(Some(x.clone())); } @@ -1638,16 +1583,16 @@ impl ObjectStore { }); } - if self.let_statement.read().unwrap().len() != other.let_statement.read().unwrap().len() { - let mut let_statement = self.let_statement.write().unwrap(); - other.let_statement.read().unwrap().iter().for_each(|x| { + if self.let_statement.borrow().len() != other.let_statement.borrow().len() { + let mut let_statement = self.let_statement.borrow_mut(); + other.let_statement.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in let_statement, if it's not there add it to let_statement. if let_statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1655,8 +1600,8 @@ impl ObjectStore { .is_none() { let _index_ = let_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } let_statement.push(Some(x.clone())); } @@ -1664,16 +1609,16 @@ impl ObjectStore { }); } - if self.list.read().unwrap().len() != other.list.read().unwrap().len() { - let mut list = self.list.write().unwrap(); - other.list.read().unwrap().iter().for_each(|x| { + if self.list.borrow().len() != other.list.borrow().len() { + let mut list = self.list.borrow_mut(); + other.list.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in list, if it's not there add it to list. if list .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1681,8 +1626,8 @@ impl ObjectStore { .is_none() { let _index_ = list.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list.push(Some(x.clone())); } @@ -1690,16 +1635,16 @@ impl ObjectStore { }); } - if self.list_element.read().unwrap().len() != other.list_element.read().unwrap().len() { - let mut list_element = self.list_element.write().unwrap(); - other.list_element.read().unwrap().iter().for_each(|x| { + if self.list_element.borrow().len() != other.list_element.borrow().len() { + let mut list_element = self.list_element.borrow_mut(); + other.list_element.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in list_element, if it's not there add it to list_element. if list_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1707,8 +1652,8 @@ impl ObjectStore { .is_none() { let _index_ = list_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list_element.push(Some(x.clone())); } @@ -1716,17 +1661,16 @@ impl ObjectStore { }); } - if self.list_expression.read().unwrap().len() != other.list_expression.read().unwrap().len() - { - let mut list_expression = self.list_expression.write().unwrap(); - other.list_expression.read().unwrap().iter().for_each(|x| { + if self.list_expression.borrow().len() != other.list_expression.borrow().len() { + let mut list_expression = self.list_expression.borrow_mut(); + other.list_expression.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in list_expression, if it's not there add it to list_expression. if list_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1734,8 +1678,8 @@ impl ObjectStore { .is_none() { let _index_ = list_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } list_expression.push(Some(x.clone())); } @@ -1743,16 +1687,16 @@ impl ObjectStore { }); } - if self.literal.read().unwrap().len() != other.literal.read().unwrap().len() { - let mut literal = self.literal.write().unwrap(); - other.literal.read().unwrap().iter().for_each(|x| { + if self.literal.borrow().len() != other.literal.borrow().len() { + let mut literal = self.literal.borrow_mut(); + other.literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in literal, if it's not there add it to literal. if literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1760,8 +1704,8 @@ impl ObjectStore { .is_none() { let _index_ = literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } literal.push(Some(x.clone())); } @@ -1769,16 +1713,16 @@ impl ObjectStore { }); } - if self.local_variable.read().unwrap().len() != other.local_variable.read().unwrap().len() { - let mut local_variable = self.local_variable.write().unwrap(); - other.local_variable.read().unwrap().iter().for_each(|x| { + if self.local_variable.borrow().len() != other.local_variable.borrow().len() { + let mut local_variable = self.local_variable.borrow_mut(); + other.local_variable.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in local_variable, if it's not there add it to local_variable. if local_variable .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1786,8 +1730,8 @@ impl ObjectStore { .is_none() { let _index_ = local_variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } local_variable.push(Some(x.clone())); } @@ -1795,16 +1739,16 @@ impl ObjectStore { }); } - if self.x_macro.read().unwrap().len() != other.x_macro.read().unwrap().len() { - let mut x_macro = self.x_macro.write().unwrap(); - other.x_macro.read().unwrap().iter().for_each(|x| { + if self.x_macro.borrow().len() != other.x_macro.borrow().len() { + let mut x_macro = self.x_macro.borrow_mut(); + other.x_macro.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_macro, if it's not there add it to x_macro. if x_macro .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1812,8 +1756,8 @@ impl ObjectStore { .is_none() { let _index_ = x_macro.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_macro.push(Some(x.clone())); } @@ -1821,16 +1765,16 @@ impl ObjectStore { }); } - if self.map.read().unwrap().len() != other.map.read().unwrap().len() { - let mut map = self.map.write().unwrap(); - other.map.read().unwrap().iter().for_each(|x| { + if self.map.borrow().len() != other.map.borrow().len() { + let mut map = self.map.borrow_mut(); + other.map.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in map, if it's not there add it to map. if map .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1838,8 +1782,8 @@ impl ObjectStore { .is_none() { let _index_ = map.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map.push(Some(x.clone())); } @@ -1847,16 +1791,16 @@ impl ObjectStore { }); } - if self.map_element.read().unwrap().len() != other.map_element.read().unwrap().len() { - let mut map_element = self.map_element.write().unwrap(); - other.map_element.read().unwrap().iter().for_each(|x| { + if self.map_element.borrow().len() != other.map_element.borrow().len() { + let mut map_element = self.map_element.borrow_mut(); + other.map_element.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in map_element, if it's not there add it to map_element. if map_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1864,8 +1808,8 @@ impl ObjectStore { .is_none() { let _index_ = map_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map_element.push(Some(x.clone())); } @@ -1873,16 +1817,16 @@ impl ObjectStore { }); } - if self.map_expression.read().unwrap().len() != other.map_expression.read().unwrap().len() { - let mut map_expression = self.map_expression.write().unwrap(); - other.map_expression.read().unwrap().iter().for_each(|x| { + if self.map_expression.borrow().len() != other.map_expression.borrow().len() { + let mut map_expression = self.map_expression.borrow_mut(); + other.map_expression.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in map_expression, if it's not there add it to map_expression. if map_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1890,8 +1834,8 @@ impl ObjectStore { .is_none() { let _index_ = map_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } map_expression.push(Some(x.clone())); } @@ -1899,16 +1843,16 @@ impl ObjectStore { }); } - if self.x_match.read().unwrap().len() != other.x_match.read().unwrap().len() { - let mut x_match = self.x_match.write().unwrap(); - other.x_match.read().unwrap().iter().for_each(|x| { + if self.x_match.borrow().len() != other.x_match.borrow().len() { + let mut x_match = self.x_match.borrow_mut(); + other.x_match.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_match, if it's not there add it to x_match. if x_match .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1916,8 +1860,8 @@ impl ObjectStore { .is_none() { let _index_ = x_match.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_match.push(Some(x.clone())); } @@ -1925,16 +1869,16 @@ impl ObjectStore { }); } - if self.method_call.read().unwrap().len() != other.method_call.read().unwrap().len() { - let mut method_call = self.method_call.write().unwrap(); - other.method_call.read().unwrap().iter().for_each(|x| { + if self.method_call.borrow().len() != other.method_call.borrow().len() { + let mut method_call = self.method_call.borrow_mut(); + other.method_call.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in method_call, if it's not there add it to method_call. if method_call .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -1942,8 +1886,8 @@ impl ObjectStore { .is_none() { let _index_ = method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } method_call.push(Some(x.clone())); } @@ -1951,49 +1895,43 @@ impl ObjectStore { }); } - if self.named_field_expression.read().unwrap().len() - != other.named_field_expression.read().unwrap().len() + if self.named_field_expression.borrow().len() != other.named_field_expression.borrow().len() { - let mut named_field_expression = self.named_field_expression.write().unwrap(); - other - .named_field_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in named_field_expression, if it's not there add it to named_field_expression. - if named_field_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = named_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + let mut named_field_expression = self.named_field_expression.borrow_mut(); + other.named_field_expression.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in named_field_expression, if it's not there add it to named_field_expression. + if named_field_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - named_field_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = named_field_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + named_field_expression.push(Some(x.clone())); } - }); + } + }); } - if self.z_object_store.read().unwrap().len() != other.z_object_store.read().unwrap().len() { - let mut z_object_store = self.z_object_store.write().unwrap(); - other.z_object_store.read().unwrap().iter().for_each(|x| { + if self.z_object_store.borrow().len() != other.z_object_store.borrow().len() { + let mut z_object_store = self.z_object_store.borrow_mut(); + other.z_object_store.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in z_object_store, if it's not there add it to z_object_store. if z_object_store .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2001,8 +1939,8 @@ impl ObjectStore { .is_none() { let _index_ = z_object_store.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } z_object_store.push(Some(x.clone())); } @@ -2010,16 +1948,16 @@ impl ObjectStore { }); } - if self.object_wrapper.read().unwrap().len() != other.object_wrapper.read().unwrap().len() { - let mut object_wrapper = self.object_wrapper.write().unwrap(); - other.object_wrapper.read().unwrap().iter().for_each(|x| { + if self.object_wrapper.borrow().len() != other.object_wrapper.borrow().len() { + let mut object_wrapper = self.object_wrapper.borrow_mut(); + other.object_wrapper.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in object_wrapper, if it's not there add it to object_wrapper. if object_wrapper .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2027,8 +1965,8 @@ impl ObjectStore { .is_none() { let _index_ = object_wrapper.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } object_wrapper.push(Some(x.clone())); } @@ -2036,16 +1974,16 @@ impl ObjectStore { }); } - if self.operator.read().unwrap().len() != other.operator.read().unwrap().len() { - let mut operator = self.operator.write().unwrap(); - other.operator.read().unwrap().iter().for_each(|x| { + if self.operator.borrow().len() != other.operator.borrow().len() { + let mut operator = self.operator.borrow_mut(); + other.operator.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in operator, if it's not there add it to operator. if operator .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2053,8 +1991,8 @@ impl ObjectStore { .is_none() { let _index_ = operator.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } operator.push(Some(x.clone())); } @@ -2062,16 +2000,16 @@ impl ObjectStore { }); } - if self.parameter.read().unwrap().len() != other.parameter.read().unwrap().len() { - let mut parameter = self.parameter.write().unwrap(); - other.parameter.read().unwrap().iter().for_each(|x| { + if self.parameter.borrow().len() != other.parameter.borrow().len() { + let mut parameter = self.parameter.borrow_mut(); + other.parameter.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in parameter, if it's not there add it to parameter. if parameter .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2079,8 +2017,8 @@ impl ObjectStore { .is_none() { let _index_ = parameter.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } parameter.push(Some(x.clone())); } @@ -2088,16 +2026,16 @@ impl ObjectStore { }); } - if self.x_path.read().unwrap().len() != other.x_path.read().unwrap().len() { - let mut x_path = self.x_path.write().unwrap(); - other.x_path.read().unwrap().iter().for_each(|x| { + if self.x_path.borrow().len() != other.x_path.borrow().len() { + let mut x_path = self.x_path.borrow_mut(); + other.x_path.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_path, if it's not there add it to x_path. if x_path .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2105,8 +2043,8 @@ impl ObjectStore { .is_none() { let _index_ = x_path.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_path.push(Some(x.clone())); } @@ -2114,16 +2052,16 @@ impl ObjectStore { }); } - if self.path_element.read().unwrap().len() != other.path_element.read().unwrap().len() { - let mut path_element = self.path_element.write().unwrap(); - other.path_element.read().unwrap().iter().for_each(|x| { + if self.path_element.borrow().len() != other.path_element.borrow().len() { + let mut path_element = self.path_element.borrow_mut(); + other.path_element.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in path_element, if it's not there add it to path_element. if path_element .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2131,8 +2069,8 @@ impl ObjectStore { .is_none() { let _index_ = path_element.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } path_element.push(Some(x.clone())); } @@ -2140,16 +2078,16 @@ impl ObjectStore { }); } - if self.pattern.read().unwrap().len() != other.pattern.read().unwrap().len() { - let mut pattern = self.pattern.write().unwrap(); - other.pattern.read().unwrap().iter().for_each(|x| { + if self.pattern.borrow().len() != other.pattern.borrow().len() { + let mut pattern = self.pattern.borrow_mut(); + other.pattern.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in pattern, if it's not there add it to pattern. if pattern .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2157,8 +2095,8 @@ impl ObjectStore { .is_none() { let _index_ = pattern.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } pattern.push(Some(x.clone())); } @@ -2166,16 +2104,16 @@ impl ObjectStore { }); } - if self.x_plugin.read().unwrap().len() != other.x_plugin.read().unwrap().len() { - let mut x_plugin = self.x_plugin.write().unwrap(); - other.x_plugin.read().unwrap().iter().for_each(|x| { + if self.x_plugin.borrow().len() != other.x_plugin.borrow().len() { + let mut x_plugin = self.x_plugin.borrow_mut(); + other.x_plugin.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_plugin, if it's not there add it to x_plugin. if x_plugin .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2183,8 +2121,8 @@ impl ObjectStore { .is_none() { let _index_ = x_plugin.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_plugin.push(Some(x.clone())); } @@ -2192,16 +2130,16 @@ impl ObjectStore { }); } - if self.x_print.read().unwrap().len() != other.x_print.read().unwrap().len() { - let mut x_print = self.x_print.write().unwrap(); - other.x_print.read().unwrap().iter().for_each(|x| { + if self.x_print.borrow().len() != other.x_print.borrow().len() { + let mut x_print = self.x_print.borrow_mut(); + other.x_print.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_print, if it's not there add it to x_print. if x_print .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2209,8 +2147,8 @@ impl ObjectStore { .is_none() { let _index_ = x_print.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_print.push(Some(x.clone())); } @@ -2218,18 +2156,16 @@ impl ObjectStore { }); } - if self.range_expression.read().unwrap().len() - != other.range_expression.read().unwrap().len() - { - let mut range_expression = self.range_expression.write().unwrap(); - other.range_expression.read().unwrap().iter().for_each(|x| { + if self.range_expression.borrow().len() != other.range_expression.borrow().len() { + let mut range_expression = self.range_expression.borrow_mut(); + other.range_expression.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in range_expression, if it's not there add it to range_expression. if range_expression .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2237,8 +2173,8 @@ impl ObjectStore { .is_none() { let _index_ = range_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } range_expression.push(Some(x.clone())); } @@ -2246,18 +2182,16 @@ impl ObjectStore { }); } - if self.result_statement.read().unwrap().len() - != other.result_statement.read().unwrap().len() - { - let mut result_statement = self.result_statement.write().unwrap(); - other.result_statement.read().unwrap().iter().for_each(|x| { + if self.result_statement.borrow().len() != other.result_statement.borrow().len() { + let mut result_statement = self.result_statement.borrow_mut(); + other.result_statement.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in result_statement, if it's not there add it to result_statement. if result_statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2265,8 +2199,8 @@ impl ObjectStore { .is_none() { let _index_ = result_statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } result_statement.push(Some(x.clone())); } @@ -2274,16 +2208,16 @@ impl ObjectStore { }); } - if self.x_return.read().unwrap().len() != other.x_return.read().unwrap().len() { - let mut x_return = self.x_return.write().unwrap(); - other.x_return.read().unwrap().iter().for_each(|x| { + if self.x_return.borrow().len() != other.x_return.borrow().len() { + let mut x_return = self.x_return.borrow_mut(); + other.x_return.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_return, if it's not there add it to x_return. if x_return .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2291,8 +2225,8 @@ impl ObjectStore { .is_none() { let _index_ = x_return.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_return.push(Some(x.clone())); } @@ -2300,16 +2234,16 @@ impl ObjectStore { }); } - if self.span.read().unwrap().len() != other.span.read().unwrap().len() { - let mut span = self.span.write().unwrap(); - other.span.read().unwrap().iter().for_each(|x| { + if self.span.borrow().len() != other.span.borrow().len() { + let mut span = self.span.borrow_mut(); + other.span.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in span, if it's not there add it to span. if span .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2317,8 +2251,8 @@ impl ObjectStore { .is_none() { let _index_ = span.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } span.push(Some(x.clone())); } @@ -2326,16 +2260,16 @@ impl ObjectStore { }); } - if self.statement.read().unwrap().len() != other.statement.read().unwrap().len() { - let mut statement = self.statement.write().unwrap(); - other.statement.read().unwrap().iter().for_each(|x| { + if self.statement.borrow().len() != other.statement.borrow().len() { + let mut statement = self.statement.borrow_mut(); + other.statement.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in statement, if it's not there add it to statement. if statement .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2343,8 +2277,8 @@ impl ObjectStore { .is_none() { let _index_ = statement.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } statement.push(Some(x.clone())); } @@ -2352,49 +2286,42 @@ impl ObjectStore { }); } - if self.static_method_call.read().unwrap().len() - != other.static_method_call.read().unwrap().len() - { - let mut static_method_call = self.static_method_call.write().unwrap(); - other - .static_method_call - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in static_method_call, if it's not there add it to static_method_call. - if static_method_call - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = static_method_call.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.static_method_call.borrow().len() != other.static_method_call.borrow().len() { + let mut static_method_call = self.static_method_call.borrow_mut(); + other.static_method_call.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in static_method_call, if it's not there add it to static_method_call. + if static_method_call + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - static_method_call.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = static_method_call.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + static_method_call.push(Some(x.clone())); } - }); + } + }); } - if self.string_bit.read().unwrap().len() != other.string_bit.read().unwrap().len() { - let mut string_bit = self.string_bit.write().unwrap(); - other.string_bit.read().unwrap().iter().for_each(|x| { + if self.string_bit.borrow().len() != other.string_bit.borrow().len() { + let mut string_bit = self.string_bit.borrow_mut(); + other.string_bit.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in string_bit, if it's not there add it to string_bit. if string_bit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2402,8 +2329,8 @@ impl ObjectStore { .is_none() { let _index_ = string_bit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } string_bit.push(Some(x.clone())); } @@ -2411,16 +2338,16 @@ impl ObjectStore { }); } - if self.string_literal.read().unwrap().len() != other.string_literal.read().unwrap().len() { - let mut string_literal = self.string_literal.write().unwrap(); - other.string_literal.read().unwrap().iter().for_each(|x| { + if self.string_literal.borrow().len() != other.string_literal.borrow().len() { + let mut string_literal = self.string_literal.borrow_mut(); + other.string_literal.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in string_literal, if it's not there add it to string_literal. if string_literal .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2428,8 +2355,8 @@ impl ObjectStore { .is_none() { let _index_ = string_literal.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } string_literal.push(Some(x.clone())); } @@ -2437,16 +2364,16 @@ impl ObjectStore { }); } - if self.woog_struct.read().unwrap().len() != other.woog_struct.read().unwrap().len() { - let mut woog_struct = self.woog_struct.write().unwrap(); - other.woog_struct.read().unwrap().iter().for_each(|x| { + if self.woog_struct.borrow().len() != other.woog_struct.borrow().len() { + let mut woog_struct = self.woog_struct.borrow_mut(); + other.woog_struct.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in woog_struct, if it's not there add it to woog_struct. if woog_struct .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2454,8 +2381,8 @@ impl ObjectStore { .is_none() { let _index_ = woog_struct.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } woog_struct.push(Some(x.clone())); } @@ -2463,49 +2390,42 @@ impl ObjectStore { }); } - if self.struct_expression.read().unwrap().len() - != other.struct_expression.read().unwrap().len() - { - let mut struct_expression = self.struct_expression.write().unwrap(); - other - .struct_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in struct_expression, if it's not there add it to struct_expression. - if struct_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = struct_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.struct_expression.borrow().len() != other.struct_expression.borrow().len() { + let mut struct_expression = self.struct_expression.borrow_mut(); + other.struct_expression.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in struct_expression, if it's not there add it to struct_expression. + if struct_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - struct_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = struct_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + struct_expression.push(Some(x.clone())); } - }); + } + }); } - if self.struct_field.read().unwrap().len() != other.struct_field.read().unwrap().len() { - let mut struct_field = self.struct_field.write().unwrap(); - other.struct_field.read().unwrap().iter().for_each(|x| { + if self.struct_field.borrow().len() != other.struct_field.borrow().len() { + let mut struct_field = self.struct_field.borrow_mut(); + other.struct_field.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_field, if it's not there add it to struct_field. if struct_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2513,8 +2433,8 @@ impl ObjectStore { .is_none() { let _index_ = struct_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } struct_field.push(Some(x.clone())); } @@ -2522,16 +2442,16 @@ impl ObjectStore { }); } - if self.struct_generic.read().unwrap().len() != other.struct_generic.read().unwrap().len() { - let mut struct_generic = self.struct_generic.write().unwrap(); - other.struct_generic.read().unwrap().iter().for_each(|x| { + if self.struct_generic.borrow().len() != other.struct_generic.borrow().len() { + let mut struct_generic = self.struct_generic.borrow_mut(); + other.struct_generic.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in struct_generic, if it's not there add it to struct_generic. if struct_generic .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2539,8 +2459,8 @@ impl ObjectStore { .is_none() { let _index_ = struct_generic.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } struct_generic.push(Some(x.clone())); } @@ -2548,16 +2468,16 @@ impl ObjectStore { }); } - if self.tuple_field.read().unwrap().len() != other.tuple_field.read().unwrap().len() { - let mut tuple_field = self.tuple_field.write().unwrap(); - other.tuple_field.read().unwrap().iter().for_each(|x| { + if self.tuple_field.borrow().len() != other.tuple_field.borrow().len() { + let mut tuple_field = self.tuple_field.borrow_mut(); + other.tuple_field.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in tuple_field, if it's not there add it to tuple_field. if tuple_field .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2565,8 +2485,8 @@ impl ObjectStore { .is_none() { let _index_ = tuple_field.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } tuple_field.push(Some(x.clone())); } @@ -2574,16 +2494,16 @@ impl ObjectStore { }); } - if self.type_cast.read().unwrap().len() != other.type_cast.read().unwrap().len() { - let mut type_cast = self.type_cast.write().unwrap(); - other.type_cast.read().unwrap().iter().for_each(|x| { + if self.type_cast.borrow().len() != other.type_cast.borrow().len() { + let mut type_cast = self.type_cast.borrow_mut(); + other.type_cast.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in type_cast, if it's not there add it to type_cast. if type_cast .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2591,8 +2511,8 @@ impl ObjectStore { .is_none() { let _index_ = type_cast.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } type_cast.push(Some(x.clone())); } @@ -2600,16 +2520,16 @@ impl ObjectStore { }); } - if self.unary.read().unwrap().len() != other.unary.read().unwrap().len() { - let mut unary = self.unary.write().unwrap(); - other.unary.read().unwrap().iter().for_each(|x| { + if self.unary.borrow().len() != other.unary.borrow().len() { + let mut unary = self.unary.borrow_mut(); + other.unary.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in unary, if it's not there add it to unary. if unary .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2617,8 +2537,8 @@ impl ObjectStore { .is_none() { let _index_ = unary.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } unary.push(Some(x.clone())); } @@ -2626,16 +2546,16 @@ impl ObjectStore { }); } - if self.unit.read().unwrap().len() != other.unit.read().unwrap().len() { - let mut unit = self.unit.write().unwrap(); - other.unit.read().unwrap().iter().for_each(|x| { + if self.unit.borrow().len() != other.unit.borrow().len() { + let mut unit = self.unit.borrow_mut(); + other.unit.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in unit, if it's not there add it to unit. if unit .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2643,8 +2563,8 @@ impl ObjectStore { .is_none() { let _index_ = unit.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } unit.push(Some(x.clone())); } @@ -2652,14 +2572,13 @@ impl ObjectStore { }); } - if self.unnamed_field_expression.read().unwrap().len() - != other.unnamed_field_expression.read().unwrap().len() + if self.unnamed_field_expression.borrow().len() + != other.unnamed_field_expression.borrow().len() { - let mut unnamed_field_expression = self.unnamed_field_expression.write().unwrap(); + let mut unnamed_field_expression = self.unnamed_field_expression.borrow_mut(); other .unnamed_field_expression - .read() - .unwrap() + .borrow() .iter() .for_each(|x| { if let Some(x) = x { @@ -2668,7 +2587,7 @@ impl ObjectStore { .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2676,8 +2595,8 @@ impl ObjectStore { .is_none() { let _index_ = unnamed_field_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } unnamed_field_expression.push(Some(x.clone())); } @@ -2685,16 +2604,16 @@ impl ObjectStore { }); } - if self.x_value.read().unwrap().len() != other.x_value.read().unwrap().len() { - let mut x_value = self.x_value.write().unwrap(); - other.x_value.read().unwrap().iter().for_each(|x| { + if self.x_value.borrow().len() != other.x_value.borrow().len() { + let mut x_value = self.x_value.borrow_mut(); + other.x_value.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in x_value, if it's not there add it to x_value. if x_value .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2702,8 +2621,8 @@ impl ObjectStore { .is_none() { let _index_ = x_value.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } x_value.push(Some(x.clone())); } @@ -2711,16 +2630,16 @@ impl ObjectStore { }); } - if self.value_type.read().unwrap().len() != other.value_type.read().unwrap().len() { - let mut value_type = self.value_type.write().unwrap(); - other.value_type.read().unwrap().iter().for_each(|x| { + if self.value_type.borrow().len() != other.value_type.borrow().len() { + let mut value_type = self.value_type.borrow_mut(); + other.value_type.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in value_type, if it's not there add it to value_type. if value_type .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2728,8 +2647,8 @@ impl ObjectStore { .is_none() { let _index_ = value_type.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } value_type.push(Some(x.clone())); } @@ -2737,16 +2656,16 @@ impl ObjectStore { }); } - if self.variable.read().unwrap().len() != other.variable.read().unwrap().len() { - let mut variable = self.variable.write().unwrap(); - other.variable.read().unwrap().iter().for_each(|x| { + if self.variable.borrow().len() != other.variable.borrow().len() { + let mut variable = self.variable.borrow_mut(); + other.variable.borrow().iter().for_each(|x| { if let Some(x) = x { // Look for other in variable, if it's not there add it to variable. if variable .iter() .find(|&y| { if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() + *y.borrow() == *x.borrow() } else { false } @@ -2754,8 +2673,8 @@ impl ObjectStore { .is_none() { let _index_ = variable.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } variable.push(Some(x.clone())); } @@ -2763,37 +2682,30 @@ impl ObjectStore { }); } - if self.variable_expression.read().unwrap().len() - != other.variable_expression.read().unwrap().len() - { - let mut variable_expression = self.variable_expression.write().unwrap(); - other - .variable_expression - .read() - .unwrap() - .iter() - .for_each(|x| { - if let Some(x) = x { - // Look for other in variable_expression, if it's not there add it to variable_expression. - if variable_expression - .iter() - .find(|&y| { - if let Some(y) = y { - *y.read().unwrap() == *x.read().unwrap() - } else { - false - } - }) - .is_none() - { - let _index_ = variable_expression.len(); - if x.read().unwrap().id != _index_ { - x.write().unwrap().id = _index_; + if self.variable_expression.borrow().len() != other.variable_expression.borrow().len() { + let mut variable_expression = self.variable_expression.borrow_mut(); + other.variable_expression.borrow().iter().for_each(|x| { + if let Some(x) = x { + // Look for other in variable_expression, if it's not there add it to variable_expression. + if variable_expression + .iter() + .find(|&y| { + if let Some(y) = y { + *y.borrow() == *x.borrow() + } else { + false } - variable_expression.push(Some(x.clone())); + }) + .is_none() + { + let _index_ = variable_expression.len(); + if x.borrow().id != _index_ { + x.borrow_mut().id = _index_; } + variable_expression.push(Some(x.clone())); } - }); + } + }); } } pub fn new() -> Self {