Added project specific format; Default values in WireArray are now U
authorFabian Stemmler <stemmler@in.tum.de>
Sat, 18 May 2019 13:13:45 +0000 (15:13 +0200)
committerFabian Stemmler <stemmler@in.tum.de>
Sat, 18 May 2019 13:13:45 +0000 (15:13 +0200)
30 files changed:
era.mi/.classpath
era.mi/.settings/org.eclipse.jdt.core.prefs
era.mi/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
era.mi/src/era/mi/logic/Bit.java
era.mi/src/era/mi/logic/Simulation.java
era.mi/src/era/mi/logic/Util.java
era.mi/src/era/mi/logic/components/BasicComponent.java
era.mi/src/era/mi/logic/components/BitDisplay.java
era.mi/src/era/mi/logic/components/Clock.java
era.mi/src/era/mi/logic/components/Component.java
era.mi/src/era/mi/logic/components/Demux.java
era.mi/src/era/mi/logic/components/ManualSwitch.java
era.mi/src/era/mi/logic/components/Merger.java
era.mi/src/era/mi/logic/components/Mux.java
era.mi/src/era/mi/logic/components/Splitter.java
era.mi/src/era/mi/logic/components/TriStateBuffer.java
era.mi/src/era/mi/logic/components/gates/AndGate.java
era.mi/src/era/mi/logic/components/gates/MultiInputGate.java
era.mi/src/era/mi/logic/components/gates/NotGate.java
era.mi/src/era/mi/logic/components/gates/OrGate.java
era.mi/src/era/mi/logic/components/gates/XorGate.java
era.mi/src/era/mi/logic/tests/ComponentTest.java
era.mi/src/era/mi/logic/tests/Connector.java
era.mi/src/era/mi/logic/tests/GUITest.java
era.mi/src/era/mi/logic/tests/TestBitDisplay.java
era.mi/src/era/mi/logic/timeline/Timeline.java
era.mi/src/era/mi/logic/timeline/TimelineEvent.java
era.mi/src/era/mi/logic/timeline/TimelineEventHandler.java
era.mi/src/era/mi/logic/wires/WireArray.java
era.mi/src/era/mi/logic/wires/WireArrayObserver.java

index bc8d71b..be85523 100644 (file)
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
+       <classpathentry kind="src" path="src" />
+       <classpathentry kind="con"
+               path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5" />
+       <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"/>
+                       <attribute name="module" value="true" />
                </attributes>
        </classpathentry>
-       <classpathentry kind="output" path="bin"/>
+       <classpathentry kind="output" path="bin" />
 </classpath>
index a54bb93..fd071d5 100644 (file)
@@ -10,3 +10,317 @@ 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_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_binary_expression=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_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_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_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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.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.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_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=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_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_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_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_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_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_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_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_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_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_while_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+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_assignment_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=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/era.mi/.settings/org.eclipse.jdt.ui.prefs b/era.mi/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..f5705df
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_MyPrefrence
+formatter_settings_version=14
index 8010ca7..da9a227 100644 (file)
@@ -5,35 +5,44 @@ import java.util.Arrays;
 /**
  * stdlogic according to IEEE 1164
  */
-public enum Bit {
+public enum Bit
+{
        U, X, ZERO, ONE, Z;
 
-       public static Bit and(Bit a, Bit b) {
+       public static Bit and(Bit a, Bit b)
+       {
                return a.and(b);
        }
 
-       public Bit and(Bit other) {
+       public Bit and(Bit other)
+       {
                return fromTable(AND_TABLE, this, other);
        }
 
-       public static Bit or(Bit a, Bit b) {
+       public static Bit or(Bit a, Bit b)
+       {
                return a.or(b);
        }
 
-       public Bit or(Bit other) {
+       public Bit or(Bit other)
+       {
                return fromTable(OR_TABLE, this, other);
        }
 
-       public static Bit xor(Bit a, Bit b) {
+       public static Bit xor(Bit a, Bit b)
+       {
                return a.xor(b);
        }
 
-       public Bit xor(Bit other) {
+       public Bit xor(Bit other)
+       {
                return fromTable(XOR_TABLE, this, other);
        }
 
-       public Bit not() {
-               switch (this) {
+       public Bit not()
+       {
+               switch (this)
+               {
                case U:
                        return U;
                case ONE:
@@ -45,21 +54,25 @@ public enum Bit {
                }
        }
 
-       public Bit[] makeArray(int length) {
+       public Bit[] makeArray(int length)
+       {
                Bit[] bits = new Bit[length];
                Arrays.fill(bits, this);
                return bits;
        }
 
-       public Bit combineWith(Bit other) {
+       public Bit combineWith(Bit other)
+       {
                return fromTable(JOIN_TABLE, this, other);
        }
 
-       public static Bit combine(Bit a, Bit b) {
+       public static Bit combine(Bit a, Bit b)
+       {
                return a.combineWith(b);
        }
 
-       private static Bit fromTable(Bit[][] table, Bit a, Bit b) {
+       private static Bit fromTable(Bit[][] table, Bit a, Bit b)
+       {
                return table[a.ordinal()][b.ordinal()];
        }
 
index 7b1ccb4..f4b25d2 100644 (file)
@@ -2,9 +2,11 @@ package era.mi.logic;
 
 import era.mi.logic.timeline.Timeline;
 
-public class Simulation {
+public class Simulation
+{
        public final static Timeline TIMELINE = new Timeline(11);
 
-       public static void main(String[] args) {
+       public static void main(String[] args)
+       {
        }
 }
\ No newline at end of file
index 4a03410..b7402c2 100644 (file)
@@ -2,10 +2,12 @@ package era.mi.logic;
 
 import java.util.Arrays;
 
-public final class Util {
+public final class Util
+{
 
        @SuppressWarnings("unchecked")
-       public static <T> T[] concat(T[]... arrays) {
+       public static <T> T[] concat(T[]... arrays)
+       {
                if (arrays.length == 0)
                        throw new IllegalArgumentException("Cannot concatenate 0 arrays.");
 
@@ -15,7 +17,8 @@ public final class Util {
 
                T[] newArray = Arrays.copyOf(arrays[0], length);
                int appendIndex = arrays[0].length;
-               for (int i = 1; i < arrays.length; i++) {
+               for (int i = 1; i < arrays.length; i++)
+               {
                        System.arraycopy(arrays[i], 0, newArray, appendIndex, arrays[i].length);
                        appendIndex += arrays[i].length;
                }
@@ -45,31 +48,38 @@ public final class Util {
 //             return (T[][]) newArray;
 //     }
 
-       public static Bit[] and(Bit[] a, Bit[] b) {
+       public static Bit[] and(Bit[] a, Bit[] b)
+       {
                return binBitOp(a, b, (bA, bB) -> Bit.and(bA, bB));
        }
 
-       public static Bit[] or(Bit[] a, Bit[] b) {
+       public static Bit[] or(Bit[] a, Bit[] b)
+       {
                return binBitOp(a, b, (bA, bB) -> Bit.or(bA, bB));
        }
 
-       public static Bit[] xor(Bit[] a, Bit[] b) {
+       public static Bit[] xor(Bit[] a, Bit[] b)
+       {
                return binBitOp(a, b, (bA, bB) -> Bit.xor(bA, bB));
        }
 
-       private static Bit[] binBitOp(Bit[] a, Bit[] b, BitOp op) {
+       private static Bit[] binBitOp(Bit[] a, Bit[] b, BitOp op)
+       {
                if (a.length != b.length)
                        throw new IllegalArgumentException("Bit Arrays were not of equal length.");
                Bit[] out = new Bit[a.length];
-               for (int i = 0; i < a.length; i++) {
+               for (int i = 0; i < a.length; i++)
+               {
                        out[i] = op.execute(a[i], b[i]);
                }
                return out;
        }
 
-       public static Bit[] not(Bit[] a) {
+       public static Bit[] not(Bit[] a)
+       {
                Bit[] out = new Bit[a.length];
-               for (int i = 0; i < a.length; i++) {
+               for (int i = 0; i < a.length; i++)
+               {
                        out[i] = a[i].not();
                }
                return out;
@@ -80,16 +90,19 @@ public final class Util {
         * 
         * @author Christian Femers
         */
-       public static Bit[] combineInto(Bit[] dest, Bit[] addition) {
+       public static Bit[] combineInto(Bit[] dest, Bit[] addition)
+       {
                if (dest.length != addition.length)
                        throw new IllegalArgumentException("Bit Arrays were not of equal length.");
-               for (int i = 0; i < addition.length; i++) {
+               for (int i = 0; i < addition.length; i++)
+               {
                        dest[i] = dest[i].combineWith(addition[i]);
                }
                return dest;
        }
 
-       interface BitOp {
+       interface BitOp
+       {
                Bit execute(Bit a, Bit b);
        }
 }
index 5b63e0b..509c662 100644 (file)
@@ -10,7 +10,8 @@ import era.mi.logic.wires.WireArrayObserver;
  * 
  * @author Fabian Stemmler
  */
-public abstract class BasicComponent implements WireArrayObserver, Component {
+public abstract class BasicComponent implements WireArrayObserver, Component
+{
        private int processTime;
 
        /**
@@ -19,13 +20,16 @@ public abstract class BasicComponent implements WireArrayObserver, Component {
         * 
         * @author Fabian Stemmler
         */
-       public BasicComponent(int processTime) {
+       public BasicComponent(int processTime)
+       {
                this.processTime = processTime > 0 ? processTime : 1;
        }
 
        @Override
-       public void update(WireArray initiator, Bit[] oldValues) {
-               Simulation.TIMELINE.addEvent((e) -> {
+       public void update(WireArray initiator, Bit[] oldValues)
+       {
+               Simulation.TIMELINE.addEvent((e) ->
+               {
                        compute();
                }, processTime);
        }
index 2cabbb8..051010b 100644 (file)
@@ -8,11 +8,13 @@ import java.util.List;
 import era.mi.logic.Bit;
 import era.mi.logic.wires.WireArray;
 
-public class BitDisplay extends BasicComponent {
+public class BitDisplay extends BasicComponent
+{
        private final WireArray in;
        private Bit[] displayedValue;
 
-       public BitDisplay(WireArray in) {
+       public BitDisplay(WireArray in)
+       {
                super(1);
                this.in = in;
                in.addObserver(this);
@@ -20,25 +22,30 @@ public class BitDisplay extends BasicComponent {
        }
 
        @Override
-       protected void compute() {
+       protected void compute()
+       {
                displayedValue = in.getValues();
        }
 
-       public Bit[] getDisplayedValue() {
+       public Bit[] getDisplayedValue()
+       {
                return displayedValue;
        }
 
-       public boolean isDisplaying(Bit... values) {
+       public boolean isDisplaying(Bit... values)
+       {
                return Arrays.equals(displayedValue, values);
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(in));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(new ArrayList<WireArray>());
        }
 }
index 3fe3611..56f1110 100644 (file)
@@ -9,11 +9,12 @@ import era.mi.logic.Simulation;
 import era.mi.logic.timeline.TimelineEvent;
 import era.mi.logic.timeline.TimelineEventHandler;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
-public class Clock implements TimelineEventHandler, Component {
+public class Clock implements TimelineEventHandler, Component
+{
        private boolean toggle = false;
-       private WireArrayInput outI;
+       private WireArrayEnd outI;
        private int delta;
 
        /**
@@ -21,34 +22,40 @@ public class Clock implements TimelineEventHandler, Component {
         * @param out   {@link WireArray} the clock's impulses are fed into
         * @param delta ticks between rising and falling edge
         */
-       public Clock(WireArray out, int delta) {
+       public Clock(WireArray out, int delta)
+       {
                this.delta = delta;
                this.outI = out.createInput();
                Simulation.TIMELINE.addEvent(this, 50);
        }
 
        @Override
-       public void handle(TimelineEvent e) {
+       public void handle(TimelineEvent e)
+       {
                addToTimeline();
                outI.feedSignals(new Bit[] { toggle ? Bit.ONE : Bit.ZERO });
                toggle = !toggle;
        }
 
-       public WireArray getOut() {
+       public WireArray getOut()
+       {
                return outI.owner;
        }
 
-       private void addToTimeline() {
+       private void addToTimeline()
+       {
                Simulation.TIMELINE.addEvent(this, delta);
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList());
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(outI.owner));
        }
 }
index c5186d0..19b5d3e 100644 (file)
@@ -4,7 +4,8 @@ import java.util.List;
 
 import era.mi.logic.wires.WireArray;
 
-public interface Component {
+public interface Component
+{
 
        /**
         * Returns immutable list of all inputs to the {@link Component} (including e.g. the select bits to a MUX). Intended for visualization
index f534334..b7ed0ff 100644 (file)
@@ -5,7 +5,7 @@ import java.util.Collections;
 import java.util.List;
 
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
 /**
  * Models a multiplexer. Takes an arbitrary amount of input {@link WireArray}s, one of which, as determined by select, is put through to the
@@ -14,10 +14,11 @@ import era.mi.logic.wires.WireArray.WireArrayInput;
  * @author Fabian Stemmler
  *
  */
-public class Demux extends BasicComponent {
+public class Demux extends BasicComponent
+{
        private final WireArray select, in;
        private final WireArray[] outputs;
-       private final WireArrayInput[] outputsI;
+       private final WireArrayEnd[] outputsI;
        private final int outputSize;
        private int selected = -1;
 
@@ -28,14 +29,16 @@ public class Demux extends BasicComponent {
         * @param select  Indexes the input array which is to be mapped to the output. Must have enough bits to index all inputs.
         * @param outputs One of these inputs is mapped to the output, depending on the select bits
         */
-       public Demux(int processTime, WireArray in, WireArray select, WireArray... outputs) {
+       public Demux(int processTime, WireArray in, WireArray select, WireArray... outputs)
+       {
                super(processTime);
                outputSize = in.length;
 
                this.in = in;
                this.outputs = outputs;
-               this.outputsI = new WireArrayInput[outputs.length];
-               for (int i = 0; i < this.outputsI.length; i++) {
+               this.outputsI = new WireArrayEnd[outputs.length];
+               for (int i = 0; i < this.outputsI.length; i++)
+               {
                        if (outputs[i].length != outputSize)
                                throw new IllegalArgumentException("All DEMUX wire arrays must be of uniform length!");
                        this.outputsI[i] = outputs[i].createInput();
@@ -52,7 +55,8 @@ public class Demux extends BasicComponent {
        }
 
        @Override
-       public void compute() {
+       public void compute()
+       {
                int selectValue = select.hasNumericValue() ? (int) select.getUnsignedValue() : -1;
                if (selectValue >= outputsI.length)
                        selectValue = -1;
@@ -67,12 +71,14 @@ public class Demux extends BasicComponent {
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(in, select));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(outputs));
        }
 }
index 34c603c..c56d802 100644 (file)
@@ -4,7 +4,7 @@ import java.util.List;
 
 import era.mi.logic.Bit;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
 /**
  * This class models a simple on/off (ONE/ZERO) switch for user interaction.
@@ -12,52 +12,62 @@ import era.mi.logic.wires.WireArray.WireArrayInput;
  * @author Christian Femers
  *
  */
-public class ManualSwitch implements Component {
+public class ManualSwitch implements Component
+{
        private WireArray output;
-       private WireArrayInput outputI;
+       private WireArrayEnd outputI;
        private boolean isOn;
 
-       public ManualSwitch(WireArray output) {
+       public ManualSwitch(WireArray output)
+       {
                if (output.length != 1)
                        throw new IllegalArgumentException("Switch output can be only a single wire");
                this.output = output;
                this.outputI = output.createInput();
        }
 
-       public void switchOn() {
+       public void switchOn()
+       {
                setState(true);
        }
 
-       public void switchOff() {
+       public void switchOff()
+       {
                setState(false);
        }
 
-       public void toggle() {
+       public void toggle()
+       {
                setState(!isOn);
        }
 
-       public void setState(boolean isOn) {
+       public void setState(boolean isOn)
+       {
                if (this.isOn == isOn)
                        return;
                this.isOn = isOn;
                outputI.feedSignals(getValue());
        }
 
-       public boolean isOn() {
+       public boolean isOn()
+       {
                return isOn;
        }
 
-       public Bit getValue() {
+       public Bit getValue()
+       {
                return isOn ? Bit.ONE : Bit.ZERO;
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return List.of();
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return List.of(output);
        }
 
index 1efcf8a..17d1b57 100644 (file)
@@ -6,11 +6,12 @@ import java.util.List;
 
 import era.mi.logic.Bit;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 import era.mi.logic.wires.WireArrayObserver;
 
-public class Merger implements WireArrayObserver, Component {
-       private WireArrayInput outI;
+public class Merger implements WireArrayObserver, Component
+{
+       private WireArrayEnd outI;
        private WireArray[] inputs;
        private int[] beginningIndex;
 
@@ -19,13 +20,15 @@ public class Merger implements WireArrayObserver, Component {
         * @param union  The output of merging n {@link WireArray}s into one. Must have length = a1.length() + a2.length() + ... + an.length().
         * @param inputs The inputs to be merged into the union
         */
-       public Merger(WireArray union, WireArray... inputs) {
+       public Merger(WireArray union, WireArray... inputs)
+       {
                this.inputs = inputs;
                this.outI = union.createInput();
                this.beginningIndex = new int[inputs.length];
 
                int length = 0;
-               for (int i = 0; i < inputs.length; i++) {
+               for (int i = 0; i < inputs.length; i++)
+               {
                        beginningIndex[i] = length;
                        length += inputs[i].length;
                        inputs[i].addObserver(this);
@@ -36,39 +39,46 @@ public class Merger implements WireArrayObserver, Component {
                                        "The output of merging n WireArrays into one must have length = a1.length() + a2.length() + ... + an.length().");
        }
 
-       public WireArray getInput(int index) {
+       public WireArray getInput(int index)
+       {
                return inputs[index];
        }
 
-       public WireArray getUnion() {
+       public WireArray getUnion()
+       {
                return outI.owner;
        }
 
        @Override
-       public void update(WireArray initiator, Bit[] oldValues) {
+       public void update(WireArray initiator, Bit[] oldValues)
+       {
                int index = find(initiator);
                int beginning = beginningIndex[index];
                outI.feedSignals(beginning, initiator.getValues());
        }
 
-       private int find(WireArray w) {
+       private int find(WireArray w)
+       {
                for (int i = 0; i < inputs.length; i++)
                        if (inputs[i] == w)
                                return i;
                return -1;
        }
 
-       public WireArray[] getInputs() {
+       public WireArray[] getInputs()
+       {
                return inputs.clone();
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(inputs));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(outI.owner));
        }
 }
index db01eb0..d6307f9 100644 (file)
@@ -6,7 +6,7 @@ import java.util.Collections;
 import java.util.List;
 
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
 /**
  * Models a multiplexer. Takes an arbitrary amount of input {@link WireArray}s, one of which, as determined by select, is put through to the
@@ -15,9 +15,10 @@ import era.mi.logic.wires.WireArray.WireArrayInput;
  * @author Fabian Stemmler
  *
  */
-public class Mux extends BasicComponent {
+public class Mux extends BasicComponent
+{
        private WireArray select;
-       private WireArrayInput outI;
+       private WireArrayEnd outI;
        private WireArray[] inputs;
        private final int outputSize;
 
@@ -28,12 +29,14 @@ public class Mux extends BasicComponent {
         * @param select Indexes the input array which is to be mapped to the output. Must have enough bits to index all inputs.
         * @param inputs One of these inputs is mapped to the output, depending on the select bits
         */
-       public Mux(int processTime, WireArray out, WireArray select, WireArray... inputs) {
+       public Mux(int processTime, WireArray out, WireArray select, WireArray... inputs)
+       {
                super(processTime);
                outputSize = out.length;
 
                this.inputs = inputs.clone();
-               for (int i = 0; i < this.inputs.length; i++) {
+               for (int i = 0; i < this.inputs.length; i++)
+               {
                        if (inputs[i].length != outputSize)
                                throw new IllegalArgumentException("All MUX wire arrays must be of uniform length!");
                        inputs[i].addObserver(this);
@@ -50,18 +53,22 @@ public class Mux extends BasicComponent {
                outI = out.createInput();
        }
 
-       public WireArray getOut() {
+       public WireArray getOut()
+       {
                return outI.owner;
        }
 
-       public WireArray getSelect() {
+       public WireArray getSelect()
+       {
                return select;
        }
 
        @Override
-       public void compute() {
+       public void compute()
+       {
                int selectValue;
-               if (!select.hasNumericValue() || (selectValue = (int) select.getUnsignedValue()) >= inputs.length) {
+               if (!select.hasNumericValue() || (selectValue = (int) select.getUnsignedValue()) >= inputs.length)
+               {
                        outI.clearSignals();
                        return;
                }
@@ -71,14 +78,16 @@ public class Mux extends BasicComponent {
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                ArrayList<WireArray> wires = new ArrayList<WireArray>(Arrays.asList(inputs));
                wires.add(select);
                return Collections.unmodifiableList(wires);
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(outI.owner));
        }
 }
index 360ff43..37e9401 100644 (file)
@@ -2,14 +2,16 @@ package era.mi.logic.components;
 
 import era.mi.logic.Bit;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 import era.mi.logic.wires.WireArrayObserver;
 
-public class Splitter implements WireArrayObserver {
+public class Splitter implements WireArrayObserver
+{
        private WireArray input;
-       private WireArrayInput[] outputs;
+       private WireArrayEnd[] outputs;
 
-       public Splitter(WireArray input, WireArray... outputs) {
+       public Splitter(WireArray input, WireArray... outputs)
+       {
                this.input = input;
                this.outputs = WireArray.extractInputs(outputs);
                input.addObserver(this);
@@ -22,10 +24,12 @@ public class Splitter implements WireArrayObserver {
                                        "The input of splitting one into n WireArrays must have length = a1.length() + a2.length() + ... + an.length().");
        }
 
-       protected void compute() {
+       protected void compute()
+       {
                int startIndex = 0;
                Bit[] inputBits = input.getValues();
-               for (int i = 0; i < outputs.length; i++) {
+               for (int i = 0; i < outputs.length; i++)
+               {
                        Bit[] outputBits = new Bit[outputs[i].owner.length];
                        System.arraycopy(inputBits, startIndex, outputBits, 0, outputs[i].owner.length);
                        outputs[i].feedSignals(outputBits);
@@ -34,7 +38,8 @@ public class Splitter implements WireArrayObserver {
        }
 
        @Override
-       public void update(WireArray initiator, Bit[] oldValues) {
+       public void update(WireArray initiator, Bit[] oldValues)
+       {
                compute();
        }
 }
index a0e7a8b..5c02a4e 100644 (file)
@@ -6,13 +6,15 @@ import java.util.List;
 
 import era.mi.logic.Bit;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
-public class TriStateBuffer extends BasicComponent {
+public class TriStateBuffer extends BasicComponent
+{
        WireArray in, enable;
-       WireArrayInput outI;
+       WireArrayEnd outI;
 
-       public TriStateBuffer(int processTime, WireArray in, WireArray out, WireArray enable) {
+       public TriStateBuffer(int processTime, WireArray in, WireArray out, WireArray enable)
+       {
                super(processTime);
                if (in.length != out.length)
                        throw new IllegalArgumentException(
@@ -27,7 +29,8 @@ public class TriStateBuffer extends BasicComponent {
        }
 
        @Override
-       protected void compute() {
+       protected void compute()
+       {
                if (enable.getValue() == Bit.ONE)
                        outI.feedSignals(in.getValues());
                else
@@ -35,12 +38,14 @@ public class TriStateBuffer extends BasicComponent {
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(in, enable));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(outI.owner));
        }
 
index ffb5b5a..853fecc 100644 (file)
@@ -3,8 +3,10 @@ package era.mi.logic.components.gates;
 import era.mi.logic.Util;
 import era.mi.logic.wires.WireArray;
 
-public class AndGate extends MultiInputGate {
-       public AndGate(int processTime, WireArray out, WireArray... in) {
+public class AndGate extends MultiInputGate
+{
+       public AndGate(int processTime, WireArray out, WireArray... in)
+       {
                super(processTime, Util::and, out, in);
        }
 }
index f7af52e..d26297b 100644 (file)
@@ -7,23 +7,26 @@ import java.util.List;
 import era.mi.logic.Bit;
 import era.mi.logic.components.BasicComponent;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
-public abstract class MultiInputGate extends BasicComponent {
+public abstract class MultiInputGate extends BasicComponent
+{
        protected WireArray[] in;
        protected WireArray out;
-       protected WireArrayInput outI;
+       protected WireArrayEnd outI;
        protected final int length;
        protected Operation op;
 
-       protected MultiInputGate(int processTime, Operation op, WireArray out, WireArray... in) {
+       protected MultiInputGate(int processTime, Operation op, WireArray out, WireArray... in)
+       {
                super(processTime);
                this.op = op;
                length = out.length;
                this.in = in.clone();
                if (in.length < 1)
                        throw new IllegalArgumentException(String.format("Cannot create gate with %d wires.", in.length));
-               for (WireArray w : in) {
+               for (WireArray w : in)
+               {
                        if (w.length != length)
                                throw new IllegalArgumentException("All wires connected to the gate must be of uniform length.");
                        w.addObserver(this);
@@ -33,23 +36,27 @@ public abstract class MultiInputGate extends BasicComponent {
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(in));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(out));
        }
 
-       protected void compute() {
+       protected void compute()
+       {
                Bit[] result = in[0].getValues();
                for (int i = 1; i < in.length; i++)
                        result = op.execute(result, in[i].getValues());
                outI.feedSignals(result);
        }
 
-       protected interface Operation {
+       protected interface Operation
+       {
                public Bit[] execute(Bit[] a, Bit[] b);
        }
 }
index f81ba92..c482115 100644 (file)
@@ -7,13 +7,15 @@ import java.util.List;
 import era.mi.logic.Util;
 import era.mi.logic.components.BasicComponent;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
-public class NotGate extends BasicComponent {
+public class NotGate extends BasicComponent
+{
        private WireArray in, out;
-       private WireArrayInput outI;
+       private WireArrayEnd outI;
 
-       public NotGate(int processTime, WireArray in, WireArray out) {
+       public NotGate(int processTime, WireArray in, WireArray out)
+       {
                super(processTime);
                this.in = in;
                in.addObserver(this);
@@ -21,25 +23,30 @@ public class NotGate extends BasicComponent {
                outI = out.createInput();
        }
 
-       public void compute() {
+       public void compute()
+       {
                outI.feedSignals(Util.not(in.getValues()));
        }
 
-       public WireArray getIn() {
+       public WireArray getIn()
+       {
                return in;
        }
 
-       public WireArray getOut() {
+       public WireArray getOut()
+       {
                return out;
        }
 
        @Override
-       public List<WireArray> getAllInputs() {
+       public List<WireArray> getAllInputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(in));
        }
 
        @Override
-       public List<WireArray> getAllOutputs() {
+       public List<WireArray> getAllOutputs()
+       {
                return Collections.unmodifiableList(Arrays.asList(out));
        }
 }
index 723fc72..0050a77 100644 (file)
@@ -3,8 +3,10 @@ package era.mi.logic.components.gates;
 import era.mi.logic.Util;
 import era.mi.logic.wires.WireArray;
 
-public class OrGate extends MultiInputGate {
-       public OrGate(int processTime, WireArray out, WireArray... in) {
+public class OrGate extends MultiInputGate
+{
+       public OrGate(int processTime, WireArray out, WireArray... in)
+       {
                super(processTime, Util::or, out, in);
        }
 }
index 2532c9f..ad2f829 100644 (file)
@@ -8,8 +8,10 @@ import era.mi.logic.wires.WireArray;
  * 
  * @author Fabian Stemmler
  */
-public class XorGate extends MultiInputGate {
-       public XorGate(int processTime, WireArray out, WireArray... in) {
+public class XorGate extends MultiInputGate
+{
+       public XorGate(int processTime, WireArray out, WireArray... in)
+       {
                super(processTime, Util::xor, out, in);
        }
 
index b1c9f5e..47c28e3 100644 (file)
@@ -19,12 +19,14 @@ import era.mi.logic.components.gates.NotGate;
 import era.mi.logic.components.gates.OrGate;
 import era.mi.logic.components.gates.XorGate;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 
-class ComponentTest {
+class ComponentTest
+{
 
        @Test
-       void circuitExampleTest() {
+       void circuitExampleTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(1, 1), b = new WireArray(1, 1), c = new WireArray(1, 10), d = new WireArray(2, 1),
                                e = new WireArray(1, 1), f = new WireArray(1, 1), g = new WireArray(1, 1), h = new WireArray(2, 1), i = new WireArray(2, 1),
@@ -48,7 +50,8 @@ class ComponentTest {
        }
 
        @Test
-       void splitterTest() {
+       void splitterTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(3, 1), b = new WireArray(2, 1), c = new WireArray(3, 1), in = new WireArray(8, 1);
                in.createInput().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
@@ -62,7 +65,8 @@ class ComponentTest {
        }
 
        @Test
-       void mergerTest() {
+       void mergerTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(3, 1), b = new WireArray(2, 1), c = new WireArray(3, 1), out = new WireArray(8, 1);
                a.createInput().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);
@@ -78,13 +82,14 @@ class ComponentTest {
        }
 
        @Test
-       void triStateBufferTest() {
+       void triStateBufferTest()
+       {
                WireArray a = new WireArray(1, 1), b = new WireArray(1, 1), en = new WireArray(1, 1), notEn = new WireArray(1, 1);
                new NotGate(1, en, notEn);
                new TriStateBuffer(1, a, b, en);
                new TriStateBuffer(1, b, a, notEn);
 
-               WireArrayInput enI = en.createInput(), aI = a.createInput(), bI = b.createInput();
+               WireArrayEnd enI = en.createInput(), aI = a.createInput(), bI = b.createInput();
                enI.feedSignals(Bit.ONE);
                aI.feedSignals(Bit.ONE);
 
@@ -109,11 +114,12 @@ class ComponentTest {
        }
 
        @Test
-       void muxTest() {
+       void muxTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(4, 3), b = new WireArray(4, 6), c = new WireArray(4, 4), select = new WireArray(2, 5),
                                out = new WireArray(4, 1);
-               WireArrayInput selectIn = select.createInput();
+               WireArrayEnd selectIn = select.createInput();
 
                selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
                a.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
@@ -136,11 +142,12 @@ class ComponentTest {
        }
 
        @Test
-       void demuxTest() {
+       void demuxTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(4, 3), b = new WireArray(4, 6), c = new WireArray(4, 4), select = new WireArray(2, 5),
                                in = new WireArray(4, 1);
-               WireArrayInput selectIn = select.createInput();
+               WireArrayEnd selectIn = select.createInput();
 
                selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
                in.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
@@ -149,26 +156,27 @@ class ComponentTest {
                Simulation.TIMELINE.executeAll();
 
                assertBitArrayEquals(a.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
-               assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
-               assertBitArrayEquals(c.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
+               assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);
+               assertBitArrayEquals(c.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);
                selectIn.feedSignals(Bit.ZERO, Bit.ONE);
                Simulation.TIMELINE.executeAll();
 
                assertBitArrayEquals(a.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
-               assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
+               assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);
                assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
 
                selectIn.feedSignals(Bit.ONE, Bit.ONE);
                Simulation.TIMELINE.executeAll();
 
                assertBitArrayEquals(a.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
-               assertBitArrayEquals(b.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
+               assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U, Bit.U);
                assertBitArrayEquals(c.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
 
        }
 
        @Test
-       void andTest() {
+       void andTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(4, 1), b = new WireArray(4, 3), c = new WireArray(4, 1);
                new AndGate(1, c, a, b);
@@ -181,7 +189,8 @@ class ComponentTest {
        }
 
        @Test
-       void orTest() {
+       void orTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(4, 1), b = new WireArray(4, 3), c = new WireArray(4, 1);
                new OrGate(1, c, a, b);
@@ -194,7 +203,8 @@ class ComponentTest {
        }
 
        @Test
-       void xorTest() {
+       void xorTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray a = new WireArray(3, 1), b = new WireArray(3, 2), c = new WireArray(3, 1), d = new WireArray(3, 1);
                new XorGate(1, d, a, b, c);
@@ -208,7 +218,8 @@ class ComponentTest {
        }
 
        @Test
-       void rsLatchCircuitTest() {
+       void rsLatchCircuitTest()
+       {
                Simulation.TIMELINE.reset();
                WireArray r = new WireArray(1, 1), s = new WireArray(1, 1), t1 = new WireArray(1, 15), t2 = new WireArray(1, 1),
                                q = new WireArray(1, 1), nq = new WireArray(1, 1);
@@ -218,7 +229,7 @@ class ComponentTest {
                new NotGate(1, t2, q);
                new NotGate(1, t1, nq);
 
-               WireArrayInput sIn = s.createInput(), rIn = r.createInput();
+               WireArrayEnd sIn = s.createInput(), rIn = r.createInput();
 
                sIn.feedSignals(Bit.ONE);
                rIn.feedSignals(Bit.ZERO);
@@ -243,7 +254,8 @@ class ComponentTest {
        }
 
        @Test
-       void numericValueTest() {
+       void numericValueTest()
+       {
                Simulation.TIMELINE.reset();
 
                WireArray a = new WireArray(4, 1);
@@ -256,10 +268,11 @@ class ComponentTest {
        }
 
        @Test
-       void multipleInputs() {
+       void multipleInputs()
+       {
                Simulation.TIMELINE.reset();
                WireArray w = new WireArray(2, 1);
-               WireArrayInput wI1 = w.createInput(), wI2 = w.createInput();
+               WireArrayEnd wI1 = w.createInput(), wI2 = w.createInput();
                wI1.feedSignals(Bit.ONE, Bit.Z);
                wI2.feedSignals(Bit.Z, Bit.X);
                Simulation.TIMELINE.executeAll();
@@ -279,8 +292,9 @@ class ComponentTest {
                assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);
        }
 
-       @Test
-       void wireConnections() {
+//     @Test
+       void wireConnections()
+       {
                // Nur ein Experiment, was Ã¼ber mehrere 'passive' Bausteine hinweg passieren würde
 
                Simulation.TIMELINE.reset();
@@ -288,9 +302,9 @@ class ComponentTest {
                WireArray a = new WireArray(1, 2);
                WireArray b = new WireArray(1, 2);
                WireArray c = new WireArray(1, 2);
-               WireArrayInput aI = a.createInput();
-               WireArrayInput bI = b.createInput();
-               WireArrayInput cI = c.createInput();
+               WireArrayEnd aI = a.createInput();
+               WireArrayEnd bI = b.createInput();
+               WireArrayEnd cI = c.createInput();
 
                TestBitDisplay test = new TestBitDisplay(c);
                TestBitDisplay test2 = new TestBitDisplay(a);
@@ -352,7 +366,8 @@ class ComponentTest {
                test2.assertAfterSimulationIs(Bit.ONE);
        }
 
-       private static void assertBitArrayEquals(Bit[] actual, Bit... expected) {
+       private static void assertBitArrayEquals(Bit[] actual, Bit... expected)
+       {
                assertArrayEquals(expected, actual);
        }
 }
index 99975da..9a8d3fc 100644 (file)
@@ -3,16 +3,18 @@ package era.mi.logic.tests;
 import era.mi.logic.Bit;
 import era.mi.logic.Simulation;
 import era.mi.logic.wires.WireArray;
-import era.mi.logic.wires.WireArray.WireArrayInput;
+import era.mi.logic.wires.WireArray.WireArrayEnd;
 import era.mi.logic.wires.WireArrayObserver;
 
-public class Connector implements WireArrayObserver {
+public class Connector implements WireArrayObserver
+{
        private final WireArray a;
 //     private final WireArray b;
-       private final WireArrayInput aI;
-       private final WireArrayInput bI;
+       private final WireArrayEnd aI;
+       private final WireArrayEnd bI;
 
-       public Connector(WireArray a, WireArray b) {
+       public Connector(WireArray a, WireArray b)
+       {
                if (a.length != b.length)
                        throw new IllegalArgumentException(String.format("WireArray width does not match: %d, %d", a.length, b.length));
                this.a = a;
@@ -24,8 +26,10 @@ public class Connector implements WireArrayObserver {
        }
 
        @Override
-       public void update(WireArray initiator, Bit[] oldValues) {
-               Simulation.TIMELINE.addEvent((e) -> {
+       public void update(WireArray initiator, Bit[] oldValues)
+       {
+               Simulation.TIMELINE.addEvent((e) ->
+               {
                        if (initiator == a)
                                bI.feedSignals(aI.wireValuesExcludingMe());
                        else
index d1e3a96..8630772 100644 (file)
@@ -22,7 +22,8 @@ import era.mi.logic.components.gates.OrGate;
 import era.mi.logic.timeline.Timeline.ExecutionResult;
 import era.mi.logic.wires.WireArray;
 
-public class GUITest extends JPanel {
+public class GUITest extends JPanel
+{
 
        private static final long serialVersionUID = 1L;
 
@@ -51,13 +52,18 @@ public class GUITest extends JPanel {
        int width;
        boolean sizeChanged;
 
-       public GUITest() {
-               addMouseListener(new MouseListener() {
+       public GUITest()
+       {
+               addMouseListener(new MouseListener()
+               {
 
                        @Override
-                       public void mouseReleased(MouseEvent e) {
-                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {
-                                       if (dim.getValue().contains(e.getPoint())) {
+                       public void mouseReleased(MouseEvent e)
+                       {
+                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())
+                               {
+                                       if (dim.getValue().contains(e.getPoint()))
+                                       {
                                                dim.getKey().switchOff();
                                                repaint();
                                        }
@@ -65,9 +71,12 @@ public class GUITest extends JPanel {
                        }
 
                        @Override
-                       public void mousePressed(MouseEvent e) {
-                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {
-                                       if (dim.getValue().contains(e.getPoint())) {
+                       public void mousePressed(MouseEvent e)
+                       {
+                               for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet())
+                               {
+                                       if (dim.getValue().contains(e.getPoint()))
+                                       {
                                                dim.getKey().switchOn();
                                                repaint();
                                        }
@@ -75,17 +84,20 @@ public class GUITest extends JPanel {
                        }
 
                        @Override
-                       public void mouseExited(MouseEvent e) {
+                       public void mouseExited(MouseEvent e)
+                       {
                                // none
                        }
 
                        @Override
-                       public void mouseEntered(MouseEvent e) {
+                       public void mouseEntered(MouseEvent e)
+                       {
                                // none
                        }
 
                        @Override
-                       public void mouseClicked(MouseEvent e) {
+                       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())) {
@@ -98,7 +110,8 @@ public class GUITest extends JPanel {
        }
 
        @Override
-       public void paint(Graphics some_g) {
+       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);
@@ -142,31 +155,37 @@ public class GUITest extends JPanel {
                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() {
+       private void checkSizeChange()
+       {
                sizeChanged = height != getHeight() || width != getWidth();
-               if (sizeChanged) {
+               if (sizeChanged)
+               {
                        height = getHeight();
                        width = getWidth();
                }
        }
 
-       private void adaptFont(Graphics g) {
+       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) {
+       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, WireArray wa, String name, double x1, double y1, double x2, double y2) {
+       private void drawWire(Graphics g, WireArray 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) {
+       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;
@@ -180,13 +199,15 @@ public class GUITest extends JPanel {
 
        }
 
-       private void drawSwitch(Graphics g, ManualSwitch ms, String text, double posX1, double posY1, double posX2, double posY2) {
+       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) {
+               if (sizeChanged)
+               {
                        Rectangle r = new Rectangle(x1, y1, x2 - x1, y2 - y1);
                        switchMap.put(ms, r);
                }
@@ -198,12 +219,15 @@ public class GUITest extends JPanel {
                drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
        }
 
-       private static void setBlack(Graphics g) {
+       private static void setBlack(Graphics g)
+       {
                g.setColor(Color.BLACK);
        }
 
-       private static void setTo(Graphics g, WireArray wa) {
-               switch (wa.getValue()) {
+       private static void setTo(Graphics g, WireArray wa)
+       {
+               switch (wa.getValue())
+               {
                case ONE:
                        g.setColor(Color.GREEN);
                        break;
@@ -221,15 +245,18 @@ public class GUITest extends JPanel {
                }
        }
 
-       private int gY(double pos) {
+       private int gY(double pos)
+       {
                return (int) (pos * height / 11);
        }
 
-       private int gX(double pos) {
+       private int gX(double pos)
+       {
                return (int) (pos * width / 11) + 50;
        }
 
-       public static void main(String[] args) {
+       public static void main(String[] args)
+       {
                JFrame f = new JFrame("Test circuit 1.0.0");
                GUITest gt = new GUITest();
                f.add(gt);
@@ -243,15 +270,19 @@ public class GUITest extends JPanel {
                long lastFrame = begin;
                long updateT = 16;
 
-               while (f.isVisible()) {
+               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 {
+                       try
+                       {
                                Thread.sleep(Math.max(16 - System.currentTimeMillis() + lastFrame, 0));
-                       } catch (Exception e) {
+                       }
+                       catch (Exception e)
+                       {
                                e.printStackTrace();
                        }
                        lastFrame = System.currentTimeMillis();
index a448eb0..be4d95a 100644 (file)
@@ -10,23 +10,29 @@ import era.mi.logic.Simulation;
 import era.mi.logic.components.BitDisplay;
 import era.mi.logic.wires.WireArray;
 
-public final class TestBitDisplay extends BitDisplay {
+public final class TestBitDisplay extends BitDisplay
+{
 
-       public TestBitDisplay(WireArray in) {
+       public TestBitDisplay(WireArray in)
+       {
                super(in);
        }
 
-       public void assertDisplays(Bit... expected) {
+       public void assertDisplays(Bit... expected)
+       {
                assertArrayEquals(expected, getDisplayedValue());
        }
 
-       public void assertAfterSimulationIs(Bit... expected) {
+       public void assertAfterSimulationIs(Bit... expected)
+       {
                Simulation.TIMELINE.executeAll();
                assertDisplays(expected);
        }
 
-       public void assertAfterSimulationIs(LongConsumer r, Bit... expected) {
-               while (Simulation.TIMELINE.hasNext()) {
+       public void assertAfterSimulationIs(LongConsumer r, Bit... expected)
+       {
+               while (Simulation.TIMELINE.hasNext())
+               {
                        Simulation.TIMELINE.executeNext();
                        r.accept(Simulation.TIMELINE.getSimulationTime());
                }
@@ -34,7 +40,8 @@ public final class TestBitDisplay extends BitDisplay {
        }
 
        @Override
-       protected void compute() {
+       protected void compute()
+       {
                super.compute();
                System.out.println("update: value is " + Arrays.toString(getDisplayedValue()));
        }
index 7030310..63d7395 100644 (file)
@@ -11,14 +11,17 @@ import java.util.function.Consumer;
  * @author Fabian Stemmler
  *
  */
-public class Timeline {
+public class Timeline
+{
        private PriorityQueue<InnerEvent> events;
        private long currentTime = 0;
 
        private final List<Consumer<TimelineEvent>> eventAddedListener;
 
-       public Timeline(int initCapacity) {
-               events = new PriorityQueue<InnerEvent>(initCapacity, (a, b) -> {
+       public Timeline(int initCapacity)
+       {
+               events = new PriorityQueue<InnerEvent>(initCapacity, (a, b) ->
+               {
                        long difference = a.getTiming() - b.getTiming();
                        if (difference == 0)
                                return 0;
@@ -28,17 +31,20 @@ public class Timeline {
                eventAddedListener = new ArrayList<>();
        }
 
-       public boolean hasNext() {
+       public boolean hasNext()
+       {
                return !events.isEmpty();
        }
 
-       public void executeNext() {
+       public void executeNext()
+       {
                InnerEvent first = events.poll();
                currentTime = first.getTiming();
                first.run();
        }
 
-       public void executeAll() {
+       public void executeAll()
+       {
                while (hasNext())
                        executeNext();
        }
@@ -51,14 +57,17 @@ public class Timeline {
         * @return if it was possible to fulfil the goal in the given real world time.
         * @author Christian Femers
         */
-       public ExecutionResult executeUpTo(long timestamp, long stopMillis) {
-               if (events.isEmpty()) {
+       public ExecutionResult executeUpTo(long timestamp, long stopMillis)
+       {
+               if (events.isEmpty())
+               {
                        currentTime = timestamp;
                        return ExecutionResult.NOTHING_DONE;
                }
                int checkStop = 0;
                InnerEvent first = events.peek();
-               while (first != null && first.getTiming() <= timestamp) {
+               while (first != null && first.getTiming() <= timestamp)
+               {
                        events.remove();
                        currentTime = first.getTiming();
                        first.run();
@@ -72,27 +81,32 @@ public class Timeline {
                return ExecutionResult.DONE_IN_TIME;
        }
 
-       public long getSimulationTime() {
+       public long getSimulationTime()
+       {
                return currentTime;
        }
 
-       public long nextEventTime() {
+       public long nextEventTime()
+       {
                if (!hasNext())
                        return -1;
                else
                        return events.peek().timing;
        }
 
-       public void reset() {
+       public void reset()
+       {
                events.clear();
                currentTime = 0;
        }
 
-       public void addEventAddedListener(Consumer<TimelineEvent> listener) {
+       public void addEventAddedListener(Consumer<TimelineEvent> listener)
+       {
                eventAddedListener.add(listener);
        }
 
-       public void removeEventAddedListener(Consumer<TimelineEvent> listener) {
+       public void removeEventAddedListener(Consumer<TimelineEvent> listener)
+       {
                eventAddedListener.remove(listener);
        }
 
@@ -102,14 +116,16 @@ public class Timeline {
         * @param function       The {@link TimelineEventHandler} that will be executed, when the {@link InnerEvent} occurs on the timeline.
         * @param relativeTiming The amount of MI ticks in which the {@link InnerEvent} is called, starting from the current time.
         */
-       public void addEvent(TimelineEventHandler function, int relativeTiming) {
+       public void addEvent(TimelineEventHandler function, int relativeTiming)
+       {
                long timing = currentTime + relativeTiming;
                TimelineEvent event = new TimelineEvent(timing);
                events.add(new InnerEvent(function, event, timing));
                eventAddedListener.forEach(l -> l.accept(event));
        }
 
-       private class InnerEvent {
+       private class InnerEvent
+       {
 
                private final long timing;
                private final TimelineEventHandler function;
@@ -121,36 +137,43 @@ public class Timeline {
                 * @param function {@link TimelineEventHandler} to be executed when the {@link InnerEvent} occurs
                 * @param timing   Point in the MI simulation {@link Timeline}, at which the {@link InnerEvent} is executed;
                 */
-               InnerEvent(TimelineEventHandler function, TimelineEvent event, long timing) {
+               InnerEvent(TimelineEventHandler function, TimelineEvent event, long timing)
+               {
                        this.function = function;
                        this.event = event;
                        this.timing = timing;
                }
 
-               public long getTiming() {
+               public long getTiming()
+               {
                        return timing;
                }
 
-               public void run() {
+               public void run()
+               {
                        function.handle(event);
                }
 
                @Override
-               public String toString() {
+               public String toString()
+               {
                        return event.toString();
                }
        }
 
        @Override
-       public String toString() {
+       public String toString()
+       {
                return "simulation time: " + currentTime + ", " + events.toString();
        }
 
-       public static long toNanoseconds(long ticks) {
+       public static long toNanoseconds(long ticks)
+       {
                return ticks; // TODO: Alter this when it has been determined how ticks should relate to real time.
        }
 
-       public enum ExecutionResult {
+       public enum ExecutionResult
+       {
                NOTHING_DONE, DONE_IN_TIME, RAN_OUT_OF_TIME
        }
 }
\ No newline at end of file
index 9d33482..b3eec8c 100644 (file)
@@ -7,19 +7,23 @@ package era.mi.logic.timeline;
  * @author Fabian Stemmler
  *
  */
-public class TimelineEvent {
+public class TimelineEvent
+{
        private final long timing;
 
-       TimelineEvent(long timing) {
+       TimelineEvent(long timing)
+       {
                super();
                this.timing = timing;
        }
 
-       public long getTiming() {
+       public long getTiming()
+       {
                return timing;
        }
 
-       public String toString() {
+       public String toString()
+       {
                return "timestamp: " + timing;
        }
 }
\ No newline at end of file
index d9899e0..59a91c9 100644 (file)
@@ -1,5 +1,6 @@
 package era.mi.logic.timeline;
 
-public interface TimelineEventHandler {
+public interface TimelineEventHandler
+{
        public void handle(TimelineEvent e);
 }
\ No newline at end of file
index 957f00b..4b5fdc7 100644 (file)
@@ -1,5 +1,6 @@
 package era.mi.logic.wires;
 
+import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -15,14 +16,16 @@ import era.mi.logic.Util;
  * @author Fabian Stemmler
  *
  */
-public class WireArray {
+public class WireArray
+{
        private Bit[] values;
        public final int travelTime;
        private List<WireArrayObserver> observers = new ArrayList<WireArrayObserver>();
        public final int length;
-       private List<WireArrayInput> inputs = new ArrayList<WireArrayInput>();
+       private List<WireArrayEnd> inputs = new ArrayList<WireArrayEnd>();
 
-       public WireArray(int length, int travelTime) {
+       public WireArray(int length, int travelTime)
+       {
                if (length < 1)
                        throw new IllegalArgumentException(
                                        String.format("Tried to create an array of wires with length %d, but a length of less than 1 makes no sense.", length));
@@ -31,27 +34,33 @@ public class WireArray {
                initValues();
        }
 
-       private void initValues() {
-               values = Bit.Z.makeArray(length);
+       private void initValues()
+       {
+               values = Bit.U.makeArray(length);
        }
 
-       private void recalculateSingleInput() {
-               WireArrayInput input = inputs.get(0);
-               if (!Arrays.equals(input.getValues(), values)) {
+       private void recalculateSingleInput()
+       {
+               WireArrayEnd input = inputs.get(0);
+               if (!Arrays.equals(input.getValues(), values))
+               {
                        Bit[] oldValues = values.clone();
                        System.arraycopy(input.getValues(), 0, values, 0, length);
                        notifyObservers(oldValues);
                }
        }
 
-       private void recalculateMultipleInputs() {
-               Iterator<WireArrayInput> it = inputs.iterator();
+       private void recalculateMultipleInputs()
+       {
+               Iterator<WireArrayEnd> it = inputs.iterator();
                Bit[] newValues = it.next().inputValues.clone();
 
-               while (it.hasNext()) {
-                       WireArrayInput input = it.next();
+               while (it.hasNext())
+               {
+                       WireArrayEnd input = it.next();
                        Bit[] bits = input.getValues();
-                       for (int i = 0; i < length; i++) {
+                       for (int i = 0; i < length; i++)
+                       {
                                if (Bit.Z.equals(bits[i]) || newValues[i].equals(bits[i]))
                                        continue;
                                else if (Bit.Z.equals(newValues[i]))
@@ -61,15 +70,18 @@ public class WireArray {
                        }
                }
 
-               if (!Arrays.equals(newValues, values)) {
+               if (!Arrays.equals(newValues, values))
+               {
                        Bit[] oldValues = values;
                        values = newValues;
                        notifyObservers(oldValues);
                }
        }
 
-       private void recalculate() {
-               switch (inputs.size()) {
+       private void recalculate()
+       {
+               switch (inputs.size())
+               {
                case 0:
                        return;
                case 1:
@@ -88,8 +100,10 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public boolean hasNumericValue() {
-               for (Bit b : values) {
+       public boolean hasNumericValue()
+       {
+               for (Bit b : values)
+               {
                        if (b != Bit.ZERO && b != Bit.ONE)
                                return false;
                }
@@ -103,11 +117,14 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public long getUnsignedValue() {
+       public long getUnsignedValue()
+       {
                long val = 0;
                long mask = 1;
-               for (int i = 0; i < length; i++) {
-                       switch (values[i]) {
+               for (int i = 0; i < length; i++)
+               {
+                       switch (values[i])
+                       {
                        default:
                        case Z:
                        case X:
@@ -130,10 +147,12 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public long getSignedValue() {
+       public long getSignedValue()
+       {
                long val = getUnsignedValue();
                long mask = 1 << (length - 1);
-               if ((mask & val) != 0) {
+               if ((mask & val) != 0)
+               {
                        int shifts = 64 - length;
                        return (val << shifts) >> shifts;
                }
@@ -147,7 +166,8 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public Bit getValue() {
+       public Bit getValue()
+       {
                return getValue(0);
        }
 
@@ -158,11 +178,13 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public Bit getValue(int index) {
+       public Bit getValue(int index)
+       {
                return values[index];
        }
 
-       public Bit[] getValues(int start, int end) {
+       public Bit[] getValues(int start, int end)
+       {
                int length = end - start;
                Bit[] bits = new Bit[length];
                System.arraycopy(values, start, bits, 0, length);
@@ -174,7 +196,8 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public Bit[] getValues() {
+       public Bit[] getValues()
+       {
                return values.clone();
        }
 
@@ -186,45 +209,54 @@ public class WireArray {
         * 
         * @author Fabian Stemmler
         */
-       public boolean addObserver(WireArrayObserver ob) {
+       public boolean addObserver(WireArrayObserver ob)
+       {
                return observers.add(ob);
        }
 
-       private void notifyObservers(Bit[] oldValues) {
+       private void notifyObservers(Bit[] oldValues)
+       {
                for (WireArrayObserver o : observers)
                        o.update(this, oldValues);
        }
 
        /**
-        * Create and register a {@link WireArrayInput} object, which is tied to this {@link WireArray}.
+        * Create and register a {@link WireArrayEnd} object, which is tied to this {@link WireArray}.
         */
-       public WireArrayInput createInput() {
-               return new WireArrayInput(this);
+       public WireArrayEnd createInput()
+       {
+               return new WireArrayEnd(this);
        }
 
-       private void registerInput(WireArrayInput toRegister) {
+       private void registerInput(WireArrayEnd toRegister)
+       {
                inputs.add(toRegister);
        }
 
        /**
-        * A {@link WireArrayInput} feeds a constant signal into the {@link WireArray} it is tied to. The combination of all inputs determines
-        * the {@link WireArray}s final value. X dominates all other inputs Z does not affect the final value, unless there are no other inputs
-        * than Z 0 and 1 turn into X when they are mixed
+        * A {@link WireArrayEnd} feeds a constant signal into the {@link WireArray} it is tied to. The combination of all inputs determines the
+        * {@link WireArray}s final value. X dominates all other inputs Z does not affect the final value, unless there are no other inputs than
+        * Z 0 and 1 turn into X when they are mixed
         * 
         * @author Fabian Stemmler
         */
-       public class WireArrayInput {
+       public class WireArrayEnd implements Closeable
+       {
                public final WireArray owner;
+               private boolean open;
                private Bit[] inputValues;
 
-               private WireArrayInput(WireArray owner) {
+               private WireArrayEnd(WireArray owner)
+               {
                        super();
                        this.owner = owner;
+                       open = true;
                        initValues();
                        owner.registerInput(this);
                }
 
-               private void initValues() {
+               private void initValues()
+               {
                        inputValues = Bit.Z.makeArray(length);
                }
 
@@ -235,12 +267,14 @@ public class WireArray {
                 * 
                 * @author Fabian Stemmler
                 */
-               public void feedSignals(Bit... newValues) {
-                       if (newValues.length == length) {
+               public void feedSignals(Bit... newValues)
+               {
+                       if (newValues.length == length)
+                       {
                                feedSignals(0, newValues);
                        } else
                                throw new IllegalArgumentException(
-                                               String.format("Attempted to input %o bits instead of %o bits.", newValues.length, length));
+                                               String.format("Attempted to input %d bits instead of %d bits.", newValues.length, length));
                }
 
                /**
@@ -251,40 +285,49 @@ public class WireArray {
                 * 
                 * @author Fabian Stemmler
                 */
-               public void feedSignals(int startingBit, Bit... newValues) {
+               public void feedSignals(int startingBit, Bit... newValues)
+               {
+                       if (!open)
+                               throw new RuntimeException("Attempted to write to closed WireArrayEnd.");
                        Simulation.TIMELINE.addEvent((e) -> setValues(startingBit, newValues), travelTime);
                }
 
-               private void setValues(int startingBit, Bit... newValues) {
+               private void setValues(int startingBit, Bit... newValues)
+               {
                        int exclLastIndex = startingBit + newValues.length;
                        if (length < exclLastIndex)
                                throw new ArrayIndexOutOfBoundsException(
-                                               String.format("Attempted to input bits from index %o to %o when there are only %o wires.", startingBit,
+                                               String.format("Attempted to input bits from index %d to %d when there are only %d wires.", startingBit,
                                                                exclLastIndex - 1, length));
-                       if (!Arrays.equals(inputValues, startingBit, exclLastIndex, newValues, 0, newValues.length)) {
+                       if (!Arrays.equals(inputValues, startingBit, exclLastIndex, newValues, 0, newValues.length))
+                       {
                                System.arraycopy(newValues, 0, inputValues, startingBit, newValues.length);
                                owner.recalculate();
                        }
                }
 
                /**
-                * Returns a copy (safe to modify) of the values the {@link WireArrayInput} is currently feeding into the associated
+                * Returns a copy (safe to modify) of the values the {@link WireArrayEnd} is currently feeding into the associated
                 * {@link WireArray}.
                 */
-               public Bit[] getValues() {
+               public Bit[] getValues()
+               {
                        return inputValues.clone();
                }
 
                /**
-                * {@link WireArrayInput} now feeds Z into the associated {@link WireArray}.
+                * {@link WireArrayEnd} now feeds Z into the associated {@link WireArray}.
                 */
-               public void clearSignals() {
+               public void clearSignals()
+               {
                        feedSignals(Bit.Z.makeArray(length));
                }
 
-               public Bit[] wireValuesExcludingMe() {
+               public Bit[] wireValuesExcludingMe()
+               {
                        Bit[] bits = Bit.Z.makeArray(length);
-                       for (WireArrayInput wai : inputs) {
+                       for (WireArrayEnd wai : inputs)
+                       {
                                if (wai == this)
                                        continue;
                                Util.combineInto(bits, wai.getValues());
@@ -292,19 +335,39 @@ public class WireArray {
                        return bits;
                }
 
+               public Bit getWireValue()
+               {
+                       return owner.getValue();
+               }
+
+               public Bit[] getWireValues()
+               {
+                       return owner.getValues();
+               }
+
                @Override
-               public String toString() {
+               public String toString()
+               {
                        return Arrays.toString(inputValues);
                }
+
+               @Override
+               public void close()
+               {
+                       inputs.remove(this);
+                       open = false;
+               }
        }
 
        @Override
-       public String toString() {
+       public String toString()
+       {
                return String.format("wire 0x%08x value: %s inputs: %s", hashCode(), Arrays.toString(values), inputs);
        }
 
-       public static WireArrayInput[] extractInputs(WireArray[] w) {
-               WireArrayInput[] inputs = new WireArrayInput[w.length];
+       public static WireArrayEnd[] extractInputs(WireArray[] w)
+       {
+               WireArrayEnd[] inputs = new WireArrayEnd[w.length];
                for (int i = 0; i < w.length; i++)
                        inputs[i] = w[i].createInput();
                return inputs;
index b7ed808..2c807bb 100644 (file)
@@ -2,6 +2,7 @@ package era.mi.logic.wires;
 
 import era.mi.logic.Bit;
 
-public interface WireArrayObserver {
+public interface WireArrayObserver
+{
        public void update(WireArray initiator, Bit[] oldValues);
 }