re-add source tree to restore compile error-free state
diff --git a/org.eclipse.viatra2.core2/.classpath b/org.eclipse.viatra2.core2/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.viatra2.core2/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.viatra2.core2/.project b/org.eclipse.viatra2.core2/.project
new file mode 100644
index 0000000..70d0c56
--- /dev/null
+++ b/org.eclipse.viatra2.core2/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.viatra2.core2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8aebd6a
--- /dev/null
+++ b/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,263 @@
+#Wed Jan 12 11:16:12 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..b6dbbc6
--- /dev/null
+++ b/org.eclipse.viatra2.core2/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,10 @@
+#Mon Jul 10 11:23:28 CEST 2006
+eclipse.preferences.version=1
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=10
+internal.default.compliance=default
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
diff --git a/org.eclipse.viatra2.core2/META-INF/MANIFEST.MF b/org.eclipse.viatra2.core2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..92ed559
--- /dev/null
+++ b/org.eclipse.viatra2.core2/META-INF/MANIFEST.MF
@@ -0,0 +1,44 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: VIATRA2 R3 Core
+Bundle-SymbolicName: org.eclipse.viatra2.core2;singleton:=true
+Bundle-Version: 3.3.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.viatra2.ViatraPlugin
+Bundle-Vendor: BUTE-FTSRG
+Export-Package: org.eclipse.viatra2,
+ org.eclipse.viatra2.buffers,
+ org.eclipse.viatra2.codegen,
+ org.eclipse.viatra2.copier,
+ org.eclipse.viatra2.core,
+ org.eclipse.viatra2.core.constraint,
+ org.eclipse.viatra2.core.notification,
+ org.eclipse.viatra2.core.simple,
+ org.eclipse.viatra2.core.simple.cache,
+ org.eclipse.viatra2.core.simple.constraint,
+ org.eclipse.viatra2.core.simple.notification,
+ org.eclipse.viatra2.core.simple.tempdata,
+ org.eclipse.viatra2.core.tracebased,
+ org.eclipse.viatra2.core.tracebased.tracetree,
+ org.eclipse.viatra2.errors,
+ org.eclipse.viatra2.errors.info,
+ org.eclipse.viatra2.errors.reporting,
+ org.eclipse.viatra2.exports,
+ org.eclipse.viatra2.framework,
+ org.eclipse.viatra2.framework.properties,
+ org.eclipse.viatra2.framework.properties.providers,
+ org.eclipse.viatra2.imports,
+ org.eclipse.viatra2.interpreters,
+ org.eclipse.viatra2.interpreters.debugInterface,
+ org.eclipse.viatra2.loaders,
+ org.eclipse.viatra2.logger,
+ org.eclipse.viatra2.merger,
+ org.eclipse.viatra2.modelChecker,
+ org.eclipse.viatra2.modelChecker.impl,
+ org.eclipse.viatra2.natives,
+ org.eclipse.viatra2.tags,
+ org.eclipse.viatra2.tags.impl
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.viatra2.core2/about.html b/org.eclipse.viatra2.core2/about.html
new file mode 100644
index 0000000..1262b8c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>July 4th, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.viatra2.core2/build.properties b/org.eclipse.viatra2.core2/build.properties
new file mode 100644
index 0000000..9b31074
--- /dev/null
+++ b/org.eclipse.viatra2.core2/build.properties
@@ -0,0 +1,8 @@
+bin.includes = model/,\
+ plugin.xml,\
+ schema/,\
+ META-INF/,\
+ .
+source.. = src/
+src.includes = schema/,\
+ model/
diff --git a/org.eclipse.viatra2.core2/model/vpmcore.vpml b/org.eclipse.viatra2.core2/model/vpmcore.vpml
new file mode 100644
index 0000000..0d4fba8
--- /dev/null
+++ b/org.eclipse.viatra2.core2/model/vpmcore.vpml
@@ -0,0 +1,105 @@
+<?xml version="1.0" ?>
+<VPM>
+<PROPERTIES>
+<PROPERTY name="codeout@class" value="unknown"/>
+<PROPERTY name="codeout@efile.autolinefeed" value="yes"/>
+<PROPERTY name="codeout@efile.basedir" value=""/>
+<PROPERTY name="codeout@efile.project" value=""/>
+<PROPERTY name="codeout@file.autolinefeed" value="yes"/>
+<PROPERTY name="codeout@initial" value="unknown"/>
+<PROPERTY name="codeout@simple.autolinefeed" value="yes"/>
+<PROPERTY name="codeout@simple.output" value="screen"/>
+<PROPERTY name="codeout@window.autolinefeed" value="yes"/>
+<PROPERTY name="log@level" value="3"/>
+<PROPERTY name="log@output" value="screen"/>
+<PROPERTY name="viatra_tree_editor@formatstring_entity" value="%n%[20]{ {$%}}v%{ : $}t%{ [$]}s"/>
+<PROPERTY name="viatra_tree_editor@formatstring_relation" value="%n (-> %target)%{ : $}t%{ [$]}s"/>
+</PROPERTIES>
+<MODEL>
+<ROOTENTITY id="0"/>
+<ENTITIES>
+<ENTITY id="1">
+<NAME>datatypes</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="0"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="2">
+<NAME>String</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="1"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="3">
+<NAME>Boolean</NAME>
+<VIEWINFO>Inheritance from Constant should not be allowed.</VIEWINFO>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="1"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="4">
+<NAME>false</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="3"/></TYPE>
+<PARENT><ENTITY idref="3"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="5">
+<NAME>true</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="3"/></TYPE>
+<PARENT><ENTITY idref="3"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="6">
+<NAME>Integer</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="1"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="7">
+<NAME>Double</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="1"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="8">
+<NAME>MultiplicityKind</NAME>
+<VIEWINFO>Multiplicity kind of relations in the VPM modelspace.</VIEWINFO>
+<ISFINALTYPE>false</ISFINALTYPE>
+<PARENT><ENTITY idref="1"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="9">
+<NAME>one_to_one</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="8"/></TYPE>
+<PARENT><ENTITY idref="8"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="10">
+<NAME>one_to_many</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="8"/></TYPE>
+<PARENT><ENTITY idref="8"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="11">
+<NAME>many_to_one</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="8"/></TYPE>
+<PARENT><ENTITY idref="8"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+<ENTITY id="12">
+<NAME>many_to_many</NAME>
+<ISFINALTYPE>false</ISFINALTYPE>
+<TYPE><MODELELEMENT idref="8"/></TYPE>
+<PARENT><ENTITY idref="8"/></PARENT>
+<VALUE></VALUE>
+</ENTITY>
+</ENTITIES>
+<RELATIONS>
+</RELATIONS>
+</MODEL>
+</VPM>
diff --git a/org.eclipse.viatra2.core2/model/vpmcore.vtml b/org.eclipse.viatra2.core2/model/vpmcore.vtml
new file mode 100644
index 0000000..e941f72
--- /dev/null
+++ b/org.eclipse.viatra2.core2/model/vpmcore.vtml
@@ -0,0 +1,26 @@
+entity('datatypes')
+{
+ entity('datatypes'.'Boolean')
+ {
+ entity('datatypes'.'Boolean'.'false');
+ entity('datatypes'.'Boolean'.'true');
+ }
+ entity('datatypes'.'Double');
+ entity('datatypes'.'Integer');
+ entity('datatypes'.'MultiplicityKind')
+ {
+ entity('datatypes'.'MultiplicityKind'.'many_to_many');
+ entity('datatypes'.'MultiplicityKind'.'many_to_one');
+ entity('datatypes'.'MultiplicityKind'.'one_to_many');
+ entity('datatypes'.'MultiplicityKind'.'one_to_one');
+ }
+ entity('datatypes'.'String');
+}
+
+instanceOf('datatypes'.'Boolean'.'false','datatypes'.'Boolean');
+instanceOf('datatypes'.'Boolean'.'true','datatypes'.'Boolean');
+instanceOf('datatypes'.'MultiplicityKind'.'many_to_many','datatypes'.'MultiplicityKind');
+instanceOf('datatypes'.'MultiplicityKind'.'many_to_one','datatypes'.'MultiplicityKind');
+instanceOf('datatypes'.'MultiplicityKind'.'one_to_many','datatypes'.'MultiplicityKind');
+instanceOf('datatypes'.'MultiplicityKind'.'one_to_one','datatypes'.'MultiplicityKind');
+
diff --git a/org.eclipse.viatra2.core2/plugin.xml b/org.eclipse.viatra2.core2/plugin.xml
new file mode 100644
index 0000000..7fff545
--- /dev/null
+++ b/org.eclipse.viatra2.core2/plugin.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension-point id="modelimport" name="Model Import Interface" schema="schema/modelimport.exsd"/>
+ <extension-point id="programloader" name="Program Model Loader Interface" schema="schema/programloader.exsd"/>
+ <extension-point id="nativefunction" name="Native Function Extension Point" schema="schema/nativefunction.exsd"/>
+ <extension-point id="codeout" name="code output plugin" schema="schema/codeout.exsd"/>
+ <extension-point id="logger" name="logger" schema="schema/logger.exsd"/>
+ <extension-point id="interpreter" name="interpreter" schema="schema/interpreter.exsd"/>
+ <extension-point id="properties" name="properties" schema="schema/properties.exsd"/>
+ <extension-point id="wizardcontributor" name="New Modelspace Wizard Contributor" schema="schema/wizardcontributor.exsd"/>
+ <extension-point id="frameworkservice" name="VIATRA Framework Service" schema="schema/frameworkservice.exsd"/>
+ <extension
+ point="org.eclipse.viatra2.core2.codeout">
+ <codeout
+ class="org.eclipse.viatra2.codegen.FileCodeFormatter"/>
+ </extension>
+ <extension
+ point="org.eclipse.viatra2.core2.logger">
+ <logger class="org.eclipse.viatra2.logger.SimpleLoggerFactory"/>
+ </extension>
+ <extension
+ point="org.eclipse.viatra2.core2.nativefunction">
+ <function class="org.eclipse.viatra2.natives.AdderFunction"/>
+ <function class="org.eclipse.viatra2.natives.ExistsFunction"/>
+ <function class="org.eclipse.viatra2.natives.SysTimeFunction"/>
+ <function class="org.eclipse.viatra2.natives.CleanFunction"/>
+ <function class="org.eclipse.viatra2.buffers.GetBuffer"/>
+ <function
+ class="org.eclipse.viatra2.natives.GetVIATRAID">
+ </function>
+ <function
+ class="org.eclipse.viatra2.natives.MeasureMemoryFootprintFunction">
+ </function>
+ <function class="org.eclipse.viatra2.buffers.ClearBuffer"/>
+ <function class="org.eclipse.viatra2.buffers.FlushBuffer"/>
+ <function
+ class="org.eclipse.viatra2.natives.RandomDoubleFunction">
+ </function>
+ <function
+ class="org.eclipse.viatra2.natives.RandomIntegerFunction">
+ </function>
+
+
+ </extension>
+ <extension
+ point="org.eclipse.viatra2.core2.wizardcontributor">
+ <category
+ id="vpm"
+ name="VPM Core"/>
+ <model
+ categoryID="vpm"
+ description="The Visual and Precise Metamodeling language core metamodel by Daniel Varro"
+ file_vpml="model/vpmcore.vpml"
+ file_vtml="model/vpmcore.vtml"
+ id="org.eclipse.viatra2.core2.vpmcoremodel"
+ name="VPM Core and Datatypes metamodel"/>
+ </extension>
+ <extension
+ point="org.eclipse.viatra2.core2.properties">
+ <propertyprovider class="org.eclipse.viatra2.framework.properties.providers.VPMLoggerPropertyProvider"/>
+ <propertyprovider
+ class="org.eclipse.viatra2.framework.properties.providers.VPMCorePropertyProvider">
+ </propertyprovider>
+ <!-- <propertyprovider
+ class="org.eclipse.viatra2.modelChecker.ModelCheckerPropertyProvider">
+ </propertyprovider> -->
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.core.resources.IResource"
+ class="org.eclipse.viatra2.errors.reporting.internal.FileToMarkerManager">
+ <adapter
+ type="org.eclipse.viatra2.errors.reporting.IErrorReporter">
+ </adapter>
+ </factory>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.viatra2.core2/schema/codeout.exsd b/org.eclipse.viatra2.core2/schema/codeout.exsd
new file mode 100644
index 0000000..02b7e37
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/codeout.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="codeout" name="code output plugin"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="codeout" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="codeout">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.codegen.CodeOutputPlugin"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/frameworkservice.exsd b/org.eclipse.viatra2.core2/schema/frameworkservice.exsd
new file mode 100644
index 0000000..9048e1b
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/frameworkservice.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="frameworkservice" name="VIATRA Framework Service"/>
+ </appInfo>
+ <documentation>
+ Provides an extension point for plugins offering core VIATRA2 Framework services.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <choice>
+ <element ref="factory"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="factoryclass" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.framework.IFrameworkServiceFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="servicename" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ VIATRA2 R3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/interpreter.exsd b/org.eclipse.viatra2.core2/schema/interpreter.exsd
new file mode 100644
index 0000000..957b36a
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/interpreter.exsd
@@ -0,0 +1,130 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="interpreter" name="interpreter"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="interpreter"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="interpreter">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.interpreters.ModelInterpreter"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="interpretedClasses" type="string" use="required">
+ <annotation>
+ <documentation>
+ Java FQN of interpretable classes.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/logger.exsd b/org.eclipse.viatra2.core2/schema/logger.exsd
new file mode 100644
index 0000000..0d43ad3
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/logger.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="logger" name="logger"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="logger"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="logger">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.logger.Logger"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/modelimport.exsd b/org.eclipse.viatra2.core2/schema/modelimport.exsd
new file mode 100644
index 0000000..f6edb1c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/modelimport.exsd
@@ -0,0 +1,128 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="modelimport" name="Model Import Interface"/>
+ </appinfo>
+ <documentation>
+ The importer.class must implement the org.eclipse.viatra2.imports.NativeImporterFactory interface.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="importer" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="importer">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Must implement Interface:
+org.eclipse.viatra2.imports.NativeImporter
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.imports.NativeImporter"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="fileExtensionList" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/nativefunction.exsd b/org.eclipse.viatra2.core2/schema/nativefunction.exsd
new file mode 100644
index 0000000..35a7265
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/nativefunction.exsd
@@ -0,0 +1,99 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="nativefunction" name="Native Function Extension Point"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="function"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="function">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.natives.ASMNativeFunction"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/programloader.exsd b/org.eclipse.viatra2.core2/schema/programloader.exsd
new file mode 100644
index 0000000..d15859f
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/programloader.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="modelimport" name="Model Import Interface"/>
+ </appinfo>
+ <documentation>
+ The importer.class must implement the org.eclipse.viatra2.imports.NativeImporterFactory interface.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="loader" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="loader">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.loaders.Loader"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="fileExtensionList" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/properties.exsd b/org.eclipse.viatra2.core2/schema/properties.exsd
new file mode 100644
index 0000000..803c382
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/properties.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="properties" name="properties"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="propertyprovider" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="propertyprovider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.viatra2.framework.properties.IViatraPropertyProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/schema/wizardcontributor.exsd b/org.eclipse.viatra2.core2/schema/wizardcontributor.exsd
new file mode 100644
index 0000000..317a4a3
--- /dev/null
+++ b/org.eclipse.viatra2.core2/schema/wizardcontributor.exsd
@@ -0,0 +1,178 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.viatra2.core2">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.viatra2.core2" id="wizardcontributor" name="New Modelspace Wizard Contributor"/>
+ </appInfo>
+ <documentation>
+ This extension point provides support for plugins to contribute modelspace fragments to the New Modelspace Wizard provided by the Viatra Tree Editor R2.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="category"/>
+ <element ref="model" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="model">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="requiredIDs" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="forbiddenIDs" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="containedIDs" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="categoryID" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="file_vtml" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="file_vpml" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/EclipseExtensionProvider.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/EclipseExtensionProvider.java
new file mode 100644
index 0000000..397265b
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/EclipseExtensionProvider.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import org.eclipse.viatra2.codegen.CodeOutputPluginFactory;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.simple.SimpleModelSpace;
+import org.eclipse.viatra2.core.tracebased.TraceModelSpace;
+import org.eclipse.viatra2.framework.ExtensionProvider;
+import org.eclipse.viatra2.framework.FrameworkException;
+import org.eclipse.viatra2.framework.properties.IViatraPropertyProvider;
+import org.eclipse.viatra2.framework.properties.VPMProperties;
+import org.eclipse.viatra2.framework.properties.providers.VPMCorePropertyProvider;
+import org.eclipse.viatra2.imports.NativeImporterFactory;
+import org.eclipse.viatra2.interpreters.ModelInterpreterFactory;
+import org.eclipse.viatra2.loaders.LoaderFactory;
+import org.eclipse.viatra2.logger.Logger;
+import org.eclipse.viatra2.logger.LoggerFactory;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+
+/**
+ * The extension loader in Eclipse environment. Extensions for the VPM modeling
+ * core are found and loaded as Eclipse plugins.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class EclipseExtensionProvider implements ExtensionProvider {
+ Logger logger;
+
+ public Logger getDefaultLogger() {
+ return ViatraPlugin.getDefault().getEclipseLogger();
+ }
+
+ public void setLogger(Logger l) {
+ logger = l;
+ }
+
+ public LoggerFactory[] getAvailableLoggers() {
+ return ViatraPlugin.getDefault().initLoggerPlugins().toArray(
+ new LoggerFactory[0]);
+ }
+
+ public CodeOutputPluginFactory[] getCodeOutputPlugins() {
+ return ViatraPlugin.getDefault().initCodeOutPlugins().toArray(
+ new CodeOutputPluginFactory[0]);
+ }
+
+ public NativeImporterFactory[] getNativeImporters(VPMProperties p) {
+ return ViatraPlugin.getDefault().getImporterPlugins();
+ }
+
+ public LoaderFactory[] getLoaders(VPMProperties p) {
+ return ViatraPlugin.getDefault().getLoaderPlugins();
+ }
+
+ /*
+ * public InputStream getPropertyStream() throws IOException { return
+ * ViatraPlugin.getDefault().getPropertyStream(); }
+ */
+
+ public VPMProperties getDefaultProperties() throws FrameworkException {
+ // XXX VPMProperties is instantiated here
+ VPMProperties props = new VPMProperties();
+ for (IViatraPropertyProvider p : getPropertyProviders()) {
+ props.addPropertyProvider(p);
+ for (String key : p.getAllPropertyIds()) {
+ props.setRuntimeProperty(p.getProviderID(), key, p
+ .getDefaultPropertyValue(key));
+ }
+ }
+ return props;
+ }
+
+ public ASMNativeFunction[] getNativeFunctions() {
+ return ViatraPlugin.getDefault().initNativeFunctionPlugins().toArray(
+ new ASMNativeFunction[0]);
+ }
+
+ public IModelSpace getEmptyModelspace(VPMProperties props) {
+ if (props.isRuntimePropertySet(
+ VPMCorePropertyProvider.VPM_CORE_PROVIDER_NAME,
+ VPMCorePropertyProvider.VPM_CORE_PROVIDER_MANAGER_PROPERTY)) {
+ if (props
+ .getRuntimeProperty(
+ VPMCorePropertyProvider.VPM_CORE_PROVIDER_NAME,
+ VPMCorePropertyProvider.VPM_CORE_PROVIDER_MANAGER_PROPERTY)
+ .equals(VPMCorePropertyProvider.VPM_CORE_PROVIDER_TRACEBASED_VALUE)) {
+ return new TraceModelSpace();
+ }
+ }
+ return new SimpleModelSpace();
+ }
+
+ public ModelInterpreterFactory[] getInterpreters() {
+ return ViatraPlugin.getDefault().initInterpreterPlugins().toArray(
+ new ModelInterpreterFactory[0]);
+ }
+
+ public IViatraPropertyProvider[] getPropertyProviders() {
+ return ViatraPlugin.getDefault().getPropertyProviders().toArray(
+ new IViatraPropertyProvider[0]);
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralCodeoutFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralCodeoutFactory.java
new file mode 100644
index 0000000..7e504f5
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralCodeoutFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.viatra2.codegen.CodeOutputPlugin;
+import org.eclipse.viatra2.codegen.CodeOutputPluginFactory;
+import org.eclipse.viatra2.framework.IFramework;
+import org.eclipse.viatra2.imports.NativeImporter;
+
+public class GeneralCodeoutFactory implements CodeOutputPluginFactory {
+ String name;
+
+ String id;
+
+ NativeImporter importer;
+
+ String[] fileExtensionList;
+
+ IConfigurationElement el;
+
+ public GeneralCodeoutFactory(String id, String name,
+ IConfigurationElement el) {
+ this.id = id;
+ this.name = name;
+ this.el = el;
+ }
+
+ public void setFileExtensionList(String[] fileExtensionList) {
+ this.fileExtensionList = fileExtensionList;
+ }
+
+ public CodeOutputPlugin createCodeoutPlugin(IFramework fw) {
+ try {
+ CodeOutputPlugin o = (CodeOutputPlugin) el
+ .createExecutableExtension("class");
+ return o;
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public String getCodeOutName() {
+ return name;
+ }
+
+ public String getCodeOutId() {
+ return id;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralInterpreterFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralInterpreterFactory.java
new file mode 100644
index 0000000..e29b89e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralInterpreterFactory.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.viatra2.interpreters.ModelInterpreter;
+import org.eclipse.viatra2.interpreters.ModelInterpreterFactory;
+
+public class GeneralInterpreterFactory implements ModelInterpreterFactory {
+ IConfigurationElement className;
+
+ public GeneralInterpreterFactory(IConfigurationElement name2) {
+ className = name2;
+ }
+
+ public String getDescription() {
+ return className.getAttribute("description");
+ }
+
+ public String getId() {
+ return className.getAttribute("id");
+ }
+
+ public String getName() {
+ return className.getAttribute("name");
+ }
+
+ public ModelInterpreter getInterpreter() {
+ ModelInterpreter o = null;
+ try {
+ o = (ModelInterpreter) className.createExecutableExtension("class");
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return o;
+ }
+
+ public String[] getInterpretedClasses() {
+ String ret = className.getAttribute("interpretedClasses");
+ if (ret == null)
+ return null;
+ if (ret.length() > 0) {
+ StringTokenizer tok = new StringTokenizer(ret, ",");
+ String[] args = new String[tok.countTokens()];
+ for (int i = 0; i < args.length; ++i) {
+ args[i] = tok.nextToken();
+ }
+ return args;
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralLoaderFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralLoaderFactory.java
new file mode 100644
index 0000000..3cbba86
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralLoaderFactory.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.loaders.Loader;
+import org.eclipse.viatra2.loaders.LoaderFactory;
+
+public class GeneralLoaderFactory implements LoaderFactory {
+ String loaderName;
+
+ String id;
+
+ IConfigurationElement loader;
+
+ String[] fileExtensionList;
+
+ public GeneralLoaderFactory(String id, String name,
+ IConfigurationElement loader, String[] fileExtensionList) {
+ this.id = id;
+ loaderName = name;
+ this.loader = loader;
+ this.fileExtensionList = fileExtensionList;
+ }
+
+ public String getLoaderName() {
+ return loaderName;
+ }
+
+ public Loader getLoaderInstance() throws VPMRuntimeException {
+ try {
+ return (Loader) loader.createExecutableExtension("class");
+ } catch (CoreException e) {
+ throw new VPMRuntimeException("error instantiating loader class", e);
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String[] getFileExtensionList() {
+ return fileExtensionList;
+ }
+
+ public void setFileExtensionList(String[] fileExtensionList) {
+ this.fileExtensionList = fileExtensionList;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralNativeImporterFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralNativeImporterFactory.java
new file mode 100644
index 0000000..d72a7e5
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/GeneralNativeImporterFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.imports.NativeImporter;
+import org.eclipse.viatra2.imports.NativeImporterFactory;
+
+public class GeneralNativeImporterFactory implements NativeImporterFactory {
+ String importerName;
+
+ String id;
+
+ IConfigurationElement importer;
+
+ String[] fileExtensionList;
+
+ public GeneralNativeImporterFactory(String id, String name,
+ IConfigurationElement importer, String[] fileExtensionList) {
+ this.id = id;
+ importerName = name;
+ this.importer = importer;
+ this.fileExtensionList = fileExtensionList;
+ }
+
+ public String getImporterName() {
+ return importerName;
+ }
+
+ public NativeImporter getImporterInstance() throws VPMRuntimeException {
+ try {
+ return (NativeImporter) importer.createExecutableExtension("class");
+ } catch (CoreException e) {
+ throw new VPMRuntimeException("error instantiating importer class",
+ e);
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String[] getFileExtensionList() {
+ return fileExtensionList;
+ }
+
+ public void setFileExtensionList(String[] fileExtensionList) {
+ this.fileExtensionList = fileExtensionList;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/ViatraPlugin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/ViatraPlugin.java
new file mode 100644
index 0000000..79d1711
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/ViatraPlugin.java
@@ -0,0 +1,465 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.viatra2.codegen.CodeOutputPluginFactory;
+import org.eclipse.viatra2.framework.FrameworkManager;
+import org.eclipse.viatra2.framework.properties.IViatraPropertyProvider;
+import org.eclipse.viatra2.imports.NativeImporterFactory;
+import org.eclipse.viatra2.interpreters.ModelInterpreterFactory;
+import org.eclipse.viatra2.loaders.LoaderFactory;
+import org.eclipse.viatra2.logger.EclipseLogger;
+import org.eclipse.viatra2.logger.Logger;
+import org.eclipse.viatra2.logger.LoggerFactory;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class ViatraPlugin extends Plugin// Plugin
+{
+ // The shared instance.
+ private static ViatraPlugin plugin;
+
+ // Resource bundle.
+// private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+
+ public ViatraPlugin() {
+
+ super();
+
+ plugin = this;
+/* try {
+ resourceBundle = ResourceBundle
+ .getBundle("org.eclipse.viatra2.ViatraPluginResources");
+
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+
+ }
+ */
+ FrameworkManager.getInstance().setExtensionProvider(
+ new EclipseExtensionProvider());
+ }
+
+ /*
+ * public ViatraPlugin(IPluginDescriptor pdesc) {
+ *
+ * super(pdesc);
+ *
+ *
+ * plugin = this; try { resourceBundle =
+ * ResourceBundle.getBundle("org.eclipse.viatra2.ViatraPluginResources");
+ *
+ * } catch (MissingResourceException x) { resourceBundle = null;
+ *
+ * } }
+ */
+
+ static final String import_ext_id = "org.eclipse.viatra2.core2.modelimport";
+
+ static final String loader_ext_id = "org.eclipse.viatra2.core2.programloader";
+
+ static final String native_ext_id = "org.eclipse.viatra2.core2.nativefunction";
+
+ static final String codeout_ext_id = "org.eclipse.viatra2.core2.codeout";
+
+ static final String logger_ext_id = "org.eclipse.viatra2.core2.logger";
+
+ static final String interpreter_ext_id = "org.eclipse.viatra2.core2.interpreter";
+
+ static final String properties_ext_id = "org.eclipse.viatra2.core2.properties";
+
+ private List<IViatraPropertyProvider> initPropertyProviders() {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint poi = reg.getExtensionPoint(properties_ext_id);
+ ArrayList<IViatraPropertyProvider> r = new ArrayList<IViatraPropertyProvider>();
+ if (poi == null)
+ return r;
+ IExtension[] exts = poi.getExtensions();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ Object o = el[j].createExecutableExtension("class");
+ if (o instanceof IViatraPropertyProvider) {
+ r.add((IViatraPropertyProvider) o);
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ }
+
+ initPrefs(r);
+
+ return r;
+ }
+
+ List<IViatraPropertyProvider> propProviders;
+
+ public List<IViatraPropertyProvider> getPropertyProviders() {
+ if (propProviders == null)
+ propProviders = initPropertyProviders();
+ return propProviders;
+ }
+
+ /**
+ * Load default if not yet present.
+ */
+ private void initPrefs(List<IViatraPropertyProvider> providers) {
+// IPreferenceStore prefs = ViatraPlugin.getDefault().getPreferenceStore();
+ Preferences prefs = ViatraPlugin.getDefault().getPluginPreferences();
+ for (IViatraPropertyProvider p : providers) {
+ for (String prop_id : p.getAllPropertyIds()) {
+ if (!prefs.contains(p.getProviderID() + "::" + prop_id)) {
+ switch (p.getPropertyKind(prop_id)) {
+ case STRING:
+ prefs.setDefault(p.getProviderID() + "::" + prop_id, p
+ .getDefaultPropertyValue(prop_id));
+ break;
+ case INTEGER:
+ prefs.setDefault(p.getProviderID() + "::" + prop_id,
+ Integer.parseInt(p
+ .getDefaultPropertyValue(prop_id)));
+ break;
+ case BOOLEAN:
+ prefs.setDefault(p.getProviderID() + "::" + prop_id,
+ Boolean.parseBoolean(p
+ .getDefaultPropertyValue(prop_id)));
+ break;
+ case PATH:
+ prefs.setDefault(p.getProviderID() + "::" + prop_id, p
+ .getDefaultPropertyValue(prop_id));
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+ public List<ASMNativeFunction> initNativeFunctionPlugins() {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint poi = reg.getExtensionPoint(native_ext_id);
+ ArrayList<ASMNativeFunction> ret = new ArrayList<ASMNativeFunction>();
+ if (poi == null)
+ return ret;
+ IExtension[] exts = poi.getExtensions();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ Object o = el[j].createExecutableExtension("class");
+ if (o instanceof ASMNativeFunction) {
+ ret.add((ASMNativeFunction) o);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return ret;
+ }
+
+ public Vector<LoaderFactory> initLoaderPlugins() {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint poi = reg.getExtensionPoint(loader_ext_id);
+ Vector<LoaderFactory> v = new Vector<LoaderFactory>();
+ if (poi == null)
+ return v;
+ IExtension[] exts = poi.getExtensions();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ String name = el[j].getAttribute("name");
+ String id = el[j].getAttribute("id");
+ String fileExtensionList = el[j]
+ .getAttribute("fileExtensionList");
+ String[] list = new String[0];
+ try {
+ StringTokenizer tok = new StringTokenizer(
+ fileExtensionList, ",");
+ list = new String[tok.countTokens()];
+ for (int k = 0; k < list.length; ++k) {
+ list[k] = tok.nextToken();
+ }
+ } catch (Exception e) {
+
+ }
+ LoaderFactory fact = new GeneralLoaderFactory(id, name,
+ el[j], list);
+ v.add(fact);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO megjeleniteni valahogy
+ }
+ }
+ }
+ return v;
+ }
+
+ public Vector<NativeImporterFactory> initModelImportPlugins() {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint poi = reg.getExtensionPoint(import_ext_id);
+ Vector<NativeImporterFactory> v = new Vector<NativeImporterFactory>();
+ if (poi == null)
+ return v;
+ IExtension[] exts = poi.getExtensions();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ String name = el[j].getAttribute("name");
+ String id = el[j].getAttribute("id");
+ String fileExtensionList = el[j]
+ .getAttribute("fileExtensionList");
+ String[] list = new String[0];
+ try {
+ StringTokenizer tok = new StringTokenizer(
+ fileExtensionList, ",");
+ list = new String[tok.countTokens()];
+ for (int k = 0; k < list.length; ++k) {
+ list[k] = tok.nextToken();
+ }
+ } catch (Exception e) {
+
+ }
+ NativeImporterFactory fact = new GeneralNativeImporterFactory(
+ id, name, el[j], list);
+ v.add(fact);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO megjeleniteni valahogy
+ }
+ }
+ }
+ return v;
+ }
+
+ public Vector<CodeOutputPluginFactory> initCodeOutPlugins() {
+ // TODO
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+
+ IExtensionPoint poi = reg.getExtensionPoint(codeout_ext_id);
+
+ if (poi == null)
+ return new Vector<CodeOutputPluginFactory>();
+ IExtension[] exts = poi.getExtensions();
+
+ Vector<CodeOutputPluginFactory> v = new Vector<CodeOutputPluginFactory>();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ // CodeOutputPlugin o =
+ // (CodeOutputPlugin)el[j].createExecutableExtension
+ // ("class");
+ String id = el[j].getAttribute("id");
+ String name = el[j].getAttribute("name");
+ GeneralCodeoutFactory fact = new GeneralCodeoutFactory(id,
+ name, el[j]);
+ v.add(fact);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO megjeleniteni valahogy
+ }
+ }
+ }
+ return v;
+ }
+
+ public Vector<LoggerFactory> initLoggerPlugins() {
+ // TODO
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+
+ IExtensionPoint poi = reg.getExtensionPoint(logger_ext_id);
+
+ if (poi == null)
+ return new Vector<LoggerFactory>();
+ IExtension[] exts = poi.getExtensions();
+
+ Vector<LoggerFactory> v = new Vector<LoggerFactory>();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ LoggerFactory o = (LoggerFactory) el[j]
+ .createExecutableExtension("class");
+ v.add(o);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO megjeleniteni valahogy
+ }
+ }
+ }
+ return v;
+ }
+
+ public Vector<ModelInterpreterFactory> initInterpreterPlugins() {
+ // TODO
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+
+ IExtensionPoint poi = reg.getExtensionPoint(interpreter_ext_id);
+
+ if (poi == null)
+ return new Vector<ModelInterpreterFactory>();
+ IExtension[] exts = poi.getExtensions();
+
+ Vector<ModelInterpreterFactory> v = new Vector<ModelInterpreterFactory>();
+ for (int i = 0; i < exts.length; i++) {
+ IConfigurationElement[] el = exts[i].getConfigurationElements();
+ for (int j = 0; j < el.length; j++) {
+ try {
+ // (ModelInterpreterFactory)el[j].createExecutableExtension(
+ // "class")
+ ModelInterpreterFactory o = new GeneralInterpreterFactory(
+ el[j]);
+ v.add(o);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO megjeleniteni valahogy
+ }
+ }
+ }
+ return v;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+
+ public ILog log;
+
+ List<NativeImporterFactory> nativeImporterPlugins;
+
+ List<LoaderFactory> loaderPlugins;
+
+// List<ASMNativeFunction> nativeFunctions;
+
+ private BundleContext context;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ this.context = context;
+ log = Platform.getLog(context.getBundle());
+ try {
+ // FrameWorkManager fw = FrameWorkManager.getInstance();
+ nativeImporterPlugins = initModelImportPlugins();
+ loaderPlugins = initLoaderPlugins();
+// nativeFunctions = initNativeFunctionPlugins();
+ } catch (Exception e) {
+ logError("error : " + e.getLocalizedMessage());
+ }
+ }
+
+ public NativeImporterFactory[] getImporterPlugins() {
+ return nativeImporterPlugins.toArray(new NativeImporterFactory[0]);
+ }
+
+ public LoaderFactory[] getLoaderPlugins() {
+ return loaderPlugins.toArray(new LoaderFactory[0]);
+ }
+
+ public void logError(String s) {
+ Status st = new Status(Status.ERROR, "ViatraCore", 1, s, null);
+ log.log(st);
+ }
+
+ public void logInfo(String s) {
+ Status st = new Status(Status.INFO, "ViatraCore", 1, s, null);
+ log.log(st);
+
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static ViatraPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ /*
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = ViatraPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+*/
+ /**
+ * Returns the plugin's resource bundle,
+ */
+// public ResourceBundle getResourceBundle() {
+// return resourceBundle;
+// }
+
+ public Logger getEclipseLogger() {
+ ILog elog = ViatraPlugin.getDefault().log;
+ Logger eclLogger = new EclipseLogger(elog);
+ eclLogger.init(null);
+ // XXX Eclipse logger is inited with null properties
+ return eclLogger;
+ }
+
+ /*
+ * public InputStream getPropertyStream () throws IOException { return
+ * openStream(new Path("vpm.properties")); }
+ */
+ /*
+ public List<ASMNativeFunction> getNativeFunctions() {
+ // null would be returned if VIATRA is running in a console
+ // environment... Andras Balogh
+ if (nativeFunctions == null)
+ nativeFunctions = new ArrayList<ASMNativeFunction>();
+ return nativeFunctions;
+ }
+*/
+ public BundleContext getContext() {
+ return context;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferPrint.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferPrint.java
new file mode 100644
index 0000000..82c2934
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferPrint.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+import java.io.StringWriter;
+
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+
+public class BufferPrint implements ASMNativeFunction {
+
+ public Object evaluate(IModelSpace msp, Object[] params)
+ throws VPMRuntimeException {
+ if (params[0] instanceof StringWriter) {
+ StringWriter out = (StringWriter) params[0];
+ int ctr = 0;
+ for (int i = 1; i < params.length; i++) {
+ String s = params[i].toString();
+ out.write(s);
+ ctr += s.length();
+ }
+ return ctr;
+ } else
+ return 0;
+ }
+
+ public String getDescription() {
+ return "Prints output to the given buffer.";
+ }
+
+ public String getID() {
+ return "bufferPrint";
+ }
+
+ public String getName() {
+ return "bufferPrint";
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferStore.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferStore.java
new file mode 100644
index 0000000..d71f74b
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/BufferStore.java
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringBufferInputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.viatra2.core.IModelSpace;
+
+/**
+ * Buffer store singleton to manage output buffers for VIATRA2.
+ * @author Istvan Rath
+ *
+ */
+public class BufferStore {
+
+ private static BufferStore _instance = new BufferStore();
+
+ private HashMap<IModelSpace, HashMap<String, StringWriter>> core_buffers = new HashMap<IModelSpace, HashMap<String, StringWriter>>();
+
+ private HashMap<IModelSpace, HashMap<String, FileWriter>> file_buffers = new HashMap<IModelSpace, HashMap<String, FileWriter>>();
+
+ public static synchronized void removeBuffer(IModelSpace m, String pURI) {
+ String key = pURI;
+ HashMap<String, StringWriter> target = _instance.core_buffers.get(m);
+ if (target != null) {
+ target.remove(key);
+ }
+ HashMap<String, FileWriter> _target = _instance.file_buffers.get(m);
+ if (_target != null) {
+ _target.remove(key);
+ }
+ }
+
+ public static synchronized void removeFileBuffers(IModelSpace m) {
+ _instance.file_buffers.remove(m);
+ // refresh workspace
+ try {
+ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(
+ IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ m.getFramework().getLogger().fatal(e.getMessage());
+ }
+ }
+
+ /**
+ * Clear operation is only supported for "core://" buffers.
+ * @param m
+ * @param pURI
+ * @throws URISyntaxException
+ */
+ public static synchronized void clearBuffer(IModelSpace m, String pURI) throws URISyntaxException
+ {
+ // parse URI
+ URI uri = new URI(pURI);
+ String key = pURI;
+ if ("core".equals(uri.getScheme())) {
+ // write to in-memory buffer
+ HashMap<String, StringWriter> target = _instance.core_buffers
+ .get(m);
+ if (target == null) {
+ target = new HashMap<String, StringWriter>();
+ _instance.core_buffers.put(m, target);
+ }
+ StringWriter ret = target.get(key);
+ if (ret == null) {
+ // designated buffer does not exist
+ // do nothing
+ }
+ else
+ {
+ ret.getBuffer().delete(0, ret.getBuffer().length());
+ //ret = new StringWriter(); // this causes a problem if there
+ // is a state reference at VTCL level (see #186)
+
+ //target.put(key, ret);
+ }
+ } else if ("file".equals(uri.getScheme()))
+ {
+ HashMap<String, FileWriter> target = _instance.file_buffers.get(m);
+ if (target==null) {
+ target = new HashMap<String, FileWriter>();
+ _instance.file_buffers.put(m, target);
+ }
+ FileWriter ret = target.get(key);
+ if (ret == null)
+ {
+ // do nothing
+ }
+ else {
+ String path = uri.getAuthority() + uri.getPath();
+ IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ new Path(path));
+ if (ifile.exists())
+ {
+ // only do something if the file exists
+ try {
+
+ ifile.setContents(new StringBufferInputStream(""), true, false, null);
+ //ifile.delete(true, null);
+ //ifile.create(new StringBufferInputStream(""), true, null);
+ /*
+ FileWriter fw = new FileWriter(
+ new File(ifile.getLocation().toOSString()), false);
+ fw.write("");
+ fw.flush();
+ fw.close();
+ */
+ }
+ catch (Exception e) {
+ m.getFramework().getLogger().error("Error encountered while attempting to clear file buffer: "+e.getMessage());
+ m.getFramework().getLogger().printStackTrace(e);
+ }
+ }
+ }
+ } else if("os".equals(uri.getScheme())) {
+ HashMap<String, FileWriter> target = _instance.file_buffers.get(m);
+ if (target==null) {
+ target = new HashMap<String, FileWriter>();
+ _instance.file_buffers.put(m, target);
+ }
+ FileWriter ret = target.get(key);
+ if (ret == null)
+ {
+ // do nothing
+ }
+ else {
+ String path = uri.getAuthority() + uri.getPath();
+ File f = new File(path);
+ if(f.exists()) {
+ FileWriter fw;
+ try {
+ fw = new FileWriter(f, false);
+ fw.write("");
+ fw.flush();
+ fw.close();
+ } catch (Exception e) {
+ m.getFramework().getLogger().error("Error encountered while attempting to clear os buffer: "+e.getMessage());
+ m.getFramework().getLogger().printStackTrace(e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Retrieves a reference to a <code>java.io.Writer</code> which can be used as a VIATRA2
+ * output buffer.
+ * @param m
+ * @param pURI
+ * @return
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ public static synchronized Writer getBuffer(IModelSpace m, String pURI, boolean append)
+ throws URISyntaxException, IOException {
+ // parse URI
+ URI uri = new URI(pURI);
+ String key = pURI;
+ if ("core".equals(uri.getScheme())) {
+ // write to in-memory buffer
+ HashMap<String, StringWriter> target = _instance.core_buffers
+ .get(m);
+ if (target == null) {
+ target = new HashMap<String, StringWriter>();
+ _instance.core_buffers.put(m, target);
+ }
+ StringWriter ret = target.get(key);
+ if (ret == null) {
+ ret = new StringWriter();
+ target.put(key, ret);
+ notifyAdded(key);
+ }
+ return ret;
+ } else if ("file".equals(uri.getScheme())) {
+ // write to workspace-relative file
+ String path = uri.getAuthority() + uri.getPath();
+ // check whether the path exists
+ // if not, create projects
+ // ResourcesPlugin.getWorkspace().newProjectDescription("teszt");
+
+ HashMap<String, FileWriter> target = _instance.file_buffers.get(m);
+ if (target == null) {
+ target = new HashMap<String, FileWriter>();
+ _instance.file_buffers.put(m, target);
+ }
+ FileWriter ret = target.get(key);
+ if (ret == null) {
+ IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ new Path(path));
+ IProject p = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(uri.getAuthority());
+ IProgressMonitor mon = new NullProgressMonitor();
+ try {
+ if (!p.exists()) {
+ p.create(mon);
+ }
+ p.open(mon);
+ } catch (CoreException cex) {
+ throw new IOException(
+ "Target project cannot be created/opened");
+ }
+
+ // make sure project-relative path exists
+ try {
+ String[] segments = uri.getPath().split("/");
+ if (segments.length > 2) // first segment is always "" due
+ // to path beginning with '/'
+ {
+ // there is at least one directory below the project
+ // root
+ IFolder curr = null;
+ for (int i = 1; i < segments.length - 1; i++) // last
+ // segment
+ // will
+ // always
+ // be
+ // the
+ // file
+ // name
+ {
+ if (curr == null)
+ curr = p.getFolder(segments[i]);
+ else
+ curr = curr.getFolder(segments[i]);
+ if (!curr.exists())
+ curr.create(true, true, mon);
+ }
+ }
+ } catch (CoreException cex) {
+ throw new IOException(
+ "Target folder structure cannot be created");
+ }
+ // open writer to the file
+ ret = new FileWriter(
+ new File(ifile.getLocation().toOSString()), append);
+ target.put(key, ret);
+ // notifyAdded(key);
+ }
+ return ret;
+ } else if("os".equals(uri.getScheme())) {
+ // write to workspace-relative file
+ String path = uri.getAuthority() + uri.getPath();
+ // check whether the path exists
+ // if not, create projects
+ // ResourcesPlugin.getWorkspace().newProjectDescription("teszt");
+
+ HashMap<String, FileWriter> target = _instance.file_buffers.get(m);
+ if (target == null) {
+ target = new HashMap<String, FileWriter>();
+ _instance.file_buffers.put(m, target);
+ }
+ FileWriter ret = target.get(key);
+ if (ret == null) {
+ // absolute path should be correct...
+ File f = new File(path);
+ if(!f.exists()) {
+ String par = f.getParent();
+ File parf = new File(par);
+ if(!parf.exists()) {
+ parf.mkdirs();
+ }
+ f.createNewFile();
+ }
+ ret = new FileWriter(f, append);
+ target.put(key, ret);
+ }
+ return ret;
+ }
+ return null;
+ }
+
+
+ public static synchronized Writer getBuffer(IModelSpace m, String pURI) throws URISyntaxException, IOException
+ {
+ return getBuffer(m, pURI, true);
+ }
+
+ public static synchronized Set<Map.Entry<String, StringWriter>> getAllCoreBuffers(
+ IModelSpace m) {
+ if (_instance.core_buffers.get(m) != null)
+ return _instance.core_buffers.get(m).entrySet();
+ else
+ return null;
+ }
+
+ public static synchronized Set<Map.Entry<String, FileWriter>> getAllFileBuffers(
+ IModelSpace m) {
+ if (_instance.file_buffers.get(m) != null)
+ return _instance.file_buffers.get(m).entrySet();
+ else
+ return null;
+ }
+
+ private List<IBufferStoreListener> listeners = new ArrayList<IBufferStoreListener>();
+
+ public synchronized static void addListener(IBufferStoreListener l) {
+ _instance.listeners.add(l);
+ }
+
+ public synchronized static void removeListener(IBufferStoreListener l) {
+ _instance.listeners.remove(l);
+ }
+
+ private static void notifyAdded(String key) {
+ for (IBufferStoreListener l : _instance.listeners)
+ l.bufferAdded(key);
+ }
+
+ private static void notifyRemoved(String key) {
+ for (IBufferStoreListener l : _instance.listeners)
+ l.bufferRemoved(key);
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/ClearBuffer.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/ClearBuffer.java
new file mode 100644
index 0000000..b4f7514
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/ClearBuffer.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+import java.net.URISyntaxException;
+
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+import org.eclipse.viatra2.natives.NativeFunctionParameter;
+import org.eclipse.viatra2.natives.VIATRANativeFunction;
+
+@VIATRANativeFunction(name = "clearBuffer", remark = "Clears an output buffer.",
+ returns = { NativeFunctionParameter.ParameterType.BOOLEAN },
+ params = { @NativeFunctionParameter(
+ description = "Uniquely identifies an output buffer.Currently supported schemes are: core://<<id>>, file://<<workspace-relative path>>, os://<<absolute path>>.",
+ name = "bufferURI",
+ type = { NativeFunctionParameter.ParameterType.STRING }) })
+public class ClearBuffer implements ASMNativeFunction {
+
+ public Object evaluate(IModelSpace msp, Object[] params)
+ throws VPMRuntimeException {
+ try {
+ BufferStore.clearBuffer(msp, params[0].toString());
+ return Boolean.TRUE;
+ } catch (URISyntaxException e) {
+ throw new VPMRuntimeException("Invalid URI syntax", e);
+ }
+ }
+
+ public String getDescription() {
+ return "Clears a core:// output buffer";
+ }
+
+ public String getID() {
+ return this.getClass().getCanonicalName();
+ }
+
+ public String getName() {
+ return "clearBuffer"; // VTCL
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/FlushBuffer.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/FlushBuffer.java
new file mode 100644
index 0000000..0f59668
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/FlushBuffer.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URISyntaxException;
+
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+import org.eclipse.viatra2.natives.NativeFunctionParameter;
+import org.eclipse.viatra2.natives.VIATRANativeFunction;
+
+@VIATRANativeFunction(name = "flushBuffer", remark = "Flushes an output buffer.",
+ returns = { NativeFunctionParameter.ParameterType.BOOLEAN },
+ params = { @NativeFunctionParameter(
+ description = "Uniquely identifies an output buffer.",
+ name = "bufferURI",
+ type = { NativeFunctionParameter.ParameterType.STRING }) })
+public class FlushBuffer implements ASMNativeFunction {
+
+ public Object evaluate(IModelSpace msp, Object[] params)
+ throws VPMRuntimeException {
+ try {
+ Writer w = BufferStore.getBuffer(msp, params[0].toString());
+ w.flush();
+ return Boolean.TRUE;
+ } catch (URISyntaxException e) {
+ throw new VPMRuntimeException("Invalid URI syntax", e);
+ } catch (IOException e) {
+ throw new VPMRuntimeException("Error while flushing buffer", e);
+ }
+ }
+
+ public String getDescription() {
+ return "Flushes an output buffer";
+ }
+
+ public String getID() {
+ return this.getClass().getCanonicalName();
+ }
+
+ public String getName() {
+ return "flushBuffer"; // VTCL
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/GetBuffer.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/GetBuffer.java
new file mode 100644
index 0000000..3d56ae8
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/GetBuffer.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.natives.ASMNativeFunction;
+import org.eclipse.viatra2.natives.NativeFunctionParameter;
+import org.eclipse.viatra2.natives.VIATRANativeFunction;
+
+@VIATRANativeFunction(name = "getBuffer",
+ remark = "If the buffer does not exist yet, it will be created. Existing files will be appended to.",
+ returns = { NativeFunctionParameter.ParameterType.NATIVE },
+ params = {
+ @NativeFunctionParameter(
+ description = "Uniquely identifies an output buffer. Currently supported schemes are: core://<<id>>, file://<<workspace-relative path>>, os://<<absolute path>>.",
+ name = "bufferURI", type = { NativeFunctionParameter.ParameterType.STRING}
+ ),
+ @NativeFunctionParameter(
+ description = "OPTIONALLY indicates whether a file:// or os:// buffer should be created by truncating the original file or append to",
+ name = "append", type = {NativeFunctionParameter.ParameterType.BOOLEAN}
+ )
+ }
+)
+public class GetBuffer implements ASMNativeFunction {
+
+ public Object evaluate(IModelSpace msp, Object[] params)
+ throws VPMRuntimeException {
+ try {
+ if (params.length>1 && params[1] instanceof Boolean)
+ {
+ return BufferStore.getBuffer(msp, params[0].toString(), (Boolean)params[1]);
+ }
+ else if (params.length==1) {
+ return BufferStore.getBuffer(msp, params[0].toString());
+ }
+ } catch (URISyntaxException e) {
+ throw new VPMRuntimeException("Invalid URI syntax", e);
+ } catch (IOException e) {
+ throw new VPMRuntimeException("I/O error", e);
+ }
+ return null;
+ }
+
+ public String getDescription() {
+ return "Creates/retrieves a new output buffer";
+ }
+
+ public String getID() {
+ return this.getClass().getCanonicalName();
+ }
+
+ public String getName() {
+ return "getBuffer"; // VTCL
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/IBufferStoreListener.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/IBufferStoreListener.java
new file mode 100644
index 0000000..09831e2
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/buffers/IBufferStoreListener.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.buffers;
+
+public interface IBufferStoreListener {
+
+ public void bufferAdded(String newKey);
+
+ public void bufferRemoved(String removedKey);
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPlugin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPlugin.java
new file mode 100644
index 0000000..1f1b918
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPlugin.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.codegen;
+
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.framework.IFramework;
+
+/**
+ * This is the interface of code output. Code generator GTASM programs write
+ * code on the code output (this is the standard output of GTASM programs). All
+ * strings are written on the code output as an atomic step. In other words the
+ * code output is not buffered, so code output can be controlled for example by
+ * prefixes.
+ *
+ * @author Andras Balogh, istvan
+ *
+ * Modified by Istvan Rath on 2008.07.30: - init(l,p) -> init(fw)
+ *
+ */
+public interface CodeOutputPlugin {
+
+ /**
+ * Initializes the code output formatter.
+ *
+ * @param l
+ * - System logger
+ * @param p
+ * - VPMProperties supplied by the user
+ */
+
+ public void init(IFramework fw);
+
+ /**
+ * The plugin starts the work (opens files, etc.) This method is called by
+ * the Viatra framework, if the code generation begins.
+ */
+ public void beginWork();
+
+ /**
+ * The plugin finishes the work (closes files, etc.) This method is called by
+ * the Viatra framework if the code generation is finished. (eg. after an
+ * ASM stops)
+ *
+ */
+ public void endWork();
+
+ /**
+ * Prints out the code supplied in the parameter according to the settings
+ * of the plugin.
+ *
+ * @param s
+ * The code to be written out.
+ */
+ public void codeOut(String s) throws VPMRuntimeException;
+ /**
+ * Prints out the code supplied in the parameter according to the settings
+ * of the plugin and the mode string given.
+ *
+ * @param s
+ * The code to be written out.
+ */
+ // public void codeOut(String uri,String s, String mode);
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPluginFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPluginFactory.java
new file mode 100644
index 0000000..00594a6
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/CodeOutputPluginFactory.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.codegen;
+
+import org.eclipse.viatra2.framework.IFramework;
+
+/**
+ * Factory interface to instantiate code output plugins.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public interface CodeOutputPluginFactory {
+ /**
+ * Instantiate a code output plugin
+ *
+ * @param fw
+ * @return
+ */
+ CodeOutputPlugin createCodeoutPlugin(IFramework fw);
+
+ /**
+ * Name of the code output plugin type
+ *
+ * @return name of the code output plugin type
+ */
+ String getCodeOutName();
+
+ /**
+ * ID of the code output plugin type.
+ *
+ * @return ID of the code output plugin type
+ */
+ String getCodeOutId();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/FileCodeFormatter.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/FileCodeFormatter.java
new file mode 100644
index 0000000..3118bbd
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/codegen/FileCodeFormatter.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.codegen;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+
+import org.eclipse.viatra2.framework.IFramework;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * @author Andras Balogh
+ *
+ */
+public class FileCodeFormatter implements CodeOutputPlugin {
+
+ Logger log;
+
+ PrintStream codeout = System.out;
+
+ boolean inFile = false;
+
+ public void init(IFramework fw) {
+
+ log = fw.getLogger();
+ log.debug("File-based code formatter loaded.");
+ String s = fw.getProperties().getRuntimeProperty("codeout",
+ "file.autolinefeed");
+ if (s != null) {
+ printLN = s.toLowerCase().equals("yes");
+ }
+
+ }
+
+ boolean printLN = true;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.viatra2.codegen.CodeOutputPlugin#beginWork()
+ */
+ public void beginWork() {
+ // TODO Auto-generated method stub
+ inFile = false;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.viatra2.codegen.CodeOutputPlugin#endWork()
+ */
+ public void endWork() {
+ if (inFile) {
+ codeout.flush();
+ codeout.close();
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.viatra2.codegen.CodeOutputPlugin#codeOut(java.lang.String)
+ */
+ public void codeOut(String s) {
+ // TODO Auto-generated method stub
+ if (inFile) {
+ if (s.startsWith("//!!ENDFILE")) {
+ inFile = false;
+ codeout.close();
+
+ } else {
+ if (printLN)
+ codeout.println(s);
+ else
+ codeout.print(s.replaceAll("\\\\n", "\n"));
+ }
+ } else {
+ if (s.startsWith("//!!FILE=")) {
+ String s2 = s.substring(9);
+ try {
+ codeout = new PrintStream(new FileOutputStream(s2, false),
+ true);
+ inFile = true;
+ } catch (Exception e) {
+ log.error("File " + s2
+ + " cannot be created for code output. Reason: "
+ + e.getMessage());
+ }
+ }
+ }
+
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopy.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopy.java
new file mode 100644
index 0000000..48a2f4f
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopy.java
@@ -0,0 +1,321 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.copier;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelManager;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.errors.VPMCoreException;
+
+/**
+ *
+ * @author Andras Schmidt; modified by Istvan Rath
+ *
+ */
+public class ModelCopy {
+ Map<IModelElement, IModelElement> remap;
+
+ Set<IModelElement> toCopy;
+
+ TreeMap<IModelElement, IModelElement> src2tg = new TreeMap<IModelElement, IModelElement>();
+
+ IModelSpace targetModel;
+
+ IModelSpace sourceModel;
+
+ IModelManager tModelManager;
+
+ /**
+ * Copy elements from one model into another model. Elements to be copied
+ * are given as a set of elements. The new place of the elements to be
+ * copied is given by a map. For example a branch copy has the following
+ * parameters: toCopy: all elements below the root remap: parent of root's
+ * fully qualified name -> new parent of root's fully qualified name
+ *
+ * @param sourceModel
+ * the model to copy elements from
+ * @param targetModel
+ * the model to copy elements to
+ * @param toCopy
+ * elements to be copied
+ * @param remap
+ * fqn mapping from old model's fqn to new model's fqn
+ * @throws VPMCoreException
+ * @throws ModelCopyException
+ */
+ public static void copyModel(IModelSpace sourceModel,
+ IModelSpace targetModel, Set<IModelElement> toCopy,
+ Map<IModelElement, IModelElement> remap) throws VPMCoreException,
+ ModelCopyException {
+ ModelCopy mc = new ModelCopy();
+ mc._copyModel(sourceModel, targetModel, toCopy, remap);
+ }
+
+ /**
+ * Copy a part of a model into another model.
+ *
+ * @param sourceModel
+ * the source model
+ * @param targetModel
+ * the target model
+ * @param root
+ * the root of the model part to be copied
+ * @param destinationContainer
+ * the container of the copied model in the destination model
+ * @param doOutEdges
+ * true: copy edges going out of the copied part of model
+ * @return returns the root modelement of the copied model part
+ * @throws VPMCoreException
+ * @throws ModelCopyException
+ */
+ public static IModelElement copyModel(IModelSpace sourceModel,
+ IModelSpace targetModel, IModelElement root,
+ IModelElement destinationContainer, boolean doOutEdges)
+ throws VPMCoreException, ModelCopyException {
+ TreeSet<IModelElement> elementsToCopy = new TreeSet<IModelElement>();
+ addModelElementAndChildren(root, root, elementsToCopy, doOutEdges);
+ TreeMap<IModelElement, IModelElement> remap = new TreeMap<IModelElement, IModelElement>();
+ remap.put(root.getNamespace(), destinationContainer);
+ ModelCopy mc = new ModelCopy();
+ mc._copyModel(sourceModel, targetModel, elementsToCopy, remap);
+ IModelElement ret = mc.src2tg.get(root);
+ return ret;
+ }
+
+ public static IModelElement copyModels(Set<IModelElement> elementsToCopy,
+ IModelSpace sourceModel, IModelSpace targetModel,
+ IModelElement root, IModelElement destinationContainer,
+ boolean doOutEdges) throws VPMCoreException, ModelCopyException {
+ TreeSet<IModelElement> _elementsToCopy = new TreeSet<IModelElement>();
+ TreeMap<IModelElement, IModelElement> remap = new TreeMap<IModelElement, IModelElement>();
+ for (IModelElement e : elementsToCopy) {
+ addModelElementAndChildren(e, e, _elementsToCopy, doOutEdges);
+ remap.put(e.getNamespace(), destinationContainer); // FIXME this may
+ // be dangerous!
+ }
+ remap.put(root.getNamespace(), destinationContainer);
+ ModelCopy mc = new ModelCopy();
+ mc._copyModel(sourceModel, targetModel, _elementsToCopy, remap);
+ IModelElement ret = mc.src2tg.get(root);
+ return ret;
+ }
+
+ private static void addModelElementAndChildren(IModelElement root,
+ IModelElement me, TreeSet<IModelElement> elementsToCopy,
+ boolean copyOutEdges) {
+ // if(me.equals(root)||me.isBelowNamespace(root))
+ elementsToCopy.add(me);
+ for (IModelElement _me : me.getElementsInNamespace()) {
+ if (!copyOutEdges) {
+ if (_me instanceof IRelation) {
+ IRelation rel = (IRelation) _me;
+ IModelElement to = rel.getTo();
+ if (!(to.equals(root) || to.isBelowNamespace(root))) {
+ continue;
+ }
+ }
+ }
+ addModelElementAndChildren(root, _me, elementsToCopy, copyOutEdges);
+ }
+ if (copyOutEdges) {
+ // TODO do we need to copy the incoming edges as well?
+ for (IModelElement _me : me.getRelationsTo()) {
+ elementsToCopy.add(_me);
+ }
+ }
+ }
+
+ private void _copyModel(IModelSpace sourceModel, IModelSpace targetModel,
+ Set<IModelElement> toCopy, Map<IModelElement, IModelElement> remap)
+ throws VPMCoreException, ModelCopyException {
+ this.remap = remap;
+ this.toCopy = toCopy;
+ this.targetModel = targetModel;
+ this.sourceModel = sourceModel;
+ tModelManager = targetModel.getModelManager();
+ Set<IModelElement> roots = findRoots(toCopy);
+ for (IModelElement root : roots) {
+ createBranch(root);
+ }
+ setTargets();
+ setTypes();
+ }
+
+ private void setTargets() throws VPMCoreException, ModelCopyException {
+ for (IModelElement me : toCopy) {
+ if (!(me instanceof IRelation)) {
+ continue;
+ }
+ IRelation rel = (IRelation) me;
+ IModelElement tg = targetOf(me);
+ if (tg == null) {
+ continue;
+ }
+ if (!(tg instanceof IRelation)) {
+ addError(
+ "copy model internal error: target of a relation is not relaiton",
+ me);
+ continue;
+ }
+ IRelation tgRel = (IRelation) tg;
+ IModelElement to = rel.getTo();
+ IModelElement tgTo = targetOf(to);
+ if (tgTo == null) {
+ addError("target of relation has no map in target model", rel,
+ to);
+ continue;
+ }
+ tModelManager.setRelationTo(tgRel, tgTo);
+ IRelation inverse = rel.getInverse();
+ if (inverse != null) {
+ IModelElement tgInverse = targetOf(inverse);
+ if (tgInverse != null && tgInverse instanceof IRelation) {
+ IRelation rTgInverse = (IRelation) tgInverse;
+ tModelManager.setRelationInverse(tgRel, rTgInverse);
+ } else {
+ addError("Inverse of relation is not mapped to a relation",
+ rel, inverse);
+ }
+ }
+ }
+
+ }
+
+ private void setTypes() throws VPMCoreException, ModelCopyException {
+ for (IModelElement me : toCopy) {
+ IModelElement tg = targetOf(me);
+ if (tg == null) {
+ continue;
+ }
+ Collection<IModelElement> types = me.getTypes();
+ for (IModelElement type : types) {
+ IModelElement tgType = targetOf(type);
+ if (tgType != null) {
+ tModelManager.newInstanceOf(tgType, tg);
+ } else {
+ addError(
+ "Element in target model does not exist, when creating type",
+ tg, type);
+ }
+ }
+ types = me.getSupertypes();
+ for (IModelElement type : types) {
+ IModelElement tgType = targetOf(type);
+ if (tgType != null) {
+ tModelManager.newSupertypeOf(tgType, tg);
+ } else {
+ addError(
+ "Element in target model does not exist, when creating supertype",
+ tg, type);
+ }
+ }
+ }
+ }
+
+ private void createBranch(IModelElement me) throws VPMCoreException,
+ ModelCopyException {
+ if (!toCopy.contains(me))
+ return;
+ IModelElement newMe = null;
+ if (me instanceof IEntity) {
+ IEntity ent = (IEntity) me;
+ IEntity par = ent.getParent();
+ IModelElement newPar = targetOf(par);
+ if (newPar != null && newPar instanceof IEntity) {
+ IEntity eNewPar = (IEntity) newPar;
+ newMe = tModelManager.newEntity(ent.getName(), ent.getValue(),
+ eNewPar);
+ } else {
+ addError(
+ "Parent of copy root entity is not found in target model",
+ ent);
+ }
+ } else {
+ IRelation rel = (IRelation) me;
+ IModelElement par = rel.getFrom();
+ IModelElement newPar = targetOf(par);
+ if (newPar != null) {
+ newMe = tModelManager.newRelation(rel.getName(), newPar,
+ newPar, rel.getMultiplicity(), rel.getIsAggregation(),
+ null);
+ } else {
+ addError(
+ "Source of copy root relation is not found in target model",
+ rel);
+ }
+ }
+ if (newMe == null)
+ return;
+ addMapping(me, newMe);
+ tModelManager.setViewInfo(newMe, me.getViewInfo());
+ tModelManager.setIsFinalType(newMe, me.getIsFinalType());
+ Collection<IModelElement> children = me.getElementsInNamespace();
+ for (IModelElement child : children) {
+ createBranch(child);
+ }
+ }
+
+ private void addError(String msg, IModelElement cause, IModelElement cause2)
+ throws ModelCopyException {
+ System.out.println(msg + " " + cause.toString() + " "
+ + cause2.toString());
+ // TODO
+ }
+
+ private void addError(String msg, IModelElement cause)
+ throws ModelCopyException {
+ System.out.println(msg + " " + cause.toString());
+ // TODO
+ }
+
+ private void addMapping(IModelElement source, IModelElement target) {
+ src2tg.put(source, target);
+ }
+
+ private IModelElement targetOf(IModelElement source) {
+ if (remap.containsKey(source)) {
+ return remap.get(source);
+ }
+ IModelElement tg = src2tg.get(source);
+ if (tg != null)
+ return tg;
+ if (targetModel.equals(sourceModel)) {
+ return source;
+ }
+ tg = targetModel.getModelManager().getElementByName(
+ source.getFullyQualifiedName());
+ if (tg != null)
+ return tg;
+ return null;
+ }
+
+ private Set<IModelElement> findRoots(Set<IModelElement> toCopy) {
+ TreeSet<IModelElement> ret = new TreeSet<IModelElement>();
+ for (IModelElement me : toCopy) {
+ IModelElement namespace = me.getNamespace();
+ if (namespace == null)
+ ret.add(me);
+ else if (!toCopy.contains(namespace)) {
+ ret.add(me);
+ }
+ }
+ return ret;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopyException.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopyException.java
new file mode 100644
index 0000000..4aea6c4
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/copier/ModelCopyException.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.copier;
+
+/**
+ * Extention thrown by model copy.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class ModelCopyException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EDeleteSemantics.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EDeleteSemantics.java
new file mode 100644
index 0000000..91acca2
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EDeleteSemantics.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+/**
+ * Semantics of model element deletion.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public enum EDeleteSemantics {
+ /**
+ * Delete semantics. Means that the element will be deleted with: - all type
+ * relations - all realations - all functions - all contained entities will
+ * be moved to the root entiy
+ */
+ DELETE_SEMANTICS_FORCE,
+ /**
+ * Delete semantics. Means that the element will be deleted with: - all type
+ * relations - all realations - all functions - all elements in namespace
+ * will also be deleted recursively
+ */
+ DELETE_SEMANTICS_BRANCH_FORCE
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EModelElementProperty.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EModelElementProperty.java
new file mode 100644
index 0000000..9d4277f
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EModelElementProperty.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+public enum EModelElementProperty {
+ Name, Value
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EMultiplicityKind.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EMultiplicityKind.java
new file mode 100644
index 0000000..805f7e9
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/EMultiplicityKind.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+/**
+ * An enumeration describing the multiplicty attributes of an IRelation.
+ *
+ * @author Istvan Rath Note: DO NOT, repeat, DO NOT change the order of enumeration
+ * constants in this file.
+ */
+public enum EMultiplicityKind {
+
+ MANY_TO_MANY, MANY_TO_ONE, ONE_TO_MANY, ONE_TO_ONE
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ICoreNotificationListener.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ICoreNotificationListener.java
new file mode 100644
index 0000000..5b26252
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ICoreNotificationListener.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+
+/**
+ * This interface defines the notification delivery mechanism
+ *
+ * @author Andras Balogh
+ *
+ */
+public interface ICoreNotificationListener {
+ /**
+ * Listener category that listens all notifications in order to make it
+ * possible to undo them.
+ */
+ public static int UNDO_LISTENER = 0;
+
+ /**
+ * This method is called if a new notification event is generated in a model
+ * element associated with the current listener.
+ *
+ * @param notification
+ * this object stores the type and parameters of the notification
+ */
+ public void actionPerformed(ICoreNotificationObject notification);
+
+ /**
+ * Returns the category of this listener.
+ *
+ * @return category
+ */
+ public int getListenerCategory();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IEntity.java
new file mode 100644
index 0000000..00018a0
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IEntity.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.Collection;
+
+/**
+ * Interface for representing VPM entities
+ *
+ * @author Andras Balogh
+ *
+ */
+public interface IEntity extends IModelElement {
+
+ /**
+ * Gets the entitys value
+ *
+ * @return the value
+ */
+ public String getValue();
+
+ /**
+ * Retrives a model element that is contained by this entity and has a given
+ * name
+ *
+ * @param n
+ * name of element to return
+ * @return element ref, or null if not found
+ */
+ public IModelElement getContentByName(String n);
+
+ /**
+ * Retrives a model element that is contained by this entity and has a given
+ * type
+ *
+ * @param n
+ * type of element to return
+ * @return element ref, or null if not found
+ */
+ public IModelElement getContentByType(IModelElement n);
+
+ /**
+ * Returns nested elements of the Entity
+ *
+ * @return Set of contained elements.
+ */
+ public Collection<IModelElement> getContents();
+
+ /**
+ * Gets the parent entity of modelelement will return null for root entity.
+ *
+ * @return set
+ */
+ public IEntity getParent();
+
+ /**
+ * Checks wether the entity is fully isolated eg. it has no connections to
+ * other elements in the modelspace.
+ */
+ // public boolean isFullyIsolated();
+ /**
+ * Checks wether the entity is isolated, eg. it has no connection to the
+ * components in the given Collection
+ *
+ * @param e
+ * The base Collection.
+ */
+ // public boolean isFullyIsolatedInE(Collection e);
+ /**
+ * Checks wether the entity has connections.
+ *
+ * @return true, if the entity has no Relations or Functions associated
+ * with.
+ */
+ // public boolean isIsolated();
+ /**
+ * Checks if the entity has a connection to the submodel with root e
+ *
+ * @param e
+ * The base entity
+ * @return true, if the submodel and the entity are disjunct.
+ */
+ // public boolean isIsolatedInE(IEntity e);
+ /**
+ * Returns the components of the entity.
+ *
+ * @return set of elements contained by the entity. (recursive)
+ */
+ public Collection<IModelElement> getAllComponents();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelElement.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelElement.java
new file mode 100644
index 0000000..c94798e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelElement.java
@@ -0,0 +1,411 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.Collection;
+
+/**
+ * This interface specifies the VPM core element representation
+ *
+ * @author Andras Balogh, Andras Schmidt, Istvan Rath
+ *
+ */
+public interface IModelElement extends Comparable<IModelElement> {
+ /**
+ * Gets the element's state. When you delete an element is changes state to
+ * deleted. Any action to the deleted element is corrupt, and must throw
+ * exception.
+ *
+ * @return true if the element is in the 'deleted' state
+ */
+ public boolean isDeleted();
+
+ public boolean isEntity();
+
+ public boolean isRelation();
+
+ /**
+ * Gets the element's ID
+ *
+ * @return id
+ */
+ public String getID();
+
+ /**
+ * Gets the element's name
+ *
+ * @return the name of the element
+ */
+ public String getName();
+
+ /**
+ * Gets the element's view information
+ *
+ * @return the view information string of the element
+ */
+ public String getViewInfo();
+
+ /**
+ * Gets the element's isFinalType flag
+ *
+ * @return true, if the model element cannot be subtyped
+ */
+ public boolean getIsFinalType();
+
+ /**
+ * Returns the element's fully qualified name
+ *
+ * @return name
+ */
+ public String getFullyQualifiedName();
+
+ /**
+ * Returns the collection of supertypes.
+ *
+ * @return the collection of supertypes
+ */
+ public Collection<IModelElement> getSupertypes();
+
+ /**
+ * Gets the types of the element. The result set contains all Elements,
+ * which are instantiated by this Element.
+ *
+ * @return set of elements.
+ */
+ public Collection<IModelElement> getTypes();
+
+ /**
+ * Gets the list of subtypes of the current Element.
+ *
+ * @return Set of elements
+ */
+ public Collection<IModelElement> getSubtypes();
+
+ /**
+ * Gets all elements that are instances of the current one.
+ *
+ * @return collection of instances
+ */
+ public Collection<IModelElement> getInstances();
+
+ /**
+ * Gets the String representation of this object.
+ */
+ public String toString();
+
+ /**
+ * Gets recursively all supertypes of the current Element.
+ *
+ * @return set of Elements.
+ */
+ public Collection<IModelElement> getAllSupertypes();
+
+ /**
+ * Gets recoursively all types of the current Element.
+ *
+ * @return set of Elements.
+ */
+ public Collection<IModelElement> getAllTypes();
+
+ /**
+ * Gets recoursively all subtypes of the current element.
+ *
+ * @return set of types.
+ */
+ public Collection<IModelElement> getAllSubtypes();
+
+ /**
+ * Gets recoursively all instances of the current element (and its
+ * subtypes).
+ *
+ * @return set of types.
+ */
+ public Collection<IModelElement> getAllInstances();
+
+ /**
+ * Query the instanceof relation.
+ *
+ * @param type
+ * @return true if type is type of this, i.e.:
+ * A.isInstanceOf(B) true <=> B is a type of A
+ */
+ public boolean isInstanceOf(IModelElement type);
+
+ /**
+ * Query the supertypeof relation.
+ *
+ * @param sub
+ * @return true if sub is subtype of this, i.e.:
+ * A.isSupertypeOf(B) true <=> A is a supertype of B
+ */
+ public boolean isSupertypeOf(IModelElement sub);
+
+ /**
+ * Query the subtypeof relation.
+ *
+ * @param sup
+ * @return true if sup is supertype of this, i.e.:
+ * A.isSubtypeof(B) true <=> B is a supertype of A
+ */
+ public boolean isSubtypeOf(IModelElement sup);
+
+ /**
+ * Query the typeof relation.
+ *
+ * @param inst
+ * @return true if inst is type of this, i.e.:
+ * A.isTypeOf(B) true <=> A is a type of B
+ */
+ public boolean isTypeOf(IModelElement inst);
+
+ /**
+ * Query the typeof relation.
+ *
+ * @param inst
+ * @return true if inst is direct instance of this, i.e.:
+ * A.isDirectTypeOf(B) true <=> A is a direct type (without transitivity) of B
+ */
+ public boolean isDirectTypeOf(IModelElement inst);
+
+ /**
+ * Query the subtypeof relation.
+ *
+ * @param inst
+ * @return true if sup is direct supertype of this, i.e.:
+ * A.isDirectSubtypeOf(B) true <=> B is a direct supertype of A
+ */
+ public boolean isDirectSubtypeOf(IModelElement sup);
+
+ /**
+ * Query the subtypeof relation.
+ *
+ * @param inst
+ * @return true if sup is direct subtype of this, i.e.:
+ * A.isDirectSupertypeOf(B) true <=> A is a direct supertype of B
+ */
+ public boolean isDirectSupertypeOf(IModelElement sub);
+
+ /**
+ * Query the instanceof relation.
+ *
+ * @param inst
+ * @return true if type is direct type of this
+ * A.isDirectInstanceOf(B) true <=> B is a direct type of A
+ */
+ public boolean isDirectInstanceOf(IModelElement type);
+
+ /**
+ * Query the modelspace that contains this element
+ *
+ * @return the modelspace that contains this element
+ */
+ public IModelSpace getModelSpace();
+
+ /**
+ * Returns all relations, which end at this entity
+ *
+ * @return
+ */
+ public Collection<IRelation> getRelationsTo();
+
+ /**
+ * Returns all relations, which start at this entity
+ *
+ * @return
+ */
+ public Collection<IRelation> getRelationsFrom();
+
+ /**
+ * Returns one relation, which ends at this entity and has type type
+ *
+ * @param type
+ * @return
+ */
+ public IRelation getRelationToByType(IModelElement type);
+
+ /**
+ * Returns one relation, which starts at this entity and has type type
+ *
+ * @param type
+ * @return
+ */
+ public IRelation getRelationFromByType(IModelElement type);
+
+ /**
+ * Returns one relation, which ends at this entity and has name name
+ *
+ * @param name
+ * @return
+ */
+ public IRelation getRelationToByName(String name);
+
+ /**
+ * Returns one relation, which starts at this entity and has name name
+ *
+ * @param name
+ * @return
+ */
+ public IRelation getRelationFromByName(String name);
+
+ /**
+ * Returns all relations associated with this entity
+ *
+ * @return collection of relations
+ */
+ public Collection<IRelation> getRelations();
+
+ /**
+ * Returns the first connection for a given name
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ // public IRelation getConnectionByName(String n);
+ /**
+ * Returns the connection from the element for a given name
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ // public IRelation getConnectionFromByName(String n);
+ /**
+ * Returns the first connection for a given type
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ // public IRelation getConnectionByType(IModelElement n);
+ /**
+ * Returns the first connection for a given type starting from the entity
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ // public IRelation getConnectionFromByType(IRelation n);
+ /**
+ * Returns the first relation for a given name
+ *
+ * @param n
+ * then name of the relation
+ * @return The coresponding relation
+ */
+ public IRelation getRelationByName(String n);
+
+ /**
+ * Returns the first relation for a given type
+ *
+ * @param n
+ * then name of the relation
+ * @return The coresponding relation
+ */
+ public IRelation getRelationByType(IModelElement n);
+
+ public IModelElement getRelationTargetByType(IRelation type);
+
+ /**
+ * Returns all connection target which is conected via a relation with the
+ * specified type
+ *
+ * @param type
+ * the relation type
+ * @return set of appropriate model elements.
+ */
+ public Collection<IModelElement> getAllRelationTargetByType(IRelation type);
+
+ /**
+ * Returns the first connection source which is connected via a relation of
+ * the specified type.
+ *
+ * @param type
+ * The relation type.
+ * @return the first appropriate connection if found, null otherwise.
+ */
+ public IModelElement getRelationSourceByType(IRelation type);
+
+ /**
+ * Gets all relations starting at this element conforming to the type.
+ * @param type
+ * @return
+ */
+ public Collection<IRelation> getAllRelationFromByType(IRelation type);
+
+ /**
+ * Gets all relations ending at this element conforming to type.
+ * @param type
+ * @return
+ */
+ public Collection<IRelation> getAllRelationToByType(IRelation type);
+
+ /**
+ * Returns all connection source which is connected via a relation with the
+ * specified type
+ *
+ * @param type
+ * the relation type
+ * @return set of appropriate model elements.
+ */
+ public Collection<IModelElement> getAllRelationSourceByType(IRelation type);
+
+ /**
+ * Get the modelelement that has this one in its namespace. parent for
+ * entity, source for relation
+ *
+ * @return namespace, or null for root.
+ */
+ public IModelElement getNamespace();
+
+ /**
+ * Returns whether the model element is below grandpa in namaspace hierarcy.
+ *
+ * @param grandpa
+ * @return
+ */
+ public boolean isBelowNamespace(IModelElement grandpa);
+
+ /**
+ * Find element with given name in the namespace of this element (child
+ * entity or relation from this element)
+ *
+ * @param name
+ * element's name to be found
+ * @return element with name below this element or null if element with name
+ * is not present
+ */
+ public IModelElement getElementInNamespaceByName(String name);
+
+ /**
+ * Find all element in the namespace of this element (child entity or
+ * relation from this element)
+ *
+ * @return all elements in namespace of this element
+ */
+ public Collection<IModelElement> getElementsInNamespace();
+
+ /**
+ * Returns the transitive closure of the namespace (all elements below).
+ */
+ public Collection<IModelElement> getAllElementsInNamespace();
+
+ /**
+ * Find all elemetns which are in the required relation with this element.
+ * This method is a reflection method for many query methods.
+ *
+ * @param relationType
+ * @return collection of elements
+ */
+// public Collection<IModelElement> getElementsInRelation(EConstraint relationType);
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManager.java
new file mode 100644
index 0000000..0a1cb32
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManager.java
@@ -0,0 +1,595 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.Set;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.eclipse.viatra2.errors.VPMCoreException;
+
+/**
+ * Interface for defining the requirements for VPM model management
+ * implementations
+ *
+ * @author Andras Balogh, Istvan Rath, Andras Schmidt
+ *
+ */
+public interface IModelManager {
+
+ /**
+ * Initializes the model manager.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ // public void init(Logger l, Properties p, IModelSpace m) throws
+ // VPMRuntimeException;
+
+ /**
+ * Retrieves the root entity of the modelspace.
+ *
+ * @return root entity
+ */
+ public IEntity getRoot();
+
+ /**
+ * Deletes the entity from the modelspace according to a specified
+ * semantics.
+ *
+ * @param e
+ * entity to be deleted
+ * @param semantics
+ * semantics id
+ * @deprecated use delete element instead
+ */
+ @Deprecated
+ public void deleteEntity(IEntity e, EDeleteSemantics semantics)
+ throws VPMCoreException;
+
+ /**
+ * Deletes the element from the modelspace according to a specified
+ * semantics.
+ *
+ * @param me
+ * element to be deleted
+ * @param semantics
+ * semantics id
+ */
+ public void deleteElement(IModelElement me, EDeleteSemantics semantics)
+ throws VPMCoreException;
+
+ /**
+ * Deletes a relation from the modelspace.
+ *
+ * @param r
+ * the relation to be deleted.
+ * @deprecated use deleteElement instead
+ */
+ @Deprecated
+ public void deleteRelation(IRelation r, EDeleteSemantics semantics)
+ throws VPMCoreException;
+
+ /**
+ * Retrives the model element by its fully qualified name
+ *
+ * @param n
+ * the fully qualified model element name
+ * @return element if found, else null
+ */
+ public IModelElement getElementByName(String n);
+
+ /**
+ * Retrieves an entity by its fully qualified name
+ *
+ * @param n
+ * fully qualified name of entity
+ * @return entity if found, else null
+ */
+ public IEntity getEntityByName(String n);
+
+ /**
+ * Retrieves a relation by its fully qualified name
+ *
+ * @param n
+ * fully qualified name of relation
+ * @return relation if found, else null
+ */
+ public IRelation getRelationByName(String n);
+
+ /**
+ * Retrives the model element by its ID
+ *
+ * @param n
+ * model element ID
+ * @return element if found, else null
+ */
+ public IModelElement getElementByID(String n);
+
+ /**
+ * Retrieves an entity by its ID
+ *
+ * @param n
+ * ID of entity
+ * @return entity if found, else null
+ */
+ public IEntity getEntityByID(String n);
+
+ /**
+ * Retrieves a relation by its ID
+ *
+ * @param n
+ * ID of relation
+ * @return relation if found, else null
+ */
+ public IRelation getRelationByID(String n);
+
+ /**
+ * Retrieves all entities currently in the modelspace.
+ *
+ * @return collection of entities
+ */
+ public Set<? extends IEntity> getEntities();
+
+ public Set<? extends IModelElement> getElements();
+
+ /**
+ * Retrieves all relations currently in the modelspace.
+ *
+ * @return collection of relations
+ */
+ public Set<? extends IRelation> getRelations();
+
+ /**
+ * Creates a new entity with a random and unique name, contained in the
+ * modelspace root
+ *
+ * @return reference to the entity
+ */
+ public IEntity newEntity();
+
+ /**
+ * Creates a new entity with a random and unique name in the specified
+ * container
+ *
+ * @param container
+ * the container, may not be null
+ * @return reference to the entity
+ */
+ public IEntity newEntity(IEntity container) throws VPMCoreException;
+
+ /**
+ * Creates a new entity with the given name in the modelspace root
+ *
+ * @param name
+ * the name of the entity, may not be null
+ * @return reference to the entity
+ */
+ public IEntity newEntity(String name) throws VPMCoreException;
+
+ /**
+ * Creates a new entity with the given name and container
+ *
+ * @param name
+ * the name of the entity, may not be null
+ * @param container
+ * the container, may not be null
+ * @return reference to the entity
+ */
+ public IEntity newEntity(String name, IEntity container)
+ throws VPMCoreException;
+
+ /**
+ * Creates a new entity with the given name and value in the modelspace root
+ *
+ * @param name
+ * the name of the entity, may not be null
+ * @param value
+ * the value of the entity, may not be null
+ * @return reference to the entity
+ */
+ public IEntity newEntity(String name, String value) throws VPMCoreException;
+
+ /**
+ * Creates a new entity with the given name, value and container
+ *
+ * @param name
+ * the name of the entity, may not be null
+ * @param value
+ * the value of the entity, may not be null
+ * @param container
+ * the container, may not be null
+ * @return reference to the entity
+ */
+ public IEntity newEntity(String name, String value, IEntity container)
+ throws VPMCoreException;
+ /**
+ * Creates a new entity with the given name, value container and a single type.
+ * Each of the parameters can be left null.
+ *
+ * @param name
+ * the name of the entity
+ * @param value
+ * the value of the entity
+ * @param container
+ * the container
+ * @param type
+ * the single initial type of the entity
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name, String value, IEntity container, IEntity type)
+ throws VPMCoreException;
+
+
+
+ /**
+ * Creates a new relation with a random and unique name, between the given
+ * model elements.
+ *
+ * @param from
+ * source model element
+ * @param to
+ * target model element
+ * @return reference to the new relation
+ */
+ public IRelation newRelation(IModelElement from, IModelElement to)
+ throws VPMCoreException;
+
+ /**
+ * Creates a new relation with a random and unique name, between the given
+ * model elements, with the given multiplicity, isAggregation, Inverse
+ * attributes.
+ *
+ * @param from
+ * source model element
+ * @param to
+ * target model element
+ * @param multiplicity
+ * a valid EMultiplicityKind enumeration constant
+ * @param isaggregation
+ * true, if the relation represents an aggregation
+ * @param inverse
+ * the relation's inverse, or null if it has none
+ * @return reference to the new relation
+ */
+ public IRelation newRelation(IModelElement from, IModelElement to,
+ EMultiplicityKind multiplicity, boolean isaggregation,
+ IRelation inverse) throws VPMCoreException;
+
+ /**
+ * Creates a new relation with the given name, between the given elements.
+ *
+ * @param name
+ * name of the relation
+ * @param from
+ * source entity
+ * @param to
+ * target entity
+ * @return reference to the new relation
+ */
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to) throws VPMCoreException;
+
+ /**
+ * Creates a new relation with the given name, between the given model
+ * elements, with the given multiplicity, isAggregation, hasInverse
+ * attributes.
+ *
+ * @param name
+ * name of the relation
+ * @param from
+ * source model element
+ * @param to
+ * target model element
+ * @param multiplicity
+ * a valid EMultiplicityKind enumeration constant
+ * @param isaggregation
+ * true, if the relation represents an aggregation
+ * @param inverse
+ * the relation's inverse, or null if it has none
+ * @return reference to the new relation
+ */
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, EMultiplicityKind multiplicity,
+ boolean isaggregation, IRelation inverse) throws VPMCoreException;
+
+ /**
+ * Creates a new relation with the given name, between the given model elements, with the given single type.
+ * Name and type can be left null.
+ *
+ * @param name
+ * name of relation
+ * @param from
+ * source entity
+ * @param to
+ * target entity
+ * @param type
+ * the single initial type of the relation
+ * @return reference to the new relation
+ * @throws VPMCoreException
+ */
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, IRelation type) throws VPMCoreException;
+
+
+ /**
+ * Creates an instanceOf relation between the two model elements
+ *
+ * @param type
+ * the type element
+ * @param inst
+ * the instance
+ */
+ public void newInstanceOf(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ public void newInstanceOfEditor(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ public void newInstanceOfMachine(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ /**
+ * Creates a new supertypeOf relation between the two elements
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ */
+ public void newSupertypeOf(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ public void newSupertypeOfMachine(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ public void newSupertypeOfEditor(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ /**
+ * Deletes the instanceOf relation between the two model elements
+ *
+ * @param type
+ * the type element
+ * @param inst
+ * the instance
+ */
+ public void deleteInstanceOf(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ public void deleteInstanceOfMachine(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ public void deleteInstanceOfEditor(IModelElement type, IModelElement inst)
+ throws VPMCoreException;
+
+ /**
+ * Deletes the supertypeOf relation between the two elements
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ */
+ public void deleteSupertypeOf(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ public void deleteSupertypeOfMachine(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ public void deleteSupertypeOfEditor(IModelElement sup, IModelElement sub)
+ throws VPMCoreException;
+
+ /**
+ * Sets the name of the element
+ *
+ * @param e
+ * the element
+ * @param n
+ * the new name
+ */
+ public void setName(IModelElement e, String n) throws VPMCoreException;
+
+ /**
+ * Sets the value of the entity
+ *
+ * @param e
+ * the entity
+ * @param v
+ * the new value
+ */
+ public void setValue(IEntity e, String v) throws VPMCoreException;
+
+ /**
+ * Sets the source of the relation
+ *
+ * @param rel
+ * the relation
+ * @param from
+ * the new source model element
+ * @throws VPMCoreException
+ */
+ public void setRelationFrom(IRelation rel, IModelElement from)
+ throws VPMCoreException;
+
+ /**
+ * Sets the target of the relation
+ *
+ * @param rel
+ * the relation
+ * @param to
+ * the new target model element
+ * @throws VPMCoreException
+ */
+ public void setRelationTo(IRelation rel, IModelElement to)
+ throws VPMCoreException;
+
+ /**
+ * Sets the multiplicity of the relation
+ *
+ * @param rel
+ * the relation
+ * @param multiplicity
+ * a valid EMultiplicityKind enumeration constant
+ */
+ public void setRelationMultiplicity(IRelation rel,
+ EMultiplicityKind multiplicity) throws VPMCoreException;
+
+ /**
+ * Sets the isAggregation attribute of the relation
+ *
+ * @param rel
+ * the relation
+ * @param isaggregation
+ * true, if the relation should represent an aggregation
+ */
+ public void setRelationIsAggregation(IRelation rel, boolean isaggregation)
+ throws VPMCoreException;
+
+ /**
+ * Sets the Inverse attribute of the relation
+ *
+ * @param rel
+ * the relation
+ * @param inverse
+ * the relation's inverse, or null if it has none
+ */
+ public void setRelationInverse(IRelation rel, IRelation inverse)
+ throws VPMCoreException;
+
+ /**
+ * Removes the element from its current container and moves it to the
+ * specified new container
+ *
+ * @param e
+ * the element
+ * @param cont
+ * new container
+ */
+ public void moveEntityTo(IEntity e, IEntity cont) throws VPMCoreException;
+
+ /**
+ * Sets the "view information" string attribute of the model element
+ *
+ * @param me
+ * the model element
+ * @param viewInfo
+ * the new "view information" string
+ * @throws VPMCoreException
+ */
+ public void setViewInfo(IModelElement me, String viewInfo)
+ throws VPMCoreException;
+
+ /**
+ * Sets the isFinalType flag for a model element.
+ *
+ * @param me
+ * the model element
+ * @param isfinaltype
+ * true, if the element is not to be subtyped
+ * @throws VPMCoreException
+ */
+ public void setIsFinalType(IModelElement me, boolean isfinaltype)
+ throws VPMCoreException;
+
+ /**
+ * Sets whether the type of this relation's source can be omitted (instances
+ * can have source of any type).
+ */
+ public void setIsAnyFrom(IRelation rel, boolean isAnyFrom)
+ throws VPMCoreException;
+
+ /**
+ * Sets whether the type of this relation's target can be omitted (instances
+ * can have target of any type).
+ */
+ public void setIsAnyTo(IRelation rel, boolean isAnyTo)
+ throws VPMCoreException;
+
+ /**
+ * Modify the model to let these model elements in the desired relation.
+ *
+ * @param relationType
+ * BELOW, OVER, ENTITY and RELATION has no sense, others can be
+ * ok parameters
+ * @param src
+ * @param tg
+ * @throws VPMCoreException
+ */
+// public void setRelationshipBetween(EConstraint relationType,
+// IModelElement src, IModelElement tg) throws VPMCoreException;
+
+ public void setProperty(IModelElement me, EModelElementProperty property,
+ Object value) throws VPMCoreException;
+
+ /**
+ * Modify the model to let the desired relation no longer exist between the
+ * model elements.
+ *
+ * @param relationType
+ * not all relation types can be deleted this way
+ * @param src
+ * @param tg
+ * @throws VPMCoreException
+ */
+// public void deleteRelationshipBetween(EConstraint relationType,
+// IModelElement src, IModelElement tg) throws VPMCoreException;
+
+ /**
+ * Copies a set of model elements (<b>deeply</b>) to a destination container
+ * within the modelspace.
+ *
+ * @param sourceElements
+ * the set of model elements to copy
+ * @param sourceRoot
+ * the root of the source model to copy
+ * @param destinationContainer
+ * the container of the copied model in the destination model
+ * @param copyOutEdges
+ * true: copy edges going out of the copied part of model
+ * @return the root modelement of the copied model part
+ * @throws VPMCoreException
+ */
+ public IModelElement copyModelElements(Set<IModelElement> sourceElements,
+ IModelElement sourceRoot, IModelElement destinationContainer,
+ boolean copyOutEdges) throws VPMCoreException;
+
+ /**
+ * Copies a model element (and all of its containment subtree) to a
+ * destination container within the modelspace.
+ *
+ * @param source
+ * the model element which will be copied along with all its
+ * <b>deep</b> contents
+ * @param destinationContainer
+ * the container of the copied model in the destination model
+ * @param copyOutEdges
+ * true: copy edges going out of the copied part of model
+ * @return the root modelement of the copied model part
+ * @throws VPMCoreException
+ */
+ public IModelElement copyModelElement(IModelElement source,
+ IModelElement destinationContainer, boolean copyOutEdges)
+ throws VPMCoreException;
+
+ /**
+ * Returns a reentrant read-write lock of the modelspace.
+ *
+ * @return the lock to the modelspace
+ */
+ public ReadWriteLock getLock();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManagerExtended.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManagerExtended.java
new file mode 100644
index 0000000..f167be5
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelManagerExtended.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import org.eclipse.viatra2.errors.VPMCoreException;
+
+/**
+ * Interface for extra model management functionality.
+ *
+ * @author Istvan Rath
+ *
+ */
+public interface IModelManagerExtended extends IModelManager {
+
+ public IEntity newEntity(IEntity type);
+
+ public IEntity newEntity(String name, IEntity type) throws VPMCoreException;
+
+ public IEntity newEntity(String name, String value, IEntity type)
+ throws VPMCoreException;
+
+ public IEntity newEntity(String name, IEntity container, IEntity type)
+ throws VPMCoreException;
+
+ public IRelation newRelation(IModelElement from, IModelElement to,
+ IRelation type) throws VPMCoreException;
+
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, IRelation type) throws VPMCoreException;
+
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, EMultiplicityKind multiplicity,
+ boolean isAggregation, IRelation inverse, IRelation type)
+ throws VPMCoreException;
+
+ // more to come.
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelMerger.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelMerger.java
new file mode 100644
index 0000000..e85b6ae
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelMerger.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import org.eclipse.viatra2.errors.VPMException;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.framework.properties.VPMProperties;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This interface defines the model merger interface for the Viatra core.
+ *
+ * @author Andras Balogh
+ *
+ */
+public interface IModelMerger {
+ /**
+ * Initializes the model merger.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, VPMProperties p, IModelSpace m)
+ throws VPMRuntimeException;
+
+ /**
+ * Mergers the current modelspace with an other one.
+ *
+ * @param m1
+ * - the modelspace to merge
+ * @throws VPMException
+ */
+ public void merge(IModelSpace m1) throws VPMException;
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelSpace.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelSpace.java
new file mode 100644
index 0000000..c486ee7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IModelSpace.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.Collection;
+
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.framework.IFramework;
+
+/**
+ *
+ * This interface specifies the container of core functions. Implementations
+ * have to discover and load model manager, merger, notfification, undo and
+ * transaction support classes.
+ *
+ * ModelSpace interface is the common container of the Viatra core functions.
+ *
+ * @author Andras Balogh
+ *
+ * Modification on 2006.08.07 by Istvan Rath: - commented out
+ * getUndoManager(): we should hide the undo manager and use the
+ * transaction manager instead
+ *
+ */
+public interface IModelSpace {
+
+ /**
+ * Initializes the modelspace.
+ *
+ * @param f
+ * - the framework to plug in the model
+ * @throws VPMRuntimeException
+ */
+ public void init(IFramework f) throws VPMRuntimeException;
+
+ /**
+ * Returns the model merger associated with this modelspace
+ *
+ * @return the model merger
+ */
+ public IModelMerger getModelMerger();
+
+ /**
+ * Returns the model manager asociated with this modelspace.
+ *
+ * @return the model manager
+ */
+ public IModelManager getModelManager();
+
+ public IFramework getFramework();
+
+ /**
+ * Returns the notification manager associated with this modelspace, or null
+ * if notification is not supported.
+ *
+ * @return notification manager
+ */
+ public INotificationManager getNotificationManager();
+
+ /**
+ * Returns the pattern matcher associated with this modelspace.
+ *
+ * @return notification manager
+ */
+ // public IPatternMatcher getPatternMatcher();
+ /**
+ * Returns the transaction manager associated with this modelspace, or null
+ * if transactions are not supported.
+ *
+ * @return transaction manager.
+ */
+ public ITransactionManager getTransactionManager();
+
+ /**
+ * Returns the undo manager associated with this modelspace, or null if undo
+ * is not supported.
+ *
+ * @return undo manager.
+ */
+ // public IUndoManager getUndoManager();
+ /**
+ * Checks whether transactions are supported
+ *
+ * @return true if transactions are supported, else false.
+ */
+ public boolean isTransactionAware();
+
+ /**
+ * Checks whether notifications are supported
+ *
+ * @return true if notifications are supported, else false.
+ */
+ public boolean isNotificationAware();
+
+ /**
+ * Checks whether undo is supported
+ *
+ * @return true if undo is supported, else false.
+ */
+ public boolean isUndoAware();
+
+ /**
+ * Clones (doubles) the whole modelspace
+ *
+ * @return cloned modelspace
+ */
+ public IModelSpace cloneModelSpace();
+
+ /**
+ * Ancestor elements are handled specially. They need not be saved and
+ * loaded, and their relations are updated automatically.
+ *
+ * @return
+ */
+ public Collection<IModelElement> getAncestorElements();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/INotificationManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/INotificationManager.java
new file mode 100644
index 0000000..4a79618
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/INotificationManager.java
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.Collection;
+
+/**
+ * This interface specifies the required services of a notification manager.
+ *
+ * @author Andras Balogh
+ */
+public interface INotificationManager {
+
+ /**
+ * Notification category for undo managers.
+ */
+ public final static int UNDO_SUPPORT = 0;
+
+ /**
+ * Notification category for transaction managers.
+ */
+ public final static int TRANSACTION_SUPPORT = 1;
+
+ /**
+ * Notification category for other core event listeners.
+ */
+ public final static int CORE_SUPPORT = 2;
+
+ /**
+ * Notification category for interpreter-level notification support.
+ */
+ public final static int INTERPRETER_SUPPORT = 3;
+
+ /**
+ * Notification category for gui managers.
+ */
+ public final static int GUI_SUPPORT = 4;
+
+ /**
+ * Initializes the notification manager.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ // public void init(Logger l, Properties p, IModelSpace m) throws
+ // VPMRuntimeException;
+ /**
+ * Adds a new default listner that has to be associated with all new model
+ * elements.
+ *
+ * @param l
+ * the new listner object
+ */
+ // public void addDefaultListener(ICoreNotificationListener l);
+ /**
+ * Adds a new listner that has to be associated with the whole modelSpace.
+ *
+ * @param l
+ * the new listner object
+ */
+ public void addAllListener(ICoreNotificationListener l);
+
+ /**
+ * Removes a default listener
+ *
+ * @param l
+ * the listener to be removed
+ */
+ // public void removeDefaultListener(ICoreNotificationListener l);
+ /**
+ * Removes a listner that was to be associated with the whole modelSpace.
+ *
+ * @param l
+ * the new listner object
+ */
+ public void removeAllListener(ICoreNotificationListener l);
+
+ /**
+ * Returns the current collection of default listeners.
+ *
+ * @return collection of listeners
+ */
+ // public Collection getDefaultListeners();
+ /**
+ * Returns the current collection of listeners who listen every events in
+ * modelSpace.
+ *
+ * @return collection of listeners
+ */
+ public Collection<ICoreNotificationListener> getListenAllListeners();
+
+ /**
+ * Enables notification dispatching.
+ *
+ */
+ public void enableNotifications();
+
+ /**
+ * Disablesnotification dispatching.
+ *
+ */
+ public void disableNotifications();
+
+ /**
+ * Chercks whether notifications are enabled or not.
+ *
+ * @return true, if notification dispatching is enabed.
+ */
+ public boolean isNotificationEnabled();
+
+ /**
+ * Sets the notification level. All notifications having a category that is
+ * less or equal to the level will be dispatched.
+ *
+ * @param l
+ * the new level
+ *
+ */
+ public void setNotificationLevel(int l);
+
+ /**
+ * Retrives the current notification level.
+ *
+ * @return current notification level
+ */
+ public int getNotificationLevel();
+
+ /**
+ * Add a notification listener to a given element.
+ *
+ * @param me
+ * @param l
+ */
+ public void addNotificationListener(IModelElement me,
+ ICoreNotificationListener l);
+
+ /**
+ * Remove a notification listener from a given element.
+ *
+ * @param me
+ * @param l
+ */
+ public void removeNotificationListener(IModelElement me,
+ ICoreNotificationListener l);
+
+ /**
+ * Gets the collection of notification listeners registered to a given
+ * element.
+ *
+ * @param me
+ * @return
+ */
+ public Collection<ICoreNotificationListener> getNotificationListeners(IModelElement me);
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IPause.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IPause.java
new file mode 100644
index 0000000..3a7fee8
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IPause.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+public interface IPause {
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IRelation.java
new file mode 100644
index 0000000..9501d23
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IRelation.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+/**
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+public interface IRelation extends IModelElement {
+
+ /**
+ * Gets the source of this relation.
+ *
+ * @return An Entity
+ */
+ public IModelElement getFrom();
+
+ /**
+ * Gets the destination of this relation.
+ *
+ * @return an Entity
+ */
+ public IModelElement getTo();
+
+ /**
+ * Gets the multiplicity of this relation.
+ *
+ * @return a MultiplicityKind enumeration constant
+ */
+ public EMultiplicityKind getMultiplicity();
+
+ /**
+ * Returns a reference to this relation's inverse, or null if it has none.
+ *
+ * @return a reference to this relation's inverse, or null if it has none
+ */
+ public IRelation getInverse();
+
+ /**
+ * Returns whether this relation represents an aggregation.
+ *
+ * @return true, if this relation represents an aggregation, false otherwise
+ */
+ public boolean getIsAggregation();
+
+ /**
+ * Returns whether the type of this relation's source can be omitted
+ * (instances can have source of any type).
+ *
+ * @return
+ */
+ public boolean getIsAnyFrom();
+
+ /**
+ * Returns whether the type of this relation's target can be omitted
+ * (instances can have target of any type).
+ *
+ * @return
+ */
+ public boolean getIsAnyTo();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ITransactionManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ITransactionManager.java
new file mode 100644
index 0000000..9bf1179
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/ITransactionManager.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+/**
+ * This interface defines the required operations of a transaction manager for
+ * the Viatra core. Transaction is bound to the thread that calls
+ * beginTransaction.
+ *
+ *
+ * @author Andras Balogh
+ *
+ * Modification on 2006.08.07 by Istvan Rath: - added
+ * beginUndoableTransaction - added tryBeginUndoableTransaction -
+ * introduced unique transaction ID: changed return type of functions to
+ * String - added undoTransaction
+ *
+ */
+public interface ITransactionManager {
+ /**
+ * Initializes the transaction manager.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ // public void init(Logger l, Properties p, IModelSpace m) throws
+ // VPMRuntimeException;
+ /**
+ * Begins a new undoable transaction. Can block the caller thread. If the
+ * current thread is in transaction then increments the transaction counter.
+ *
+ * @return a unique transaction ID
+ */
+ public String beginUndoableTransaction();
+
+ /**
+ * Begins a new undoable transaction. Can block the caller thread. If the
+ * current thread is in transaction then increments the transaction counter.
+ *
+ * @return a unique transaction ID
+ * @param info
+ * an information object which is passed to all notification
+ * listeners
+ */
+ public String beginUndoableTransaction(Object info);
+
+ /**
+ * Begins a new, NOT UNDOABLE transaction. Can block the caller thread. If
+ * the current thread is in transaction then increments the transaction
+ * counter.
+ *
+ * @return a unique transaction ID
+ */
+ public String beginTransaction();
+
+ /**
+ * Begins a new, NOT UNDOABLE transaction. Can block the caller thread. If
+ * the current thread is in transaction then increments the transaction
+ * counter.
+ *
+ * @return a unique transaction ID
+ * @param info
+ * an information object which is passed to all notification
+ * listeners. Example usage: pass Boolean.TRUE to stop the
+ * GUI from updating mid-transaction.
+ */
+ public String beginTransaction(Object info);
+
+ /**
+ * Tries to begin a transaction. Returns immediately. Can be used for both
+ * undoable and non-undoable transactions.
+ *
+ * @return true if the modelspace was not locked and this thread locked the
+ * modelspace false if modelspace is locked, and no lock was done
+ */
+ public boolean tryBeginTransaction();
+
+ /**
+ * Commits the current transaction. Decrements the transaction counter and
+ * if it is zero then commits the transaction.
+ *
+ */
+ public void commitTransaction();
+
+
+ /**
+ * Commits all currently active subtransactions together with the main transaction.
+ */
+ public void commitCompositeTransaction();
+
+
+ /**
+ * Aborts the current transaction.
+ * Effect: the transaction lock will be released.
+ */
+ public void abortTransaction();
+
+ /**
+ * Undoes the effects of the transaction identified by the unique ID given.
+ * Note: all other transactions, which are affected, are also undoed.
+ *
+ * @param aTransactionID
+ */
+ public void undoTransaction(String aTransactionID);
+
+ /**
+ * Pauses the current transaction. This means that lock is released. Should
+ * only be use by interpreter debugger. Pausing a transaction can cause the
+ * transaction code to crash.
+ *
+ * @return object that contains transaction counter before pausing
+ * transaction
+ */
+ public IPause pauseTransaction() throws IllegalMonitorStateException;
+
+ /**
+ * unpauses a transaction. Lock regained, and transaction goes on.
+ *
+ * @param n
+ * the object that was returned by pauseTransaction
+ */
+ public void unPauseTransaction(IPause n);
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IUndoManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IUndoManager.java
new file mode 100644
index 0000000..f31e710
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/IUndoManager.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core;
+
+import java.util.List;
+
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This interface defines the undo support for the Viatra core.
+ *
+ * @author Andras Balogh
+ *
+ */
+public interface IUndoManager {
+ /**
+ * Initializes the undo manager.
+ *
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, IModelSpace m) throws VPMRuntimeException;
+
+ /**
+ * Registers a new undo block with a descriptive name. (Checkpoint)
+ *
+ * @param name
+ * - name of undo block
+ */
+ public void nextUndoBlock(String name);
+
+ /**
+ * Checks whether the undo buffer is empty
+ *
+ * @return true, if there are operations in the undo buffer
+ */
+ public boolean canUndo();
+
+ /**
+ * Get the first n undo marks' name.
+ *
+ * @param n
+ * Limit of undo marks.
+ * @return List of strings
+ */
+ public List<String> getUndoList(int n);
+
+ /**
+ * Flushes the undo buffer.
+ *
+ */
+ public void flushUndoBuffer();
+
+ /**
+ * Undoes the last operation
+ */
+ public void undo();
+
+ /**
+ * Undoes the last n operations
+ *
+ * @param n
+ * number of operations to be undone.
+ */
+ public void undo(int n);
+
+ /**
+ * Undoes all operations made after the last checkpoint with given name.
+ *
+ * @param markName
+ */
+ public void undo(String markName);
+
+ /**
+ * Undoes all operations made after the n. checkpoint with given name.
+ *
+ * @param markName
+ * @param n
+ */
+ public void undo(String markName, int n);
+
+ /**
+ * Gets a list of undoable operations currently in the undo buffer.
+ *
+ * @return array of operation names
+ */
+ public List<String> getUndoableList();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/EConstraint.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/EConstraint.java
new file mode 100644
index 0000000..70e48a3
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/EConstraint.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.constraint;
+
+/**
+ * This enumeration contains all types of relations in which two model elements
+ * can be.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public enum EConstraint {
+ /** This is an element and tg is linked to this on from side */
+ REL_FROM,
+ /** This is an element and tg is linked to this on to side */
+ REL_TO,
+ /**
+ * This is a relation and tg is the end point of the relation on the from
+ * side
+ */
+ ENTITY_REL_FROM,
+ /**
+ * This is a relation and tg is the end point of the relation on the to side
+ */
+ ENTITY_REL_TO,
+ /** src is over of tg */
+ OVER,
+ /** tg is child of src */
+ CHILD,
+ /** tg is parent of src */
+ PARENT,
+ /** tg is subtype of source */
+ SUBTYPE,
+ /** tg is supertype of source */
+ SUPERTYPE,
+ /** source is type of tg */
+ INSTANCE,
+ /** source is instance of tg */
+ TYPE,
+ /** source is entity tg is null */
+ ENTITY,
+ /** source is relation tg is null */
+ RELATION,
+ /** src is below tg */
+ BELOW, DSUBTYPE, DSUPERTYPE, DINSTANCE, DTYPE,
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/IConstraint.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/IConstraint.java
new file mode 100644
index 0000000..e4773d7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/constraint/IConstraint.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.constraint;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface IConstraint {
+ /** This is an element and tg is linked to this on from side */
+ final static int REL_FROM = 0;
+
+ /** This is an element and tg is linked to this on to side */
+ final static int REL_TO = 1;
+
+ /**
+ * This is a relation and tg is the end point of the relation on the from
+ * side
+ */
+ final static int ENTITY_REL_FROM = 2;
+
+ /**
+ * This is a relation and tg is the end point of the relation on the to side
+ */
+ final static int ENTITY_REL_TO = 3;
+
+ final static int OVER = 4;
+
+ /** tg is child of src */
+ final static int CHILD = 5;
+
+ /** tg is parent of src */
+ final static int PARENT = 6;
+
+ /** tg is subtype of source */
+ final static int SUBTYPE = 7;
+
+ /** tg is supertype of source */
+ final static int SUPERTYPE = 8;
+
+ /** source is type of tg */
+ final static int INSTANCE = 9;
+
+ /** source is instance of tg */
+ final static int TYPE = 10;
+
+ /** source is entity tg is null */
+ final static int ENTITY = 11;
+
+ /** source is relation tg is null */
+ final static int RELATION = 12;
+
+ /** src is below tg */
+ final static int BELOW = 13;
+
+ final static int N_CONSTRAINTS = 14;
+
+ final static int DTYPE = 14;
+
+ final static int DSUBTYPE = 15;
+
+ final static int DINSTANCE = 16;
+
+ final static int DSUPERTYPE = 17;
+
+ final static String[] namesOfConstraints = { "is source of",
+ "is target of", "starts from", "ends at", "is over of",
+ "is grandchild of", "is child of", "is supertype of",
+ "is subtype of", "is type of", "is instance of", "is an entity",
+ "is a relation", "is below of", "ERROR" };
+
+ // IPatternVariable getSourceVar();
+ // IPatternVariable getTargetVar();
+ int getType();
+
+ EConstraint getType2();
+
+ Object getTag();
+
+ void setTag(Object o);
+
+ // int typeFromOtherSide() throws PatternMatcherException;
+ /**
+ * Return the type of the constraint if seen from the other side. Returns -1
+ * (not a real type) if no other side is present.
+ *
+ * @return
+ */
+ int typeFromOtherSideNoException();
+ /**
+ * In a pattern constraints can be given from both side. So one constraint
+ * can have two representations in constraint list. This method will return
+ * true if this is the main representation of the constraint.
+ *
+ * @return
+ */
+ // boolean isOtherSide();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObject.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObject.java
new file mode 100644
index 0000000..1e0bf7c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObject.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import java.util.Collection;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * This is an interface of a notification object. A notification object is sent,
+ * whenever the modelspace changes. It contains string constants which identify
+ * the various notification types supported by the Viatra Core, as well as some
+ * utility getter functions.
+ *
+ * @author Andras Schmidt
+ *
+ * Modified on 2006.08.08 by Istvan Rath: - added transaction-specific
+ * ID's (TA prefix) - cleaned up javadoc
+ * Modified on 2011.06.10 by Ábel Hegedüs: - changed to use enum
+ */
+public interface ICoreNotificationObject {
+
+ /**
+ * Converts this notification to a human readable string representation.
+ */
+ public String toString();
+
+ /**
+ * Get the type of this action. The returned string constant will always be
+ * one of the types defined in the interface.
+ */
+ public String getActionType();
+
+ /**
+ * Get the type of this action.
+ *
+ * @return type defined by the interface
+ */
+ public NotificationType getActionTypeEnum();
+
+ /**
+ * Get the objects receiving this notification instance.
+ */
+ public Collection<ICoreNotificationListener> getListeners();
+
+ /**
+ * Get a collection of model elements which were involved in the
+ * modification which this notification object is signalling.
+ */
+ public Collection<IModelElement> getNotifiedObjects();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateEntity.java
new file mode 100644
index 0000000..0fe65ef
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateEntity.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectCreateEntity extends
+ ICoreNotificationObject {
+
+
+ IEntity getContainer();
+
+ IEntity getCreated();
+
+ String getName();
+
+ String getValue();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateInstanceOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateInstanceOf.java
new file mode 100644
index 0000000..236d0cc
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateInstanceOf.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectCreateInstanceOf extends
+ ICoreNotificationObject {
+ IModelElement getType();
+
+ IModelElement getInstance();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateRelation.java
new file mode 100644
index 0000000..85d250e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateRelation.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectCreateRelation extends
+ ICoreNotificationObject {
+
+ IModelElement getFrom();
+
+ IModelElement getTo();
+
+ IRelation getNewRelation();
+
+ String getName();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateSupertypeOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateSupertypeOf.java
new file mode 100644
index 0000000..8c6e230
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectCreateSupertypeOf.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectCreateSupertypeOf extends
+ ICoreNotificationObject {
+ IModelElement getSuper();
+
+ IModelElement getSub();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteContainment.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteContainment.java
new file mode 100644
index 0000000..7797b58
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteContainment.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectDeleteContainment extends
+ ICoreNotificationObject {
+ IEntity getParent();
+
+ IModelElement getChild();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteEntity.java
new file mode 100644
index 0000000..100a369
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteEntity.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectDeleteEntity extends
+ ICoreNotificationObject {
+
+ IEntity getDeleted();
+
+ String getName();
+
+ String getValue();
+
+ IEntity getParent();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteInstanceOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteInstanceOf.java
new file mode 100644
index 0000000..dcd8dca
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteInstanceOf.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectDeleteInstanceOf extends
+ ICoreNotificationObject {
+ IModelElement getType();
+
+ IModelElement getInstance();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteRelation.java
new file mode 100644
index 0000000..5ad8685
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteRelation.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectDeleteRelation extends
+ ICoreNotificationObject {
+
+ IRelation getDeleted();
+
+ String getName();
+
+ IModelElement getFrom();
+
+ IModelElement getTo();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteSupertypeOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteSupertypeOf.java
new file mode 100644
index 0000000..959674e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectDeleteSupertypeOf.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectDeleteSupertypeOf extends
+ ICoreNotificationObject {
+ IModelElement getSuper();
+
+ IModelElement getSub();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectMoveTo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectMoveTo.java
new file mode 100644
index 0000000..ea6e594
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectMoveTo.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectMoveTo extends ICoreNotificationObject {
+ IEntity getNewContainer();
+
+ IEntity getOldContainer();
+
+ IEntity getElement();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsAny.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsAny.java
new file mode 100644
index 0000000..4ece670
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsAny.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+public interface ICoreNotificationObjectSetIsAny extends
+ ICoreNotificationObject {
+ IModelElement getRelation();
+
+ boolean getIsAny();
+
+ boolean getIsAnyOld();
+
+ /**
+ * Returns true is source side was set, and false if target side was set.
+ *
+ * @return
+ */
+ boolean getIsFromSideSet();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsFinalType.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsFinalType.java
new file mode 100644
index 0000000..68bffff
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetIsFinalType.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ *
+ * @author Istvan Rath
+ *
+ */
+public interface ICoreNotificationObjectSetIsFinalType extends
+ ICoreNotificationObject {
+
+ IModelElement getElement();
+
+ boolean getIsFinalType();
+
+ boolean getIsFinalTypeOld();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetName.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetName.java
new file mode 100644
index 0000000..c8eafd7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetName.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectSetName extends ICoreNotificationObject {
+ String getNewName();
+
+ String getOldName();
+
+ IModelElement getElement();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationFrom.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationFrom.java
new file mode 100644
index 0000000..32cb8dc
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationFrom.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectSetRelationFrom extends
+ ICoreNotificationObject {
+ IRelation getRelation();
+
+ IModelElement getOldFrom();
+
+ IModelElement getNewFrom();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationInverse.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationInverse.java
new file mode 100644
index 0000000..d38d978
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationInverse.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IRelation;
+
+public interface ICoreNotificationObjectSetRelationInverse extends
+ ICoreNotificationObject {
+
+ IRelation getRelation();
+
+ IRelation getInverse();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationIsAggregation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationIsAggregation.java
new file mode 100644
index 0000000..b2bf3bb
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationIsAggregation.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IRelation;
+
+public interface ICoreNotificationObjectSetRelationIsAggregation extends
+ ICoreNotificationObject {
+
+
+
+ IRelation getRelation();
+
+ boolean getIsAggregation();
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationMultiplicity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationMultiplicity.java
new file mode 100644
index 0000000..e0004e9
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationMultiplicity.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.EMultiplicityKind;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+public interface ICoreNotificationObjectSetRelationMultiplicity extends
+ ICoreNotificationObject {
+
+
+ IRelation getRelation();
+
+ EMultiplicityKind getMultiplicity();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationTo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationTo.java
new file mode 100644
index 0000000..8c1af39
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetRelationTo.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectSetRelationTo extends
+ ICoreNotificationObject {
+ IRelation getRelation();
+
+ IModelElement getOldTo();
+
+ IModelElement getNewTo();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetValue.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetValue.java
new file mode 100644
index 0000000..43504b6
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetValue.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectSetValue extends
+ ICoreNotificationObject {
+ String getNewValue();
+
+ String getOldValue();
+
+ IEntity getEntity();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetViewInfo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetViewInfo.java
new file mode 100644
index 0000000..0c3b28d
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSetViewInfo.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectSetViewInfo extends
+ ICoreNotificationObject {
+ IModelElement getElement();
+
+ String getOldViewInfo();
+
+ String getNewViewInfo();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionBegin.java
new file mode 100644
index 0000000..bf7da30
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionBegin.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectSubTransactionBegin extends
+ ICoreNotificationObjectTransactionBegin {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionEnd.java
new file mode 100644
index 0000000..45a1e7e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectSubTransactionEnd.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectSubTransactionEnd extends
+ ICoreNotificationObjectTransactionEnd {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransaction.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransaction.java
new file mode 100644
index 0000000..cf4cab4
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransaction.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionBegin.java
new file mode 100644
index 0000000..54e447c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionBegin.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectTransactionBegin extends
+ ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionEnd.java
new file mode 100644
index 0000000..3023133
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectTransactionEnd.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectTransactionEnd extends
+ ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoBegin.java
new file mode 100644
index 0000000..7048260
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoBegin.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectUndoBegin extends
+ ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoEnd.java
new file mode 100644
index 0000000..73d78e7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoEnd.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectUndoEnd extends
+ ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoableTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoableTransactionBegin.java
new file mode 100644
index 0000000..b213ecf
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUndoableTransactionBegin.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+public interface ICoreNotificationObjectUndoableTransactionBegin extends
+ ICoreNotificationObjectTransaction {
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUserMark.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUserMark.java
new file mode 100644
index 0000000..d174601
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/ICoreNotificationObjectUserMark.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.notification;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public interface ICoreNotificationObjectUserMark {
+ String getMarkName();
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/NotificationType.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/NotificationType.java
new file mode 100644
index 0000000..d2e2a83
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/notification/NotificationType.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2010 Abel Hegedus and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Abel Hegedus - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.viatra2.core.notification;
+
+/**
+ * Type enum for notifications
+ *
+ * @author Abel Hegedus
+ *
+ */
+public enum NotificationType {
+
+ /**
+ * Signals that a "user mark" (checkpoint) has been added to the undo stack.
+ * This is only used by the undo manager.
+ */
+ USER_MARK ( "user mark"),
+
+ /**
+ * Means that one atomic step is finished. This defines a consistent point,
+ * where undo can be stopped.
+ */
+ ACTION_ATOMIC_STEP_READY ( "atomic step ready"),
+
+ /**
+ * Means that an entity was created. Parameters: IModelElement container
+ * entity (may be null, then containment add will come in an other
+ * notification) IModelElement of newly created entity String name of newly
+ * created entity String value of newly created entity
+ */
+ ACTION_CREATE_ENTITY ( "create entity"),
+
+ /**
+ * Means that an entity was deleted Parameters: String ID of deleted entity
+ * String name of deleted entity String value of deleted entity String ID of
+ * parent
+ */
+ ACTION_DELETE_ENTITY ( "delete entity"),
+
+ /**
+ * Means that a function was created Parameters: String ID of container
+ * entity (may be null, then containment add will come in an other
+ * notification) String ID of from entity String ID of to entity String ID
+ * of newly created function String name of newly created function
+ */
+ ACTION_CREATE_RELATION ( "create relation"),
+
+ /**
+ * Means that an entity was deleted Parameters: String ID of deleted entity
+ * String name of deleted entity String value of deleted entity String ID of
+ * parent
+ */
+ ACTION_DELETE_RELATION ( "delete relation"),
+
+ /**
+ * Means that a relation's source model element was changed.
+ */
+ ACTION_SET_RELATION_FROM ( "set relation from"),
+
+ /**
+ * Means that a relation's target model element was changed.
+ */
+ ACTION_SET_RELATION_TO ( "set relation to"),
+
+ /**
+ * Means that an instanceOf implicit relation was created.
+ */
+ ACTION_CREATE_INSTANCEOF ( "create instanceof"),
+
+ /**
+ * Means that an instanceOf implicit relation was deleted.
+ */
+ ACTION_DELETE_INSTANCEOF ( "delete instanceof"),
+
+ /**
+ * Means that an supertypeOf implicit relation was created.
+ */
+ ACTION_CREATE_SUPERTYPEOF ( "create supertypeof"),
+
+ /**
+ * Means that an supertypeOf implicit relation was deleted.
+ */
+ ACTION_DELETE_SUPERTYPEOF ( "delete supertypeof"),
+
+ /**
+ * Means that a containment relation was deleted. Note: the state of the
+ * modelspace is not consistent!
+ */
+ ACTION_DELETE_CONTAINMENT ( "delete containment"),
+
+ /**
+ * Means that the value of an entity was changed.
+ */
+ ACTION_SET_VALUE ( "set value"),
+
+ /**
+ * Means that the view info of an element was changed.
+ */
+ ACTION_SET_VIEW_INFO ( "set view info"),
+
+ /**
+ * Means that the name of an element was changed.
+ */
+ ACTION_SET_NAME ( "set name"),
+
+ /**
+ * Means that the isFinalType attribute of an element was changed.
+ */
+ ACTION_SET_ISFINALTYPE ( "set isfinaltype"),
+
+ /**
+ * Means that the isAny attribute of an element was changed.
+ */
+ ACTION_SET_ISANY ( "set isany"),
+
+ /**
+ * Means that an element was moved to an entity, with removing from all
+ * others.
+ */
+ ACTION_MOVE_ELEMENT_TO ( "move element to"),
+
+ /**
+ * Means that an undoable transaction has begun.
+ */
+ TA_UNDOABLE_TRANSACTION_BEGIN ( "begin undoable transaction"),
+
+ /**
+ * Means that a non-undoable transaction has begun.
+ */
+ TA_TRANSACTION_BEGIN ( "begin transaction"),
+
+ /**
+ * Means that a sub-transaction has begun.
+ */
+ TA_SUBTRANSACTION_BEGIN ( "begin subtransaction"),
+
+ /**
+ * Signals the end of a sub-transaction.
+ */
+ TA_SUBTRANSACTION_END ( "end subtransaction"),
+
+ /**
+ * Signals the end of a transaction.
+ */
+ TA_TRANSACTION_END ( "end transaction"),
+
+ /**
+ * Signals that an undo operation has begun.
+ */
+ TA_UNDO_BEGIN ( "begin undo"),
+
+ /**
+ * Signals that an undo operation has ended.
+ */
+ TA_UNDO_END ( "end undo"),
+
+ /**
+ * Signals that a relation's inverse has been set.
+ */
+ ACTION_SET_RELATION_INVERSE ( "set inverse"),
+
+ /**
+ * The relation's isAggregation flag has been set.
+ */
+ ACTION_SET_RELATION_ISAGGREGATION ( "set isAggregation"),
+
+ /**
+ * The relation's multiplicity has been set.
+ */
+ ACTION_SET_RELATION_MULTIPLICITY ( "set multiplicity"),
+
+ /**
+ * Signals that the transaction has been aborted.
+ */
+ TA_TRANSACTION_ABORT ( "transaction abort"),
+
+ /**
+ * Signals that the subtransaction has been aborted.
+ */
+ TA_SUBTRANSACTION_ABORT ( "subtransaction abort"),
+
+ ACTION_MORE_ATOMICS_TO_ONE_ATOM_START ( "1000"),
+
+ ACTION_MORE_ATOMICS_TO_ONE_ATOM_END ("1001"),
+
+ ACTION_SKIP_NOTIFICATIONS_START ("1002"),
+
+ ACTION_SKIP_NOTIFICATIONS_END ( "1003");
+
+
+ private final String text;
+
+ private NotificationType(String text){
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ // TODO Auto-generated method stub
+ return text;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/CollectionsDisjunktTester.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/CollectionsDisjunktTester.java
new file mode 100644
index 0000000..32ba72a
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/CollectionsDisjunktTester.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+/**
+ * This class implements an algorithm to test two collections whether they are
+ * disjunkt or not.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class CollectionsDisjunktTester {
+ /**
+ * Tests whether the two collections are disjunkt or not. Will work fast
+ * (TODO) if ordered sets are given (with the same ordering).
+ *
+ * @param col1
+ * @param col2
+ * @return
+ */
+ public static boolean isDisjunct(Collection col1, Collection col2) {
+ // TODO try to find out the structure of collections and implement a
+ // faster search
+ return isDisjunctBruteForce(col1, col2);
+ }
+
+ private static boolean isDisjunctBruteForce(Collection col1, Collection col2) {
+ Iterator it = col1.iterator();
+ while (it.hasNext()) {
+ if (col2.contains(it.next()))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * returns the shared objects in the two collections. Will work fast (TODO)
+ * if ordered sets are given (with the same ordering).
+ *
+ * @param col1
+ * @param col2
+ * @return
+ */
+ public static Collection<Object> sharedElements(Collection col1,
+ Collection col2) {
+ TreeSet<Object> ret = new TreeSet<Object>();
+ Iterator it = col1.iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
+ if (col2.contains(o))
+ ret.add(o);
+ }
+ return ret;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/ConstantSet.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/ConstantSet.java
new file mode 100644
index 0000000..6206efb
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/ConstantSet.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * @author Andras Schmidt
+ *
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ConstantSet<T> extends TreeSet<T> {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public ConstantSet(Set<? extends T> x) {
+ super(x);
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/IDProvider.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/IDProvider.java
new file mode 100644
index 0000000..9c63684
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/IDProvider.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * @author Andras Schmidt
+ *
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class IDProvider {
+ Logger logger;
+
+ long IDCounter = 0;
+
+ IDProvider(Logger l) {
+ logger = l;
+ }
+
+ public long newID() {
+ return IDCounter++;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/KeyedObject.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/KeyedObject.java
new file mode 100644
index 0000000..f4d59df
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/KeyedObject.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+/**
+ * @author Andras Schmidt
+ *
+ * This interface represents an object which has keys. * Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public interface KeyedObject {
+ Comparable<?> getKey(int i);
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/OneIterator.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/OneIterator.java
new file mode 100644
index 0000000..3d0d54f
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/OneIterator.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Iterator;
+
+/**
+ * Iterator of a singleton or an empty collection
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class OneIterator<T> implements Iterator<T> {
+ T o;
+
+ /**
+ * Instantiate a iterator of a singleton or an empty collection
+ *
+ * @param o
+ * null: singleton colection, not null: collection that contains
+ * the given object
+ */
+ public OneIterator(T o) {
+ this.o = o;
+ }
+
+ public boolean hasNext() {
+ return o != null;
+ }
+
+ public T next() {
+ T ret = o;
+ o = null;
+ return ret;
+ }
+
+ public void remove() {
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/Pause.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/Pause.java
new file mode 100644
index 0000000..7a4ab00
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/Pause.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import org.eclipse.viatra2.core.IPause;
+
+class Pause implements IPause {
+ int n;
+
+ Pause(int n) {
+ this.n = n;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleEntity.java
new file mode 100644
index 0000000..afc5142
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleEntity.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.TreeMap;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.simple.cache.TrickyCollection;
+
+/**
+ * Class for representing VPM entities
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class SimpleEntity extends SimpleModelElement implements IEntity {
+ /**
+ * The parent of this entity
+ */
+ protected SimpleEntity parent = null;
+
+ /**
+ * The contained entities of this entity
+ */
+ protected TreeMap<Long, IModelElement> containment;
+
+ /**
+ * The value stored in this entity
+ */
+ protected String value;
+
+ /**
+ * Instantiate an entity with given id in the given modelspace
+ *
+ * @param ID
+ * @param ms
+ */
+ public SimpleEntity(long ID, SimpleModelSpace ms) {
+ super(ID, ms);
+ containment = new TreeMap<Long, IModelElement>();
+ value = "";
+ }
+
+ /**
+ * Gets the entitys value
+ *
+ * @return the value
+ */
+ public String getValue() {
+ try {
+ modelSpace.lock.readLock().lock();
+
+ return value;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Retrives a model element that is contained by this entity and has a given
+ * name
+ *
+ * @param n
+ * name of element to return
+ * @return element ref, or null if not found
+ */
+ public IModelElement getContentByName(String n) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Long id = namespace.get(n);
+ if (id != null) {
+ IEntity me = (IEntity) containment.get(id);
+ return me;
+ }
+ return null;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Retrives a model element that is contained by this entity and has a given
+ * type
+ *
+ * @param n
+ * type of element to return
+ * @return element ref, or null if not found
+ */
+ public IModelElement getContentByType(IModelElement n) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Iterator<IModelElement> it = containment.values().iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ if (me.isInstanceOf(n))
+ return me;
+ }
+ return null;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Returns nested elements of the Entity
+ *
+ * @return Set of contained elements.
+ */
+ public Collection<IModelElement> getContents() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return containment.values();
+ // TODO konstans
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public Collection<IModelElement> getAllComponents() {
+ return new TrickyCollection(null, this);
+ // return _getAllComponents();
+ }
+
+ /**
+ * Returns the components of the entity.
+ *
+ * @return set of elements contained by the entity. (recoursive)
+ */
+ public Collection<IModelElement> _getAllComponents() {
+ try {
+ modelSpace.lock.readLock().lock();
+ ArrayList<IModelElement> ret = new ArrayList<IModelElement>();
+ ret.addAll(getContents());
+ for (IModelElement elem : getContents()) {
+ if (elem instanceof IEntity) {
+ SimpleEntity e = (SimpleEntity) elem;
+ ret.addAll(e._getAllComponents());
+ }
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public IEntity getParent() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return parent;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Returns one of the element's fully qualified name
+ *
+ * @return name
+ */
+ @Override
+ public String getFullyQualifiedName() {
+ try {
+ modelSpace.lock.readLock().lock();
+ String name = getName();
+ IEntity root = modelSpace.getModelManager().getRoot();
+ if (root == this)
+ return "";
+ if (!(root == parent) && !(parent == null))
+ name = parent.getFullyQualifiedName() + "." + name;
+ return name;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see hu.bme.mit.viatra.core.IModelElement#getNamespace()
+ */
+ public IModelElement getNamespace() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return parent;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public boolean isEntity() {
+ return true;
+ }
+
+ public boolean isRelation() {
+ return false;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelElement.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelElement.java
new file mode 100644
index 0000000..6350a98
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelElement.java
@@ -0,0 +1,1035 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.constraint.EConstraint;
+import org.eclipse.viatra2.core.simple.tempdata.TemporaryData;
+
+/**
+ * This class implements the VPM core element representation
+ *
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+abstract public class SimpleModelElement implements KeyedObject, IModelElement {
+ /**
+ * ID of this element. Unique in modelspace.
+ */
+ long ID;
+
+ /**
+ * Stores relations that have this element as source. Maps the ids of
+ * relations to the relations.
+ */
+ protected TreeMap<Long, IRelation> relationsFrom;
+
+ /**
+ * Stores relations that have this element as target.
+ */
+ protected Set<IRelation> relationsTo;
+
+ /**
+ * Stores elements in namespace. Maps elements name in namespace to the
+ * element's ID
+ */
+ protected TreeMap<String, Long> namespace;
+
+ /**
+ * Name of this element. Unique in namespace.
+ */
+ String name = "";
+
+ String viewInfo = null;
+
+ boolean isFinalType = false;
+
+ public boolean getIsFinalType() {
+ return isFinalType;
+ }
+
+ /**
+ * The modelSpace in which this element is instantiated.
+ */
+ SimpleModelSpace modelSpace;
+
+ /**
+ * supertypes of this element.
+ */
+ protected Set<IModelElement> supertype = null;
+
+ /**
+ * types of this element.
+ */
+ protected Set<IModelElement> type = null;
+
+ /**
+ * subtypes of this element.
+ */
+ protected Set<IModelElement> subtypes;
+
+ /**
+ * instances of this element.
+ */
+ protected Set<IModelElement> instances;
+
+ /**
+ * Cached objects to store redundant data: they will become invalid when
+ * modelspace changes If we have a valid data then the get method returns
+ * it, if we have no valid data then the get method counts it.
+ */
+ protected TemporaryData<Set<IModelElement>> allInstances;//=TemporaryData
+ // .
+ // create();
+
+ protected TemporaryData<Set<IModelElement>> allTypes;// =TemporaryData.
+ // create();
+
+ protected TemporaryData<Set<IModelElement>> allSupertypes;// =
+ // TemporaryData
+ // .
+ // create();
+
+ protected TemporaryData<Set<IModelElement>> allSubtypes;//=TemporaryData
+ // .create();
+
+ /**
+ * Listeners to notify, when this element changes.
+ */
+ protected List<ICoreNotificationListener> notificationListeners;
+
+ /**
+ * Compares this to o Two elements are compared by their IDs. This makes it
+ * fast to search an element by ID in a Set.
+ *
+ * @return true if their ID are equal.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof SimpleModelElement)
+ return ID == ((SimpleModelElement) o).ID;
+ else
+ return false;
+ }
+
+ /**
+ * Comapres this to o Two elements are compared by their IDs. This makes it
+ * fast to search an element by ID in a Set.
+ *
+ * @return 1:greater, 0: equals, -1:less
+ */
+ public int compareTo(IModelElement o) {
+ long diff = ID - ((SimpleModelElement) o).ID;
+ // Problem is: long->int conversion might fail to preserve sign, so we
+ // need this
+ // difficult construct.
+ return diff > 0 ? 1 : (diff < 0 ? -1 : 0);
+ }
+
+ /**
+ * This will be used when implementing faster search.
+ */
+ public static final int KEY_ID = 0;
+
+ /**
+ * This will be used when implementing faster search.
+ */
+ public static final int KEY_NAME = 1;
+
+ /**
+ * This will be used when implementing faster search.
+ */
+ public Comparable<?> getKey(int nr) {
+ switch (nr) {
+ case KEY_ID:
+ return new Long(ID);
+ case KEY_NAME:
+ return name;
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates new SimpleModelElement. Its ID will be set to _ID.
+ */
+ public SimpleModelElement(long _ID, SimpleModelSpace ms) {
+ ID = _ID;
+ modelSpace = ms;
+ allInstances = modelSpace.tempFactory.create();
+ allTypes = modelSpace.tempFactory.create();
+ allSupertypes = modelSpace.tempFactory.create();
+ allSubtypes = modelSpace.tempFactory.create();
+
+ // supertype=new TreeSet();
+ // type=new TreeSet();
+ // subtypes=new TreeSet();
+ // instances=new TreeSet();
+
+ relationsFrom = new TreeMap<Long, IRelation>();
+ relationsTo = new SmallTreeSet<IRelation>();
+ namespace = new TreeMap<String, Long>();
+
+ supertype = new SmallTreeSet<IModelElement>();
+ type = new SmallTreeSet<IModelElement>();
+ subtypes = new SmallTreeSet<IModelElement>();
+ instances = new SmallTreeSet<IModelElement>();
+ notificationListeners = new ArrayList<ICoreNotificationListener>(0);
+ }
+
+ /**
+ * Gets the element's ID
+ *
+ * @return id
+ */
+ public String getID() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return Long.toString(ID);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public Long getLongID() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return new Long(ID);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets the elements name
+ *
+ * @return the name of the element
+ */
+ public String getName() {
+ try {
+ // modelSpace.lock.lock();
+ return name;
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ /**
+ * Returns the collection of supertypes.
+ *
+ * @return the collection of supertypes
+ */
+ public Collection<IModelElement> getSupertypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ if (SimpleModelSpace.isAncestorAware) {
+ if (supertype.size() == 0 && modelSpace.ancestorEntity != null) {
+ TreeSet<IModelElement> retSet = new TreeSet<IModelElement>(
+ supertype);
+ if (isEntity())
+ retSet.add(modelSpace.ancestorEntity);
+ else
+ retSet.add(modelSpace.ancestorRelation);
+ return retSet;
+ } else {
+ return supertype;
+ }
+ } else
+ return supertype;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets the types of the element. The result set contains all Elements,
+ * which are instanciated by this Element.
+ *
+ * @return set of elements.
+ */
+ public Collection<IModelElement> getTypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ if (SimpleModelSpace.isAncestorAware) {
+ if (type.size() == 0 && modelSpace.ancestorEntity != null) {
+ TreeSet<IModelElement> retSet = new TreeSet<IModelElement>(
+ supertype);
+ if (isEntity())
+ retSet.add(modelSpace.ancestorEntity);
+ else
+ retSet.add(modelSpace.ancestorRelation);
+ return retSet;
+ }
+ return type;
+ } else
+ return type;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets the list of subtypes of the current Element.
+ *
+ * @return Set of elements
+ */
+ public Collection<IModelElement> getSubtypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return subtypes;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets all elements that are instances of the current one.
+ *
+ * @return collection of instances
+ */
+ public Collection<IModelElement> getInstances() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return instances;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets the String representation of this object.
+ */
+ @Override
+ public String toString() {
+ // TODO
+ try {
+ // modelSpace.lock.lock();
+ return getFullyQualifiedName();
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ /**
+ * Gets recursively all supertypes of the current Element.
+ *
+ * @return set of Elements.
+ */
+ public Collection<IModelElement> getAllSupertypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ Set<IModelElement> retSet = allSupertypes
+ .getObject(modelSpace.numberOfChanges);
+ if (retSet != null)
+ return retSet;
+ retSet = new TreeSet<IModelElement>();
+ Iterator<IModelElement> it = supertype.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ retSet.add(me);
+ retSet.addAll(me.getAllSupertypes());
+ }
+ allSupertypes.setObject(modelSpace.numberOfChanges, retSet);
+ return retSet;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets recursively all types of the current Element.
+ *
+ * @return set of Elements.
+ */
+ public Collection<IModelElement> getAllTypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ Set<IModelElement> retSet = allTypes
+ .getObject(modelSpace.numberOfChanges);
+ if (retSet != null)
+ return retSet;
+ retSet = new TreeSet<IModelElement>();
+ Iterator<IModelElement> it = type.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ retSet.add(me);
+ retSet.addAll(me.getAllSupertypes());
+ }
+ allTypes.setObject(modelSpace.numberOfChanges, retSet);
+ return retSet;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets recoursively all subtypes of the current element.
+ *
+ * @return set of types.
+ */
+ public Collection<IModelElement> getAllSubtypes() {
+ try {
+ modelSpace.lock.readLock().lock();
+ Set<IModelElement> retSet = allSubtypes
+ .getObject(modelSpace.numberOfChanges);
+ if (retSet != null)
+ return retSet;
+ retSet = new TreeSet<IModelElement>();
+ Iterator<IModelElement> it = subtypes.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ retSet.add(me);
+ retSet.addAll(me.getAllSubtypes());
+ }
+ allSubtypes.setObject(modelSpace.numberOfChanges, retSet);
+ return retSet;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets recoursively all instances of the current element (and its
+ * subtypes).
+ *
+ * @return set of types.
+ */
+ public Collection<IModelElement> getAllInstances() {
+ try {
+ modelSpace.lock.readLock().lock();
+ Set<IModelElement> retSet = allInstances
+ .getObject(modelSpace.numberOfChanges);
+ if (retSet == null) {
+ //retSet = new TreeSet<IModelElement>();
+ retSet = new HashSet<IModelElement>();
+
+ retSet.addAll(instances);
+ Iterator<IModelElement> itS = getAllSubtypes().iterator();
+ while (itS.hasNext()) {
+ SimpleModelElement meS = (SimpleModelElement) itS.next();
+ retSet.addAll(meS.getAllInstances());
+ }
+ allInstances.setObject(modelSpace.numberOfChanges, retSet);
+ }
+ return retSet;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Adds a new notification listener to this element
+ *
+ * @param l
+ * the new listener
+ */
+ protected void addNotificationListener(ICoreNotificationListener l) {
+ try {
+ modelSpace.lock.writeLock().lock();
+ notificationListeners.add(l);
+ } finally {
+ modelSpace.lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Removes a notification listener
+ *
+ * @param l
+ * the listener to be removed
+ */
+ public void removeNotificationListener(ICoreNotificationListener l) {
+ try {
+ modelSpace.lock.writeLock().lock();
+ notificationListeners.remove(l);
+ } finally {
+ modelSpace.lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Returns the current set of listeners of this element
+ *
+ * @return collection of listeners
+ */
+ public Collection<ICoreNotificationListener> getNotificationListeners() {
+ try {
+ // modelSpace.lock.lock();
+ return notificationListeners;
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * hu.bme.mit.viatra.core.IModelElement#isInstanceOf(hu.bme.mit.viatra.core
+ * .IModelElement)
+ */
+ public boolean isInstanceOf(IModelElement type) {
+ if (type==null) {
+ return false;
+ }
+ try {
+ modelSpace.lock.readLock().lock();
+ if (!this.type.contains(type))
+ return getAllTypes().contains(type);
+ else
+ return true;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * hu.bme.mit.viatra.core.IModelElement#isSupertypeOf(hu.bme.mit.viatra.
+ * core.IModelElement)
+ */
+ public boolean isSupertypeOf(IModelElement sub) {
+ if (sub==null) return false;
+ try {
+ modelSpace.lock.readLock().lock();
+ if (sub == this)
+ return false; //TODO: ask Dani
+ return getAllSubtypes().contains(sub);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * hu.bme.mit.viatra.core.IModelElement#isSubtypeOf(hu.bme.mit.viatra.core
+ * .IModelElement)
+ */
+ public boolean isSubtypeOf(IModelElement type) {
+ if (type==null) return false;
+ try {
+ modelSpace.lock.readLock().lock();
+ if (type == this)
+ return false; //TODO: ask Dani
+ return type.isSupertypeOf(this);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * hu.bme.mit.viatra.core.IModelElement#isTypeOf(hu.bme.mit.viatra.core.
+ * IModelElement)
+ */
+ public boolean isTypeOf(IModelElement inst) {
+ if (inst==null) return false;
+ try {
+ modelSpace.lock.readLock().lock();
+ return inst.isInstanceOf(this);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * corrected.
+ * (non-Javadoc)
+ * @see org.eclipse.viatra2.core.IModelElement#isDirectTypeOf(org.eclipse.viatra2.core.IModelElement)
+ */
+ public boolean isDirectTypeOf(IModelElement inst) {
+ if (inst==null) return false;
+ try {
+ modelSpace.lock.readLock().lock();
+ return getInstances().contains(inst);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * corrected.
+ * (non-Javadoc)
+ * @see org.eclipse.viatra2.core.IModelElement#isDirectSubtypeOf(org.eclipse.viatra2.core.IModelElement)
+ */
+ public boolean isDirectSubtypeOf(IModelElement sup) {
+ if (sup==null) return false;
+ try {
+ modelSpace.lock.readLock().lock();
+ if (sup == this)
+ return true;
+ return getSupertypes().contains(sup);
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * Corrected.
+ * (non-Javadoc)
+ * @see org.eclipse.viatra2.core.IModelElement#isDirectSupertypeOf(org.eclipse.viatra2.core.IModelElement)
+ */
+ public boolean isDirectSupertypeOf(IModelElement sub) {
+ return sub.isDirectSubtypeOf(this);
+ }
+
+ /*
+ * Corrected.
+ * (non-Javadoc)
+ * @see org.eclipse.viatra2.core.IModelElement#isDirectInstanceOf(org.eclipse.viatra2.core.IModelElement)
+ */
+ public boolean isDirectInstanceOf(IModelElement type) {
+ return type.isDirectTypeOf(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see hu.bme.mit.viatra.core.IModelElement#getViewInfo()
+ */
+ public String getViewInfo() {
+ try {
+ // modelSpace.lock.lock();
+ return viewInfo;
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see hu.bme.mit.viatra.core.IModelElement#getModelSpace()
+ */
+ public IModelSpace getModelSpace() {
+ try {
+ // modelSpace.lock.lock();
+ return modelSpace;
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ /**
+ * Gets all connections (relations and functions) of the Entity.
+ *
+ * @return Set of connections.
+ */
+ /*
+ * public Collection<IRelation> getConnections() { try {
+ * modelSpace.lock.lock(); TreeSet<IRelation> retSet = new
+ * TreeSet<IRelation>(); retSet.addAll(relationsFrom.values());
+ * retSet.addAll(relationsTo); return retSet; } finally {
+ * modelSpace.lock.unlock(); } }
+ */
+
+ /**
+ * Returns the first connection for a given name
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ /*
+ * public IRelation getConnectionByName(String n) { try {
+ * modelSpace.lock.lock(); return (IRelation)
+ * getElemByName(getConnections(), n); } finally { modelSpace.lock.unlock();
+ * } }
+ */
+ /**
+ * Returns the first connection for a given name
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ /*
+ * public IRelation getConnectionFromByName(String n) { try {
+ * modelSpace.lock.lock(); IModelElement me =
+ * getElementInNamespaceByName(n); if (me == null) return null; if (me
+ * instanceof IRelation) return (IRelation) me; return null; } finally {
+ * modelSpace.lock.unlock(); } }
+ */
+ /**
+ * Returns the first connection for a given type
+ *
+ * @param n
+ * then name of the connection
+ * @return The coresponding relation
+ */
+ /*
+ * public IRelation getConnectionByType(IModelElement n) { try {
+ * modelSpace.lock.lock(); return (IRelation)
+ * getElemByType(getConnections(), n); } finally { modelSpace.lock.unlock();
+ * } }
+ *
+ * public IRelation getConnectionFromByType(IRelation n) { try {
+ * modelSpace.lock.lock(); return (IRelation)
+ * getElemByType(getConnectionsFrom(), n); } finally {
+ * modelSpace.lock.unlock(); } }
+ *
+ * public IRelation getConnectionToByType(IModelElement n) { try {
+ * modelSpace.lock.lock(); return (IRelation)
+ * getElemByType(getConnectionsTo(), n); } finally {
+ * modelSpace.lock.unlock(); } }
+ */
+ public Collection<IRelation> getAllRelationFromByType(IRelation n) {
+ try {
+ // modelSpace.lock.lock();
+ // return getAllElemByType(getConnectionsFrom(), n);
+ return getAllElemByType(getRelationsFrom(), n);
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ public Collection<IRelation> getAllRelationToByType(IRelation n) {
+// try {
+ // modelSpace.lock.lock();
+ // return getAllElemByType(getConnectionsTo(), n);
+ return getAllElemByType(getRelationsTo(), n);
+// } finally {
+ // modelSpace.lock.unlock();
+// }
+ }
+
+ public Collection<IRelation> getRelationsTo() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return relationsTo;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public Collection<IRelation> getRelationsFrom() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return relationsFrom.values();
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public IRelation getRelationToByType(IModelElement type) {
+ return (IRelation) getElemByType(relationsTo, type);
+ }
+
+ public IRelation getRelationFromByType(IModelElement type) {
+ return (IRelation) getElemByType(relationsFrom.values(), type);
+ }
+
+ public IRelation getRelationToByName(String name) {
+ return (IRelation) getElemByName(relationsTo, name);
+ }
+
+ public IRelation getRelationFromByName(String name) {
+ return (IRelation) getElemByName(relationsFrom.values(), name);
+ }
+
+ private IModelElement getElemByName(Collection<? extends IModelElement> elems, String name) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Iterator<? extends IModelElement> it = elems.iterator();
+ while (it.hasNext()) {
+ IModelElement rel = it.next();
+ if (rel.getName().equals(name))
+ return rel;
+ }
+ return null;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ private IModelElement getElemByType(Collection<? extends IModelElement> elems, IModelElement type) {
+ try {
+ modelSpace.lock.readLock().lock();
+
+ // TODO mi a konkret szemantikja?
+ Iterator<? extends IModelElement> it = elems.iterator();
+ while (it.hasNext()) {
+ IModelElement rel = it.next();
+ if (rel.getAllTypes().contains(type))
+ return rel;
+ }
+ return null;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+
+ }
+
+ private Collection<IRelation> getAllElemByType(Collection<? extends IModelElement> elems,
+ IModelElement type) {
+ try {
+ modelSpace.lock.readLock().lock();
+
+ Iterator<? extends IModelElement> it = elems.iterator();
+ ArrayList<IRelation> ret = new ArrayList<IRelation>();
+ while (it.hasNext()) {
+ IRelation rel = (IRelation) it.next();
+ if (rel.getAllTypes().contains(type))
+ ret.add(rel);
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+
+ }
+
+ /**
+ * Returns the first connection source which is connected via a relation of
+ * the specified type.
+ *
+ * @param type
+ * The relation type.
+ * @return the first appropriate connection if found, null otherwise.
+ */
+ public IModelElement getRelationSourceByType(IRelation type) {
+ try {
+ modelSpace.lock.readLock().lock();
+
+ IRelation conn = getRelationToByType(type);
+ if (conn == null)
+ return null;
+ else
+ return conn.getFrom();
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+
+ }
+
+ /**
+ * Returns all connection source which is conected via a relation with the
+ * specified type
+ *
+ * @param type
+ * the relation type
+ * @return set of appropriate entities.
+ */
+ public Collection<IModelElement> getAllRelationSourceByType(IRelation type) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Collection<IRelation> conns = getAllRelationToByType(type);
+ ArrayList<IModelElement> ret = new ArrayList<IModelElement>();
+ Iterator<IRelation> it = conns.iterator();
+ while (it.hasNext()) {
+ ret.add(it.next().getFrom());
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Returns all relations associated with this entity
+ *
+ * @return collection of relations
+ */
+ public Collection<IRelation> getRelations() {
+ try {
+ modelSpace.lock.readLock().lock();
+ TreeSet<IRelation> retSet = new TreeSet<IRelation>();
+ retSet.addAll(relationsFrom.values());
+ retSet.addAll(relationsTo);
+ return retSet;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /*
+ * public Collection<IRelation> getConnectionsTo() { TreeSet<IRelation>
+ * retSet = new TreeSet<IRelation>(); retSet.addAll(relationsTo); return
+ * retSet; }
+ *
+ * public Collection<IRelation> getConnectionsFrom() { TreeSet<IRelation>
+ * retSet = new TreeSet<IRelation>(); retSet.addAll(relationsFrom.values());
+ * return retSet; }
+ */
+ /**
+ * Returns the first relation for a given name
+ *
+ * @param n
+ * then name of the relation
+ * @return The coresponding relation
+ */
+ public IRelation getRelationByName(String n) {
+ return (IRelation) getElemByName(getRelations(), n);
+ }
+
+ /**
+ * Returns the first relation for a given type
+ *
+ * @param n
+ * the type of the relation
+ * @return The coresponding relation
+ */
+ public IRelation getRelationByType(IModelElement n) {
+ return (IRelation) getElemByType(getRelations(), n);
+ }
+
+ /**
+ * Get the target of the Relation typed type.
+ */
+ public IModelElement getRelationTargetByType(IRelation type) {
+ IRelation conn = getRelationFromByType(type);
+ if (conn == null)
+ return null;
+ else
+ return conn.getTo();
+ }
+
+ /**
+ * Returns all connection target which is conected via a relation with the
+ * specified type
+ *
+ * @param type
+ * the relation type
+ * @return set of appropriate entities.
+ */
+ public Collection<IModelElement> getAllRelationTargetByType(IRelation type) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Collection<IRelation> conns = getAllRelationFromByType(type);
+ ArrayList<IModelElement> ret = new ArrayList<IModelElement>();
+ Iterator<IRelation> it = conns.iterator();
+ while (it.hasNext()) {
+ ret.add(it.next().getTo());
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ abstract public String getFullyQualifiedName();
+
+ public IModelElement getElementInNamespaceByName(String name) {
+ try {
+ modelSpace.lock.readLock().lock();
+ Long id = namespace.get(name);
+ if (id != null) {
+ IModelElement me = relationsFrom.get(id);
+ if (me == null) {
+ if (this instanceof SimpleEntity)
+ me = ((SimpleEntity) this).containment
+ .get(id);
+ }
+ if (me == null)
+ // inkonzisztens a namespace, es a tartalmazasi cucc.
+ throw new VPMCoreInternalRuntimeException();
+ return me;
+ } else {
+ return null;
+ }
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public Collection<IModelElement> getElementsInNamespace() {
+ try {
+ modelSpace.lock.readLock().lock();
+ int size = relationsFrom.size();
+ if (this instanceof IEntity) {
+ size += ((SimpleEntity) this).containment.size();
+ }
+ List<IModelElement> ret = new ArrayList<IModelElement>(size);
+ for (Iterator<Long> it = namespace.values().iterator(); it.hasNext();) {
+ Long id = it.next();
+ IModelElement me = relationsFrom.get(id);
+ if (me == null) {
+ if (this instanceof SimpleEntity)
+ me = ((SimpleEntity) this).containment
+ .get(id);
+ }
+ if (me == null)
+ // inkonzisztens a namespace, es a tartalmazasi cucc.
+ throw new VPMCoreInternalRuntimeException();
+ ret.add(me);
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public Collection<IModelElement> getAllElementsInNamespace() {
+ try {
+ modelSpace.lock.readLock().lock();
+ ArrayList<IModelElement> ret = new ArrayList<IModelElement>();
+ ret.addAll(getElementsInNamespace());
+ for (IModelElement elem : getElementsInNamespace()) {
+ ret.addAll(elem.getAllElementsInNamespace());
+ }
+ return ret;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ protected boolean isDeleted = false;
+
+ public boolean isDeleted() {
+ try {
+ // modelSpace.lock.lock();
+ return isDeleted;
+ } finally {
+ // modelSpace.lock.unlock();
+ }
+ }
+
+ public boolean isBelowNamespace(IModelElement grandpa) {
+ if (grandpa==null) {
+ //throw new VPMCoreNullParameterException("parameter grandpa cannot be null!");
+ modelSpace.framework.getLogger().warning("isBelowNamespace has been queried with a null parameter!");
+ return false;
+ }
+ IModelElement namespce = getNamespace();
+ if (namespce == null)
+ return false;
+ if (namespce.equals(grandpa))
+// if (grandpa.equals(namespce))
+ return true;
+ else
+ return namespce.isBelowNamespace(grandpa);
+ }
+
+ public Collection<IModelElement> getElementsInRelation(
+ EConstraint relationType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelManager.java
new file mode 100644
index 0000000..36210bf
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelManager.java
@@ -0,0 +1,1963 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.eclipse.viatra2.copier.ModelCopy;
+import org.eclipse.viatra2.copier.ModelCopyException;
+import org.eclipse.viatra2.core.EDeleteSemantics;
+import org.eclipse.viatra2.core.EModelElementProperty;
+import org.eclipse.viatra2.core.EMultiplicityKind;
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelManager;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+import org.eclipse.viatra2.core.simple.notification.NotificationObject;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectAtomicStepReady;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectCreateEntity;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectCreateInstanceOf;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectCreateRelation;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectCreateSupertypeOf;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectDeleteContainment;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectDeleteEntity;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectDeleteInstanceOf;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectDeleteRelation;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectDeleteSupertypeOf;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectMoreAtomicsToOneAtomEnd;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectMoreAtomicsToOneAtomStart;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectMoveTo;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetIsAny;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetIsFinalType;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetName;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetRelationFrom;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetRelationInverse;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetRelationIsAggregation;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetRelationMultiplicity;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetRelationTo;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetValue;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSetViewInfo;
+import org.eclipse.viatra2.errors.VPMCoreException;
+import org.eclipse.viatra2.errors.VPMCoreNullParameterException;
+import org.eclipse.viatra2.errors.VPMCoreRuntimeException;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * Class that manages the SimpleCore modelSpace.
+ *
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+public class SimpleModelManager implements IModelManager {
+ private SimpleModelSpace modelSpace;
+
+ private SimpleNotificationManager nManager;
+
+ private Logger logger;
+
+ /**
+ * The lock that must be locked when reading or updating the model
+ */
+ private ReadWriteLock lock = null;
+
+ // public static final String topEntityName="vpm.entity";
+ // public static final String topRelationName="vpm.entity.relation";
+ // public static final String topFunctionName="vpm.entity.function";
+ // / Exception messages
+ public static final String EXCEPTION_TYPE_BETWEEN_DIFFERENT_ELEMENTS = "type between different elements cannot be added: ";
+
+ public static final String EXCEPTION_INSTANCE_BETWEEN_DIFFERENT_ELEMENTS = "instance between different elements cannot be added: ";
+
+ public static final String EXCEPTION_ALREADY_SUPERTYPE = "new supertype: already supertype (may be recursive): ";
+
+ public static final String EXCEPTION_ALREADY_INSTANCE = "new instanceof: already instance (may be recursive): ";
+
+ public static final String EXCEPTION_NEW_SUPERTYPE_CAUSES_CIRCLE = "new supertype: relation would cause circle: ";
+
+ public static final String EXCEPTION_DELETE_SUPERTYPE_EDITOR_NO_RELATION = "deleteSupetypeOf(editor semantics): no direct supertypeOf relation is found: ";
+
+ public static final String EXCEPTION_DELETE_INSTANCEOF_NO_RELATION = "deleteInstanceOf(editor semantics): no direct instanceOf relation is found: ";
+
+ public static final String EXCEPTION_NEW_SUPERTYPE_MAKES_EXISTING_RELATION_IMPLICIT = "new supertype(editor semantics): relation would cause existing relation implicit: ";
+
+ public static final String EXCEPTION_NEW_INSTANCE_MAKES_EXISTING_RELATION_IMPLICIT = "new instance(editor semantics): relation would cause existing relation implicit: ";
+
+ private static final String parameterNullNotAllowed = "Parameter null not allowed";
+
+ private static final String WARNING_DELETE_NOT_SUPERTYPE = "deleteSupertypeOf(machine semantics): no supertypeof between elements: ";
+
+ /**
+ * Check the string if it can be the name of an element. The name of an
+ * element must not contain '.'
+ *
+ * @param name
+ * the requested name for new element
+ * @throws VPMCoreException
+ * if the name contains '.'
+ */
+ private void checkElemName(String name) throws VPMCoreException {
+ if (name.indexOf('.') >= 0)
+ throw new VPMCoreException(
+ "Name of element must not contain character dot('.')");
+ }
+
+ /**
+ * Initializes the model manager.
+ *
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, IModelSpace m) throws VPMRuntimeException {
+ modelSpace = (SimpleModelSpace) m;
+ lock = modelSpace.lock;
+ nManager = (SimpleNotificationManager) modelSpace
+ .getNotificationManager();
+ logger = l;
+ }
+
+ /**
+ * Retrieves the root element of the modelspace.
+ *
+ * @return root entity
+ */
+ public IEntity getRoot() {
+ return modelSpace.rootEntity;
+ }
+
+ /**
+ * Delete an element and all elements in its namespace
+ *
+ * @param root
+ * @throws VPMCoreException
+ */
+ private void deleteBranch(IModelElement root) throws VPMCoreException {
+ // Delete all elements in namespace (recursive)
+ while (root.getElementsInNamespace().size() > 0) {
+ IModelElement me = root.getElementsInNamespace().iterator().next();
+ deleteBranch(me);
+ // If the element is a relation then deleting the target element
+ // deletes the relation as well, so at this point the root can be
+ // deleted from model
+ if (root.isDeleted())
+ return;
+ }
+ // delete this element
+ deleteElement(root, EDeleteSemantics.DELETE_SEMANTICS_FORCE);
+ }
+
+ /**
+ * Deletes the entity from the modelspace according to a specified
+ * semantics.
+ *
+ * @param e
+ * entity to be deleted
+ * @param semantics
+ * semantics id
+ */
+ public void deleteEntity(IEntity e, EDeleteSemantics semantics)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ // checl parameters
+ if (e == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ if (e == modelSpace.ancestorEntity
+ || e == modelSpace.ancestorContainer) {
+ throw new VPMCoreException(
+ "ancestor entity can not be deleted.");
+ }
+ if (!modelSpace.entitiesSet.contains(e)) {
+ throw new VPMCoreException(
+ "Entity to be deleted not in modelSpace.");
+ }
+ if (EDeleteSemantics.DELETE_SEMANTICS_BRANCH_FORCE == semantics) {
+ deleteBranch(e);
+ return;
+ }
+ if (semantics == EDeleteSemantics.DELETE_SEMANTICS_FORCE) {
+ if (e.equals(getRoot())) {
+ throw new VPMCoreException("Root entity cannot be deleted.");
+ }
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomStart());
+ // Delete all relations that have this element as source or
+ // target
+ deleteConnections(e, semantics); // moved here by Istvan Rath:
+ // IMPORTANT FOR DSM fw!!!
+ // Delete all instanceof and supertype relations from and to
+ // this element
+ deleteFromTypeHierarchy(e);
+ IEntity parent = e.getParent();
+ // Remove the element from its container: now it has no parent
+ deleteFromContainer(e);
+ // Move all contained entities to the root
+ deleteFromContainerHierarchy(e);
+ // notify the change
+ NotificationObject note = new NotificationObjectDeleteEntity(
+ (SimpleEntity) e, (SimpleEntity) parent);
+ // remove the object from the model
+ modelSpace.entities
+ .remove(((SimpleModelElement) e).getLongID());
+ modelSpace.entitiesSet.remove(e);
+ // set the element deleted
+ ((SimpleEntity) e).isDeleted = true;
+ sendNotification(note);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomEnd());
+ sendNotification(new NotificationObjectAtomicStepReady());
+ return;
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Deletes a relation (or function) from the modelspace.
+ *
+ * @param r
+ * the relation to be deleted.
+ * @throws VPMCoreNullParameterException
+ */
+ public void deleteRelation(IRelation r, EDeleteSemantics semantics)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (r == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ if (r == modelSpace.ancestorRelation)
+ throw new VPMCoreException(
+ "ancestor relation can not be deleted");
+ _deleteRelation(r, semantics);
+ return;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ private void _deleteRelation(IRelation r, EDeleteSemantics semantics)
+ throws VPMCoreException {
+ if (EDeleteSemantics.DELETE_SEMANTICS_BRANCH_FORCE == (semantics)) {
+ deleteBranch(r);
+ return;
+ }
+ if (semantics == (EDeleteSemantics.DELETE_SEMANTICS_FORCE)) {
+ SimpleRelation rel = (SimpleRelation) r;
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomStart());
+ // delete all type and subtype relations
+ deleteFromTypeHierarchy(rel);
+ NotificationObject note;
+ note = new NotificationObjectDeleteRelation(rel,
+ (SimpleModelElement) rel.getFrom(),
+ (SimpleModelElement) rel.getTo());
+ setRelFrom(rel, null);
+ setRelTo(rel, null);
+ // delete all relations from and to this element
+ deleteConnections(rel, semantics);
+ // remove the relation from model
+ modelSpace.relations.remove(rel.getLongID());
+ modelSpace.relationsSet.remove(rel);
+ rel.isDeleted = true;
+ sendNotification(note);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomEnd());
+ sendNotification(new NotificationObjectAtomicStepReady());
+ return;
+ }
+ throw new VPMCoreRuntimeException("No semantics defined for delete");
+ }
+
+ /**
+ * Delete all instanceOf and supertypeOf links from this element
+ *
+ * @param _me
+ */
+ private void deleteFromTypeHierarchy(IModelElement _me)
+ throws VPMCoreException {
+ SimpleModelElement me = (SimpleModelElement) _me;
+ ArrayList<IModelElement> l = new ArrayList<IModelElement>(me.supertype);
+ for (int i = 0; i < l.size(); ++i) {
+ deleteSupertypeOfDirect((SimpleModelElement) l.get(i), me);
+ }
+ l = new ArrayList<IModelElement>(me.subtypes);
+ for (int i = 0; i < l.size(); ++i) {
+ deleteSupertypeOfDirect(me, (SimpleModelElement) l.get(i));
+ }
+
+ l = new ArrayList<IModelElement>(me.type);
+ for (int i = 0; i < l.size(); ++i) {
+ deleteInstanceOfDirect((SimpleModelElement) l.get(i), me);
+ }
+ l = new ArrayList<IModelElement>(me.instances);
+ for (int i = 0; i < l.size(); ++i) {
+ deleteInstanceOfDirect(me, (SimpleModelElement) l.get(i));
+ }
+ }
+
+ private void deleteFromContainer(IEntity _me)
+ throws VPMCoreNullParameterException, VPMCoreException {
+ SimpleEntity me = (SimpleEntity) _me;
+ SimpleEntity par = me.parent;
+ par.containment.remove(me.getLongID());
+ removeFromNamespace(par, _me);
+ me.parent = null;
+ NotificationObject note = new NotificationObjectDeleteContainment(par,
+ me);
+ sendNotification(note);
+ }
+
+ private void deleteFromContainerHierarchy(IEntity _me)
+ throws VPMCoreNullParameterException, VPMCoreException {
+ SimpleEntity ent = (SimpleEntity) _me;
+ ArrayList<IModelElement> children = new ArrayList<IModelElement>(
+ ent.containment.values());
+ for (int i = 0; i < children.size(); ++i) {
+ SimpleEntity child = (SimpleEntity) children.get(i);
+ moveEntityTo(child, getRoot());
+ }
+ }
+
+ private void deleteConnections(IModelElement _ent,
+ EDeleteSemantics semantics) {
+ SimpleModelElement ent = (SimpleModelElement) _ent;
+ // Iterator it=ent.getConnections().iterator();
+ Iterator it = ent.getRelations().iterator();
+ // TODO Self connections must be contained only once in the collection.
+ // So the collection is a Set
+ while (it.hasNext()) {
+ SimpleRelation r = (SimpleRelation) it.next();
+ try {
+ // TODO elvileg nem lehet exception
+ deleteRelation(r, semantics);
+ } catch (VPMCoreException e) {
+ }
+ }
+ }
+
+ /**
+ * Retrives the model element by its name
+ *
+ * @param n
+ * the fully qualified model element name
+ * @return element if found, else null
+ */
+ public IModelElement getElementByName(String n) {
+ try {
+ lock.readLock().lock();
+ IModelElement weAreHere = getRoot();
+ while (n != null && !n.equals("") && weAreHere != null) {
+ int k;
+ int l = n.indexOf('.');
+ k = l + 1;
+ if (l == -1) {
+ l = n.length();
+ k = l;
+ }
+ String name = n.substring(0, l);
+ weAreHere = weAreHere.getElementInNamespaceByName(name);
+ n = n.substring(k);
+ }
+ return weAreHere;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Retrieves an entity by its name
+ *
+ * @param n
+ * fully qualified name of entity
+ * @return entity if found, else null
+ */
+ public IEntity getEntityByName(String n) {
+ IModelElement me = getElementByName(n);
+ if (me instanceof IEntity) {
+ return (IEntity) me;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Retrieves a relation by its name
+ *
+ * @param n
+ * fully qualified name of relation
+ * @return relation if found, else null
+ */
+ public IRelation getRelationByName(String n) {
+ IModelElement me = getElementByName(n);
+ if (me instanceof IRelation) {
+ return (IRelation) me;
+ }
+ return null;
+ }
+
+ /**
+ * Retrives the model element by its ID
+ *
+ * @param n
+ * model element ID
+ * @return element if found, else null
+ */
+ public IModelElement getElementByID(String n) {
+ if (n == null)
+ return null; // added by Istvan Rath.
+ try {
+ lock.readLock().lock();
+ long reqID = 0;
+ try {
+ reqID = Long.parseLong(n);
+ } catch (NumberFormatException e) {
+ // if the string represents no number, then it is no ID of any
+ // elements in modelspace
+ return null;
+ }
+ if (!n.equals(Long.toString(reqID)))
+ return null;
+ IModelElement ret = modelSpace.entities.get(reqID);
+ if (ret == null)
+ ret = modelSpace.relations.get(reqID);
+ return ret;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Retrieves an entity by its ID
+ *
+ * @param n
+ * ID of entity
+ * @return entity if found, else null
+ */
+ public IEntity getEntityByID(String n) {
+ IModelElement ret = getElementByID(n);
+ if (ret instanceof IEntity)
+ return (IEntity) ret;
+ return null;
+ }
+
+ /**
+ * Retrieves a relation by its ID
+ *
+ * @param n
+ * ID of relation
+ * @return relation if found, else null
+ */
+ public IRelation getRelationByID(String n) {
+ IModelElement ret = getElementByID(n);
+ if (ret instanceof IRelation)
+ return (IRelation) ret;
+ return null;
+ }
+
+ /**
+ * Retrives all entities currently in the modelspace.
+ *
+ * @return collection of entities
+ */
+ public Set<? extends IEntity> getEntities() {
+ try {
+ lock.readLock().lock();
+ // return new ConstantSet<IEntity>(modelSpace.entitiesSet);
+ return modelSpace.entitiesSet;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Retrieves all relations currently in the modelspace.
+ *
+ * @return collection of relations
+ */
+ public Set<? extends IRelation> getRelations() {
+ try {
+ lock.readLock().lock();
+ // return new ConstantSet<IRelation>(modelSpace.relationsSet);
+ return modelSpace.relationsSet;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ private void setElemName(SimpleModelElement ent, String name) {
+ ent.name = name;
+ }
+
+ private void setRelFrom(SimpleRelation rel, SimpleModelElement from)
+ throws VPMCoreException {
+ SimpleModelElement oldRelFrom = (SimpleModelElement) rel.getFrom();
+ if (oldRelFrom != null) {
+ oldRelFrom.relationsFrom.remove(rel.getLongID());
+ removeFromNamespace(rel.from, rel);
+ }
+ rel.from = from;
+ if (from != null) {
+ from.relationsFrom.put(rel.getLongID(), rel);
+ addToNamespace(from, rel);
+ }
+ }
+
+ private void setRelTo(SimpleRelation rel, SimpleModelElement to) {
+ SimpleModelElement oldRelTo = (SimpleModelElement) rel.getTo();
+ if (oldRelTo != null) {
+ oldRelTo.relationsTo.remove(rel);
+ }
+ rel.to = to;
+ if (to != null) {
+ to.relationsTo.add(rel);
+ }
+ }
+
+ private SimpleRelation createRelation(IModelElement from, IModelElement to,
+ String name) throws VPMCoreException {
+ checkElemName(name);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomStart());
+ SimpleRelation newRel = new SimpleRelation(modelSpace.newId(),
+ modelSpace);
+ modelSpace.relations.put(newRel.getLongID(), newRel);
+ modelSpace.relationsSet.add(newRel);
+ setElemName(newRel, name);
+ setRelFrom(newRel, (SimpleModelElement) from);
+ setRelTo(newRel, (SimpleModelElement) to);
+ NotificationObject note = new NotificationObjectCreateRelation(newRel,
+ (SimpleModelElement) from, (SimpleModelElement) to);
+ sendNotification(note);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomEnd());
+ return newRel;
+ }
+
+ // protected SimpleRelation undoCreateRelation(SimpleRelation rel,
+ // SimpleEntity from, SimpleEntity to) throws VPMCoreException
+ protected SimpleRelation undoCreateRelation(SimpleRelation rel,
+ SimpleModelElement from, SimpleModelElement to)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ modelSpace.relations.put(rel.getLongID(), rel);
+ modelSpace.relationsSet.add(rel);
+ setRelFrom(rel, from);
+ setRelTo(rel, to);
+ rel.isDeleted = false;
+ NotificationObject note = new NotificationObjectCreateRelation(rel,
+ from, to);
+ sendNotification(note);
+ return rel;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new entity in modelSpace
+ *
+ * @param container
+ * the entity's initial container
+ * @param name
+ * the entity's initial name
+ * @param value
+ * the entity's initial value
+ * @return the entity
+ * @throws VPMCoreException
+ */
+ private SimpleEntity createEntity(SimpleEntity container, String name,
+ String value) throws VPMCoreException {
+ checkElemName(name);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomStart());
+
+ SimpleEntity newEnt = new SimpleEntity(modelSpace.newId(), modelSpace);
+ modelSpace.entities.put(newEnt.getLongID(), newEnt);
+ modelSpace.entitiesSet.add(newEnt);
+ setElemName(newEnt, name);
+ newEnt.value = value;
+ firstContainment(container, newEnt);
+ NotificationObject notification = new NotificationObjectCreateEntity(
+ newEnt, container);
+ sendNotification(notification);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomEnd());
+ return newEnt;
+ }
+
+ /**
+ * Put me into container.
+ *
+ * @param container
+ * the container
+ * @param me
+ * the modelelement to put into container
+ */
+ protected void undoCreateContainment(SimpleEntity container, SimpleEntity me)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ container.containment.put(me.getLongID(), me);
+ me.parent = container;
+ // following added by Istvan Rath
+ addToNamespace(container, me);
+ NotificationObject note = new NotificationObjectMoveTo(me,
+ container, (SimpleEntity) me.getParent());
+ sendNotification(note);
+ // end added by Istvan Rath
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Put an entity into modelspace when undo.
+ *
+ * @param entity
+ * the entity to put back into modelSpace
+ * @return the entity
+ */
+ protected SimpleEntity undoCreateEntity(SimpleEntity entity,
+ SimpleEntity parent) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ entity.notificationListeners = new ArrayList<ICoreNotificationListener>();
+ modelSpace.entities.put(entity.getLongID(), entity);
+ modelSpace.entitiesSet.add(entity);
+ entity.isDeleted = false;
+ NotificationObject notification = new NotificationObjectCreateEntity(
+ entity, parent);
+ sendNotification(notification);
+ return entity;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new entity with a random and unique name in the modelspace root
+ *
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity() {
+ try {
+ return newEntity(modelSpace.uniqueName(), "", getRoot());
+ } catch (VPMCoreException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Creates a new entity with a random and unique name in the specified
+ * container
+ *
+ * @param container
+ * the container
+ * @return reference to the entity
+ * @throws VPMCoreException
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(IEntity container) throws VPMCoreException {
+ return newEntity(modelSpace.uniqueName(), "", container);
+ }
+
+ /**
+ * Creates a new entity with the given name in the modelspace root
+ *
+ * @param name
+ * the name of the entity
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name) throws VPMCoreException {
+ return newEntity(name, "", getRoot());
+ }
+
+ /**
+ * Creates a new entity with the given name and container
+ *
+ * @param name
+ * the name of the entity
+ * @param container
+ * the container
+ * @return reference to the entity
+ * @throws VPMCoreException
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name, IEntity container)
+ throws VPMCoreException {
+ return newEntity(name, "", container);
+ }
+
+ /**
+ * Creates a new entity with the given name and value in the modelspace root
+ *
+ * @param name
+ * the name of the entity
+ * @param value
+ * the value of the entity
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name, String value) throws VPMCoreException {
+ return newEntity(name, value, getRoot());
+ }
+
+ /**
+ * Creates a new entity with the given name, value and container
+ *
+ * @param name
+ * the name of the entity
+ * @param value
+ * the value of the entity
+ * @param container
+ * the container
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name, String value, IEntity container)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (name == null || container == null || value == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleEntity newEnt = createEntity((SimpleEntity) container, name,
+ value);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ return newEnt;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new entity with the given name, value container and a single type.
+ * Each of the parameters can be left null.
+ *
+ * @param name
+ * the name of the entity
+ * @param value
+ * the value of the entity
+ * @param container
+ * the container
+ * @param type
+ * the single initial type of the entity
+ * @return reference to the entity
+ * @throws VPMCoreException
+ */
+ public IEntity newEntity(String name, String value, IEntity container, IEntity type)
+ throws VPMCoreException
+ {
+ try {
+ lock.writeLock().lock();
+ if (name==null) name = modelSpace.uniqueName();
+ if (value==null) value = "";
+ if (container==null) container = getRoot();
+ IEntity newEnt = newEntity(name, value, container);
+ if (type != null) newInstanceOf(type, newEnt);
+ return newEnt;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new relation with a random and unique name, between the given model elements.
+ *
+ * @param from
+ * source entity
+ * @param to
+ * target entity
+ * @return reference to the new relation
+ * @throws VPMCoreException
+ */
+ public IRelation newRelation(IModelElement from, IModelElement to)
+ throws VPMCoreException {
+ return newRelation(modelSpace.uniqueName(), from, to);
+ }
+
+ public IRelation newRelation(IModelElement from, IModelElement to,
+ EMultiplicityKind multiplicity, boolean isaggregation,
+ IRelation inverse) throws VPMCoreException {
+ return newRelation(modelSpace.uniqueName(), from, to, multiplicity,
+ isaggregation, inverse);
+ }
+
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, EMultiplicityKind multiplicity,
+ boolean isaggregation, IRelation inverse) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (from == null || to == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleRelation newRel = createRelation(from, to, name);
+ newRel.multiplicity = multiplicity;
+ newRel.inverse = inverse;
+ newRel.isAggregation = isaggregation;
+ sendNotification(new NotificationObjectAtomicStepReady());
+ return newRel;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new relation with the given name, between the given model elements.
+ *
+ * @param name
+ * name of relation
+ * @param from
+ * source entity
+ * @param to
+ * target entity
+ * @return reference to the new relation
+ * @throws VPMCoreException
+ */
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to) throws VPMCoreException {
+ return newRelation(name, from, to, EMultiplicityKind.MANY_TO_MANY,
+ false, null);
+ }
+
+ /**
+ * Creates a new relation with the given name, between the given model elements, with the given single type.
+ * Name and type can be left null.
+ *
+ * @param name
+ * name of relation
+ * @param from
+ * source entity
+ * @param to
+ * target entity
+ * @param type
+ * the single initial type of the relation
+ * @return reference to the new relation
+ * @throws VPMCoreException
+ */
+ public IRelation newRelation(String name, IModelElement from,
+ IModelElement to, IRelation type) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (name==null) name = modelSpace.uniqueName();
+ IRelation newRel = newRelation(name, from, to);
+ if (type!=null) newInstanceOf(type, newRel);
+ return newRel;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * returns the type of modelelement
+ *
+ * @param e
+ * @return 0: entity 1: function 2: relation -1:not modelelement
+ */
+ int getElementType(IModelElement e) {
+ if (e instanceof IEntity)
+ return 0;
+ if (e instanceof IRelation)
+ return 2;
+ return -1;
+ }
+
+ /**
+ * Creates an instanceOf relation between the two model elements
+ *
+ * @param type
+ * the type element
+ * @param inst
+ * the instance
+ */
+ public void newInstanceOf(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ newInstanceOfMachine(type, inst);
+ }
+
+ /**
+ * Creates a new supertypeOf relation between the two elements
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void newSupertypeOf(IModelElement sup, IModelElement sub)
+ throws VPMCoreException {
+ newSupertypeOfMachine(sup, sub);
+ }
+
+ /**
+ * Creates a new supertypeOf relation between the two elements with editor
+ * semantics: only the minimal requied supertypeOf relations can be exactly
+ * added
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void newSupertypeOfEditor(IModelElement sup, IModelElement sub)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (sup == null || sub == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleModelElement _sup = (SimpleModelElement) sup;
+ SimpleModelElement _sub = (SimpleModelElement) sub;
+ if (getElementType(sup) != getElementType(sub))
+ throw new VPMCoreException(
+ EXCEPTION_TYPE_BETWEEN_DIFFERENT_ELEMENTS
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ if (_sub.getAllSupertypes().contains(_sup))
+ throw new VPMCoreException(EXCEPTION_ALREADY_SUPERTYPE
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ if (_sup.getAllSupertypes().contains(_sub))
+ throw new VPMCoreException(
+ EXCEPTION_NEW_SUPERTYPE_CAUSES_CIRCLE
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ if (!CollectionsDisjunktTester.isDisjunct(_sup.getAllSupertypes(),
+ _sub.supertype)
+ || !CollectionsDisjunktTester.isDisjunct(_sub
+ .getAllSubtypes(), _sup.subtypes))
+ throw new VPMCoreException(
+ EXCEPTION_NEW_SUPERTYPE_MAKES_EXISTING_RELATION_IMPLICIT
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ newSupertypeOfDirect(_sup, _sub);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new instanceOf relation between the two elements with editor
+ * semantics: only the minimal requied instanceOf relations can be exactly
+ * added
+ *
+ * @param sup
+ * the supertype
+ * @param inst
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void newInstanceOfEditor(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (type == null || inst == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleModelElement _type = (SimpleModelElement) type;
+ SimpleModelElement _inst = (SimpleModelElement) inst;
+ if (getElementType(type) != getElementType(inst))
+ throw new VPMCoreException(
+ EXCEPTION_INSTANCE_BETWEEN_DIFFERENT_ELEMENTS
+ + type.getFullyQualifiedName() + ","
+ + inst.getFullyQualifiedName());
+ if (_inst.getAllTypes().contains(_type))
+ throw new VPMCoreException(EXCEPTION_ALREADY_INSTANCE
+ + type.getFullyQualifiedName() + ","
+ + inst.getFullyQualifiedName());
+ if (!CollectionsDisjunktTester.isDisjunct(_type.getAllSupertypes(),
+ _inst.type))
+ throw new VPMCoreException(
+ EXCEPTION_NEW_INSTANCE_MAKES_EXISTING_RELATION_IMPLICIT
+ + type.getFullyQualifiedName() + ","
+ + inst.getFullyQualifiedName());
+ newInstanceOfDirect(_type, _inst);
+ if (inst instanceof IRelation) {
+ checkIsAggregationSemantics((SimpleRelation) inst);
+ }
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new instanceOf relation between the two elements with machine
+ * semantics: only the minimal requied instanceOf relations can be exactly
+ * added
+ *
+ * @param sup
+ * the supertype
+ * @param inst
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void newInstanceOfMachine(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (type == null || inst == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleModelElement _type = (SimpleModelElement) type;
+ SimpleModelElement _inst = (SimpleModelElement) inst;
+ if (getElementType(type) != getElementType(inst))
+ throw new VPMCoreException(
+ EXCEPTION_INSTANCE_BETWEEN_DIFFERENT_ELEMENTS
+ + type.getFullyQualifiedName() + ","
+ + inst.getFullyQualifiedName());
+ if (_inst.getAllTypes().contains(_type))
+ return;
+ newInstanceOfDirect(_type, _inst);
+ // Delete direct arcs made implicit
+ Collection col = CollectionsDisjunktTester.sharedElements(_type
+ .getAllSupertypes(), _inst.type);
+ Iterator it = col.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ deleteInstanceOfDirect(me, _inst);
+ }
+ if (inst instanceof IRelation) {
+ checkIsAggregationSemantics((SimpleRelation) inst);
+ }
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Creates a new supertypeOf relation between the two elements with editor
+ * semantics: relation will be added if not present already
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void newSupertypeOfMachine(IModelElement _sup, IModelElement _sub)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (_sup == null || _sub == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleModelElement sup = (SimpleModelElement) _sup;
+ SimpleModelElement sub = (SimpleModelElement) _sub;
+ if (getElementType(sup) != getElementType(sub))
+ throw new VPMCoreException(
+ EXCEPTION_TYPE_BETWEEN_DIFFERENT_ELEMENTS
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ if (sup == sub || _sub.getAllSupertypes().contains(_sup)) {
+ // TODO kell-e warning??
+ // log_warn(WARNING_ALREADY_SUPERTYPE,sup, sub);
+ return;
+ }
+ if (_sup.getAllSupertypes().contains(_sub))
+ throw new VPMCoreException(
+ EXCEPTION_NEW_SUPERTYPE_CAUSES_CIRCLE
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ // Add this relation
+ newSupertypeOfDirect(sup, sub);
+ // Delete all relations made implicit by this relation
+ Collection madeImplicit = CollectionsDisjunktTester.sharedElements(
+ sub.supertype, sup.getAllSupertypes());
+ Iterator it = madeImplicit.iterator();
+ while (it.hasNext()) {
+ // implicit ancestor of sub
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ deleteSupertypeOfDirect(me, sub);
+ }
+ // Implicits on other side:
+ madeImplicit = CollectionsDisjunktTester.sharedElements(
+ sup.subtypes, sub.getAllSubtypes());
+ it = madeImplicit.iterator();
+ while (it.hasNext()) {
+ // implicit ancestor of sub
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ deleteSupertypeOfDirect(sup, me);
+ }
+
+ // Transaction is ready, modelSpace is in consistent state. Add Undo
+ // point
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Adds a direct supertypeof relation (editor style). No check is done. This
+ * is the main step of all supertypeof relation mechanisms.
+ *
+ * @param sup
+ * @param sub
+ */
+ private void newSupertypeOfDirect(SimpleModelElement sup,
+ SimpleModelElement sub) {
+ sup.subtypes.add(sub);
+ sub.supertype.add(sup);
+ NotificationObject note = new NotificationObjectCreateSupertypeOf(sup,
+ sub);
+ /*
+ * NotificationObject note=new
+ * NotificationObject(ICoreNotificationObject
+ * .ACTION_CREATE_SUPERTYPEOF); note.addParameterElem(sup);
+ * note.addParameterElem(sub);
+ */
+ sendNotification(note);
+ }
+
+ /**
+ * Adds a direct instanceof relation (editor style). No check is done. This
+ * is the main step of all instanceof relation mechanisms.
+ *
+ * @param type
+ * @param inst
+ */
+ private void newInstanceOfDirect(SimpleModelElement type,
+ SimpleModelElement inst) {
+ type.instances.add(inst);
+ inst.type.add(type);
+ NotificationObject note = new NotificationObjectCreateInstanceOf(type,
+ inst);
+ /*
+ * NotificationObject note=new
+ * NotificationObject(ICoreNotificationObject.ACTION_CREATE_INSTANCEOF);
+ * note.addParameterElem(type); note.addParameterElem(inst);
+ */
+ sendNotification(note);
+ }
+
+ /**
+ * Creates a new containment, without notification of name change, if that
+ * happens. It is used, when creating new element.
+ *
+ * @param cont
+ * @param elem
+ */
+ private void firstContainment(IEntity cont, IEntity elem)
+ throws VPMCoreException {
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomStart());
+ _newContainment(cont, elem);
+ sendNotification(new NotificationObjectMoreAtomicsToOneAtomEnd());
+ }
+
+ private void addToNamespace(IModelElement cont, IModelElement elem) {
+ SimpleModelElement e = (SimpleModelElement) elem;
+ SimpleModelElement c = (SimpleModelElement) cont;
+ String nameKey = e.getName();
+ Long id = c.namespace.get(nameKey);
+ if (id == null) {
+ c.namespace.put(e.getName(), e.getLongID());
+ } else {
+ String newName = modelSpace.uniqueName(e.getName());
+ log_warn_nameclash(e, c, newName);
+ e.name = newName;
+ NotificationObject note = new NotificationObjectSetName(e, newName,
+ nameKey);
+ sendNotification(note);
+ addToNamespace(cont, elem);
+ }
+ }
+
+ private void removeFromNamespace(IModelElement cont, IModelElement elem) {
+ ((SimpleModelElement) cont).namespace.remove(elem.getName());
+ }
+
+ /**
+ * Creates a new containment, without sending Atomic_step notification
+ *
+ * @param cont
+ * @param elem
+ */
+ private void _newContainment(IEntity cont, IEntity elem)
+ throws VPMCoreException {
+ SimpleEntity e = (SimpleEntity) elem;
+ SimpleEntity c = (SimpleEntity) cont;
+ if (e.parent != null)
+ throw new VPMCoreException("core internal error");
+ c.containment.put(e.getLongID(), e);
+ e.parent = c;
+ addToNamespace(cont, elem);
+ }
+
+ /**
+ * Deletes the instanceOf relation between the two model elements
+ *
+ * @param type
+ * the type element
+ * @param inst
+ * the instance
+ * @throws VPMCoreNullParameterException
+ */
+ public void deleteInstanceOf(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ deleteInstanceOfMachine(type, inst);
+ }
+
+ /**
+ * Deletes the supertypeOf relation between the two elements
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ */
+ public void deleteSupertypeOf(IModelElement sup, IModelElement sub)
+ throws VPMCoreException {
+ deleteSupertypeOfMachine(sup, sub);
+ }
+
+ public void deleteSupertypeOfEditor(IModelElement sup, IModelElement sub)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (sup == null || sub == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleModelElement _sup = (SimpleModelElement) sup;
+ SimpleModelElement _sub = (SimpleModelElement) sub;
+ if (_sub.supertype.contains(_sup)) {
+ deleteSupertypeOfDirect(_sup, _sub);
+ } else {
+ throw new VPMCoreException(
+ EXCEPTION_DELETE_SUPERTYPE_EDITOR_NO_RELATION
+ + sup.getFullyQualifiedName() + ","
+ + sub.getFullyQualifiedName());
+ }
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void deleteInstanceOfEditor(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (inst == null || type == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleModelElement _type = (SimpleModelElement) type;
+ SimpleModelElement _inst = (SimpleModelElement) inst;
+ if (_inst.type.contains(_type)) {
+ deleteInstanceOfDirect(_type, _inst);
+ } else {
+ throw new VPMCoreException(
+ EXCEPTION_DELETE_INSTANCEOF_NO_RELATION
+ + type.getFullyQualifiedName() + ","
+ + inst.getFullyQualifiedName());
+ }
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ private boolean stupidMethod = false;
+
+ public void deleteInstanceOfMachine(IModelElement type, IModelElement inst)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (inst == null || type == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleModelElement _type = (SimpleModelElement) type;
+ SimpleModelElement _inst = (SimpleModelElement) inst;
+ boolean isDeleted = false;
+ // if direct instanceof delete it
+ if (_inst.type.contains(_type)) {
+ deleteInstanceOfDirect(_type, _inst);
+ isDeleted = true;
+ }
+ // if not direct delete all instance arrows that
+ // implicate the ine to delete
+ else {
+ Iterator<IModelElement> it = _inst.type.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ if (me.getAllSupertypes().contains(_type)) {
+ deleteInstanceOfDirect(me, _inst);
+ isDeleted = true;
+ }
+ }
+ }
+ // Create all implicit instanceofs direct
+ if (stupidMethod) {
+ if (isDeleted) {
+ Iterator<IModelElement> iter = _type.supertype.iterator();
+ while (iter.hasNext()) {
+ SimpleModelElement supMeType = (SimpleModelElement) iter
+ .next();
+ if (!_inst.getAllTypes().contains(supMeType))
+ newInstanceOfDirect(supMeType, _inst);
+ }
+ }
+ }
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * delete supertype relation between sup and sub with machine semantics: no
+ * error if relation is not present no warn if it is an implicit relation
+ * delete the minimum number of direct relationships do not delete
+ * relationships (make new direct relationships) which were caused implicit
+ * by this relationship
+ *
+ * @param sup
+ * the supertype
+ * @param sub
+ * the subtype
+ * @throws VPMCoreNullParameterException
+ * @throws VPMCoreException
+ */
+ public void deleteSupertypeOfMachine(IModelElement sup, IModelElement sub)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (sup == null || sub == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleModelElement _sup = (SimpleModelElement) sup;
+ SimpleModelElement _sub = (SimpleModelElement) sub;
+ ArrayList<IModelElement> deletedList = new ArrayList<IModelElement>();
+ // Delete if direct arc exists
+ if (_sub.supertype.contains(_sup)) {
+ deleteSupertypeOfDirect(_sup, _sub);
+ deletedList.add(_sup);
+ }
+ // Tricky delete
+ else {
+ // Find all arcs that makes it subtype of sup
+ Iterator it = _sub.supertype.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = (SimpleModelElement) it.next();
+ if (me.getAllSupertypes().contains(_sup)) {
+ deleteSupertypeOfDirect(me, _sub);
+ deletedList.add(me);
+ }
+ }
+ }
+ if (stupidMethod) {
+ // Add sub the super elements of sup (implicit arcs become
+ // explicit)
+ if (!deletedList.isEmpty()) {
+ Iterator iter = _sup.supertype.iterator();
+ while (iter.hasNext()) {
+ SimpleModelElement supMeSup = (SimpleModelElement) iter
+ .next();
+ if (!_sub.getAllSupertypes().contains(supMeSup))
+ newSupertypeOfDirect(supMeSup, _sub);
+ }
+ }
+ // Add subSubtyped elements the old supertype (implicit arcs
+ // become explicit)
+ for (int i = 0; i < deletedList.size(); ++i) {
+ SimpleModelElement supMe = (SimpleModelElement) deletedList
+ .get(i);
+ Iterator it = _sub.subtypes.iterator();
+ while (it.hasNext()) {
+ SimpleModelElement subMe = (SimpleModelElement) it
+ .next();
+ newSupertypeOfDirect(supMe, subMe);
+ }
+ }
+ }
+ if (deletedList.size() == 0) {
+ log_warn(WARNING_DELETE_NOT_SUPERTYPE, _sup, _sub);
+ } else {
+ sendNotification(new NotificationObjectAtomicStepReady());
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Delete the supertypeof relation between the two elements. The relation to
+ * be deleted must be direct
+ *
+ * @param sup
+ * supertype
+ * @param sub
+ * subtype
+ * @throws VPMCoreNullParameterException
+ * @throws VPMCoreException
+ */
+ private void deleteSupertypeOfDirect(SimpleModelElement sup,
+ SimpleModelElement sub) throws VPMCoreNullParameterException,
+ VPMCoreException {
+ sup.subtypes.remove(sub);
+ sub.supertype.remove(sup);
+ NotificationObject note = new NotificationObjectDeleteSupertypeOf(sup,
+ sub);
+ sendNotification(note);
+ }
+
+ /**
+ * Delete the instanceof relation between the two elements. The relation to
+ * be deleted must be direct
+ *
+ * @param type
+ * @param inst
+ * @throws VPMCoreNullParameterException
+ * @throws VPMCoreException
+ */
+ private void deleteInstanceOfDirect(SimpleModelElement type,
+ SimpleModelElement inst) throws VPMCoreNullParameterException,
+ VPMCoreException {
+ type.instances.remove(inst);
+ inst.type.remove(type);
+ NotificationObject note = new NotificationObjectDeleteInstanceOf(type,
+ inst);
+ sendNotification(note);
+ }
+
+ /**
+ * Sets the name of the element
+ *
+ * @param e
+ * the element
+ * @param n
+ * the new name
+ * @throws VPMCoreException
+ */
+ public void setName(IModelElement e, String n) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (e == null || n == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ // check name if valid
+ checkElemName(n);
+ _setName((SimpleModelElement) e, n);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Sets the name of the element without sending ATOMIC_ACTION NOTIFICATION
+ *
+ * @param elem
+ * the element
+ * @param n
+ * the new name
+ */
+ private void _setName(SimpleModelElement elem, String n) {
+ String oldName = elem.getName();
+ if (n.equals(oldName)) {
+ // name not changing, nothing to do
+ return;
+ }
+ SimpleModelElement par = (SimpleModelElement) elem.getNamespace();
+ // check if elements has a namespace
+ // all elements must have namespace, but this method may be called
+ // in a non-consistent state
+ if (par != null) {
+ if (par.namespace.get(n) != null) {
+ // if the container already has an element with the name to be
+ // set
+ // then generate a new name.
+ log_warn(WARNING_NAME_CLASH_AT_NAME_CHANGE + n, elem, par);
+ n = modelSpace.uniqueName(n);
+ }
+ // We must not change name while in container, because the container
+ // sorts contained
+ // elements by name:
+ removeFromNamespace(elem.getNamespace(), elem);
+ elem.name = n;
+ addToNamespace(elem.getNamespace(), elem);
+ } else {
+ elem.name = n;
+ }
+ NotificationObject note = new NotificationObjectSetName(elem, n,
+ oldName);
+ sendNotification(note);
+ }
+
+ /**
+ * Sets the value of the entity
+ *
+ * @param e
+ * the entity
+ * @param v
+ * the new value
+ * @throws VPMCoreNullParameterException
+ */
+ public void setValue(IEntity e, String v)
+ throws VPMCoreNullParameterException {
+ try {
+ lock.writeLock().lock();
+ if (e == null || v == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleEntity ent = (SimpleEntity) e;
+ String oldValue = ent.value;
+ ent.value = v;
+ NotificationObject note = new NotificationObjectSetValue(ent, v,
+ oldValue);
+ sendNotification(note);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Removes the element from its current container and moves it to the
+ * specified new container
+ *
+ * @param e
+ * the element
+ * @param cont
+ * new container
+ */
+ public void moveEntityTo(IEntity e, IEntity cont) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ // TODO mi van, ha pont abban a kontenerban van?
+ if (e == null || cont == null) {
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ }
+ SimpleEntity ent = (SimpleEntity) e;
+ SimpleEntity par = ent.parent;
+ if (ent.equals(cont))
+ throw new VPMCoreException(
+ "error in parameters of moveEntityTo: parent and children are equal");
+ if (par == cont)
+ return;
+ par.containment.remove(ent.getLongID());
+ ent.parent = null;
+ removeFromNamespace(par, ent);
+ _newContainment(cont, e);
+ NotificationObject note = new NotificationObjectMoveTo(ent,
+ (SimpleEntity) cont, par);
+ sendNotification(note);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ return;
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Send the given notification to all listeners, which have a category
+ * higher than the set notification level.
+ *
+ * @param notification
+ */
+ private void sendNotification(ICoreNotificationObject notification) {
+ modelSpace.numberOfChanges++;
+ if (nManager != null)
+ nManager.sendNotification(notification);
+ }
+
+ private static final String WARNING_NAME_CLASH_AT_NAME_CHANGE = "name clash at name change. New name, element, container: ";
+
+ private void log_warn(String s, SimpleModelElement sme,
+ SimpleModelElement sme2) {
+ String s1 = sme.getFullyQualifiedName();
+ String s2 = sme2.getFullyQualifiedName();
+ logger.warning(s + ":" + s1 + "," + s2);
+ }
+
+ private void log_warn_nameclash(SimpleModelElement element_with_old_name,
+ SimpleModelElement container, String new_name) {
+ String warn = "The creation / copy / renaming of element '"
+ + element_with_old_name.getFullyQualifiedName()
+ + "' caused name clash in container '"
+ + container.getFullyQualifiedName()
+ + "' and thus it was automatically renamed to '" + new_name
+ + "'";
+ logger.warning(warn);
+ }
+
+ private void checkParameter(IModelElement me) throws VPMCoreException {
+ if (me == null)
+ throw new VPMCoreNullParameterException("");
+ if (me.isDeleted())
+ throw new VPMCoreException("parameter already deleted");
+ }
+
+ // TODO: check parameters
+ public void setRelationFrom(IRelation rel, IModelElement from)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ checkParameter(rel);
+ checkParameter(from);
+ if (rel == from)
+ throw new VPMCoreException("edge end must not be itself");
+ if (checkEdgeCircle(rel, from)) {
+ throw new VPMCoreException(
+ "edge set from element error: would make infinite fully qualified name");
+ }
+ SimpleRelation srel = (SimpleRelation) rel;
+ SimpleModelElement sfrom = (SimpleModelElement) from;
+ NotificationObject no = new NotificationObjectSetRelationFrom(
+ (SimpleRelation) rel, (SimpleModelElement) rel.getFrom(),
+ (SimpleModelElement) from);
+ setRelFrom(srel, sfrom);
+ sendNotification(no);
+ checkIsAggregationSemantics(srel);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Check whether the isAggregation type relation's source and target are
+ * parent and child entities. If check fails then the state is repaired by
+ * moving the target entity below the parent
+ *
+ * @param rel
+ * @throws VPMCoreException
+ */
+ private void checkIsAggregationSemantics(SimpleRelation rel)
+ throws VPMCoreException {
+ for (IModelElement me : rel.getTypes()) {
+ if (me instanceof SimpleRelation) {
+ SimpleRelation tRel = (SimpleRelation) me;
+ if (tRel.getIsAggregation()) {
+ // The edge must be an aggregation:
+ IModelElement to = rel.getTo(), from = rel.getFrom();
+ if (!to.getNamespace().equals(from)) {
+ if (to instanceof IEntity && from instanceof IEntity) {
+ if (!to.equals(from)) {
+ moveEntityTo((IEntity) to, (IEntity) from);
+ log_warn("isAggregation=true set for "
+ + rel.getFullyQualifiedName()
+ + "'s type ("
+ + tRel.getFullyQualifiedName()
+ + "), containment should hold for ",
+ (SimpleModelElement) to,
+ (SimpleModelElement) from);
+ } else {
+ log_warn(
+ "isAggregation=true set for "
+ + rel.getFullyQualifiedName()
+ + "'s type ("
+ + tRel.getFullyQualifiedName()
+ + "), containment should hold (but source and target are the same) for ",
+ (SimpleModelElement) to,
+ (SimpleModelElement) from);
+ }
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ public void setRelationTo(IRelation rel, IModelElement to)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (rel == to)
+ throw new VPMCoreException("edge end must not be itself");
+ SimpleRelation srel = (SimpleRelation) rel;
+ SimpleModelElement sto = (SimpleModelElement) to;
+ NotificationObject no = new NotificationObjectSetRelationTo(
+ (SimpleRelation) rel, (SimpleModelElement) rel.getTo(),
+ (SimpleModelElement) to);
+ setRelTo(srel, sto);
+ sendNotification(no);
+ checkIsAggregationSemantics(srel);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setViewInfo(IModelElement me, String viewInfo)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ SimpleModelElement _me = (SimpleModelElement) me;
+ sendNotification(new NotificationObjectSetViewInfo(me, me
+ .getViewInfo(), viewInfo));
+ _me.viewInfo = viewInfo;
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void deleteElement(IModelElement me, EDeleteSemantics semantics)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (me instanceof IEntity) {
+ deleteEntity((IEntity) me, semantics);
+ } else {
+ deleteRelation((IRelation) me, semantics);
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Check whether a recursive path from a relation to its source while the
+ * source is a relation generates an infinite path (a circle) or not. This
+ * must be checked when setting the source of a relation, because a circle
+ * would mean that the relations in the circle has no fully qualified name.
+ *
+ * @param rel
+ * the relation that must not be on the path (again)
+ * @param from
+ * the element that the path is currently at (can be an entity or
+ * a relation)
+ * @return true if the path contains a circle
+ */
+ private boolean checkEdgeCircle(IRelation rel, IModelElement from) {
+ try {
+ while (!(from instanceof IEntity)) {
+ if (from == rel)
+ return true;
+ if (from == null) {
+ logger.fatal("Gaz van: " + rel.getFullyQualifiedName());
+ break;
+ }
+ from = ((IRelation) from).getFrom();
+ }
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public void setRelationMultiplicity(IRelation rel,
+ EMultiplicityKind multiplicity) throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ SimpleRelation _rel = (SimpleRelation) rel;
+ _rel.multiplicity = multiplicity;
+ NotificationObject note = new NotificationObjectSetRelationMultiplicity(
+ _rel, multiplicity);
+ sendNotification(note);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setRelationIsAggregation(IRelation rel, boolean isaggregation)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ SimpleRelation _rel = (SimpleRelation) rel;
+ _rel.isAggregation = isaggregation;
+ NotificationObject note = new NotificationObjectSetRelationIsAggregation(
+ rel, isaggregation);
+ sendNotification(note);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setRelationInverse(IRelation rel, IRelation inverse)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ SimpleRelation _rel = (SimpleRelation) rel;
+ _rel.inverse = inverse;
+ NotificationObject note = new NotificationObjectSetRelationInverse(
+ rel, inverse);
+ sendNotification(note);
+ sendNotification(new NotificationObjectAtomicStepReady());
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setIsFinalType(IModelElement me, boolean isfinaltype)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (me == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleModelElement sme = (SimpleModelElement) me;
+ NotificationObject note = new NotificationObjectSetIsFinalType(me,
+ isfinaltype, sme.isFinalType);
+ sme.isFinalType = isfinaltype;
+ sendNotification(note);
+ sendNotification((new NotificationObjectAtomicStepReady()));
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setIsAnyFrom(IRelation me, boolean isAnyFrom)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (me == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleRelation srel = (SimpleRelation) me;
+ NotificationObject note = new NotificationObjectSetIsAny(me,
+ isAnyFrom, true, srel.isAnyFrom);
+ srel.isAnyFrom = isAnyFrom;
+ sendNotification(note);
+ sendNotification((new NotificationObjectAtomicStepReady()));
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ public void setIsAnyTo(IRelation me, boolean isAnyTo)
+ throws VPMCoreException {
+ try {
+ lock.writeLock().lock();
+ if (me == null)
+ throw new VPMCoreNullParameterException(parameterNullNotAllowed);
+ SimpleRelation srel = (SimpleRelation) me;
+ NotificationObject note = new NotificationObjectSetIsAny(me,
+ isAnyTo, false, srel.isAnyTo);
+ srel.isAnyTo = isAnyTo;
+ sendNotification(note);
+ sendNotification((new NotificationObjectAtomicStepReady()));
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+/*
+ public void setRelationshipBetween(EConstraint relationType,
+ IModelElement src, IModelElement tg) throws VPMCoreException {
+ if (ConstraintTranslator.isOtherSide(relationType)) {
+ relationType = ConstraintTranslator.getOtherSide(relationType);
+ IModelElement _src = src;
+ src = tg;
+ tg = _src;
+ }
+ switch (relationType) {
+ case INSTANCE:
+ newInstanceOf(src, tg);
+ break;
+ case CHILD:
+ moveEntityTo((IEntity) src, (IEntity) tg);
+ break;
+ case REL_FROM:
+ setRelationFrom((IRelation) tg, src);
+ break;
+ default:
+ logger.warning("create relationship not implemented: "
+ + relationType + ":" + src + ", " + tg);
+ // throw new RuntimeException("not implemented: "+relationType);
+ }
+ }
+*/
+ /*
+ private void deleteRelationshipBetween(EConstraint relationType,
+ IModelElement src, IModelElement tg) throws VPMCoreException {
+ if (ConstraintTranslator.isOtherSide(relationType)) {
+ relationType = ConstraintTranslator.getOtherSide(relationType);
+ IModelElement _src = src;
+ src = tg;
+ tg = _src;
+ }
+ switch (relationType) {
+ case INSTANCE:
+ deleteInstanceOf(src, tg);
+ break;
+ case CHILD:
+ moveEntityTo((IEntity) src, (IEntity) tg);
+ break;
+ case REL_FROM:
+ setRelationFrom((IRelation) tg, src);
+ break;
+ default:
+ logger.warning("del relationship not implemented: " + relationType
+ + ":" + src + ", " + tg);
+ // throw new RuntimeException("not implemented: "+relationType);
+ }
+
+ }
+ */
+
+ public Set<? extends IModelElement> getElements() {
+ try {
+ lock.readLock().lock();
+ TreeSet<IModelElement> ret = new TreeSet<IModelElement>();
+ ret.addAll(modelSpace.entitiesSet);
+ ret.addAll(modelSpace.relationsSet);
+ return ret;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ public void setProperty(IModelElement me, EModelElementProperty property,
+ Object value) throws VPMCoreException {
+ switch (property) {
+ case Name:
+ setName(me, (String) value);
+ break;
+ case Value:
+ setValue((IEntity) me, (String) value);
+ break;
+ default:
+ logger.warning("Set property not implemented:" + me + "("
+ + property + ")=" + value);
+ }
+ }
+
+ public IModelElement copyModelElement(IModelElement source,
+ IModelElement destinationContainer, boolean copyOutEdges)
+ throws VPMCoreException {
+ try {
+ return ModelCopy.copyModel(modelSpace, modelSpace, source,
+ destinationContainer, copyOutEdges);
+ } catch (ModelCopyException e) {
+ throw new VPMCoreException("error performing copy: "
+ + e.getMessage());
+ }
+ }
+
+ public IModelElement copyModelElements(Set<IModelElement> sourceElements,
+ IModelElement sourceRoot, IModelElement destinationContainer,
+ boolean copyOutEdges) throws VPMCoreException {
+ try {
+ return ModelCopy.copyModels(sourceElements, modelSpace, modelSpace,
+ sourceRoot, destinationContainer, copyOutEdges);
+ } catch (ModelCopyException e) {
+ throw new VPMCoreException("error performing copy: "
+ + e.getMessage());
+ }
+ }
+
+ /**
+ * @return the lock
+ */
+ public ReadWriteLock getLock() {
+ return lock;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelMerger.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelMerger.java
new file mode 100644
index 0000000..1720315
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelMerger.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import org.eclipse.viatra2.core.IModelMerger;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.errors.VPMException;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.framework.properties.VPMProperties;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This interface defines the model merger interface for the Viatra core.
+ *
+ * @author Andras Balogh
+ *
+ */
+public class SimpleModelMerger implements IModelMerger {
+ /**
+ * Initializes the model merger.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, VPMProperties p, IModelSpace m)
+ throws VPMRuntimeException {
+
+ }
+
+ /**
+ * Mergers the current modelspace with an other one.
+ *
+ * @param m1
+ * - the modelspace to merge
+ * @throws VPMException
+ */
+ public void merge(IModelSpace m1) throws VPMException {
+ // TODO
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelSpace.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelSpace.java
new file mode 100644
index 0000000..7249fb6
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleModelSpace.java
@@ -0,0 +1,455 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelManager;
+import org.eclipse.viatra2.core.IModelMerger;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.INotificationManager;
+import org.eclipse.viatra2.core.ITransactionManager;
+import org.eclipse.viatra2.core.IUndoManager;
+import org.eclipse.viatra2.core.simple.tempdata.TemporaryDataFactory;
+import org.eclipse.viatra2.errors.VPMCoreException;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.framework.IFramework;
+import org.eclipse.viatra2.framework.properties.VPMProperties;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ *
+ * This interface specifies the container of core functions. Implementations
+ * have to discover and load model manager, merger, notfification, undo and
+ * transaction support classes.
+ *
+ * ModelSpace interface is the common container of the Viatra core functions.
+ *
+ * @author Andras Schmidt
+ *
+ * Modification on 2006.08.07 by Istvan Rath: - removed reference to
+ * SimpleUndoManager; undo management moved into the transaction manager
+ *
+ */
+public class SimpleModelSpace implements IModelSpace {
+ /**
+ * Factory class for cached data storage
+ */
+ protected TemporaryDataFactory<Set<IModelElement>> tempFactory = new TemporaryDataFactory<Set<IModelElement>>();
+
+ protected Logger logger;
+
+ // protected PatternMatcher patternMatcher;
+ protected IModelManager mManager;
+
+ protected INotificationManager nManager;
+
+ // protected SimpleUndoManager uManager;
+ protected ITransactionManager tManager;
+
+ // protected Set _entities, _functions, _relations;
+ protected Map<Long, SimpleModelElement> entities, relations;
+
+ protected Set<SimpleEntity> entitiesSet;
+
+ protected Set<SimpleRelation> relationsSet;
+
+ protected SimpleEntity rootEntity;
+
+ // / ******* ancestors
+ public static final boolean isAncestorAware = false;
+
+ public static final String ancestorContainerName = "vpm";
+
+ public static final String ancestorEntityName = "entity";
+
+ public static final String ancestorEntityFQN = ancestorContainerName + "."
+ + ancestorEntityName;
+
+ public static final String ancestorRelationName = "relation";
+
+ public static final String ancestorRelationFQN = ancestorEntityFQN + "."
+ + ancestorRelationName;
+
+ protected SimpleEntity ancestorContainer;
+
+ protected SimpleEntity ancestorEntity;
+
+ protected SimpleRelation ancestorRelation;
+
+ // ********
+
+ protected UniqueNameProvider uniqueNameProvider;
+
+ protected IDProvider idProvider;
+
+ /**
+ * Counter that counts all updates of the model. The counter is used to
+ * check cached (dependent) data whether it is valid or not.
+ */
+ protected int numberOfChanges = 0;
+
+ // / XXX parallelVIATRA
+ // protected Lock __lock=new ReentrantLock();
+ protected ReadWriteLock lock = new ReentrantReadWriteLock();
+
+ public class NullRLock implements Lock {
+ public void lock() {
+ StackTraceElement e = Thread.currentThread().getStackTrace()[2];
+ String trace = e.getClassName() + "::" + e.getMethodName();
+ System.out.println("READ_LOCK [" + trace + "]");
+ }
+
+ public void lockInterruptibly() throws InterruptedException {
+ }
+
+ public Condition newCondition() {
+ return null;
+ }
+
+ public boolean tryLock() {
+ return true;
+ }
+
+ public boolean tryLock(long time, TimeUnit unit)
+ throws InterruptedException {
+ return true;
+ }
+
+ public void unlock() {
+ StackTraceElement e = Thread.currentThread().getStackTrace()[2];
+ String trace = e.getClassName() + "::" + e.getMethodName();
+ System.out.println("READ UNLOCK [" + trace + "]");
+ }
+
+ }
+
+ public class NullWLock implements Lock {
+ public void lock() {
+ StackTraceElement e = Thread.currentThread().getStackTrace()[2];
+ String trace = e.getClassName() + "::" + e.getMethodName();
+ System.out.println("WRITE_LOCK [" + trace + "]");
+ }
+
+ public void lockInterruptibly() throws InterruptedException {
+ }
+
+ public Condition newCondition() {
+ return null;
+ }
+
+ public boolean tryLock() {
+ return true;
+ }
+
+ public boolean tryLock(long time, TimeUnit unit)
+ throws InterruptedException {
+ return true;
+ }
+
+ public void unlock() {
+ StackTraceElement e = Thread.currentThread().getStackTrace()[2];
+ String trace = e.getClassName() + "::" + e.getMethodName();
+ System.out.println("WRITE UNLOCK [" + trace + "]");
+ }
+
+ }
+
+ protected ReadWriteLock _lock = new ReadWriteLock() {
+ NullRLock rLock = new NullRLock();
+
+ NullWLock wLock = new NullWLock();
+
+ public Lock readLock() {
+ return rLock;
+ }
+
+ public Lock writeLock() {
+ return wLock;
+ }
+
+ };
+
+ // protected String getSyncObject=new String("sync object");
+ // TODO
+ protected long newId() {
+ return idProvider.newID();
+ }
+
+ String uniqueName(String s) {
+ return uniqueNameProvider.uniqueName(s);
+ }
+
+ String uniqueName() {
+ return uniqueNameProvider.uniqueName();
+ }
+
+ IFramework framework;
+
+ public void init(IFramework fw) throws VPMRuntimeException {
+ this.framework = fw;
+ init(fw.getLogger(), fw.getProperties());
+ }
+
+ /**
+ * Initializes the modelspace.
+ *
+ * @param p
+ * - the collection of runtime properties
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger log, VPMProperties props)
+ throws VPMRuntimeException {
+ logger = log;
+ uniqueNameProvider = new UniqueNameProvider();
+ idProvider = new IDProvider(logger);
+ entities = new TreeMap<Long, SimpleModelElement>();
+ entitiesSet = new TreeSet<SimpleEntity>();
+ relations = new TreeMap<Long, SimpleModelElement>();
+ relationsSet = new TreeSet<SimpleRelation>();
+
+ rootEntity = new SimpleEntity(newId(), this);
+ rootEntity.name = "root";
+// entities.put(rootEntity.getLongID(), rootEntity);
+// entitiesSet.add(rootEntity);
+
+ initManagers();
+ }
+
+ /**
+ * @throws VPMRuntimeException
+ */
+ protected void initManagers() throws VPMRuntimeException {
+ mManager = new SimpleModelManager();
+ nManager = new SimpleNotificationManager();
+ tManager = new SimpleTransactionManager();
+ ((SimpleModelManager) mManager).init(logger, this);
+ ((SimpleNotificationManager) nManager).init(logger, this);
+ ((SimpleTransactionManager) tManager).init(logger, this);
+ if (isAncestorAware) {
+ try {
+ ancestorContainer = (SimpleEntity) mManager
+ .newEntity(ancestorContainerName);
+ ancestorEntity = (SimpleEntity) mManager.newEntity(
+ ancestorEntityName, ancestorContainer);
+ ancestorRelation = (SimpleRelation) mManager.newRelation(
+ ancestorRelationName, ancestorEntity, ancestorEntity);
+ mManager.setIsAnyFrom(ancestorRelation, true);
+ mManager.setIsAnyTo(ancestorRelation, true);
+ } catch (VPMCoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ // nManager.addAllListener(uManager);
+ nManager.addAllListener((ICoreNotificationListener) tManager);
+ }
+
+ /**
+ * Returns the model merger associated with this modelspace
+ *
+ * @return the model merger
+ */
+ public IModelMerger getModelMerger() {
+ // TODO
+ return null;
+ }
+
+ /**
+ * Returns the model manager asociated with this modelspace.
+ *
+ * @return the model manager
+ */
+ public IModelManager getModelManager() {
+ return mManager;
+ }
+
+ /**
+ * Returns the notification manager associated with this modelspace, or null
+ * if notification is not supported.
+ *
+ * @return notification manager
+ */
+ public INotificationManager getNotificationManager() {
+ return nManager;
+ }
+
+ /**
+ * Returns the transaction manager associated with this modelspace, or null
+ * if transactions are not supported.
+ *
+ * @return transaction manager.
+ */
+ public ITransactionManager getTransactionManager() {
+ return tManager;
+ }
+
+ /**
+ * Returns the undo manager associated with this modelspace, or null if undo
+ * is not supported.
+ *
+ * @return undo manager.
+ */
+ public IUndoManager getUndoManager() {
+ // return uManager;
+ logger.debug("SimpleModelSpace::getUndoManager called");
+ return null;
+ }
+
+ /**
+ * Checks whether transactions are supported
+ *
+ * @return true if transactions are supported, else false.
+ */
+ public boolean isTransactionAware() {
+ // TODO
+ return false;
+ }
+
+ /**
+ * Checks whether notifications are supported
+ *
+ * @return true if notifications are supported, else false.
+ */
+ public boolean isNotificationAware() {
+ // TODO
+ return false;
+ }
+
+ /**
+ * Checks whether undo is supported
+ *
+ * @return true if undo is supported, else false.
+ */
+ public boolean isUndoAware() {
+ return true;
+ }
+
+ /**
+ * Clones (doubles) the whole modelspace
+ *
+ * @return cloned modelspace
+ */
+ public IModelSpace cloneModelSpace() {
+ // TODO
+ return null;
+ }
+
+ public String statistics() {
+ return statistics(0);
+ }
+
+ public String statistics(long memUsedBefore) {
+ StringBuffer ret = new StringBuffer();
+ int numSups = 0;
+ int numSubs = 0;
+ int numTypes = 0;
+ int numInsts = 0;
+ Iterator<SimpleModelElement> it = entities.values().iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = it.next();
+ numSubs += me.subtypes.size();
+ numSups += me.supertype.size();
+ numTypes += me.type.size();
+ numInsts += me.instances.size();
+ }
+ it = relations.values().iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = it.next();
+ numSubs += me.subtypes.size();
+ numSups += me.supertype.size();
+ numTypes += me.type.size();
+ numInsts += me.instances.size();
+ }
+ ret.append("Number uf supertypes:" + numSups + "\n");
+ ret.append("Number uf subtypes:" + numSubs + "\n");
+ ret.append("Number uf instance:" + numInsts + "\n");
+ ret.append("Number uf types:" + numTypes + "\n");
+ int nEnts = getModelManager().getEntities().size();
+ int nRels = getModelManager().getRelations().size();
+ ret.append("nr of entities:" + nEnts + "\n");
+ ret.append("nr of rels :" + nRels + "\n");
+ int sum = nRels + nEnts;
+ ret.append("nr of sum :" + sum + "\n");
+ ret.append("average num of types:" + (float) numTypes / sum + "\n");
+ ret.append("average num of supertypes:" + (float) numSups / sum + "\n");
+ System.gc();
+ ret.append("memory per element:" + ((memUsed() - memUsedBefore) / sum));
+ return ret.toString();
+ }
+
+ private static long memUsed() {
+ Runtime r = Runtime.getRuntime();
+ long free = r.freeMemory();
+ long total = r.totalMemory();
+ return total - free;
+ }
+
+ /**
+ * Method only for test: deletes all String info in modelspace (name and
+ * value fields) Then we see what amount of memory they occupied.
+ *
+ */
+ public void deleteStrings() {
+ Iterator<SimpleModelElement> it = entities.values().iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = it.next();
+ SimpleEntity mee = (SimpleEntity) me;
+ me.name = null;
+ mee.value = null;
+ }
+ it = relations.values().iterator();
+ while (it.hasNext()) {
+ SimpleModelElement me = it.next();
+ me.name = null;
+ }
+ }
+
+ /**
+ * @return
+ */
+ public int discardAllTemp() {
+ return tempFactory.discardAll();
+ }
+
+ public Collection<IModelElement> getAncestorElements() {
+ if (isAncestorAware) {
+ TreeSet<IModelElement> ret = new TreeSet<IModelElement>();
+ if (ancestorContainer != null)
+ ret.add(ancestorContainer);
+ if (ancestorEntity != null)
+ ret.add(ancestorEntity);
+ if (ancestorRelation != null)
+ ret.add(ancestorRelation);
+ return ret;
+ } else {
+ return Collections.emptySet();
+ }
+ }
+
+ public IFramework getFramework() {
+ return framework;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleNotificationManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleNotificationManager.java
new file mode 100644
index 0000000..79a6d8e
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleNotificationManager.java
@@ -0,0 +1,298 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.INotificationManager;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This class specifies the required services of a notification manager.
+ *
+ * @author Andras Schmidt
+ */
+public class SimpleNotificationManager implements INotificationManager {
+
+ /**
+ * Notification category for undo managers.
+ */
+ public final static int UNDO_SUPPORT = 0;
+
+ /**
+ * Notification category for transaction managers.
+ */
+ public final static int TRANSACTION_SUPPORT = 1;
+
+ /**
+ * Notification category for other core event listeners.
+ */
+ public final static int CORE_SUPPORT = 2;
+
+ /**
+ * Notification category for interpreter-level notification support.
+ */
+ public final static int INTERPRETER_SUPPORT = 3;
+
+ /**
+ * Notification category for gui managers.
+ */
+ public final static int GUI_SUPPORT = 4;
+
+ boolean notificationEnabled = true;
+
+ // List defaultListeners=new ArrayList();
+ /**
+ * They listen all notifications on the whole modelspace.
+ */
+ List<ICoreNotificationListener> allListeners = new ArrayList<ICoreNotificationListener>();
+
+ int notificationLevel = 0;
+
+ Logger logger;
+
+ IModelSpace modelSpace;
+
+ /**
+ * Initializes the notification manager.
+ *
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, IModelSpace m) throws VPMRuntimeException {
+ modelSpace = m;
+ }
+
+ /**
+ * Adds a new default listner that has to be associated with all new model
+ * elements.
+ *
+ * @param l
+ * the new listner object
+ */
+ /*
+ * public void addDefaultListener(ICoreNotificationListener l) {
+ * defaultListeners.add(l); }
+ */
+
+ /**
+ * Removes a default listener
+ *
+ * @param l
+ * the listener to be removed
+ */
+ /*
+ * public void removeDefaultListener(ICoreNotificationListener l) {
+ * defaultListeners.remove(l); }
+ */
+
+ /**
+ * Returns the current collection of default listeners.
+ *
+ * @return collection of listeners
+ */
+ /*
+ * public Collection getDefaultListeners() { return defaultListeners; }
+ */
+ /**
+ * Enables notification dispatching.
+ */
+ public void enableNotifications() {
+ notificationEnabled = true;
+ }
+
+ /**
+ * Disables notification dispatching.
+ */
+ public void disableNotifications() {
+ notificationEnabled = false;
+ }
+
+ /**
+ * Checks whether notifications are enabled or not.
+ *
+ * @return true, if notification dispatching is enabed.
+ */
+ public boolean isNotificationEnabled() {
+ return notificationEnabled;
+ }
+
+ /**
+ * Sets the notification level. All notifications having a category that is
+ * less or equal to the level will be dispatched.
+ *
+ * @param l
+ * the new level
+ *
+ */
+ public void setNotificationLevel(int l) {
+ notificationLevel = l;
+ }
+
+ /**
+ * Retrives the current notification level.
+ *
+ * @return current notification level
+ */
+ public int getNotificationLevel() {
+ return notificationLevel;
+ }
+
+ public void addAllListener(ICoreNotificationListener l) {
+ allListeners.add(l);
+ }
+
+ public void removeAllListener(ICoreNotificationListener l) {
+ allListeners.remove(l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.viatra2.core.INotificationManager#getListenAllListeners()
+ */
+ public Collection<ICoreNotificationListener> getListenAllListeners() {
+ return allListeners;
+ }
+
+ protected int no_atom_depth = 0;
+
+ boolean skip_note_block = false;
+
+ /**
+ * Send the given notification to all listeners, which have a category
+ * higher than the set notification level.
+ *
+ * @param notification
+ */
+ protected void sendNotification(ICoreNotificationObject notification) {
+ switch (notification.getActionTypeEnum()) {
+ case ACTION_SKIP_NOTIFICATIONS_START:
+ skip_note_block = true;
+ return;
+ case ACTION_SKIP_NOTIFICATIONS_END:
+ skip_note_block = false;
+ return;
+ }
+ /*if (notification.getActionTypeEnum().equals(
+ NotificationType.ACTION_SKIP_NOTIFICATIONS_START)) {
+ skip_note_block = true;
+ return;
+ }
+ if (notification.getActionTypeEnum().equals(
+ NotificationType.ACTION_SKIP_NOTIFICATIONS_END)) {
+ skip_note_block = false;
+ return;
+ }*/
+ if (skip_note_block)
+ return;
+ switch(notification.getActionTypeEnum()){
+ case ACTION_ATOMIC_STEP_READY:
+ if (no_atom_depth > 0)
+ return;
+ else
+ break;
+ case ACTION_MORE_ATOMICS_TO_ONE_ATOM_START:
+ no_atom_depth++;
+ return;
+ case ACTION_MORE_ATOMICS_TO_ONE_ATOM_END:
+ no_atom_depth--;
+ // TODO
+ if (no_atom_depth < 0)
+ throw new RuntimeException("error internal");
+ return;
+
+ }
+ if (notificationEnabled) {
+ notifyListeners(notification);
+ }
+ }
+
+ /**
+ * Notification is sent to all listeners who registered
+ *
+ * @param notification
+ */
+ protected void notifyListeners(ICoreNotificationObject notification) {
+ // We need all listeners, who are linked to the changed elements
+ int level = getNotificationLevel();
+ // Send to all listeners, who have high enough level
+ for (ICoreNotificationListener listener: notification.getListeners()) {
+ if (level >= listener.getListenerCategory()) {
+ listener.actionPerformed(notification);
+ }
+ }
+ // All listeners also get a notification
+// it = getListenAllListeners().iterator();
+// while (it.hasNext()) {
+// ICoreNotificationListener listener = (ICoreNotificationListener) it
+// .next();
+// if (level >= listener.getListenerCategory()) {
+// listener.actionPerformed(notification);
+// }
+// }
+ for (ICoreNotificationListener l : new ArrayList<ICoreNotificationListener>(getListenAllListeners()))
+ {
+ if (level >= l.getListenerCategory()) {
+ l.actionPerformed(notification);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.viatra2.core.INotificationManager#addNotificationListener
+ * (org.eclipse.viatra2.core.IModelElement,
+ * org.eclipse.viatra2.core.ICoreNotificationListener)
+ */
+ public void addNotificationListener(IModelElement me,
+ ICoreNotificationListener l) {
+ ((SimpleModelElement) me).addNotificationListener(l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.viatra2.core.INotificationManager#removeNotificationListener
+ * (org.eclipse.viatra2.core.IModelElement,
+ * org.eclipse.viatra2.core.ICoreNotificationListener)
+ */
+ public void removeNotificationListener(IModelElement me,
+ ICoreNotificationListener l) {
+ ((SimpleModelElement) me).removeNotificationListener(l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.viatra2.core.INotificationManager#getNotificationListeners
+ * (org.eclipse.viatra2.core.IModelElement)
+ */
+ public Collection<ICoreNotificationListener> getNotificationListeners(IModelElement me) {
+ return ((SimpleModelElement) me).getNotificationListeners();
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleRelation.java
new file mode 100644
index 0000000..d436d62
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleRelation.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import org.eclipse.viatra2.core.EMultiplicityKind;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+
+/**
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+public class SimpleRelation extends SimpleModelElement implements IRelation {
+ /**
+ * The source element of this relation
+ */
+ protected SimpleModelElement from = null;
+
+ /**
+ * The target element of this relation
+ */
+ protected SimpleModelElement to = null;
+
+ /**
+ * The multiplicity of this relation. It has sense in meta-models only
+ */
+ protected EMultiplicityKind multiplicity = EMultiplicityKind.MANY_TO_MANY;
+
+ protected IRelation inverse = null;
+
+ /**
+ * The isAggregation property of the relation
+ */
+ protected boolean isAggregation = false;
+
+ /**
+ * The isAnyfrom property of the relation
+ */
+ protected boolean isAnyFrom = false;
+
+ /**
+ * The isAnyto property of the relation
+ */
+ protected boolean isAnyTo = false;
+
+ /**
+ * Instatiatates a relation.
+ */
+ public SimpleRelation(long ID, SimpleModelSpace ms) {
+ super(ID, ms);
+ }
+
+ /**
+ * Gets the source of this relation.
+ *
+ * @return An Entity
+ */
+ public IModelElement getFrom() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return from;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Gets the destination of this relation.
+ *
+ * @return an Entity
+ */
+ public IModelElement getTo() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return to;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Returns one of the element's fully qualified name
+ *
+ * @return name
+ */
+ public String getFullyQualifiedName() {
+ try {
+ modelSpace.lock.readLock().lock();
+ if (from == null)
+ return null;
+ String name = getName();
+ name = from.getFullyQualifiedName() + "." + name;
+ return name;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public IModelElement getNamespace() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return from;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public EMultiplicityKind getMultiplicity() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return multiplicity;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public IRelation getInverse() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return inverse;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public boolean getIsAggregation() {
+ try {
+ modelSpace.lock.readLock().lock();
+ return isAggregation;
+ } finally {
+ modelSpace.lock.readLock().unlock();
+ }
+ }
+
+ public boolean getIsAnyFrom() {
+ return isAnyFrom;
+ }
+
+ public boolean getIsAnyTo() {
+ return isAnyTo;
+ }
+
+ public boolean isEntity() {
+ return false;
+ }
+
+ public boolean isRelation() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleTransactionManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleTransactionManager.java
new file mode 100644
index 0000000..9b154df
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleTransactionManager.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IPause;
+import org.eclipse.viatra2.core.ITransactionManager;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSubTransactionAbort;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSubTransactionBegin;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectSubTransactionEnd;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectTransactionAbort;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectTransactionBegin;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectTransactionEnd;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectUndoBegin;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectUndoEnd;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectUndoableTransactionBegin;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This class implements a transaction manager for the Viatra core.
+ *
+ * @author Andras Balogh, Istvan Rath
+ *
+ */
+public class SimpleTransactionManager implements ITransactionManager,
+ ICoreNotificationListener {
+
+ private int transactionCounter = 0;
+
+ private ReentrantLock tLock = new ReentrantLock();
+
+ protected SimpleUndoManager uManager;
+
+ SimpleModelSpace modelSpace;
+
+ public enum TransactionState {
+ DEFAULT, IN_UNDOABLE_TRANSACTION, IN_TRANSACTION, PAUSED
+ }
+
+ protected TransactionState iState = TransactionState.DEFAULT;
+
+ /*
+ * This method is provided temporarily for debug purposes. (CoreUtils)
+ */
+ public SimpleUndoManager getUndoManager() {
+ return uManager;
+ }
+
+ /**
+ * Initializes the transaction manager.
+ *
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, SimpleModelSpace m) throws VPMRuntimeException {
+ uManager = new SimpleUndoManager();
+ modelSpace = m;
+
+ uManager.init(l, m);
+ }
+
+ /**
+ * Begins a new transaction.
+ *
+ */
+ public String beginTransaction() {
+ // FIXME what if a begin is issued without called end/rollback first?
+ // modelSpace.lock.lock();
+ tLock.lock();
+ iState = TransactionState.IN_TRANSACTION;
+ // if(modelSpace.lock.getHoldCount()==1)
+ if (tLock.getHoldCount() == 1) {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectTransactionBegin());
+ } else {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionBegin());
+ }
+ return "TRANS_" + (transactionCounter++);
+ }
+
+ public String beginTransaction(Object info) {
+ // FIXME what if a begin is issued without called end/rollback first?
+ // modelSpace.lock.lock();
+ tLock.lock();
+ iState = TransactionState.IN_TRANSACTION;
+ // if(modelSpace.lock.getHoldCount()==1)
+ if (tLock.getHoldCount() == 1) {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectTransactionBegin(
+ info));
+ } else {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionBegin(
+ info));
+ }
+ return "TRANS_" + (transactionCounter++);
+ }
+
+ public String beginUndoableTransaction() {
+ // modelSpace.lock.lock();
+ tLock.lock();
+ iState = TransactionState.IN_UNDOABLE_TRANSACTION;
+ // if(modelSpace.lock.getHoldCount()==1)
+ if (tLock.getHoldCount() == 1) {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectUndoableTransactionBegin());
+ } else {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionBegin());
+ }
+ String id = "TRANS_" + (transactionCounter++);
+ uManager.nextUndoBlock(id);
+ return id;
+ }
+
+ public String beginUndoableTransaction(Object info) {
+ // modelSpace.lock.lock();
+ tLock.lock();
+ iState = TransactionState.IN_UNDOABLE_TRANSACTION;
+ // if(modelSpace.lock.getHoldCount()==1)
+ if (tLock.getHoldCount() == 1) {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectUndoableTransactionBegin(
+ info));
+ } else {
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionBegin(
+ info));
+ }
+ String id = "TRANS_" + (transactionCounter++);
+ uManager.nextUndoBlock(id);
+ return id;
+ }
+
+ /**
+ * Commits the current transaction.
+ *
+ */
+ public void commitTransaction() {
+ // int count=tLock.getHoldCount();
+ if (tLock.getHoldCount() == 1) {
+ iState = TransactionState.DEFAULT;
+ // modelSpace.lock.unlock();
+ tLock.unlock();
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectTransactionEnd());
+ } else {
+ //iState = TransactionState.DEFAULT; <-- don't reach DEFAULT while only subtransactions are committed
+ // modelSpace.lock.unlock();
+ tLock.unlock();
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionEnd());
+ }
+ // iState = TransactionState.DEFAULT;
+ // modelSpace.lock.unlock();
+ }
+
+ public void commitCompositeTransaction()
+ {
+ if (tLock.getHoldCount() == 0)
+ return; // not in transaction
+ if (tLock.getHoldCount() == 1)
+ {
+ commitTransaction();
+ }
+ else
+ {
+ int i = tLock.getHoldCount();
+ while (i>0)
+ {
+ commitTransaction();
+ i--;
+ }
+ }
+ }
+
+ /**
+ * Aborts the current transaction.
+ *
+ */
+ public void abortTransaction() {
+ if (tLock.getHoldCount() == 1) {
+ iState = TransactionState.DEFAULT;
+
+
+ tLock.unlock();
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectTransactionAbort());
+
+ } else {
+ //iState = TransactionState.DEFAULT; <-- don't reach DEFAULT while only subtransactions are committed
+ // modelSpace.lock.unlock();
+ tLock.unlock();
+ ((SimpleNotificationManager) modelSpace.nManager)
+ .sendNotification(new NotificationObjectSubTransactionAbort());
+ }
+
+ }
+
+ public boolean tryBeginTransaction() {
+ // return modelSpace.lock.tryLock();
+ return tLock.tryLock();
+ // return true;
+ }
+
+ public IPause pauseTransaction() throws IllegalMonitorStateException {
+ if (tLock.isHeldByCurrentThread()) {
+ int c = tLock.getHoldCount();
+ IPause ret = new Pause(c);
+ for (int i = 0; i < c; ++i)
+ commitTransaction();
+ return ret;
+ } else {
+ throw new IllegalMonitorStateException(
+ "owner of lock is not this thread");
+ }
+ // return null;
+ }
+
+ public void unPauseTransaction(IPause n) {
+ Pause ret = (Pause) n;
+ for (int i = 0; i < ret.n; ++i)
+ beginTransaction();
+ }
+
+ public void undoTransaction(String aTransactionID) {
+ ((SimpleNotificationManager) modelSpace.nManager).sendNotification(new NotificationObjectUndoBegin());
+ uManager.undo(aTransactionID);
+ ((SimpleNotificationManager) modelSpace.nManager).sendNotification(new NotificationObjectUndoEnd());
+ }
+
+ public void actionPerformed(ICoreNotificationObject notification) {
+ if (iState == TransactionState.IN_UNDOABLE_TRANSACTION)
+ uManager.actionPerformed(notification);
+ // drop core notifications if not in an undoable transaction
+ }
+
+ public int getListenerCategory() {
+ return uManager.getListenerCategory();
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleUndoManager.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleUndoManager.java
new file mode 100644
index 0000000..407dc46
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SimpleUndoManager.java
@@ -0,0 +1,501 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.viatra2.core.EDeleteSemantics;
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IModelSpace;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.IUndoManager;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateInstanceOf;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateSupertypeOf;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteContainment;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteInstanceOf;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteSupertypeOf;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectMoveTo;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetName;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationFrom;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationTo;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetValue;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetViewInfo;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectUserMark;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.notification.NotificationObject;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectAtomicStepReady;
+import org.eclipse.viatra2.core.simple.notification.NotificationObjectUserMark;
+import org.eclipse.viatra2.errors.VPMCoreException;
+import org.eclipse.viatra2.errors.VPMCoreNullParameterException;
+import org.eclipse.viatra2.errors.VPMCoreRuntimeException;
+import org.eclipse.viatra2.errors.VPMRuntimeException;
+import org.eclipse.viatra2.logger.Logger;
+
+/**
+ * This class defines the undo support for the Simple Viatra core. This class is
+ * the undoManager interface of the Simple Core implementation, and the listener
+ * of undo notification objects too.
+ *
+ * @author Andras Schmidt
+ *
+ * Modified on 2006.08.14 by Istvan Rath: - clean up unnecessary code -
+ * add preliminary transaction support (don't throw exceptions)
+ *
+ */
+public class SimpleUndoManager implements IUndoManager,
+ ICoreNotificationListener {
+ IModelSpace modelSpace;
+
+ SimpleModelManager mManager;
+
+ Logger logger;
+
+ private Stack<ICoreNotificationObject> undoStack;
+
+ boolean underUndo;
+
+ boolean checkConsistencyOn = false;
+
+ /**
+ * Initializes the undo manager.
+ *
+ * @param l
+ * - the framework logger
+ * @param m
+ * - the owning modelspace
+ * @throws VPMRuntimeException
+ */
+ public void init(Logger l, IModelSpace m) throws VPMRuntimeException {
+ logger = l;
+ modelSpace = m;
+ mManager = (SimpleModelManager) modelSpace.getModelManager();
+ }
+
+ /**
+ * Registers a new undo block with a descriptive name. (Marks the point of
+ * state with the given string.)
+ *
+ * @param name
+ * - name of undo block
+ */
+ public void nextUndoBlock(String name) {
+ NotificationObject no = new NotificationObjectUserMark(name);
+ undoStack.push(no);
+ }
+
+ /**
+ * Checks whether the undo buffer is empty
+ *
+ * @return true, if there are operations in the undo buffer
+ */
+ public boolean canUndo() {
+ return !undoStack.empty();
+ }
+
+ /**
+ * Flushes the undo buffer.
+ *
+ */
+ public void flushUndoBuffer() {
+ undoStack = new Stack<ICoreNotificationObject>();
+ }
+
+ /**
+ * Undoes the last operation
+ */
+ public void undo() {
+ underUndo = true;
+ boolean empty = false;
+ boolean wasChange = false;
+ ICoreNotificationObject note = null;
+ do {
+ if (undoStack.isEmpty()) {
+ empty = true;
+ break;
+ }
+ note = undoStack.pop();
+ try {
+ wasChange = undoStep(note) || wasChange;
+ } catch (VPMCoreException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ } while (!(note.getActionTypeEnum() == NotificationType.ACTION_ATOMIC_STEP_READY && wasChange));
+ if (!empty)
+ undoStack.push(note);
+ underUndo = false;
+ // if(checkConsistencyOn)
+ // ConsistencyChecker.check(modelSpace);
+ }
+
+ /**
+ * Undoes all operations made after the last checkpoint with given name.
+ *
+ * @param markName
+ */
+ public void undo(String markName) {
+ underUndo = true;
+ // we are in an atomic step, we must undo until first atomic_step_ready
+ boolean wasChange = false;
+ // we have found the checkpoint mark, no more undo needed
+ boolean toLeave = false;
+ ICoreNotificationObject note = null;
+ do {
+ if (undoStack.isEmpty()) {
+ break;
+ }
+ note = undoStack.pop();
+ try {
+ wasChange = undoStep(note) || wasChange;
+ } catch (VPMCoreException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ switch(note.getActionTypeEnum()){
+
+ case ACTION_ATOMIC_STEP_READY:
+ wasChange = false;
+ break;
+
+ case USER_MARK:
+ ICoreNotificationObjectUserMark _note = (ICoreNotificationObjectUserMark) note;
+ String name = _note.getMarkName();
+ if (name.equals(markName))
+ toLeave = true;
+ break;
+
+ }
+ /*if (note.getActionType().equals(
+ ICoreNotificationObject.ACTION_ATOMIC_STEP_READY)) {
+ wasChange = false;
+ }
+ if (note.getActionType().equals(ICoreNotificationObject.USER_MARK)) {
+ ICoreNotificationObjectUserMark _note = (ICoreNotificationObjectUserMark) note;
+ String name = _note.getMarkName();
+ if (name.equals(markName))
+ toLeave = true;
+ }*/
+ } while (!toLeave || wasChange);
+ undoStack.push(new NotificationObjectAtomicStepReady());
+ underUndo = false;
+ }
+
+ /**
+ * Undoes all operations made after the n. checkpoint with given name.
+ *
+ * @param markName
+ * @param n
+ */
+ public void undo(String markName, int n) {
+ for (int i = 0; i < n; ++i)
+ undo(markName);
+ }
+
+ /**
+ * Undoes the last n operations
+ *
+ * @param n
+ * number of operations to be undone.
+ */
+ public void undo(int n) {
+ for (int i = 0; i < n; ++i)
+ undo();
+ }
+
+ private boolean undoStep(ICoreNotificationObject note)
+ throws VPMCoreException {
+ // FIXME add transaction support!
+ NotificationType action = note.getActionTypeEnum();
+
+ switch(action){
+
+ case ACTION_ATOMIC_STEP_READY:
+ return false;
+ case ACTION_CREATE_ENTITY:
+ ICoreNotificationObjectCreateEntity _note = (ICoreNotificationObjectCreateEntity) note;
+
+ IEntity ent = _note.getCreated();
+ try {
+ mManager
+ .deleteEntity(ent, EDeleteSemantics.DELETE_SEMANTICS_FORCE);
+ } catch (Exception e) {
+ throw new VPMCoreRuntimeException("undo step failed"
+ + e.toString() + e.getStackTrace());
+ }
+ return true;
+ case ACTION_DELETE_ENTITY:
+ ICoreNotificationObjectDeleteEntity _note1 = (ICoreNotificationObjectDeleteEntity) note;
+ IEntity ent1 = _note1.getDeleted();
+ IEntity parent = _note1.getParent();
+ mManager
+ .undoCreateEntity((SimpleEntity) ent1, (SimpleEntity) parent);
+ return true;
+ case ACTION_CREATE_RELATION:
+ ICoreNotificationObjectCreateRelation _note2 = (ICoreNotificationObjectCreateRelation) note;
+ IRelation rel = _note2.getNewRelation();
+ try {
+ mManager.deleteRelation(rel,
+ EDeleteSemantics.DELETE_SEMANTICS_FORCE);
+ } catch (Exception e) {
+ throw new VPMCoreRuntimeException("undo step failed"
+ + e.toString() + e.getStackTrace());
+ }
+ return true;
+ case ACTION_DELETE_RELATION:
+ ICoreNotificationObjectDeleteRelation _note3 = (ICoreNotificationObjectDeleteRelation) note;
+ mManager.undoCreateRelation((SimpleRelation) _note3.getDeleted(),
+ (SimpleModelElement) _note3.getFrom(),
+ (SimpleModelElement) _note3.getTo());
+ return true;
+ case ACTION_CREATE_INSTANCEOF:
+ ICoreNotificationObjectCreateInstanceOf _note4 = (ICoreNotificationObjectCreateInstanceOf) note;
+ SimpleModelElement sup = (SimpleModelElement) _note4.getType();
+ SimpleModelElement sub = (SimpleModelElement) _note4.getInstance();
+ try {
+ mManager.deleteInstanceOfEditor(sup, sub);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_DELETE_INSTANCEOF:
+ ICoreNotificationObjectDeleteInstanceOf _note5 = (ICoreNotificationObjectDeleteInstanceOf) note;
+ sup = (SimpleModelElement) _note5.getType();
+ sub = (SimpleModelElement) _note5.getInstance();
+ try {
+ mManager.newInstanceOfEditor(sup, sub);
+ } catch (Exception e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_CREATE_SUPERTYPEOF:
+ ICoreNotificationObjectCreateSupertypeOf _note6 = (ICoreNotificationObjectCreateSupertypeOf) note;
+ sup = (SimpleModelElement) _note6.getSuper();
+ sub = (SimpleModelElement) _note6.getSub();
+ try {
+ mManager.deleteSupertypeOfEditor(sup, sub);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_DELETE_SUPERTYPEOF:
+ ICoreNotificationObjectDeleteSupertypeOf _note7 = (ICoreNotificationObjectDeleteSupertypeOf) note;
+ sup = (SimpleModelElement) _note7.getSuper();
+ sub = (SimpleModelElement) _note7.getSub();
+ try {
+ mManager.newSupertypeOfEditor(sup, sub);
+ } catch (VPMCoreException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_DELETE_CONTAINMENT:
+ ICoreNotificationObjectDeleteContainment _note8 = (ICoreNotificationObjectDeleteContainment) note;
+
+ SimpleEntity container = (SimpleEntity) _note8.getParent();
+ SimpleEntity child = (SimpleEntity) _note8.getChild();
+ try {
+ mManager.undoCreateContainment(container, child);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_SET_VALUE:
+ ICoreNotificationObjectSetValue _note9 = (ICoreNotificationObjectSetValue) note;
+ ent = (SimpleEntity) _note9.getEntity();
+ String oldValue = _note9.getOldValue();
+ try {
+ mManager.setValue(ent, oldValue);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_SET_NAME:
+ ICoreNotificationObjectSetName _note10 = (ICoreNotificationObjectSetName) note;
+ SimpleModelElement elem = (SimpleModelElement) _note10.getElement();
+ String oldName = _note10.getOldName();
+ try {
+ mManager.setName(elem, oldName);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_MOVE_ELEMENT_TO:
+ ICoreNotificationObjectMoveTo _note11 = (ICoreNotificationObjectMoveTo) note;
+ ent = (SimpleEntity) _note11.getElement();
+ SimpleEntity from = (SimpleEntity) _note11.getOldContainer();
+ try {
+ mManager.moveEntityTo(ent, from);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_SET_RELATION_FROM:
+ ICoreNotificationObjectSetRelationFrom _note12 = (ICoreNotificationObjectSetRelationFrom) note;
+ rel = (SimpleRelation) _note12.getRelation();
+ SimpleModelElement oldFrom = (SimpleModelElement) _note12
+ .getOldFrom();
+ try {
+ mManager.setRelationFrom(rel, oldFrom);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_SET_RELATION_TO:
+ ICoreNotificationObjectSetRelationTo _note13 = (ICoreNotificationObjectSetRelationTo) note;
+ rel = (SimpleRelation) _note13.getRelation();
+ SimpleModelElement oldTo = (SimpleModelElement) _note13.getOldTo();
+ try {
+ mManager.setRelationTo(rel, oldTo);
+ } catch (VPMCoreNullParameterException e) {
+ logger.fatal("Error performing undo; message: "
+ + e.getMessage());
+ // e.printStackTrace();
+ }
+ return true;
+ case ACTION_SET_VIEW_INFO:
+ undoSetViewInfo((ICoreNotificationObjectSetViewInfo) note);
+ return true;
+ case USER_MARK:
+ return false;
+ }
+ /*
+ * Added a comment to this code to stop the undo manager from throwing unnecessary error messages
+ * which slowes down undo operations.
+ throw new VPMCoreRuntimeException("undo step not defined for step:"
+ + note.toString());
+ */
+ //logger.warning("undo step not defined for step:"+ note.toString());
+ return false;
+ }
+
+ void undoSetViewInfo(ICoreNotificationObjectSetViewInfo note) {
+ IModelElement me = note.getElement();
+ String oldViewInfo = note.getOldViewInfo();
+ try {
+ mManager.setViewInfo(me, oldViewInfo);
+ } catch (VPMCoreException e) {
+ logger.fatal("Error performing undo; message: " + e.getMessage());
+ // e.printStackTrace();
+ }
+ }
+
+ /**
+ * Gets a list of undoable operations currently in the undo buffer.
+ *
+ * @return array of operation names
+ */
+ public List<String> getUndoableList() {
+ ArrayList<String> undoList = new ArrayList<String>();
+ Iterator<ICoreNotificationObject> it = undoStack.iterator();
+ while (it.hasNext()) {
+ ICoreNotificationObject note = it.next();
+ undoList.add(note.toString());
+ }
+ return undoList;
+ }
+
+ public SimpleUndoManager() {
+ underUndo = false;
+ undoStack = new Stack<ICoreNotificationObject>();
+ }
+
+ /**
+ * This method listens all actions and logs them into a stack for undo
+ */
+ public void actionPerformed(ICoreNotificationObject notification) {
+ // if(notification.getActionType()==ICoreNotificationObject.
+ // ACTION_ATOMIC_STEP_READY)
+ // {
+ // if(checkConsistencyOn)
+ // ConsistencyChecker.check(modelSpace);
+ // }
+ NotificationType type = notification.getActionTypeEnum();
+ switch(type){
+
+ case TA_SUBTRANSACTION_BEGIN:
+ case TA_SUBTRANSACTION_END:
+ case TA_TRANSACTION_BEGIN:
+ case TA_TRANSACTION_END:
+ case TA_UNDOABLE_TRANSACTION_BEGIN:
+ return;
+ }
+ /*if (type.equals(ICoreNotificationObject.TA_SUBTRANSACTION_BEGIN)
+ || type.equals(ICoreNotificationObject.TA_SUBTRANSACTION_END)
+ || type.equals(ICoreNotificationObject.TA_TRANSACTION_BEGIN)
+ || type.equals(ICoreNotificationObject.TA_TRANSACTION_END)
+ || type
+ .equals(ICoreNotificationObject.TA_UNDOABLE_TRANSACTION_BEGIN))
+ return;*/
+ if (!underUndo)
+ undoStack.add(notification);
+ }
+
+ /**
+ * Returns the category of this listener.
+ *
+ * @return category
+ */
+ public int getListenerCategory() {
+ return ICoreNotificationListener.UNDO_LISTENER;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.viatra2.core.IUndoManager#getUndoList(int)
+ */
+ public List<String> getUndoList(int n) {
+ int count = 0;
+ ArrayList<String> ret = new ArrayList<String>();
+ int last = undoStack.size();
+ while (count < n) {
+ ICoreNotificationObject note = undoStack
+ .get(--last);
+ if (note.getActionTypeEnum().equals(NotificationType.USER_MARK)) {
+ ret.add(((ICoreNotificationObjectUserMark) note).getMarkName());
+ count++;
+ }
+ if (last == 0)
+ break;
+ }
+ return ret;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet.java
new file mode 100644
index 0000000..9935e07
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * @author Andras Schmidt
+ * @param <E>
+ *
+ */
+public class SmallTreeSet<E> implements Set<E> {
+ TreeSet<E> set = null;
+
+ public int size() {
+ if (set == null) {
+ return 0;
+ } else
+ return set.size();
+ }
+
+ public boolean isEmpty() {
+ if (set == null)
+ return true;
+ else
+ return set.isEmpty();
+
+ }
+
+ public boolean contains(Object arg0) {
+ if (set == null)
+ return false;
+ else
+ return set.contains(arg0);
+ }
+
+ class NullIterator<F> implements Iterator<F> {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public F next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ }
+
+ public Iterator<E> iterator() {
+ if (set == null)
+ return new NullIterator<E>();
+ else
+ return set.iterator();
+ }
+
+ public Object[] toArray() {
+ if (set == null)
+ return new Object[0];
+ else
+ return set.toArray();
+ }
+
+ public <T> T[] toArray(T[] arg0) {
+ if (set == null)
+ return arg0;
+ else
+ return set.toArray(arg0);
+ }
+
+ public boolean add(E arg0) {
+ if (set == null) {
+ set = new TreeSet<E>();
+ return set.add(arg0);
+ } else
+ return set.add(arg0);
+ }
+
+ public boolean remove(Object arg0) {
+ if (set == null)
+ return false;
+ else {
+ boolean ret = set.remove(arg0);
+ if (set.size() == 0)
+ set = null;
+ return ret;
+ }
+ }
+
+ public boolean containsAll(Collection arg0) {
+ if (set == null) {
+ return arg0.size() == 0;
+ } else {
+ return set.containsAll(arg0);
+ }
+ }
+
+ public boolean addAll(Collection<? extends E> arg0) {
+ if (set == null) {
+ if (arg0.size() != 0) {
+ set = new TreeSet<E>();
+ return set.addAll(arg0);
+ } else
+ return false;
+ } else {
+ return set.addAll(arg0);
+ }
+ }
+
+ public boolean retainAll(Collection arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection arg0) {
+ if (set == null) {
+ return false;
+ } else {
+ boolean ret = set.removeAll(arg0);
+ if (set.size() == 0)
+ set = null;
+ return ret;
+ }
+ }
+
+ public void clear() {
+ if (set == null)
+ return;
+ else
+ set.clear();
+ }
+
+ public boolean equals(Object o) {
+ if (o instanceof Set) {
+ Set ob = (Set) o;
+ if (set == null) {
+ return ob.size() == 0;
+ } else
+ return set.equals(ob);
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet2.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet2.java
new file mode 100644
index 0000000..9ab7cc7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/SmallTreeSet2.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * @author Andras Schmidt
+ * @param <T>
+ *
+ */
+public class SmallTreeSet2<T> implements Set<T> {
+ TreeSet<T> set = null;
+
+ T o = null;
+
+ public int size() {
+ if (set == null) {
+ return o == null ? 0 : 1;
+ } else
+ return set.size();
+ }
+
+ public boolean isEmpty() {
+ if (set == null)
+ return o == null;
+ else
+ return set.isEmpty();
+
+ }
+
+ public boolean contains(Object arg0) {
+ if (set == null) {
+ if (o != null)
+ return arg0.equals(o);
+ else
+ return false;
+ } else
+ return set.contains(arg0);
+ }
+
+ /*
+ * class OneIterator<E> implements Iterator { E o; OneIterator(E o) {
+ * this.o=o; } public boolean hasNext() { return o!=null;} public E next() {
+ * E ret=o; o=null; return ret;} public void remove() {} }
+ */
+ public Iterator<T> iterator() {
+ if (set == null) {
+ return new OneIterator<T>(o);
+ } else
+ return set.iterator();
+ }
+
+ public Object[] toArray() {
+ if (set == null) {
+ if (o == null) {
+ return new Object[0];
+ } else {
+ Object[] ret = new Object[1];
+ ret[0] = o;
+ return ret;
+ }
+ } else
+ return set.toArray();
+ }
+
+ public <K> K[] toArray(K[] arg0) {
+ /*
+ * if(set==null) { if(o!=null) { Object x=o; arg0[0]=(K)x; } return
+ * arg0; } else return set.toArray(arg0);
+ */
+ return null;
+ }
+
+ public boolean add(T arg0) {
+ if (set == null) {
+ if (o == null) {
+ o = arg0;
+ return true;
+ } else {
+ if (o.equals(arg0)) {
+ return false;
+ } else {
+ set = new TreeSet<T>();
+ set.add(o);
+ o = null;
+ return set.add(arg0);
+ }
+ }
+ } else
+ return set.add(arg0);
+ }
+
+ public boolean remove(Object arg0) {
+ if (set == null) {
+ if (o != null && o.equals(arg0)) {
+ o = null;
+ return true;
+ } else
+ return false;
+ } else {
+ boolean ret = set.remove(arg0);
+ if (set.size() == 0) {
+ set = null;
+ } else if (set.size() == 1) {
+ o = set.iterator().next();
+ set = null;
+ }
+ return ret;
+ }
+ }
+
+ public boolean containsAll(Collection arg0) {
+ if (set == null) {
+ if (o != null) {
+ if (arg0.size() == 1) {
+ return arg0.iterator().next().equals(o);
+ } else
+ return false;
+ } else {
+ return arg0.size() == 0;
+ }
+ } else {
+ return set.containsAll(arg0);
+ }
+ }
+
+ public boolean addAll(Collection<? extends T> arg0) {
+ if (set == null) {
+ if (arg0.size() > 1) {
+ set = new TreeSet<T>();
+ return set.addAll(arg0);
+ } else if (arg0.size() == 1) {
+ o = arg0.iterator().next();
+ return true;
+ } else
+ return false;
+ } else {
+ return set.addAll(arg0);
+ }
+ }
+
+ public boolean retainAll(Collection arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection arg0) {
+ throw new UnsupportedOperationException();
+ /*
+ * if(set==null) { return false; } else { boolean
+ * ret=set.removeAll(arg0); if(set.size()==0) set=null; return ret; }
+ */
+ }
+
+ public void clear() {
+ if (set == null) {
+ o = null;
+ return;
+ } else
+ set.clear();
+ }
+
+ public boolean equals(Object o) {
+ if (o == null) {
+ return set == null;
+ } if (o instanceof Set<?>) {
+ Set<?> ob = (Set<?>) o;
+ if (set == null) {
+ return ob.size() == 0;
+ } else if (set == null) {
+ if (ob.size() == 1)
+ return ob.iterator().next().equals(o);
+ else
+ return false;
+ } else
+ return set.equals(ob);
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/UniqueNameProvider.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/UniqueNameProvider.java
new file mode 100644
index 0000000..d7742bd
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/UniqueNameProvider.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+import java.util.Random;
+
+/**
+ * This class provides unique names. All used names must be notified to this
+ * object. The returned name is guaranteed to be unique.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class UniqueNameProvider {
+ Random random;
+
+
+
+ public UniqueNameProvider() {
+ random = new Random();
+ runningInstanceStamp = "_" + randomString(1);
+ }
+
+ public String byteToHex(byte _b) {
+ int b = _b;
+ b &= 0xFF; // automatic conversion converts bytes as if they were signed
+ String ret = Integer.toHexString(b);
+ if (ret.length() == 1)
+ ret = '0' + ret;
+ return ret;
+ }
+
+ public String randomString(int len) {
+ String retStr = "";
+ byte[] bytes = new byte[len];
+ random.nextBytes(bytes);
+ for (int i = 0; i < len; ++i) {
+ retStr += byteToHex(bytes[i]);
+ }
+ return retStr;
+ }
+
+ public String uniqueName(String s) {
+ return s + uniqueName();
+ }
+
+ public String uniqueName() {
+ // TODO no guarantee, just probable
+ return "uN" + (counter++) + runningInstanceStamp;
+ }
+
+ private int counter = 0;
+
+ private String runningInstanceStamp = "";
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/VPMCoreInternalRuntimeException.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/VPMCoreInternalRuntimeException.java
new file mode 100644
index 0000000..1f3d70b
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/VPMCoreInternalRuntimeException.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple;
+
+/**
+ * Inernal exception of the core. Means an error in the code implementation.
+ * Should never be thrown.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class VPMCoreInternalRuntimeException extends RuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9122506795115502943L;
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/cache/TrickyCollection.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/cache/TrickyCollection.java
new file mode 100644
index 0000000..6205101
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/cache/TrickyCollection.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.cache;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.simple.SimpleEntity;
+
+public class TrickyCollection implements Collection<IModelElement> {
+
+ private SimpleEntity owner;
+
+ private Collection<IModelElement> col;
+
+ public TrickyCollection(Collection<IModelElement> c, SimpleEntity o) {
+ col = c;
+ owner = o;
+ }
+
+ public boolean add(IModelElement arg0) {
+ return false;
+ }
+
+ public boolean addAll(Collection arg0) {
+ return false;
+ }
+
+ public void clear() {
+
+ }
+
+ public boolean contains(Object arg0) {
+ IModelElement me = (IModelElement) arg0;
+ return me.isBelowNamespace(owner);
+ }
+
+ public boolean containsAll(Collection arg0) {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.containsAll(arg0);
+ }
+
+ public boolean isEmpty() {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.isEmpty();
+ }
+
+ public Iterator<IModelElement> iterator() {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.iterator();
+ }
+
+ public boolean remove(Object arg0) {
+ return false;
+ }
+
+ public boolean removeAll(Collection arg0) {
+ return false;
+ }
+
+ public boolean retainAll(Collection arg0) {
+ return false;
+ }
+
+ public int size() {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.size();
+ }
+
+ public Object[] toArray() {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.toArray();
+ }
+
+ public Object[] toArray(Object[] arg0) {
+ if (col == null) {
+ col = owner._getAllComponents();
+ }
+ return col.toArray(arg0);
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/constraint/ConstraintTranslator.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/constraint/ConstraintTranslator.java
new file mode 100644
index 0000000..411a56b
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/constraint/ConstraintTranslator.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.constraint;
+
+import org.eclipse.viatra2.core.constraint.EConstraint;
+import org.eclipse.viatra2.core.constraint.IConstraint;
+
+/**
+ * Translates old fashioned integer constraint constats to new enumerations.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class ConstraintTranslator {
+ public static EConstraint getConst(int c) {
+ return EConstraint.values()[c];
+ }
+
+ /**
+ * Get the old fashion constrait constant
+ *
+ * @param c
+ * constraint type
+ * @return constraint type in old fashion
+ */
+ public static int getConst(EConstraint c) {
+ switch (c) {
+ case BELOW:
+ return IConstraint.BELOW;
+ case DINSTANCE:
+ return IConstraint.DINSTANCE;
+ case CHILD:
+ return IConstraint.CHILD;
+ case DSUBTYPE:
+ return IConstraint.DSUBTYPE;
+ case DSUPERTYPE:
+ return IConstraint.DSUPERTYPE;
+ case DTYPE:
+ return IConstraint.DTYPE;
+ case ENTITY:
+ return IConstraint.ENTITY;
+ case ENTITY_REL_FROM:
+ return IConstraint.REL_FROM;
+ case ENTITY_REL_TO:
+ return IConstraint.ENTITY_REL_TO;
+ case INSTANCE:
+ return IConstraint.INSTANCE;
+ case OVER:
+ return IConstraint.OVER;
+ case PARENT:
+ return IConstraint.PARENT;
+ case REL_FROM:
+ return IConstraint.REL_FROM;
+ case REL_TO:
+ return IConstraint.REL_TO;
+ case RELATION:
+ return IConstraint.RELATION;
+ case SUBTYPE:
+ return IConstraint.SUBTYPE;
+ case SUPERTYPE:
+ return IConstraint.SUPERTYPE;
+ case TYPE:
+ return IConstraint.TYPE;
+ }
+ return 0;
+ }
+
+ /**
+ * Get the other side constrait constant
+ *
+ * @param c
+ * constraint type
+ * @return constraint type from the other side
+ */
+ public static EConstraint getOtherSide(EConstraint c) {
+ switch (c) {
+ case BELOW:
+ return EConstraint.OVER;
+ case DINSTANCE:
+ return EConstraint.DTYPE;
+ case CHILD:
+ return EConstraint.PARENT;
+ case DSUBTYPE:
+ return EConstraint.DSUPERTYPE;
+ case DSUPERTYPE:
+ return EConstraint.DSUBTYPE;
+ case DTYPE:
+ return EConstraint.DINSTANCE;
+ case ENTITY:
+ return EConstraint.ENTITY;
+ case ENTITY_REL_FROM:
+ return EConstraint.REL_FROM;
+ case ENTITY_REL_TO:
+ return EConstraint.REL_TO;
+ case INSTANCE:
+ return EConstraint.TYPE;
+ case OVER:
+ return EConstraint.BELOW;
+ case PARENT:
+ return EConstraint.CHILD;
+ case REL_FROM:
+ return EConstraint.ENTITY_REL_FROM;
+ case REL_TO:
+ return EConstraint.ENTITY_REL_TO;
+ case RELATION:
+ return EConstraint.RELATION;
+ case SUBTYPE:
+ return EConstraint.SUPERTYPE;
+ case SUPERTYPE:
+ return EConstraint.SUBTYPE;
+ case TYPE:
+ return EConstraint.INSTANCE;
+ }
+ return null;
+ }
+
+ int i;
+
+ /**
+ * query if this constraint is "canonical". All types are only "canonical"
+ * in one direction.
+ *
+ * @param c
+ * constraint type
+ * @return is canonical
+ */
+ public static boolean isOtherSide(EConstraint c) {
+ switch (c) {
+ case BELOW:
+ case DINSTANCE:
+ case DSUBTYPE:
+ case SUBTYPE:
+ case INSTANCE:
+ case CHILD:
+ case ENTITY:
+ case RELATION:
+ case REL_FROM:
+ case REL_TO:
+ return false;
+ case DSUPERTYPE:
+ case DTYPE:
+ case ENTITY_REL_FROM:
+ case ENTITY_REL_TO:
+ case OVER:
+ case PARENT:
+ case SUPERTYPE:
+ case TYPE:
+ default:
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObject.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObject.java
new file mode 100644
index 0000000..5540909
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObject.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.viatra2.core.ICoreNotificationListener;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObject;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+
+/**
+ * The base class implementing the Viatra Notification object. It is essentially
+ * a data transfer object (DTO), serving as the basis of communication.
+ *
+ * @author Andras Schmidt
+ *
+ * Modified on 2006.08.09 by Istvan Rath: - cleaned up javadoc
+ */
+public abstract class NotificationObject implements ICoreNotificationObject {
+ String type = "";
+
+ Set<ICoreNotificationListener> listeners = new HashSet<ICoreNotificationListener>();
+
+ Set<IModelElement> notifiedObjects = new HashSet<IModelElement>();
+
+ public IModelElement getModelElement() {
+ return null;
+ }
+
+ public String getActionType() {
+ return getActionTypeEnum().toString();
+ }
+
+ public Collection<ICoreNotificationListener> getListeners() {
+ return listeners;
+ }
+
+ public String toString() {
+ return getActionTypeEnum().toString();
+ }
+
+ void addListener(IModelElement me) {
+ if (me != null) {
+ notifiedObjects.add(me);
+ if (me instanceof SimpleModelElement)
+ listeners.addAll(((SimpleModelElement) me)
+ .getNotificationListeners());
+ }
+ }
+
+ public Collection<IModelElement> getNotifiedObjects() {
+ return notifiedObjects;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectAtomicStepReady.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectAtomicStepReady.java
new file mode 100644
index 0000000..9152c1c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectAtomicStepReady.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectAtomicStepReady extends NotificationObject {
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_ATOMIC_STEP_READY;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateEntity.java
new file mode 100644
index 0000000..699a299
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateEntity.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateEntity;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectCreateEntity extends NotificationObject
+ implements ICoreNotificationObjectCreateEntity {
+ String name;
+
+ String value;
+
+ IEntity created;
+
+ IEntity container;
+
+ public NotificationObjectCreateEntity(IEntity created, IEntity container) {
+ this.name = created.getName();
+ this.value = created.getValue();
+ this.created = created;
+ this.container = container;
+ addListener(created);
+ addListener(container);
+ }
+
+ public IEntity getContainer() {
+ return container;
+ }
+
+ public IEntity getCreated() {
+ return created;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_CREATE_ENTITY;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateInstanceOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateInstanceOf.java
new file mode 100644
index 0000000..e3aa4d1
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateInstanceOf.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateInstanceOf;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectCreateInstanceOf extends NotificationObject
+ implements ICoreNotificationObjectCreateInstanceOf {
+ IModelElement type;
+
+ IModelElement inst;
+
+ public NotificationObjectCreateInstanceOf(IModelElement type,
+ IModelElement inst) {
+ this.type = type;
+ this.inst = inst;
+ addListener(type);
+ addListener(inst);
+ }
+
+ public IModelElement getType() {
+ return type;
+ }
+
+ public IModelElement getInstance() {
+ return inst;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_CREATE_INSTANCEOF;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateRelation.java
new file mode 100644
index 0000000..d036319
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateRelation.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateRelation;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+import org.eclipse.viatra2.core.simple.SimpleRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectCreateRelation extends NotificationObject
+ implements ICoreNotificationObjectCreateRelation {
+ SimpleRelation relation;
+
+ SimpleModelElement from;
+
+ SimpleModelElement to;
+
+ String name;
+
+ public NotificationObjectCreateRelation(SimpleRelation relation,
+ SimpleModelElement from, SimpleModelElement to) {
+ this.relation = relation;
+ this.from = from;
+ this.to = to;
+ name = relation.getName();
+ addListener(relation);
+ addListener(from);
+ addListener(to);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_CREATE_RELATION;
+ }
+
+ public IModelElement getFrom() {
+ return from;
+ }
+
+ public IModelElement getTo() {
+ return to;
+ }
+
+ public IRelation getNewRelation() {
+ return relation;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateSupertypeOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateSupertypeOf.java
new file mode 100644
index 0000000..b789364
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectCreateSupertypeOf.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectCreateSupertypeOf;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectCreateSupertypeOf extends NotificationObject
+ implements ICoreNotificationObjectCreateSupertypeOf {
+ IModelElement sup;
+
+ IModelElement sub;
+
+ public NotificationObjectCreateSupertypeOf(IModelElement sup,
+ IModelElement sub) {
+ this.sup = sup;
+ this.sub = sub;
+ addListener(sup);
+ addListener(sub);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_CREATE_SUPERTYPEOF;
+ }
+
+ public IModelElement getSuper() {
+ return sup;
+ }
+
+ public IModelElement getSub() {
+ return sub;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteContainment.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteContainment.java
new file mode 100644
index 0000000..28a2b48
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteContainment.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteContainment;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleEntity;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectDeleteContainment extends NotificationObject
+ implements ICoreNotificationObjectDeleteContainment {
+ SimpleEntity parent;
+
+ SimpleModelElement child;
+
+ /**
+ *
+ */
+ public NotificationObjectDeleteContainment(SimpleEntity parent,
+ SimpleModelElement child) {
+ this.parent = parent;
+ this.child = child;
+ addListener(parent);
+ addListener(child);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_DELETE_CONTAINMENT;
+ }
+
+ public IEntity getParent() {
+ return parent;
+ }
+
+ public IModelElement getChild() {
+ return child;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteEntity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteEntity.java
new file mode 100644
index 0000000..f29d15d
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteEntity.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteEntity;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectDeleteEntity extends NotificationObject
+ implements ICoreNotificationObjectDeleteEntity {
+ String name;
+
+ String value;
+
+ SimpleEntity deleted;
+
+ SimpleEntity parent;
+
+ public NotificationObjectDeleteEntity(SimpleEntity deleted,
+ SimpleEntity parent) {
+ this.deleted = deleted;
+ this.parent = parent;
+ name = deleted.getName();
+ value = deleted.getValue();
+ addListener(deleted);
+ addListener(parent);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_DELETE_ENTITY;
+ }
+
+ public IEntity getDeleted() {
+ return deleted;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public IEntity getParent() {
+ return parent;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteInstanceOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteInstanceOf.java
new file mode 100644
index 0000000..e8ab98f
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteInstanceOf.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteInstanceOf;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectDeleteInstanceOf extends NotificationObject
+ implements ICoreNotificationObjectDeleteInstanceOf {
+ IModelElement type;
+
+ IModelElement inst;
+
+ public NotificationObjectDeleteInstanceOf(IModelElement type,
+ IModelElement inst) {
+ this.type = type;
+ this.inst = inst;
+ addListener(type);
+ addListener(inst);
+
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_DELETE_INSTANCEOF;
+ }
+
+ public IModelElement getType() {
+ return type;
+ }
+
+ public IModelElement getInstance() {
+ return inst;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteRelation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteRelation.java
new file mode 100644
index 0000000..3b84205
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteRelation.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteRelation;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+import org.eclipse.viatra2.core.simple.SimpleRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectDeleteRelation extends NotificationObject
+ implements ICoreNotificationObjectDeleteRelation {
+ String name;
+
+ SimpleRelation deleted;
+
+ SimpleModelElement from;
+
+ SimpleModelElement to;
+
+ public NotificationObjectDeleteRelation(SimpleRelation deleted,
+ SimpleModelElement from, SimpleModelElement to) {
+ this.deleted = deleted;
+ this.from = from;
+ this.to = to;
+ name = deleted.getName();
+ addListener(deleted);
+ addListener(from);
+ addListener(to);
+ }
+
+ public NotificationType getActionTypeEnum() {
+ return NotificationType.ACTION_DELETE_RELATION;
+ }
+
+ public IRelation getDeleted() {
+ return deleted;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IModelElement getFrom() {
+ return from;
+ }
+
+ public IModelElement getTo() {
+ return to;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteSupertypeOf.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteSupertypeOf.java
new file mode 100644
index 0000000..093124a
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectDeleteSupertypeOf.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectDeleteSupertypeOf;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectDeleteSupertypeOf extends NotificationObject
+ implements ICoreNotificationObjectDeleteSupertypeOf {
+ IModelElement sup;
+
+ IModelElement sub;
+
+ public NotificationObjectDeleteSupertypeOf(IModelElement sup,
+ IModelElement sub) {
+ this.sup = sup;
+ this.sub = sub;
+ addListener(sup);
+ addListener(sub);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_DELETE_SUPERTYPEOF;
+ }
+
+ public IModelElement getSuper() {
+ return sup;
+ }
+
+ public IModelElement getSub() {
+ return sub;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomEnd.java
new file mode 100644
index 0000000..1f56b02
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomEnd.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+
+/**
+ * @author Andras Schmidt
+ */
+public class NotificationObjectMoreAtomicsToOneAtomEnd extends
+ NotificationObject {
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_MORE_ATOMICS_TO_ONE_ATOM_END;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomStart.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomStart.java
new file mode 100644
index 0000000..0814ded
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoreAtomicsToOneAtomStart.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectMoreAtomicsToOneAtomStart extends
+ NotificationObject {
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_MORE_ATOMICS_TO_ONE_ATOM_START;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoveTo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoveTo.java
new file mode 100644
index 0000000..51bd837
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectMoveTo.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectMoveTo;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleEntity;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectMoveTo extends NotificationObject implements
+ ICoreNotificationObjectMoveTo {
+ SimpleEntity newCont;
+
+ SimpleEntity oldCont;
+
+ SimpleEntity elem;
+
+ public NotificationObjectMoveTo(SimpleEntity elem, SimpleEntity newCont,
+ SimpleEntity oldCont) {
+ this.newCont = newCont;
+ this.oldCont = oldCont;
+ this.elem = elem;
+ addListener(newCont);
+ addListener(oldCont);
+ addListener(elem);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_MOVE_ELEMENT_TO;
+ }
+
+ public IEntity getNewContainer() {
+ return newCont;
+ }
+
+ public IEntity getElement() {
+ return elem;
+ }
+
+ public IEntity getOldContainer() {
+ return oldCont;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsAny.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsAny.java
new file mode 100644
index 0000000..8ab2eb7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsAny.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetIsAny;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectSetIsAny extends NotificationObject implements
+ ICoreNotificationObjectSetIsAny {
+
+ IRelation me;
+
+ boolean isAny;
+
+ boolean isAnyOld;
+
+ boolean isFromSide;
+
+ public NotificationObjectSetIsAny(IRelation me, boolean isAny,
+ boolean isFromSide, boolean isAnyOld) {
+ this.me = me;
+ this.isAny = isAny;
+ this.isFromSide = isFromSide;
+ addListener(me);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_ISANY;
+ }
+
+ public IModelElement getRelation() {
+ return me;
+ }
+
+ public boolean getIsAny() {
+ return isAny;
+ }
+
+ public boolean getIsFromSideSet() {
+ return isFromSide;
+ }
+
+ public boolean getIsAnyOld() {
+ return isAnyOld;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsFinalType.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsFinalType.java
new file mode 100644
index 0000000..a10535c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetIsFinalType.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetIsFinalType;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ *
+ * @author Istvan Rath
+ *
+ */
+public class NotificationObjectSetIsFinalType extends NotificationObject
+ implements ICoreNotificationObjectSetIsFinalType {
+
+ IModelElement me;
+
+ boolean isfinaltype;
+
+ boolean isfinaltypeOld;
+
+ public NotificationObjectSetIsFinalType(IModelElement me,
+ boolean isfinaltype, boolean isfinalTypeOld) {
+ this.me = me;
+ this.isfinaltype = isfinaltype;
+ this.isfinaltypeOld = isfinalTypeOld;
+ addListener(me);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_ISFINALTYPE;
+ }
+
+ public IModelElement getElement() {
+ return me;
+ }
+
+ public boolean getIsFinalType() {
+ return isfinaltype;
+ }
+
+ public boolean getIsFinalTypeOld() {
+ return isfinaltypeOld;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetName.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetName.java
new file mode 100644
index 0000000..7f6bc39
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetName.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetName;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectSetName extends NotificationObject implements
+ ICoreNotificationObjectSetName {
+ String newName;
+
+ String oldName;
+
+ IModelElement me;
+
+ public NotificationObjectSetName(IModelElement me, String newName,
+ String oldName) {
+ this.me = me;
+ this.newName = newName;
+ this.oldName = oldName;
+ addListener(me);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_NAME;
+ }
+
+ public String getNewName() {
+ return newName;
+ }
+
+ public String getOldName() {
+ return oldName;
+ }
+
+ public IModelElement getElement() {
+ return me;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationFrom.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationFrom.java
new file mode 100644
index 0000000..b38440c
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationFrom.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationFrom;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+import org.eclipse.viatra2.core.simple.SimpleRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectSetRelationFrom extends NotificationObject
+ implements ICoreNotificationObjectSetRelationFrom {
+ SimpleRelation rel;
+
+ SimpleModelElement oldFrom;
+
+ SimpleModelElement newFrom;
+
+ public NotificationObjectSetRelationFrom(SimpleRelation rel,
+ SimpleModelElement oldFrom, SimpleModelElement newFrom) {
+ this.rel = rel;
+ this.oldFrom = oldFrom;
+ this.newFrom = newFrom;
+ addListener(rel);
+ addListener(oldFrom);
+ addListener(newFrom);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_RELATION_FROM;
+ }
+
+ public IRelation getRelation() {
+ return rel;
+ }
+
+ public IModelElement getOldFrom() {
+ return oldFrom;
+ }
+
+ public IModelElement getNewFrom() {
+ return newFrom;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationInverse.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationInverse.java
new file mode 100644
index 0000000..3de4344
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationInverse.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationInverse;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ *
+ * @author Istvan Rath
+ *
+ */
+public class NotificationObjectSetRelationInverse extends NotificationObject
+ implements ICoreNotificationObjectSetRelationInverse {
+
+ IRelation rel;
+
+ IRelation inv;
+
+ public NotificationObjectSetRelationInverse(IRelation rel, IRelation inverse) {
+ this.rel = rel;
+ this.inv = inverse;
+ addListener(rel);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_RELATION_INVERSE;
+ }
+
+ public IRelation getRelation() {
+ return rel;
+ }
+
+ public IRelation getInverse() {
+ return inv;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationIsAggregation.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationIsAggregation.java
new file mode 100644
index 0000000..dd5b593
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationIsAggregation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationIsAggregation;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ *
+ * @author Istvan Rath
+ *
+ */
+public class NotificationObjectSetRelationIsAggregation extends
+ NotificationObject implements
+ ICoreNotificationObjectSetRelationIsAggregation {
+
+ IRelation rel;
+
+ boolean isagg;
+
+ public NotificationObjectSetRelationIsAggregation(IRelation rel,
+ boolean isaggregation) {
+ this.rel = rel;
+ this.isagg = isaggregation;
+ addListener(rel);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_RELATION_ISAGGREGATION;
+ }
+
+ public IRelation getRelation() {
+ return rel;
+ }
+
+ public boolean getIsAggregation() {
+ return isagg;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationMultiplicity.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationMultiplicity.java
new file mode 100644
index 0000000..b9956b7
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationMultiplicity.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.EMultiplicityKind;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationMultiplicity;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt, Istvan Rath
+ *
+ */
+public class NotificationObjectSetRelationMultiplicity extends
+ NotificationObject implements
+ ICoreNotificationObjectSetRelationMultiplicity {
+
+ IRelation rel;
+
+ EMultiplicityKind multi;
+
+ public NotificationObjectSetRelationMultiplicity(IRelation rel,
+ EMultiplicityKind multiplicity) {
+ this.multi = multiplicity;
+ this.rel = rel;
+ addListener(rel);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_RELATION_MULTIPLICITY;
+ }
+
+ public IRelation getRelation() {
+ return rel;
+ }
+
+ public EMultiplicityKind getMultiplicity() {
+ return multi;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationTo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationTo.java
new file mode 100644
index 0000000..ba39a43
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetRelationTo.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.IRelation;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetRelationTo;
+import org.eclipse.viatra2.core.notification.NotificationType;
+import org.eclipse.viatra2.core.simple.SimpleModelElement;
+import org.eclipse.viatra2.core.simple.SimpleRelation;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectSetRelationTo extends NotificationObject
+ implements ICoreNotificationObjectSetRelationTo {
+ SimpleRelation rel;
+
+ SimpleModelElement oldTo;
+
+ SimpleModelElement newTo;
+
+ public NotificationObjectSetRelationTo(SimpleRelation rel,
+ SimpleModelElement oldTo, SimpleModelElement newTo) {
+ this.rel = rel;
+ this.oldTo = oldTo;
+ this.newTo = newTo;
+ addListener(rel);
+ addListener(oldTo);
+ addListener(newTo);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_RELATION_TO;
+ }
+
+ public IRelation getRelation() {
+ return rel;
+ }
+
+ public IModelElement getOldTo() {
+ return oldTo;
+ }
+
+ public IModelElement getNewTo() {
+ return newTo;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetValue.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetValue.java
new file mode 100644
index 0000000..4e688b5
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetValue.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IEntity;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetValue;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectSetValue extends NotificationObject implements
+ ICoreNotificationObjectSetValue {
+ String newValue;
+
+ String oldValue;
+
+ IEntity me;
+
+ public NotificationObjectSetValue(IEntity me, String newValue,
+ String oldValue) {
+ this.me = me;
+ this.newValue = newValue;
+ this.oldValue = oldValue;
+ addListener(me);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_VALUE;
+ }
+
+ public String getNewValue() {
+ return newValue;
+ }
+
+ public String getOldValue() {
+ return oldValue;
+ }
+
+ public IEntity getEntity() {
+ return me;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetViewInfo.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetViewInfo.java
new file mode 100644
index 0000000..f24f005
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSetViewInfo.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.IModelElement;
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSetViewInfo;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectSetViewInfo extends NotificationObject implements
+ ICoreNotificationObjectSetViewInfo {
+ IModelElement me;
+
+ String oldViewInfo;
+
+ String newViewInfo;
+
+ public NotificationObjectSetViewInfo(IModelElement me, String oldViewInfo,
+ String newViewInfo) {
+ this.me = me;
+ this.oldViewInfo = oldViewInfo;
+ this.newViewInfo = newViewInfo;
+ addListener(me);
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.ACTION_SET_VIEW_INFO;
+ }
+
+ public IModelElement getElement() {
+ return me;
+ }
+
+ public String getOldViewInfo() {
+ return oldViewInfo;
+ }
+
+ public String getNewViewInfo() {
+ return newViewInfo;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionAbort.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionAbort.java
new file mode 100644
index 0000000..6871ea2
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionAbort.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectSubTransactionAbort extends NotificationObjectSubTransactionEnd {
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_SUBTRANSACTION_ABORT;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionBegin.java
new file mode 100644
index 0000000..7126000
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionBegin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSubTransactionBegin;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectSubTransactionBegin extends NotificationObject
+ implements ICoreNotificationObjectSubTransactionBegin {
+
+ private Object info;
+
+ public NotificationObjectSubTransactionBegin(Object i) {
+ this.info = i;
+ }
+
+ public NotificationObjectSubTransactionBegin() {
+
+ }
+
+ public Object getInfo() {
+ return info;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_SUBTRANSACTION_BEGIN;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionEnd.java
new file mode 100644
index 0000000..10c75e4
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectSubTransactionEnd.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectSubTransactionEnd;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectSubTransactionEnd extends NotificationObject
+ implements ICoreNotificationObjectSubTransactionEnd {
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_SUBTRANSACTION_END;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionAbort.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionAbort.java
new file mode 100644
index 0000000..036ae1a
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionAbort.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectTransactionAbort extends
+ NotificationObjectTransactionEnd {
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_TRANSACTION_ABORT;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionBegin.java
new file mode 100644
index 0000000..599aa86
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionBegin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectTransactionBegin;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectTransactionBegin extends NotificationObject
+ implements ICoreNotificationObjectTransactionBegin {
+
+ private Object info;
+
+ public NotificationObjectTransactionBegin(Object i) {
+ this.info = i;
+ }
+
+ public NotificationObjectTransactionBegin() {
+
+ }
+
+ public Object getInfo() {
+ return info;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_TRANSACTION_BEGIN;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionEnd.java
new file mode 100644
index 0000000..828fce8
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectTransactionEnd.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectTransactionEnd;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectTransactionEnd extends NotificationObject
+ implements ICoreNotificationObjectTransactionEnd {
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_TRANSACTION_END;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoBegin.java
new file mode 100644
index 0000000..29ddd14
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoBegin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectUndoBegin;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectUndoBegin extends NotificationObject implements
+ ICoreNotificationObjectUndoBegin {
+
+ private Object info;
+
+ public NotificationObjectUndoBegin(Object i) {
+ this.info = i;
+ }
+
+ public NotificationObjectUndoBegin() {
+
+ }
+
+ public Object getInfo() {
+ return info;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_UNDO_BEGIN;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoEnd.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoEnd.java
new file mode 100644
index 0000000..d76ec81
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoEnd.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectUndoEnd;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectUndoEnd extends NotificationObject implements
+ ICoreNotificationObjectUndoEnd {
+
+ private Object info;
+
+ public NotificationObjectUndoEnd(Object i) {
+ this.info = i;
+ }
+
+ public NotificationObjectUndoEnd() {
+
+ }
+
+ public Object getInfo() {
+ return info;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_UNDO_END;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoableTransactionBegin.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoableTransactionBegin.java
new file mode 100644
index 0000000..99ac918
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUndoableTransactionBegin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectUndoableTransactionBegin;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+public class NotificationObjectUndoableTransactionBegin extends
+ NotificationObject implements ICoreNotificationObjectUndoableTransactionBegin {
+
+ private Object info;
+
+ public NotificationObjectUndoableTransactionBegin(Object i) {
+ this.info = i;
+ }
+
+ public NotificationObjectUndoableTransactionBegin() {
+
+ }
+
+ public Object getInfo() {
+ return info;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.TA_UNDOABLE_TRANSACTION_BEGIN;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUserMark.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUserMark.java
new file mode 100644
index 0000000..11ef5bb
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/notification/NotificationObjectUserMark.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.notification;
+
+import org.eclipse.viatra2.core.notification.ICoreNotificationObjectUserMark;
+import org.eclipse.viatra2.core.notification.NotificationType;
+
+/**
+ * @author Andras Schmidt
+ *
+ */
+public class NotificationObjectUserMark extends NotificationObject implements
+ ICoreNotificationObjectUserMark {
+ String type;
+
+ public NotificationObjectUserMark(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public NotificationType getActionTypeEnum() {
+ // TODO Auto-generated method stub
+ return NotificationType.USER_MARK;
+ }
+ public String getMarkName() {
+ return type;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryData.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryData.java
new file mode 100644
index 0000000..9dced27
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryData.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.tempdata;
+
+/**
+ * Temporary data is valid as long as the state counter of the model
+ * (incremented at all model changes) is equal to the state when this temporary
+ * data was created. In other words, temporary data is a dependent information
+ * on the VPM model.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class TemporaryData<E> {
+ /**
+ * The state when this data is valid.
+ */
+ int createdAtState;
+
+ /**
+ * The data stored in this container.
+ */
+ E o;
+
+ /**
+ * Instantiate a container
+ *
+ * @param state
+ * The state when this data is valid.
+ * @param o
+ * The data stored in this container.
+ */
+ TemporaryData(int state, E o) {
+ createdAtState = state;
+ this.o = o;
+ }
+
+ /**
+ * Instantiate a container with data never valid
+ */
+ TemporaryData() {
+ createdAtState = -1;
+ o = null;
+ }
+
+ /**
+ * Check whether the data is valid at curren state.
+ *
+ * @param currentState
+ * the state of the VPM model
+ * @return true is data is still valid
+ */
+ public boolean isValid(int currentState) {
+ if (currentState == createdAtState)
+ return o != null;
+ else {
+ o = null;
+ return false;
+ }
+ }
+
+ /**
+ * The data stored in this container
+ *
+ * @param currentState
+ * the state of VPM model
+ * @return The data stored in this container or null if data is not valid
+ */
+ public E getObject(int currentState) {
+ if (isValid(currentState))
+ return o;
+ else {
+ o = null;
+ return null;
+ }
+ }
+
+ /**
+ * Set the new value of the data
+ *
+ * @param state
+ * The state when this data is valid.
+ * @param o
+ * The data stored in this container.
+ */
+ public void setObject(int currentState, E o) {
+ //this.discard(); // experimental
+ createdAtState = currentState;
+ this.o = o;
+ }
+
+ /**
+ * Clear this tempdata object
+ *
+ * @return 1 if this container stored a value. 0 if not.
+ */
+ public int discard() {
+ Object oldo = o;
+ o = null;
+ if (oldo != null)
+ return 1;
+ else
+ return 0;
+ }
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryDataFactory.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryDataFactory.java
new file mode 100644
index 0000000..60b9008
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/simple/tempdata/TemporaryDataFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.viatra2.core.simple.tempdata;
+
+
+/**
+ * Factory class for <code>TemporaryData</code> objects. All created temporary
+ * objects can be managed through this object.
+ *
+ * @author Andras Schmidt
+ *
+ */
+public class TemporaryDataFactory<T> {
+ /**
+ * Create a new temporary data object
+ *
+ * @param state
+ * VPM model state when data is valid
+ * @param o
+ * initial data
+ * @return new temporary data obejct
+ */
+ public TemporaryData<T> create(int state, T o) {
+ TemporaryData<T> ret = new TemporaryData<T>(state, o);
+ // tempDatas.add(ret);
+ return ret;
+ }
+
+ /**
+ * Create a new temporary data object that contains no valid data
+ *
+ * @return new temporary data obejct
+ */
+ public TemporaryData<T> create() {
+ TemporaryData<T> ret = new TemporaryData<T>();
+ // tempDatas.add(ret);
+ return ret;
+ }
+
+ //private ArrayList<TemporaryData> tempDatas = new ArrayList<TemporaryData>();
+
+ /**
+ * Discard all temporary data. (This method is used to see how much memory
+ * cached data eats, you can also see how many VPM elements were queried
+ * since the last discard)
+ *
+ * @return number of temporary datas stored before discrding.
+ */
+ public int discardAll() {
+ int ret = 0;
+// for (int i = 0; i < tempDatas.size(); ++i) {
+// ret += ((TemporaryData<?>) tempDatas.get(i)).discard();
+// }
+ return ret;
+ }
+
+}
diff --git a/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/tracebased/TraceException.java b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/tracebased/TraceException.java
new file mode 100644
index 0000000..dac2196
--- /dev/null
+++ b/org.eclipse.viatra2.core2/src/org/eclipse/viatra2/core/tracebased/TraceException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004-2010 Abel Hegedus and Daniel Varro
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+