Merged logicui into master
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 20 May 2019 17:31:07 +0000 (19:31 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 20 May 2019 17:31:07 +0000 (19:31 +0200)
23 files changed:
.gitmodules
LogicUI/.classpath [new file with mode: 0644]
LogicUI/.gitignore [new file with mode: 0644]
LogicUI/.project [new file with mode: 0644]
LogicUI/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
LogicUI/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
LogicUI/src/era/mi/gui/LogicUI.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/BasicGUIComponent.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUIAndGate.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUIManualSwitch.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUIMerger.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUIMux.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUINotGate.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUIOrGate.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/components/GUISplitter.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/wires/GUIWire.java [new file with mode: 0644]
LogicUI/src/era/mi/gui/wires/WireConnectionPoint.java [new file with mode: 0644]
SWTHelper [new submodule]
era.mi/.settings/org.eclipse.jdt.ui.prefs
era.mi/src/era/mi/logic/components/ManualSwitch.java
era.mi/src/era/mi/logic/tests/GUITest.java
logicui [deleted submodule]

index a128354..c6d7205 100644 (file)
@@ -1,8 +1,8 @@
-[submodule "logicui"]
-       path = logicui
-       url = <address of this repo>
-       branch = logicui
 [submodule "SampleERCP"]
        path = SampleERCP
        url = <address of this repo>
        branch = SampleERCP
+[submodule "SWTHelper"]
+       path = SWTHelper
+       url = https://github.com/Haspamelodica/SWTHelper
+       branch = master
diff --git a/LogicUI/.classpath b/LogicUI/.classpath
new file mode 100644 (file)
index 0000000..56baf23
--- /dev/null
@@ -0,0 +1,13 @@
+<?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-10">
+               <attributes>
+                       <attribute name="module" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/SWTZoomableCanvas"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/SWT"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/era.mi"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/LogicUI/.gitignore b/LogicUI/.gitignore
new file mode 100644 (file)
index 0000000..ae3c172
--- /dev/null
@@ -0,0 +1 @@
+/bin/
diff --git a/LogicUI/.project b/LogicUI/.project
new file mode 100644 (file)
index 0000000..8b40ae1
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>LogicUI</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/LogicUI/.settings/org.eclipse.jdt.core.prefs b/LogicUI/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..ded5573
--- /dev/null
@@ -0,0 +1,356 @@
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=10\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=10\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.release=enabled\r
+org.eclipse.jdt.core.compiler.source=10\r
+org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false\r
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647\r
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false\r
+org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false\r
+org.eclipse.jdt.core.formatter.align_with_spaces=false\r
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16\r
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16\r
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0\r
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16\r
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16\r
+org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16\r
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80\r
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0\r
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16\r
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16\r
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0\r
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16\r
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0\r
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16\r
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16\r
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16\r
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0\r
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0\r
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80\r
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16\r
+org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0\r
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16\r
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16\r
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0\r
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0\r
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16\r
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1\r
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1\r
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0\r
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0\r
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1\r
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1\r
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1\r
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1\r
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0\r
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1\r
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1\r
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line\r
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line\r
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true\r
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false\r
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false\r
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false\r
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true\r
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true\r
+org.eclipse.jdt.core.formatter.comment.format_header=false\r
+org.eclipse.jdt.core.formatter.comment.format_html=true\r
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true\r
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true\r
+org.eclipse.jdt.core.formatter.comment.format_source_code=true\r
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false\r
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false\r
+org.eclipse.jdt.core.formatter.comment.indent_tag_description=false\r
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert\r
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert\r
+org.eclipse.jdt.core.formatter.comment.line_length=140\r
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true\r
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true\r
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false\r
+org.eclipse.jdt.core.formatter.compact_else_if=true\r
+org.eclipse.jdt.core.formatter.continuation_indentation=2\r
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2\r
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off\r
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on\r
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false\r
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false\r
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true\r
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true\r
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true\r
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true\r
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true\r
+org.eclipse.jdt.core.formatter.indent_empty_lines=false\r
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true\r
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true\r
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true\r
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false\r
+org.eclipse.jdt.core.formatter.indentation.size=4\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert\r
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert\r
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert\r
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert\r
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert\r
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true\r
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true\r
+org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false\r
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false\r
+org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false\r
+org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false\r
+org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false\r
+org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false\r
+org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false\r
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false\r
+org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never\r
+org.eclipse.jdt.core.formatter.lineSplit=140\r
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false\r
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false\r
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0\r
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines\r
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines\r
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true\r
+org.eclipse.jdt.core.formatter.tabulation.char=tab\r
+org.eclipse.jdt.core.formatter.tabulation.size=4\r
+org.eclipse.jdt.core.formatter.use_on_off_tags=true\r
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false\r
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false\r
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true\r
+org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true\r
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true\r
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true\r
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter\r
diff --git a/LogicUI/.settings/org.eclipse.jdt.ui.prefs b/LogicUI/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..3568362
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1\r
+formatter_profile=_ERA-MI\r
+formatter_settings_version=16\r
diff --git a/LogicUI/src/era/mi/gui/LogicUI.java b/LogicUI/src/era/mi/gui/LogicUI.java
new file mode 100644 (file)
index 0000000..ac14c23
--- /dev/null
@@ -0,0 +1,148 @@
+package era.mi.gui;\r
+\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Map;\r
+import java.util.Set;\r
+import java.util.concurrent.atomic.AtomicBoolean;\r
+\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.FillLayout;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+import era.mi.gui.components.BasicGUIComponent;\r
+import era.mi.gui.wires.GUIWire;\r
+import era.mi.logic.Simulation;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.gcs.TranslatedGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.zoomablecanvas.ZoomableCanvas;\r
+import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasOverlay;\r
+import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput;\r
+\r
+/**\r
+ * Standalone simulation visualizer.\r
+ * \r
+ * @author Daniel Kirschten\r
+ */\r
+public class LogicUI\r
+{\r
+       private final Display display;\r
+       private final Shell shell;\r
+       private final ZoomableCanvas canvas;\r
+       private final Set<BasicGUIComponent> components;\r
+       private final Map<BasicGUIComponent, Point> componentPositions;\r
+       private final Set<GUIWire> wires;\r
+\r
+       public LogicUI()\r
+       {\r
+               display = new Display();\r
+               shell = new Shell(display);\r
+               shell.setLayout(new FillLayout());\r
+               canvas = new ZoomableCanvas(shell, SWT.NONE);\r
+\r
+               components = new HashSet<>();\r
+               componentPositions = new HashMap<>();\r
+               wires = new HashSet<>();\r
+\r
+               canvas.addZoomedRenderer(gc -> components.forEach(c -> drawComponent(gc, c)));\r
+               canvas.addZoomedRenderer(gc -> wires.forEach(w -> w.render(gc)));\r
+               ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(canvas);\r
+               userInput.buttonDrag = 3;\r
+               userInput.buttonZoom = 2;\r
+               userInput.enableUserInput();\r
+               new ZoomableCanvasOverlay(canvas, null).enableScale();\r
+               canvas.addListener(SWT.MouseDown, this::mouseDown);\r
+       }\r
+\r
+       /**\r
+        * Add a component to be drawn. Returns the given component for convenience.\r
+        * \r
+        * @author Daniel Kirschten\r
+        */\r
+       public <C extends BasicGUIComponent> C addComponent(C component, double x, double y)\r
+       {\r
+               components.add(component);\r
+               componentPositions.put(component, new Point(x, y));\r
+               return component;\r
+       }\r
+\r
+       /**\r
+        * Add a graphical wire between the given connection points of the given components. The given components have to be added and the given\r
+        * connection points have to be connected logically first.\r
+        * \r
+        * @author Daniel Kirschten\r
+        */\r
+       public void addWire(BasicGUIComponent component1, int component1ConnectionIndex, BasicGUIComponent component2,\r
+                       int component2ConnectionIndex, Point... path)\r
+       {\r
+               wires.add(new GUIWire(canvas::redrawThreadsafe, component1, component1ConnectionIndex, componentPositions.get(component1),\r
+                               component2, component2ConnectionIndex, componentPositions.get(component2), path));\r
+       }\r
+\r
+       private void drawComponent(GeneralGC gc, BasicGUIComponent component)\r
+       {\r
+               TranslatedGC tgc = new TranslatedGC(gc, componentPositions.get(component));\r
+               component.render(tgc);\r
+               tgc.setBackground(display.getSystemColor(SWT.COLOR_BLUE));\r
+       }\r
+\r
+       private void mouseDown(Event e)\r
+       {\r
+               if (e.button == 1)\r
+               {\r
+                       Point click = canvas.displayToWorldCoords(e.x, e.y);\r
+                       for (BasicGUIComponent component : components)\r
+                               if (component.getBounds().translate(componentPositions.get(component)).contains(click))\r
+                               {\r
+                                       if (component.clicked(click.x, click.y))\r
+                                               canvas.redraw();\r
+                                       break;\r
+                               }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Start the simulation timeline, and open the UI shell. Returns when the shell is closed.\r
+        */\r
+       public void run()\r
+       {\r
+               AtomicBoolean running = new AtomicBoolean(true);\r
+               Thread simulationThread = new Thread(() ->\r
+               {\r
+                       while (running.get())\r
+                       {\r
+                               // always execute to keep timeline from "hanging behind" for too long\r
+                               Simulation.TIMELINE.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10);\r
+                               long sleepTime;\r
+                               if (Simulation.TIMELINE.hasNext())\r
+                                       sleepTime = Simulation.TIMELINE.nextEventTime() - System.currentTimeMillis();\r
+                               else\r
+                                       sleepTime = 10;\r
+                               try\r
+                               {\r
+                                       if (sleepTime > 0)\r
+                                               Thread.sleep(sleepTime);\r
+                               }\r
+                               catch (InterruptedException e)\r
+                               {\r
+                               } // it is normal execution flow to be interrupted\r
+                       }\r
+               });\r
+               simulationThread.start();\r
+               Simulation.TIMELINE.addEventAddedListener(event ->\r
+               {\r
+                       if (event.getTiming() <= System.currentTimeMillis())\r
+                               simulationThread.interrupt();\r
+               });\r
+\r
+               shell.open();\r
+               while (!shell.isDisposed())\r
+                       if (!display.readAndDispatch())\r
+                               display.sleep();\r
+               running.set(false);\r
+               simulationThread.interrupt();\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java b/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java
new file mode 100644 (file)
index 0000000..daebd43
--- /dev/null
@@ -0,0 +1,44 @@
+package era.mi.gui.components;\r
+\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public interface BasicGUIComponent\r
+{\r
+       /**\r
+        * Render this component to the given gc, at coordinates (0, 0).\r
+        */\r
+       public void render(GeneralGC gc);\r
+\r
+       /**\r
+        * Returns the bounds of this component. Used for calculating which component is clicked.\r
+        */\r
+       public Rectangle getBounds();\r
+\r
+       /**\r
+        * Called when this component is clicked. Relative coordinates of the click are given. Returns true if this component has to be redrawn.\r
+        */\r
+       public default boolean clicked(double x, double y)\r
+       {\r
+               return false;\r
+       }\r
+\r
+       // TODO this code will be replaced by code in BasicComponent.\r
+       /**\r
+        * Returns how many wire arrays are connected to this component. (Connections are static - they can't be removed and no new ones can be\r
+        * added)\r
+        */\r
+       public int getConnectedWireArraysCount();\r
+\r
+       /**\r
+        * Returns the n-th wire array connected to this component.\r
+        */\r
+       public WireArray getConnectedWireArray(int connectionIndex);\r
+\r
+       /**\r
+        * Returns relative coordinates where the n-th wire array is connected to this component.\r
+        */\r
+       public Point getWireArrayConnectionPoint(int connectionIndex);\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUIAndGate.java b/LogicUI/src/era/mi/gui/components/GUIAndGate.java
new file mode 100644 (file)
index 0000000..a08d123
--- /dev/null
@@ -0,0 +1,83 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.gates.AndGate;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Font;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUIAndGate extends AndGate implements BasicGUIComponent\r
+{\r
+       private static final String LABEL = "&";\r
+\r
+       private final int inputCount;\r
+       private final double height;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUIAndGate(int processTime, WireArray out, WireArray... in)\r
+       {\r
+               super(processTime, out, in);\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               this.inputCount = in.length;\r
+               this.height = inputCount * 10;\r
+\r
+               {\r
+                       connectedWireArraysModifiable.addAll(Arrays.asList(in));\r
+                       double inputHeight = 5;\r
+                       for (int i = 0; i < inputCount; i++, inputHeight += 10)\r
+                               wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight));\r
+               }\r
+\r
+               connectedWireArraysModifiable.add(out);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, height / 2));\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, height);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawRectangle(0, 0, 20, height);\r
+               Font oldFont = gc.getFont();\r
+               Font labelFont = new Font(oldFont.getName(), 5, oldFont.getStyle());\r
+               gc.setFont(labelFont);\r
+               Point textExtent = gc.textExtent(LABEL);\r
+               gc.drawText(LABEL, 10 - textExtent.x / 2, (height - textExtent.y) / 2, true);\r
+               gc.setFont(oldFont);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java b/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java
new file mode 100644 (file)
index 0000000..a4d0c23
--- /dev/null
@@ -0,0 +1,94 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import era.mi.logic.Bit;\r
+import era.mi.logic.components.ManualSwitch;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Font;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent\r
+{\r
+       private static final Map<Bit, String> bitNames;\r
+       static\r
+       {\r
+               Map<Bit, String> bitNamesModifiable = new HashMap<>();\r
+               bitNamesModifiable.put(Bit.ONE, "1");\r
+               bitNamesModifiable.put(Bit.ZERO, "0");\r
+               bitNamesModifiable.put(Bit.Z, "Z");\r
+               bitNamesModifiable.put(Bit.U, "U");\r
+               bitNamesModifiable.put(Bit.X, "X");\r
+               bitNames = Collections.unmodifiableMap(bitNamesModifiable);\r
+       }\r
+\r
+       private final WireArray wa;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUIManualSwitch(WireArray output)\r
+       {\r
+               super(output);\r
+\r
+               this.wa = output;\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               connectedWireArraysModifiable.add(output);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, 7.5));\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, 15);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawRectangle(0, 0, 20, 15);\r
+               String label = bitNames.get(wa.getValue());\r
+               Font oldFont = gc.getFont();\r
+               Font labelFont = new Font(oldFont.getName(), 6, oldFont.getStyle());\r
+               gc.setFont(labelFont);\r
+               Point textExtent = gc.textExtent(label);\r
+               gc.drawText(label, 10 - textExtent.x / 2, 7.5 - textExtent.y / 2, true);\r
+               gc.setFont(oldFont);\r
+       }\r
+\r
+       @Override\r
+       public boolean clicked(double x, double y)\r
+       {\r
+               toggle();\r
+               return true;\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUIMerger.java b/LogicUI/src/era/mi/gui/components/GUIMerger.java
new file mode 100644 (file)
index 0000000..1bf8c80
--- /dev/null
@@ -0,0 +1,78 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.Merger;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUIMerger extends Merger implements BasicGUIComponent\r
+{\r
+       private final int inputCount;\r
+       private final double height;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUIMerger(WireArray union, WireArray... inputs)\r
+       {\r
+               super(union, inputs);\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               this.inputCount = inputs.length;\r
+               this.height = (inputCount - 1) * 10;\r
+\r
+               {\r
+                       connectedWireArraysModifiable.addAll(Arrays.asList(inputs));\r
+                       double inputHeight = 0;\r
+                       for (int i = 0; i < inputCount; i++, inputHeight += 10)\r
+                               wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight));\r
+               }\r
+\r
+               connectedWireArraysModifiable.add(union);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, height / 2));\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, height);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               double inputHeight = 0;\r
+               for (int i = 0; i < inputCount; i++, inputHeight += 10)\r
+                       gc.drawLine(0, inputHeight, 10, inputHeight);\r
+               gc.drawLine(10, 0, 10, height);\r
+               gc.drawLine(10, height / 2, 20, height / 2);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUIMux.java b/LogicUI/src/era/mi/gui/components/GUIMux.java
new file mode 100644 (file)
index 0000000..e753b14
--- /dev/null
@@ -0,0 +1,79 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.Mux;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUIMux extends Mux implements BasicGUIComponent\r
+{\r
+       private final double height;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUIMux(int processTime, WireArray out, WireArray select, WireArray... inputs)\r
+       {\r
+               super(processTime, out, select, inputs);\r
+\r
+               double height = inputs.length * 5;\r
+               if (height < 10)\r
+                       height = 10;\r
+               this.height = height;\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               connectedWireArraysModifiable.add(out);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, 10 + height / 2));\r
+\r
+               connectedWireArraysModifiable.add(select);\r
+               wireArrayConnectionPointsModifiable.add(new Point(10, 5));\r
+\r
+               {\r
+                       connectedWireArraysModifiable.addAll(Arrays.asList(inputs));\r
+                       double inputHeightIncrement = (height + 20) / inputs.length;\r
+                       double inputHeight = inputHeightIncrement / 2;\r
+                       for (int i = 0; i < inputs.length; i++, inputHeight += inputHeightIncrement)\r
+                               wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight));\r
+               }\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, height + 20);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawPolygon(new double[] { 0, 0, 20, 10, 20, height + 10, 0, height + 20 });\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUINotGate.java b/LogicUI/src/era/mi/gui/components/GUINotGate.java
new file mode 100644 (file)
index 0000000..71e1d13
--- /dev/null
@@ -0,0 +1,74 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.gates.NotGate;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Font;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUINotGate extends NotGate implements BasicGUIComponent\r
+{\r
+       private static final String LABEL = "\u22651";// >=1\r
+\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUINotGate(int processTime, WireArray in, WireArray out)\r
+       {\r
+               super(processTime, in, out);\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               connectedWireArraysModifiable.add(in);\r
+               wireArrayConnectionPointsModifiable.add(new Point(0, 5));\r
+\r
+               connectedWireArraysModifiable.add(out);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, 5));\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, 10);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawRectangle(0, 0, 17, 10);\r
+               Font oldFont = gc.getFont();\r
+               Font labelFont = new Font(oldFont.getName(), 5, oldFont.getStyle());\r
+               gc.setFont(labelFont);\r
+               Point textExtent = gc.textExtent(LABEL);\r
+               gc.drawText(LABEL, 8.5 - textExtent.x / 2, 5 - textExtent.y / 2, true);\r
+               gc.setFont(oldFont);\r
+               gc.drawOval(17, 3.5, 3, 3);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUIOrGate.java b/LogicUI/src/era/mi/gui/components/GUIOrGate.java
new file mode 100644 (file)
index 0000000..039dbe3
--- /dev/null
@@ -0,0 +1,83 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.gates.OrGate;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Font;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUIOrGate extends OrGate implements BasicGUIComponent\r
+{\r
+       private static final String LABEL = "\u22651";// >=1\r
+\r
+       private final int inputCount;\r
+       private final double height;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUIOrGate(int processTime, WireArray out, WireArray... in)\r
+       {\r
+               super(processTime, out, in);\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               this.inputCount = in.length;\r
+               this.height = inputCount * 10;\r
+\r
+               {\r
+                       connectedWireArraysModifiable.addAll(Arrays.asList(in));\r
+                       double inputHeight = 5;\r
+                       for (int i = 0; i < inputCount; i++, inputHeight += 10)\r
+                               wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight));\r
+               }\r
+\r
+               connectedWireArraysModifiable.add(out);\r
+               wireArrayConnectionPointsModifiable.add(new Point(20, height / 2));\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, height);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawRectangle(0, 0, 20, height);\r
+               Font oldFont = gc.getFont();\r
+               Font labelFont = new Font(oldFont.getName(), 5, oldFont.getStyle());\r
+               gc.setFont(labelFont);\r
+               Point textExtent = gc.textExtent(LABEL);\r
+               gc.drawText(LABEL, 10 - textExtent.x / 2, (height - textExtent.y) / 2, true);\r
+               gc.setFont(oldFont);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/components/GUISplitter.java b/LogicUI/src/era/mi/gui/components/GUISplitter.java
new file mode 100644 (file)
index 0000000..c39e428
--- /dev/null
@@ -0,0 +1,78 @@
+package era.mi.gui.components;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import era.mi.logic.components.Splitter;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class GUISplitter extends Splitter implements BasicGUIComponent\r
+{\r
+       private final int outputCount;\r
+       private final double height;\r
+       private final List<WireArray> connectedWireArrays;\r
+       private final List<Point> wireArrayConnectionPoints;\r
+\r
+       public GUISplitter(WireArray input, WireArray... outputs)\r
+       {\r
+               super(input, outputs);\r
+\r
+               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
+               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
+\r
+               this.outputCount = outputs.length;\r
+               this.height = (outputCount - 1) * 10;\r
+\r
+               connectedWireArraysModifiable.add(input);\r
+               wireArrayConnectionPointsModifiable.add(new Point(0, height / 2));\r
+\r
+               {\r
+                       connectedWireArraysModifiable.addAll(Arrays.asList(outputs));\r
+                       double outputHeight = 0;\r
+                       for (int i = 0; i < outputCount; i++, outputHeight += 10)\r
+                               wireArrayConnectionPointsModifiable.add(new Point(20, outputHeight));\r
+               }\r
+\r
+               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
+               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 20, height);\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               gc.drawLine(0, height / 2, 10, height / 2);\r
+               gc.drawLine(10, 0, 10, height);\r
+               double outputHeight = 0;\r
+               for (int i = 0; i < outputCount; i++, outputHeight += 10)\r
+                       gc.drawLine(10, outputHeight, 20, outputHeight);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return connectedWireArrays.size();\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return connectedWireArrays.get(connectionIndex);\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionI)\r
+       {\r
+               return wireArrayConnectionPoints.get(connectionI);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java b/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java
new file mode 100644 (file)
index 0000000..e5890d7
--- /dev/null
@@ -0,0 +1,58 @@
+package era.mi.gui.examples;\r
+\r
+import era.mi.gui.LogicUI;\r
+import era.mi.gui.components.GUIManualSwitch;\r
+import era.mi.gui.components.GUINotGate;\r
+import era.mi.gui.components.GUIOrGate;\r
+import era.mi.gui.wires.WireConnectionPoint;\r
+import era.mi.logic.Simulation;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+\r
+public class RSLatchGUIExample\r
+{\r
+       private static final int WIRE_DELAY = 10;\r
+       private static final int OR_DELAY = 50;\r
+       private static final int NOT_DELAY = 50;\r
+\r
+       public static void main(String[] args)\r
+       {\r
+               LogicUI ui = new LogicUI();\r
+               initComponents(ui);\r
+               ui.run();\r
+       }\r
+\r
+       private static void initComponents(LogicUI ui)\r
+       {\r
+               Simulation.TIMELINE.reset();\r
+               WireArray r = new WireArray(1, WIRE_DELAY);\r
+               WireArray s = new WireArray(1, WIRE_DELAY);\r
+               WireArray t2 = new WireArray(1, WIRE_DELAY);\r
+               WireArray t1 = new WireArray(1, WIRE_DELAY);\r
+               WireArray q = new WireArray(1, WIRE_DELAY);\r
+               WireArray nq = new WireArray(1, WIRE_DELAY);\r
+\r
+               GUIManualSwitch rIn = ui.addComponent(new GUIManualSwitch(r), 100, 100);\r
+               GUIManualSwitch sIn = ui.addComponent(new GUIManualSwitch(s), 100, 200);\r
+               GUIOrGate or1 = ui.addComponent(new GUIOrGate(OR_DELAY, t1, r, nq), 160, 102.5);\r
+               GUIOrGate or2 = ui.addComponent(new GUIOrGate(OR_DELAY, t2, q, s), 160, 192.5);\r
+               GUINotGate not1 = ui.addComponent(new GUINotGate(NOT_DELAY, t1, q), 200, 107.5);\r
+               GUINotGate not2 = ui.addComponent(new GUINotGate(NOT_DELAY, t2, nq), 200, 197.5);\r
+\r
+               WireConnectionPoint p1 = ui.addComponent(new WireConnectionPoint(q, 3), 250, 112.5);\r
+               WireConnectionPoint p2 = ui.addComponent(new WireConnectionPoint(nq, 3), 250, 202.5);\r
+               WireConnectionPoint o1 = ui.addComponent(new WireConnectionPoint(q, 1), 270, 112.5);\r
+               WireConnectionPoint o2 = ui.addComponent(new WireConnectionPoint(nq, 1), 270, 202.5);\r
+\r
+               ui.addWire(rIn, 0, or1, 0);\r
+               ui.addWire(sIn, 0, or2, 1);\r
+               ui.addWire(or1, 2, not1, 0);\r
+               ui.addWire(or2, 2, not2, 0);\r
+               ui.addWire(not1, 1, p1, 0);\r
+               ui.addWire(not2, 1, p2, 0);\r
+               ui.addWire(p1, 1, or2, 0, new Point(250, 130), new Point(140, 185), new Point(140, 197.5));\r
+               ui.addWire(p2, 1, or1, 1, new Point(250, 185), new Point(140, 130), new Point(140, 117.5));\r
+               ui.addWire(p1, 2, o1, 0);\r
+               ui.addWire(p2, 2, o2, 0);\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/wires/GUIWire.java b/LogicUI/src/era/mi/gui/wires/GUIWire.java
new file mode 100644 (file)
index 0000000..977b95f
--- /dev/null
@@ -0,0 +1,67 @@
+package era.mi.gui.wires;\r
+\r
+import java.util.Objects;\r
+\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.graphics.Color;\r
+\r
+import era.mi.gui.components.BasicGUIComponent;\r
+import era.mi.logic.Bit;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+\r
+public class GUIWire\r
+{\r
+       private final WireArray wa;\r
+       private final double[] path;\r
+\r
+       public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos,\r
+                       BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path)\r
+       {\r
+               this.wa = component1.getConnectedWireArray(component1ConnectionIndex);\r
+               if (!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex)))\r
+                       throw new IllegalArgumentException("Given connection points are not connected!");\r
+               this.path = new double[path.length * 2 + 4];\r
+               Point component1ConnectionPoint = component1.getWireArrayConnectionPoint(component1ConnectionIndex);\r
+               this.path[0] = component1Pos.x + component1ConnectionPoint.x;\r
+               this.path[1] = component1Pos.y + component1ConnectionPoint.y;\r
+               for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)\r
+               {\r
+                       this.path[dstI + 0] = path[srcI].x;\r
+                       this.path[dstI + 1] = path[srcI].y;\r
+               }\r
+               Point component2ConnectionPoint = component2.getWireArrayConnectionPoint(component2ConnectionIndex);\r
+               this.path[this.path.length - 2] = component2Pos.x + component2ConnectionPoint.x;\r
+               this.path[this.path.length - 1] = component2Pos.y + component2ConnectionPoint.y;\r
+\r
+               wa.addObserver((initiator, oldValues) -> redraw.run());\r
+       }\r
+\r
+       public void render(GeneralGC gc)\r
+       {\r
+               Color oldFG = gc.getForeground();\r
+               if (wa.length == 1)\r
+                       gc.setForeground(gc.getDevice().getSystemColor(getSWTColorConstantForBit(wa.getValue())));\r
+               gc.drawPolyline(path);\r
+               gc.setForeground(oldFG);\r
+       }\r
+\r
+       public static int getSWTColorConstantForBit(Bit bit)\r
+       {\r
+               switch (bit)\r
+               {\r
+               case ONE:\r
+                       return SWT.COLOR_GREEN;\r
+               case ZERO:\r
+                       return SWT.COLOR_BLUE;\r
+               case Z:\r
+                       return SWT.COLOR_BLACK;\r
+               case U:\r
+               case X:\r
+                       return SWT.COLOR_RED;\r
+               default:\r
+                       throw new IllegalArgumentException("Unknown enum constant: " + bit);\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/LogicUI/src/era/mi/gui/wires/WireConnectionPoint.java b/LogicUI/src/era/mi/gui/wires/WireConnectionPoint.java
new file mode 100644 (file)
index 0000000..4b10f1c
--- /dev/null
@@ -0,0 +1,55 @@
+package era.mi.gui.wires;\r
+\r
+import org.eclipse.swt.graphics.Color;\r
+\r
+import era.mi.gui.components.BasicGUIComponent;\r
+import era.mi.logic.wires.WireArray;\r
+import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
+\r
+public class WireConnectionPoint implements BasicGUIComponent\r
+{\r
+       private final WireArray wa;\r
+       private final int wiresCrossing;\r
+\r
+       public WireConnectionPoint(WireArray wa, int wiresCrossing)\r
+       {\r
+               this.wa = wa;\r
+               this.wiresCrossing = wiresCrossing;\r
+       }\r
+\r
+       @Override\r
+       public void render(GeneralGC gc)\r
+       {\r
+               Color oldBG = gc.getBackground();\r
+               if (wa.length == 1)\r
+                       gc.setBackground(gc.getDevice().getSystemColor(GUIWire.getSWTColorConstantForBit(wa.getValue())));\r
+               gc.fillOval(-1, -1, 2, 2);\r
+               gc.setBackground(oldBG);\r
+       }\r
+\r
+       @Override\r
+       public Rectangle getBounds()\r
+       {\r
+               return new Rectangle(0, 0, 0, 0);\r
+       }\r
+\r
+       @Override\r
+       public int getConnectedWireArraysCount()\r
+       {\r
+               return wiresCrossing;\r
+       }\r
+\r
+       @Override\r
+       public WireArray getConnectedWireArray(int connectionIndex)\r
+       {\r
+               return wa;\r
+       }\r
+\r
+       @Override\r
+       public Point getWireArrayConnectionPoint(int connectionIndex)\r
+       {\r
+               return new Point(0, 0);\r
+       }\r
+}
\ No newline at end of file
diff --git a/SWTHelper b/SWTHelper
new file mode 160000 (submodule)
index 0000000..395b1f9
--- /dev/null
+++ b/SWTHelper
@@ -0,0 +1 @@
+Subproject commit 395b1f9321655b638eca4a6715925e7d35e225a3
index 7c7eca3..07b37c1 100644 (file)
@@ -1,63 +1,63 @@
-eclipse.preferences.version=1\r
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true\r
-formatter_profile=_ERA-MI\r
-formatter_settings_version=16\r
-sp_cleanup.add_default_serial_version_id=true\r
-sp_cleanup.add_generated_serial_version_id=false\r
-sp_cleanup.add_missing_annotations=true\r
-sp_cleanup.add_missing_deprecated_annotations=true\r
-sp_cleanup.add_missing_methods=false\r
-sp_cleanup.add_missing_nls_tags=false\r
-sp_cleanup.add_missing_override_annotations=true\r
-sp_cleanup.add_missing_override_annotations_interface_methods=true\r
-sp_cleanup.add_serial_version_id=false\r
-sp_cleanup.always_use_blocks=false\r
-sp_cleanup.always_use_parentheses_in_expressions=false\r
-sp_cleanup.always_use_this_for_non_static_field_access=false\r
-sp_cleanup.always_use_this_for_non_static_method_access=false\r
-sp_cleanup.convert_functional_interfaces=true\r
-sp_cleanup.convert_to_enhanced_for_loop=true\r
-sp_cleanup.correct_indentation=true\r
-sp_cleanup.format_source_code=true\r
-sp_cleanup.format_source_code_changes_only=false\r
-sp_cleanup.insert_inferred_type_arguments=false\r
-sp_cleanup.make_local_variable_final=true\r
-sp_cleanup.make_parameters_final=false\r
-sp_cleanup.make_private_fields_final=true\r
-sp_cleanup.make_type_abstract_if_missing_method=false\r
-sp_cleanup.make_variable_declarations_final=true\r
-sp_cleanup.never_use_blocks=true\r
-sp_cleanup.never_use_parentheses_in_expressions=true\r
-sp_cleanup.on_save_use_additional_actions=false\r
-sp_cleanup.organize_imports=true\r
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false\r
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true\r
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true\r
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true\r
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false\r
-sp_cleanup.remove_private_constructors=true\r
-sp_cleanup.remove_redundant_modifiers=true\r
-sp_cleanup.remove_redundant_semicolons=true\r
-sp_cleanup.remove_redundant_type_arguments=true\r
-sp_cleanup.remove_trailing_whitespaces=true\r
-sp_cleanup.remove_trailing_whitespaces_all=true\r
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false\r
-sp_cleanup.remove_unnecessary_casts=true\r
-sp_cleanup.remove_unnecessary_nls_tags=true\r
-sp_cleanup.remove_unused_imports=true\r
-sp_cleanup.remove_unused_local_variables=false\r
-sp_cleanup.remove_unused_private_fields=true\r
-sp_cleanup.remove_unused_private_members=false\r
-sp_cleanup.remove_unused_private_methods=true\r
-sp_cleanup.remove_unused_private_types=true\r
-sp_cleanup.sort_members=false\r
-sp_cleanup.sort_members_all=false\r
-sp_cleanup.use_anonymous_class_creation=false\r
-sp_cleanup.use_blocks=false\r
-sp_cleanup.use_blocks_only_for_return_and_throw=false\r
-sp_cleanup.use_lambda=true\r
-sp_cleanup.use_parentheses_in_expressions=false\r
-sp_cleanup.use_this_for_non_static_field_access=true\r
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true\r
-sp_cleanup.use_this_for_non_static_method_access=true\r
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true\r
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_ERA-MI
+formatter_settings_version=16
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=false
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=true
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=true
+sp_cleanup.remove_redundant_semicolons=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
index c4b4ffa..0ad4a76 100644 (file)
@@ -1,71 +1,71 @@
-package era.mi.logic.components;\r
-\r
-import java.util.List;\r
-\r
-import era.mi.logic.types.Bit;\r
-import era.mi.logic.wires.Wire.WireEnd;\r
-\r
-/**\r
- * This class models a simple on/off (ONE/ZERO) switch for user interaction.\r
- *\r
- * @author Christian Femers\r
- *\r
- */\r
-public class ManualSwitch implements Component\r
-{\r
-       private WireEnd output;\r
-       private boolean isOn;\r
-\r
-       public ManualSwitch(WireEnd output)\r
-       {\r
-               if (output.length() != 1)\r
-                       throw new IllegalArgumentException("Switch output can be only a single wire");\r
-               this.output = output;\r
-       }\r
-\r
-       public void switchOn()\r
-       {\r
-               setState(true);\r
-       }\r
-\r
-       public void switchOff()\r
-       {\r
-               setState(false);\r
-       }\r
-\r
-       public void toggle()\r
-       {\r
-               setState(!isOn);\r
-       }\r
-\r
-       public void setState(boolean isOn)\r
-       {\r
-               if (this.isOn == isOn)\r
-                       return;\r
-               this.isOn = isOn;\r
-               output.feedSignals(getValue());\r
-       }\r
-\r
-       public boolean isOn()\r
-       {\r
-               return isOn;\r
-       }\r
-\r
-       public Bit getValue()\r
-       {\r
-               return isOn ? Bit.ONE : Bit.ZERO;\r
-       }\r
-\r
-       @Override\r
-       public List<WireEnd> getAllInputs()\r
-       {\r
-               return List.of();\r
-       }\r
-\r
-       @Override\r
-       public List<WireEnd> getAllOutputs()\r
-       {\r
-               return List.of(output);\r
-       }\r
-\r
-}\r
+package era.mi.logic.components;
+
+import java.util.List;
+
+import era.mi.logic.types.Bit;
+import era.mi.logic.wires.Wire.WireEnd;
+
+/**
+ * This class models a simple on/off (ONE/ZERO) switch for user interaction.
+ *
+ * @author Christian Femers
+ *
+ */
+public class ManualSwitch implements Component
+{
+       private WireEnd output;
+       private boolean isOn;
+
+       public ManualSwitch(WireEnd output)
+       {
+               if (output.length() != 1)
+                       throw new IllegalArgumentException("Switch output can be only a single wire");
+               this.output = output;
+       }
+
+       public void switchOn()
+       {
+               setState(true);
+       }
+
+       public void switchOff()
+       {
+               setState(false);
+       }
+
+       public void toggle()
+       {
+               setState(!isOn);
+       }
+
+       public void setState(boolean isOn)
+       {
+               if (this.isOn == isOn)
+                       return;
+               this.isOn = isOn;
+               output.feedSignals(getValue());
+       }
+
+       public boolean isOn()
+       {
+               return isOn;
+       }
+
+       public Bit getValue()
+       {
+               return isOn ? Bit.ONE : Bit.ZERO;
+       }
+
+       @Override
+       public List<WireEnd> getAllInputs()
+       {
+               return List.of();
+       }
+
+       @Override
+       public List<WireEnd> getAllOutputs()
+       {
+               return List.of(output);
+       }
+
+}
index adc4c32..b93d4b6 100644 (file)
-package era.mi.logic.tests;\r
-\r
-import java.awt.Color;\r
-import java.awt.Graphics;\r
-import java.awt.Graphics2D;\r
-import java.awt.Rectangle;\r
-import java.awt.RenderingHints;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Map.Entry;\r
-\r
-import javax.swing.JFrame;\r
-import javax.swing.JPanel;\r
-import javax.swing.WindowConstants;\r
-\r
-import era.mi.logic.Simulation;\r
-import era.mi.logic.components.ManualSwitch;\r
-import era.mi.logic.components.gates.NotGate;\r
-import era.mi.logic.components.gates.OrGate;\r
-import era.mi.logic.timeline.Timeline.ExecutionResult;\r
-import era.mi.logic.wires.Wire;\r
-\r
-public class GUITest extends JPanel\r
-{\r
-\r
-       private static final long serialVersionUID = 1L;\r
-\r
-       private static final int WIRE_DELAY = 40;\r
-       private static final int OR_DELAY = 100;\r
-       private static final int NOT_DELAY = 100;\r
-\r
-       Wire r = new Wire(1, WIRE_DELAY);\r
-       Wire s = new Wire(1, WIRE_DELAY);\r
-       Wire t1 = new Wire(1, WIRE_DELAY);\r
-       Wire t2 = new Wire(1, WIRE_DELAY);\r
-       Wire q = new Wire(1, WIRE_DELAY);\r
-       Wire nq = new Wire(1, WIRE_DELAY);\r
-\r
-       ManualSwitch rIn = new ManualSwitch(r.createEnd());\r
-       ManualSwitch sIn = new ManualSwitch(s.createEnd());\r
-\r
-       OrGate or1 = new OrGate(OR_DELAY, t2.createEnd(), r.createEnd(), nq.createEnd());\r
-       OrGate or2 = new OrGate(OR_DELAY, t1.createEnd(), s.createEnd(), q.createEnd());\r
-       NotGate not1 = new NotGate(NOT_DELAY, t2.createEnd(), q.createEnd());\r
-       NotGate not2 = new NotGate(NOT_DELAY, t1.createEnd(), nq.createEnd());\r
-\r
-       Map<ManualSwitch, Rectangle> switchMap = new HashMap<>();\r
-\r
-       int height;\r
-       int width;\r
-       boolean sizeChanged;\r
-\r
-       public GUITest()\r
-       {\r
-               addMouseListener(new MouseListener()\r
-               {\r
-\r
-                       @Override\r
-                       public void mouseReleased(MouseEvent e)\r
-                       {\r
-                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())\r
-                               {\r
-                                       if (dim.getValue().contains(e.getPoint()))\r
-                                       {\r
-                                               dim.getKey().switchOff();\r
-                                               repaint();\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       @Override\r
-                       public void mousePressed(MouseEvent e)\r
-                       {\r
-                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())\r
-                               {\r
-                                       if (dim.getValue().contains(e.getPoint()))\r
-                                       {\r
-                                               dim.getKey().switchOn();\r
-                                               repaint();\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       @Override\r
-                       public void mouseExited(MouseEvent e)\r
-                       {\r
-                               // none\r
-                       }\r
-\r
-                       @Override\r
-                       public void mouseEntered(MouseEvent e)\r
-                       {\r
-                               // none\r
-                       }\r
-\r
-                       @Override\r
-                       public void mouseClicked(MouseEvent e)\r
-                       {\r
-                               // If you want toggle buttons, use this code instead\r
-//                             for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {\r
-//                                     if (dim.getValue().contains(e.getPoint())) {\r
-//                                             dim.getKey().toggle();\r
-//                                             repaint();\r
-//                                     }\r
-//                             }\r
-                       }\r
-               });\r
-       }\r
-\r
-       @Override\r
-       public void paint(Graphics some_g)\r
-       {\r
-               super.paint(some_g);\r
-               Graphics2D g = ((Graphics2D) some_g);\r
-               g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);\r
-               g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r
-               g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);\r
-\r
-               checkSizeChange();\r
-               adaptFont(g);\r
-\r
-               drawWire(g, r, "r", 2, 9, 4, 9);\r
-\r
-               drawWire(g, s, "s", 2, 3, 4, 3);\r
-\r
-               drawWire(g, t2, "t2", 5, 8.5, 6, 8.5);\r
-\r
-               drawWire(g, t1, "t1", 5, 3.5, 6, 3.5);\r
-\r
-               drawWire(g, q, "q", 7, 8.5, 9, 8.5);\r
-\r
-               drawWire(g, nq, "nq", 7, 3.5, 9, 3.5);\r
-\r
-               drawWire(g, q, "", 7.5, 8.5, 7.5, 7.5);\r
-               drawWire(g, q, "", 7.5, 7.5, 3, 4.5);\r
-               drawWire(g, q, "", 3, 4.5, 3, 4);\r
-               drawWire(g, q, "q", 3, 4, 4, 4);\r
-\r
-               drawWire(g, nq, "", 7.5, 3.5, 7.5, 4.5);\r
-               drawWire(g, nq, "", 7.5, 4.5, 3, 7.5);\r
-               drawWire(g, nq, "", 3, 7.5, 3, 8);\r
-               drawWire(g, nq, "nq", 3, 8, 4, 8);\r
-\r
-               drawSquare(g, 4, 8, "OR");\r
-               drawSquare(g, 4, 3, "OR");\r
-\r
-               drawSquare(g, 6, 8, "NOT");\r
-               drawSquare(g, 6, 3, "NOT");\r
-\r
-               drawSwitch(g, rIn, "Switch R", 0.5, 8.25, 2, 9.75);\r
-               drawSwitch(g, sIn, "Switch S", 0.5, 2.25, 2, 3.75);\r
-\r
-               drawString(g, "Hint: drag the cursor out of the pressed switch to keep it's state", 5, 0, 0.0, 1.0);\r
-       }\r
-\r
-       private void checkSizeChange()\r
-       {\r
-               sizeChanged = height != getHeight() || width != getWidth();\r
-               if (sizeChanged)\r
-               {\r
-                       height = getHeight();\r
-                       width = getWidth();\r
-               }\r
-       }\r
-\r
-       private void adaptFont(Graphics g)\r
-       {\r
-               g.setFont(g.getFont().deriveFont(Math.min(height, width) / 40f));\r
-       }\r
-\r
-       private void drawString(Graphics g, String s, int x, int y, double anchorX, double anchorY)\r
-       {\r
-               int h = g.getFontMetrics().getAscent();\r
-               int w = g.getFontMetrics().stringWidth(s);\r
-               g.drawString(s, x - (int) (w * anchorX), y + (int) (h * anchorY));\r
-       }\r
-\r
-       private void drawWire(Graphics g, Wire wa, String name, double x1, double y1, double x2, double y2)\r
-       {\r
-               setTo(g, wa);\r
-               g.drawLine(gX(x1), gY(y1), gX(x2), gY(y2));\r
-               drawString(g, name, (gX(x1) + gX(x2)) / 2, (gY(y1) + gY(y2)) / 2 - 5, 0, 0);\r
-       }\r
-\r
-       private void drawSquare(Graphics g, int posX, int posY, String text)\r
-       {\r
-               int x1 = gX(posX) - 5;\r
-               int x2 = gX(posX + 1) + 5;\r
-               int y1 = gY(posY) - 5;\r
-               int y2 = gY(posY + 1) + 5;\r
-\r
-               g.setColor(Color.WHITE);\r
-               g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);\r
-               setBlack(g);\r
-               g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);\r
-               drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);\r
-\r
-       }\r
-\r
-       private void drawSwitch(Graphics g, ManualSwitch ms, String text, double posX1, double posY1, double posX2, double posY2)\r
-       {\r
-               int x1 = gX(posX1) - 5;\r
-               int x2 = gX(posX2) + 5;\r
-               int y1 = gY(posY1) - 5;\r
-               int y2 = gY(posY2) + 5;\r
-\r
-               if (sizeChanged)\r
-               {\r
-                       Rectangle r = new Rectangle(x1, y1, x2 - x1, y2 - y1);\r
-                       switchMap.put(ms, r);\r
-               }\r
-\r
-               g.setColor(ms.isOn() ? Color.getHSBColor(.3f, .5f, 1f) : Color.WHITE);\r
-               g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);\r
-               setBlack(g);\r
-               g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);\r
-               drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);\r
-       }\r
-\r
-       private static void setBlack(Graphics g)\r
-       {\r
-               g.setColor(Color.BLACK);\r
-       }\r
-\r
-       private static void setTo(Graphics g, Wire wa)\r
-       {\r
-               switch (wa.getValue())\r
-               {\r
-               case ONE:\r
-                       g.setColor(Color.GREEN);\r
-                       break;\r
-               case X:\r
-                       g.setColor(Color.RED);\r
-                       break;\r
-               case Z:\r
-                       g.setColor(Color.DARK_GRAY);\r
-                       break;\r
-               case ZERO:\r
-                       g.setColor(Color.BLACK);\r
-                       break;\r
-               case U:\r
-                       g.setColor(Color.MAGENTA);\r
-                       break;\r
-               default:\r
-                       throw new IllegalArgumentException();\r
-               }\r
-       }\r
-\r
-       private int gY(double pos)\r
-       {\r
-               return (int) (pos * height / 11);\r
-       }\r
-\r
-       private int gX(double pos)\r
-       {\r
-               return (int) (pos * width / 11) + 50;\r
-       }\r
-\r
-       public static void main(String[] args)\r
-       {\r
-               JFrame f = new JFrame("Test circuit 1.0.0");\r
-               GUITest gt = new GUITest();\r
-               f.add(gt);\r
-               f.setSize(800, 600);\r
-               f.setLocation(500, 400);\r
-               f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);\r
-               f.setVisible(true);\r
-\r
-               long begin = System.currentTimeMillis();\r
-\r
-               long lastFrame = begin;\r
-               long updateT = 16;\r
-\r
-               while (f.isVisible())\r
-               {\r
-                       ExecutionResult er = Simulation.TIMELINE.executeUpTo((lastFrame - begin) * 3, lastFrame + 14);\r
-//                             if (Simulation.TIMELINE.hasNext()) \r
-//                             Simulation.TIMELINE.executeNext();\r
-                       if (er != ExecutionResult.NOTHING_DONE)\r
-                               gt.repaint(12);\r
-                       try\r
-                       {\r
-                               Thread.sleep(Math.max(updateT - System.currentTimeMillis() + lastFrame, 0));\r
-                       }\r
-                       catch (Exception e)\r
-                       {\r
-                               e.printStackTrace();\r
-                       }\r
-                       lastFrame = System.currentTimeMillis();\r
-               }\r
-       }\r
-}\r
+package era.mi.logic.tests;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.WindowConstants;
+
+import era.mi.logic.Simulation;
+import era.mi.logic.components.ManualSwitch;
+import era.mi.logic.components.gates.NotGate;
+import era.mi.logic.components.gates.OrGate;
+import era.mi.logic.timeline.Timeline.ExecutionResult;
+import era.mi.logic.wires.Wire;
+
+public class GUITest extends JPanel
+{
+
+       private static final long serialVersionUID = 1L;
+
+       private static final int WIRE_DELAY = 40;
+       private static final int OR_DELAY = 100;
+       private static final int NOT_DELAY = 100;
+
+       Wire r = new Wire(1, WIRE_DELAY);
+       Wire s = new Wire(1, WIRE_DELAY);
+       Wire t1 = new Wire(1, WIRE_DELAY);
+       Wire t2 = new Wire(1, WIRE_DELAY);
+       Wire q = new Wire(1, WIRE_DELAY);
+       Wire nq = new Wire(1, WIRE_DELAY);
+
+       ManualSwitch rIn = new ManualSwitch(r.createEnd());
+       ManualSwitch sIn = new ManualSwitch(s.createEnd());
+
+       OrGate or1 = new OrGate(OR_DELAY, t2.createEnd(), r.createEnd(), nq.createEnd());
+       OrGate or2 = new OrGate(OR_DELAY, t1.createEnd(), s.createEnd(), q.createEnd());
+       NotGate not1 = new NotGate(NOT_DELAY, t2.createEnd(), q.createEnd());
+       NotGate not2 = new NotGate(NOT_DELAY, t1.createEnd(), nq.createEnd());
+
+       Map<ManualSwitch, Rectangle> switchMap = new HashMap<>();
+
+       int height;
+       int width;
+       boolean sizeChanged;
+
+       public GUITest()
+       {
+               addMouseListener(new MouseListener()
+               {
+
+                       @Override
+                       public void mouseReleased(MouseEvent e)
+                       {
+                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())
+                               {
+                                       if (dim.getValue().contains(e.getPoint()))
+                                       {
+                                               dim.getKey().switchOff();
+                                               repaint();
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mousePressed(MouseEvent e)
+                       {
+                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())
+                               {
+                                       if (dim.getValue().contains(e.getPoint()))
+                                       {
+                                               dim.getKey().switchOn();
+                                               repaint();
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mouseExited(MouseEvent e)
+                       {
+                               // none
+                       }
+
+                       @Override
+                       public void mouseEntered(MouseEvent e)
+                       {
+                               // none
+                       }
+
+                       @Override
+                       public void mouseClicked(MouseEvent e)
+                       {
+                               // If you want toggle buttons, use this code instead
+//                             for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {
+//                                     if (dim.getValue().contains(e.getPoint())) {
+//                                             dim.getKey().toggle();
+//                                             repaint();
+//                                     }
+//                             }
+                       }
+               });
+       }
+
+       @Override
+       public void paint(Graphics some_g)
+       {
+               super.paint(some_g);
+               Graphics2D g = ((Graphics2D) some_g);
+               g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
+               g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+               g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+
+               checkSizeChange();
+               adaptFont(g);
+
+               drawWire(g, r, "r", 2, 9, 4, 9);
+
+               drawWire(g, s, "s", 2, 3, 4, 3);
+
+               drawWire(g, t2, "t2", 5, 8.5, 6, 8.5);
+
+               drawWire(g, t1, "t1", 5, 3.5, 6, 3.5);
+
+               drawWire(g, q, "q", 7, 8.5, 9, 8.5);
+
+               drawWire(g, nq, "nq", 7, 3.5, 9, 3.5);
+
+               drawWire(g, q, "", 7.5, 8.5, 7.5, 7.5);
+               drawWire(g, q, "", 7.5, 7.5, 3, 4.5);
+               drawWire(g, q, "", 3, 4.5, 3, 4);
+               drawWire(g, q, "q", 3, 4, 4, 4);
+
+               drawWire(g, nq, "", 7.5, 3.5, 7.5, 4.5);
+               drawWire(g, nq, "", 7.5, 4.5, 3, 7.5);
+               drawWire(g, nq, "", 3, 7.5, 3, 8);
+               drawWire(g, nq, "nq", 3, 8, 4, 8);
+
+               drawSquare(g, 4, 8, "OR");
+               drawSquare(g, 4, 3, "OR");
+
+               drawSquare(g, 6, 8, "NOT");
+               drawSquare(g, 6, 3, "NOT");
+
+               drawSwitch(g, rIn, "Switch R", 0.5, 8.25, 2, 9.75);
+               drawSwitch(g, sIn, "Switch S", 0.5, 2.25, 2, 3.75);
+
+               drawString(g, "Hint: drag the cursor out of the pressed switch to keep it's state", 5, 0, 0.0, 1.0);
+       }
+
+       private void checkSizeChange()
+       {
+               sizeChanged = height != getHeight() || width != getWidth();
+               if (sizeChanged)
+               {
+                       height = getHeight();
+                       width = getWidth();
+               }
+       }
+
+       private void adaptFont(Graphics g)
+       {
+               g.setFont(g.getFont().deriveFont(Math.min(height, width) / 40f));
+       }
+
+       private void drawString(Graphics g, String s, int x, int y, double anchorX, double anchorY)
+       {
+               int h = g.getFontMetrics().getAscent();
+               int w = g.getFontMetrics().stringWidth(s);
+               g.drawString(s, x - (int) (w * anchorX), y + (int) (h * anchorY));
+       }
+
+       private void drawWire(Graphics g, Wire wa, String name, double x1, double y1, double x2, double y2)
+       {
+               setTo(g, wa);
+               g.drawLine(gX(x1), gY(y1), gX(x2), gY(y2));
+               drawString(g, name, (gX(x1) + gX(x2)) / 2, (gY(y1) + gY(y2)) / 2 - 5, 0, 0);
+       }
+
+       private void drawSquare(Graphics g, int posX, int posY, String text)
+       {
+               int x1 = gX(posX) - 5;
+               int x2 = gX(posX + 1) + 5;
+               int y1 = gY(posY) - 5;
+               int y2 = gY(posY + 1) + 5;
+
+               g.setColor(Color.WHITE);
+               g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+               setBlack(g);
+               g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+               drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
+
+       }
+
+       private void drawSwitch(Graphics g, ManualSwitch ms, String text, double posX1, double posY1, double posX2, double posY2)
+       {
+               int x1 = gX(posX1) - 5;
+               int x2 = gX(posX2) + 5;
+               int y1 = gY(posY1) - 5;
+               int y2 = gY(posY2) + 5;
+
+               if (sizeChanged)
+               {
+                       Rectangle r = new Rectangle(x1, y1, x2 - x1, y2 - y1);
+                       switchMap.put(ms, r);
+               }
+
+               g.setColor(ms.isOn() ? Color.getHSBColor(.3f, .5f, 1f) : Color.WHITE);
+               g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+               setBlack(g);
+               g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+               drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
+       }
+
+       private static void setBlack(Graphics g)
+       {
+               g.setColor(Color.BLACK);
+       }
+
+       private static void setTo(Graphics g, Wire wa)
+       {
+               switch (wa.getValue())
+               {
+               case ONE:
+                       g.setColor(Color.GREEN);
+                       break;
+               case X:
+                       g.setColor(Color.RED);
+                       break;
+               case Z:
+                       g.setColor(Color.DARK_GRAY);
+                       break;
+               case ZERO:
+                       g.setColor(Color.BLACK);
+                       break;
+               case U:
+                       g.setColor(Color.MAGENTA);
+                       break;
+               default:
+                       throw new IllegalArgumentException();
+               }
+       }
+
+       private int gY(double pos)
+       {
+               return (int) (pos * height / 11);
+       }
+
+       private int gX(double pos)
+       {
+               return (int) (pos * width / 11) + 50;
+       }
+
+       public static void main(String[] args)
+       {
+               JFrame f = new JFrame("Test circuit 1.0.0");
+               GUITest gt = new GUITest();
+               f.add(gt);
+               f.setSize(800, 600);
+               f.setLocation(500, 400);
+               f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+               f.setVisible(true);
+
+               long begin = System.currentTimeMillis();
+
+               long lastFrame = begin;
+               long updateT = 16;
+
+               while (f.isVisible())
+               {
+                       ExecutionResult er = Simulation.TIMELINE.executeUpTo((lastFrame - begin) * 3, lastFrame + 14);
+//                             if (Simulation.TIMELINE.hasNext()) 
+//                             Simulation.TIMELINE.executeNext();
+                       if (er != ExecutionResult.NOTHING_DONE)
+                               gt.repaint(12);
+                       try
+                       {
+                               Thread.sleep(Math.max(updateT - System.currentTimeMillis() + lastFrame, 0));
+                       }
+                       catch (Exception e)
+                       {
+                               e.printStackTrace();
+                       }
+                       lastFrame = System.currentTimeMillis();
+               }
+       }
+}
diff --git a/logicui b/logicui
deleted file mode 160000 (submodule)
index 32a3d41..0000000
--- a/logicui
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 32a3d41c11b96c2530c25b6059b4341a8b34a2e2