From 873c7cd58e0a035e68b5af352260da9f4d667c96 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Sun, 19 May 2019 19:58:26 +0200 Subject: [PATCH] Made formatting uniform - commit for logicui --- LogicUI/.settings/org.eclipse.jdt.core.prefs | 344 ++++++++++++++++++ LogicUI/.settings/org.eclipse.jdt.ui.prefs | 3 + LogicUI/src/era/mi/gui/LogicUI.java | 60 +-- .../mi/gui/components/BasicGUIComponent.java | 16 +- .../src/era/mi/gui/components/GUIAndGate.java | 13 +- .../mi/gui/components/GUIManualSwitch.java | 10 +- .../src/era/mi/gui/components/GUIMerger.java | 15 +- LogicUI/src/era/mi/gui/components/GUIMux.java | 20 +- .../src/era/mi/gui/components/GUINotGate.java | 9 +- .../src/era/mi/gui/components/GUIOrGate.java | 15 +- .../era/mi/gui/components/GUISplitter.java | 15 +- .../mi/gui/examples/RSLatchGUIExample.java | 6 +- LogicUI/src/era/mi/gui/wires/GUIWire.java | 37 +- .../era/mi/gui/wires/WireConnectionPoint.java | 10 +- 14 files changed, 476 insertions(+), 97 deletions(-) create mode 100644 LogicUI/.settings/org.eclipse.jdt.ui.prefs diff --git a/LogicUI/.settings/org.eclipse.jdt.core.prefs b/LogicUI/.settings/org.eclipse.jdt.core.prefs index a54bb93c..36338ef7 100644 --- a/LogicUI/.settings/org.eclipse.jdt.core.prefs +++ b/LogicUI/.settings/org.eclipse.jdt.core.prefs @@ -10,3 +10,347 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.source=10 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=140 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=140 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/LogicUI/.settings/org.eclipse.jdt.ui.prefs b/LogicUI/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..1972ab1d --- /dev/null +++ b/LogicUI/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=_ERA-MI +formatter_settings_version=16 diff --git a/LogicUI/src/era/mi/gui/LogicUI.java b/LogicUI/src/era/mi/gui/LogicUI.java index 1a4b76e4..45a8fa2a 100644 --- a/LogicUI/src/era/mi/gui/LogicUI.java +++ b/LogicUI/src/era/mi/gui/LogicUI.java @@ -29,12 +29,12 @@ import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInpu */ public class LogicUI { - private final Display display; - private final Shell shell; - private final ZoomableCanvas canvas; - private final Set components; - private final Map componentPositions; - private final Set wires; + private final Display display; + private final Shell shell; + private final ZoomableCanvas canvas; + private final Set components; + private final Map componentPositions; + private final Set wires; public LogicUI() { @@ -56,9 +56,9 @@ public class LogicUI new ZoomableCanvasOverlay(canvas, null).enableScale(); canvas.addListener(SWT.MouseDown, this::mouseDown); } + /** - * Add a component to be drawn. - * Returns the given component for convenience. + * Add a component to be drawn. Returns the given component for convenience. * * @author Daniel Kirschten */ @@ -68,31 +68,36 @@ public class LogicUI componentPositions.put(component, new Point(x, y)); return component; } + /** - * Add a graphical wire between the given connection points of the given components. - * The given components have to be added and the given connection points have to be connected logically first. + * Add a graphical wire between the given connection points of the given components. The given components have to be added and the given + * connection points have to be connected logically first. * * @author Daniel Kirschten */ - public void addWire(BasicGUIComponent component1, int component1ConnectionIndex, BasicGUIComponent component2, int component2ConnectionIndex, Point... path) + public void addWire(BasicGUIComponent component1, int component1ConnectionIndex, BasicGUIComponent component2, + int component2ConnectionIndex, Point... path) { - wires.add(new GUIWire(canvas::redrawThreadsafe, component1, component1ConnectionIndex, componentPositions.get(component1), component2, component2ConnectionIndex, componentPositions.get(component2), path)); + wires.add(new GUIWire(canvas::redrawThreadsafe, component1, component1ConnectionIndex, componentPositions.get(component1), + component2, component2ConnectionIndex, componentPositions.get(component2), path)); } + private void drawComponent(GeneralGC gc, BasicGUIComponent component) { TranslatedGC tgc = new TranslatedGC(gc, componentPositions.get(component)); component.render(tgc); tgc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); } + private void mouseDown(Event e) { - if(e.button == 1) + if (e.button == 1) { Point click = canvas.displayToWorldCoords(e.x, e.y); - for(BasicGUIComponent component : components) - if(component.getBounds().translate(componentPositions.get(component)).contains(click)) + for (BasicGUIComponent component : components) + if (component.getBounds().translate(componentPositions.get(component)).contains(click)) { - if(component.clicked(click.x, click.y)) + if (component.clicked(click.x, click.y)) canvas.redraw(); break; } @@ -100,41 +105,42 @@ public class LogicUI } /** - * Start the simulation timeline, and open the UI shell. - * Returns when the shell is closed. + * Start the simulation timeline, and open the UI shell. Returns when the shell is closed. */ public void run() { AtomicBoolean running = new AtomicBoolean(true); Thread simulationThread = new Thread(() -> { - while(running.get()) + while (running.get()) { - //always execute to keep timeline from "hanging behind" for too long + // always execute to keep timeline from "hanging behind" for too long Simulation.TIMELINE.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10); long sleepTime; - if(Simulation.TIMELINE.hasNext()) + if (Simulation.TIMELINE.hasNext()) sleepTime = Simulation.TIMELINE.nextEventTime() - System.currentTimeMillis(); else sleepTime = 10; try { - if(sleepTime > 0) + if (sleepTime > 0) Thread.sleep(sleepTime); - } catch(InterruptedException e) - {} //it is normal execution flow to be interrupted + } + catch (InterruptedException e) + { + } // it is normal execution flow to be interrupted } }); simulationThread.start(); Simulation.TIMELINE.addEventAddedListener(event -> { - if(event.getTiming() <= System.currentTimeMillis()) + if (event.getTiming() <= System.currentTimeMillis()) simulationThread.interrupt(); }); shell.open(); - while(!shell.isDisposed()) - if(!display.readAndDispatch()) + while (!shell.isDisposed()) + if (!display.readAndDispatch()) display.sleep(); running.set(false); simulationThread.interrupt(); diff --git a/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java b/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java index 29696e13..fa753e18 100644 --- a/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java +++ b/LogicUI/src/era/mi/gui/components/BasicGUIComponent.java @@ -11,30 +11,32 @@ public interface BasicGUIComponent * Render this component to the given gc, at coordinates (0, 0). */ public void render(GeneralGC gc); + /** - * Returns the bounds of this component. - * Used for calculating which component is clicked. + * Returns the bounds of this component. Used for calculating which component is clicked. */ public Rectangle getBounds(); + /** - * Called when this component is clicked. Relative coordinates of the click are given. - * Returns true if this component has to be redrawn. + * Called when this component is clicked. Relative coordinates of the click are given. Returns true if this component has to be redrawn. */ public default boolean clicked(double x, double y) { return false; } - //TODO this code will be replaced by code in BasicComponent. + // TODO this code will be replaced by code in BasicComponent. /** - * Returns how many wire arrays are connected to this component. - * (Connections are static - they can't be removed and no new ones can be added) + * Returns how many wire arrays are connected to this component. (Connections are static - they can't be removed and no new ones can be + * added) */ public int getConnectedWireArraysCount(); + /** * Returns the n-th wire array connected to this component. */ public WireArray getConnectedWireArray(int connectionIndex); + /** * Returns relative coordinates where the n-th wire array is connected to this component. */ diff --git a/LogicUI/src/era/mi/gui/components/GUIAndGate.java b/LogicUI/src/era/mi/gui/components/GUIAndGate.java index 3a5a5e66..fa51232b 100644 --- a/LogicUI/src/era/mi/gui/components/GUIAndGate.java +++ b/LogicUI/src/era/mi/gui/components/GUIAndGate.java @@ -16,10 +16,10 @@ public class GUIAndGate extends AndGate implements BasicGUIComponent { private static final String LABEL = "&"; - private final int inputCount; - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final int inputCount; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIAndGate(int processTime, WireArray out, WireArray... in) { @@ -34,7 +34,7 @@ public class GUIAndGate extends AndGate implements BasicGUIComponent { connectedWireArraysModifiable.addAll(Arrays.asList(in)); double inputHeight = 5; - for(int i = 0; i < inputCount; i ++, inputHeight += 10) + for (int i = 0; i < inputCount; i++, inputHeight += 10) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -50,6 +50,7 @@ public class GUIAndGate extends AndGate implements BasicGUIComponent { return new Rectangle(0, 0, 20, height); } + @Override public void render(GeneralGC gc) { @@ -67,11 +68,13 @@ public class GUIAndGate extends AndGate implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java b/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java index 9c57b9f8..c3100ffb 100644 --- a/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java +++ b/LogicUI/src/era/mi/gui/components/GUIManualSwitch.java @@ -28,9 +28,9 @@ public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent bitNames = Collections.unmodifiableMap(bitNamesModifiable); } - private final WireArray wa; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final WireArray wa; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIManualSwitch(WireArray output) { @@ -53,6 +53,7 @@ public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent { return new Rectangle(0, 0, 20, 15); } + @Override public void render(GeneralGC gc) { @@ -65,6 +66,7 @@ public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent gc.drawText(label, 10 - textExtent.x / 2, 7.5 - textExtent.y / 2, true); gc.setFont(oldFont); } + @Override public boolean clicked(double x, double y) { @@ -77,11 +79,13 @@ public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUIMerger.java b/LogicUI/src/era/mi/gui/components/GUIMerger.java index 601b434d..dd15f173 100644 --- a/LogicUI/src/era/mi/gui/components/GUIMerger.java +++ b/LogicUI/src/era/mi/gui/components/GUIMerger.java @@ -13,10 +13,10 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUIMerger extends Merger implements BasicGUIComponent { - private final int inputCount; - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final int inputCount; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIMerger(WireArray union, WireArray... inputs) { @@ -31,7 +31,7 @@ public class GUIMerger extends Merger implements BasicGUIComponent { connectedWireArraysModifiable.addAll(Arrays.asList(inputs)); double inputHeight = 0; - for(int i = 0; i < inputCount; i ++, inputHeight += 10) + for (int i = 0; i < inputCount; i++, inputHeight += 10) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -47,11 +47,12 @@ public class GUIMerger extends Merger implements BasicGUIComponent { return new Rectangle(0, 0, 20, height); } + @Override public void render(GeneralGC gc) { double inputHeight = 0; - for(int i = 0; i < inputCount; i ++, inputHeight += 10) + for (int i = 0; i < inputCount; i++, inputHeight += 10) gc.drawLine(0, inputHeight, 10, inputHeight); gc.drawLine(10, 0, 10, height); gc.drawLine(10, height / 2, 20, height / 2); @@ -62,11 +63,13 @@ public class GUIMerger extends Merger implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUIMux.java b/LogicUI/src/era/mi/gui/components/GUIMux.java index 0082a768..88ccbd73 100644 --- a/LogicUI/src/era/mi/gui/components/GUIMux.java +++ b/LogicUI/src/era/mi/gui/components/GUIMux.java @@ -13,16 +13,16 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUIMux extends Mux implements BasicGUIComponent { - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIMux(int processTime, WireArray out, WireArray select, WireArray... inputs) { super(processTime, out, select, inputs); double height = inputs.length * 5; - if(height < 10) + if (height < 10) height = 10; this.height = height; @@ -39,7 +39,7 @@ public class GUIMux extends Mux implements BasicGUIComponent connectedWireArraysModifiable.addAll(Arrays.asList(inputs)); double inputHeightIncrement = (height + 20) / inputs.length; double inputHeight = inputHeightIncrement / 2; - for(int i = 0; i < inputs.length; i ++, inputHeight += inputHeightIncrement) + for (int i = 0; i < inputs.length; i++, inputHeight += inputHeightIncrement) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -52,25 +52,25 @@ public class GUIMux extends Mux implements BasicGUIComponent { return new Rectangle(0, 0, 20, height + 20); } + @Override public void render(GeneralGC gc) { - gc.drawPolygon(new double[] { - 0, 0, - 20, 10, - 20, height + 10, - 0, height + 20}); + gc.drawPolygon(new double[] { 0, 0, 20, 10, 20, height + 10, 0, height + 20 }); } + @Override public int getConnectedWireArraysCount() { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUINotGate.java b/LogicUI/src/era/mi/gui/components/GUINotGate.java index 78bed33f..11f80b83 100644 --- a/LogicUI/src/era/mi/gui/components/GUINotGate.java +++ b/LogicUI/src/era/mi/gui/components/GUINotGate.java @@ -13,10 +13,10 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUINotGate extends NotGate implements BasicGUIComponent { - private static final String LABEL = "\u22651";//>=1 + private static final String LABEL = "\u22651";// >=1 - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUINotGate(int processTime, WireArray in, WireArray out) { @@ -40,6 +40,7 @@ public class GUINotGate extends NotGate implements BasicGUIComponent { return new Rectangle(0, 0, 20, 10); } + @Override public void render(GeneralGC gc) { @@ -58,11 +59,13 @@ public class GUINotGate extends NotGate implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUIOrGate.java b/LogicUI/src/era/mi/gui/components/GUIOrGate.java index 90b7039e..1b37b100 100644 --- a/LogicUI/src/era/mi/gui/components/GUIOrGate.java +++ b/LogicUI/src/era/mi/gui/components/GUIOrGate.java @@ -14,12 +14,12 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUIOrGate extends OrGate implements BasicGUIComponent { - private static final String LABEL = "\u22651";//>=1 + private static final String LABEL = "\u22651";// >=1 - private final int inputCount; - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final int inputCount; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIOrGate(int processTime, WireArray out, WireArray... in) { @@ -34,7 +34,7 @@ public class GUIOrGate extends OrGate implements BasicGUIComponent { connectedWireArraysModifiable.addAll(Arrays.asList(in)); double inputHeight = 5; - for(int i = 0; i < inputCount; i ++, inputHeight += 10) + for (int i = 0; i < inputCount; i++, inputHeight += 10) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -50,6 +50,7 @@ public class GUIOrGate extends OrGate implements BasicGUIComponent { return new Rectangle(0, 0, 20, height); } + @Override public void render(GeneralGC gc) { @@ -67,11 +68,13 @@ public class GUIOrGate extends OrGate implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/components/GUISplitter.java b/LogicUI/src/era/mi/gui/components/GUISplitter.java index 8d09cc70..bddd9dea 100644 --- a/LogicUI/src/era/mi/gui/components/GUISplitter.java +++ b/LogicUI/src/era/mi/gui/components/GUISplitter.java @@ -13,10 +13,10 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUISplitter extends Splitter implements BasicGUIComponent { - private final int outputCount; - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final int outputCount; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUISplitter(WireArray input, WireArray... outputs) { @@ -34,7 +34,7 @@ public class GUISplitter extends Splitter implements BasicGUIComponent { connectedWireArraysModifiable.addAll(Arrays.asList(outputs)); double outputHeight = 0; - for(int i = 0; i < outputCount; i ++, outputHeight += 10) + for (int i = 0; i < outputCount; i++, outputHeight += 10) wireArrayConnectionPointsModifiable.add(new Point(20, outputHeight)); } @@ -47,13 +47,14 @@ public class GUISplitter extends Splitter implements BasicGUIComponent { return new Rectangle(0, 0, 20, height); } + @Override public void render(GeneralGC gc) { gc.drawLine(0, height / 2, 10, height / 2); gc.drawLine(10, 0, 10, height); double outputHeight = 0; - for(int i = 0; i < outputCount; i ++, outputHeight += 10) + for (int i = 0; i < outputCount; i++, outputHeight += 10) gc.drawLine(10, outputHeight, 20, outputHeight); } @@ -62,11 +63,13 @@ public class GUISplitter extends Splitter implements BasicGUIComponent { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) { diff --git a/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java b/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java index 8b48f5e1..1b6582cc 100644 --- a/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java +++ b/LogicUI/src/era/mi/gui/examples/RSLatchGUIExample.java @@ -11,9 +11,9 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Point; public class RSLatchGUIExample { - private static final int WIRE_DELAY = 10; - private static final int OR_DELAY = 50; - private static final int NOT_DELAY = 50; + private static final int WIRE_DELAY = 10; + private static final int OR_DELAY = 50; + private static final int NOT_DELAY = 50; public static void main(String[] args) { diff --git a/LogicUI/src/era/mi/gui/wires/GUIWire.java b/LogicUI/src/era/mi/gui/wires/GUIWire.java index cae2cfd7..e711acb9 100644 --- a/LogicUI/src/era/mi/gui/wires/GUIWire.java +++ b/LogicUI/src/era/mi/gui/wires/GUIWire.java @@ -13,19 +13,20 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Point; public class GUIWire { - private final WireArray wa; - private final double[] path; + private final WireArray wa; + private final double[] path; - public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path) + public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, + BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path) { this.wa = component1.getConnectedWireArray(component1ConnectionIndex); - if(!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex))) + if (!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex))) throw new IllegalArgumentException("Given connection points are not connected!"); this.path = new double[path.length * 2 + 4]; Point component1ConnectionPoint = component1.getWireArrayConnectionPoint(component1ConnectionIndex); this.path[0] = component1Pos.x + component1ConnectionPoint.x; this.path[1] = component1Pos.y + component1ConnectionPoint.y; - for(int srcI = 0, dstI = 2; srcI < path.length; srcI ++, dstI += 2) + for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2) { this.path[dstI + 0] = path[srcI].x; this.path[dstI + 1] = path[srcI].y; @@ -40,7 +41,7 @@ public class GUIWire public void render(GeneralGC gc) { Color oldFG = gc.getForeground(); - if(wa.length == 1) + if (wa.length == 1) gc.setForeground(gc.getDevice().getSystemColor(getSWTColorConstantForBit(wa.getValue()))); gc.drawPolyline(path); gc.setForeground(oldFG); @@ -48,19 +49,19 @@ public class GUIWire public static int getSWTColorConstantForBit(Bit bit) { - switch(bit) + switch (bit) { - case ONE: - return SWT.COLOR_GREEN; - case ZERO: - return SWT.COLOR_BLUE; - case Z: - return SWT.COLOR_BLACK; - case U: - case X: - return SWT.COLOR_RED; - default: - throw new IllegalArgumentException("Unknown enum constant: " + bit); + case ONE: + return SWT.COLOR_GREEN; + case ZERO: + return SWT.COLOR_BLUE; + case Z: + return SWT.COLOR_BLACK; + case U: + case X: + return SWT.COLOR_RED; + default: + throw new IllegalArgumentException("Unknown enum constant: " + bit); } } } \ 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 index 8c2df1d5..916ceabf 100644 --- a/LogicUI/src/era/mi/gui/wires/WireConnectionPoint.java +++ b/LogicUI/src/era/mi/gui/wires/WireConnectionPoint.java @@ -10,8 +10,8 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class WireConnectionPoint implements BasicGUIComponent { - private final WireArray wa; - private final int wiresCrossing; + private final WireArray wa; + private final int wiresCrossing; public WireConnectionPoint(WireArray wa, int wiresCrossing) { @@ -23,26 +23,30 @@ public class WireConnectionPoint implements BasicGUIComponent public void render(GeneralGC gc) { Color oldBG = gc.getBackground(); - if(wa.length == 1) + if (wa.length == 1) gc.setBackground(gc.getDevice().getSystemColor(GUIWire.getSWTColorConstantForBit(wa.getValue()))); gc.fillOval(-1, -1, 2, 2); gc.setBackground(oldBG); } + @Override public Rectangle getBounds() { return new Rectangle(0, 0, 0, 0); } + @Override public int getConnectedWireArraysCount() { return wiresCrossing; } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return wa; } + @Override public Point getWireArrayConnectionPoint(int connectionIndex) { -- 2.17.1