--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.mograsim.logic.core.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=info
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=info
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=info
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=info
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
+org.eclipse.jdt.core.formatter.align_with_spaces=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=140
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.lineSplit=140
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=true
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_MoGraSim
+formatter_settings_version=16
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_semicolons=false
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Logic Tests
+Bundle-SymbolicName: net.mograsim.logic.core.tests;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Vendor: Mograsim Team
+Fragment-Host: net.mograsim.logic.model;bundle-version="0.1.0"
+Automatic-Module-Name: net.mograsim.logic.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-11
+Require-Bundle: org.junit.jupiter.api;bundle-version="5.4.0";visibility:=reexport,
+ org.junit.jupiter.params;bundle-version="5.4.0";visibility:=reexport,
+ org.junit;bundle-version="4.12.0"
--- /dev/null
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null
+package net.mograsim.logic.core.tests;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import net.mograsim.logic.core.components.CoreDemux;
+import net.mograsim.logic.core.components.CoreMux;
+import net.mograsim.logic.core.components.CoreTriStateBuffer;
+import net.mograsim.logic.core.components.CoreUnidirectionalMerger;
+import net.mograsim.logic.core.components.CoreUnidirectionalSplitter;
+import net.mograsim.logic.core.components.gates.CoreAndGate;
+import net.mograsim.logic.core.components.gates.CoreNandGate;
+import net.mograsim.logic.core.components.gates.CoreNorGate;
+import net.mograsim.logic.core.components.gates.CoreNotGate;
+import net.mograsim.logic.core.components.gates.CoreOrGate;
+import net.mograsim.logic.core.components.gates.CoreXorGate;
+import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.types.Bit;
+import net.mograsim.logic.core.types.BitVector;
+import net.mograsim.logic.core.wires.CoreWire;
+import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
+import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
+
+@SuppressWarnings("unused")
+class CoreComponentTest
+{
+ private Timeline t = new Timeline(11);
+
+ @BeforeEach
+ void resetTimeline()
+ {
+ t.reset();
+ }
+
+ @Test
+ void circuitExampleTest()
+ {
+ CoreWire a = new CoreWire(t, 1, 1), b = new CoreWire(t, 1, 1), c = new CoreWire(t, 1, 10), d = new CoreWire(t, 2, 1),
+ e = new CoreWire(t, 1, 1), f = new CoreWire(t, 1, 1), g = new CoreWire(t, 1, 1), h = new CoreWire(t, 2, 1),
+ i = new CoreWire(t, 2, 1), j = new CoreWire(t, 1, 1), k = new CoreWire(t, 1, 1);
+ new CoreAndGate(t, 1, f.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
+ new CoreNotGate(t, 1, f.createReadOnlyEnd(), g.createReadWriteEnd());
+ new CoreUnidirectionalMerger(t, h.createReadWriteEnd(), c.createReadOnlyEnd(), g.createReadOnlyEnd());
+ new CoreMux(t, 1, i.createReadWriteEnd(), e.createReadOnlyEnd(), h.createReadOnlyEnd(), d.createReadOnlyEnd());
+ new CoreUnidirectionalSplitter(t, i.createReadOnlyEnd(), k.createReadWriteEnd(), j.createReadWriteEnd());
+
+ a.createReadWriteEnd().feedSignals(Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ONE);
+ c.createReadWriteEnd().feedSignals(Bit.ZERO);
+ d.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE);
+ e.createReadWriteEnd().feedSignals(Bit.ZERO);
+
+ t.executeAll();
+
+ assertEquals(Bit.ONE, j.getValue());
+ assertEquals(Bit.ZERO, k.getValue());
+ }
+
+ @Test
+ void splitterTest()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), in = new CoreWire(t, 8, 1);
+ in.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+ new CoreUnidirectionalSplitter(t, in.createReadOnlyEnd(), a.createReadWriteEnd(), b.createReadWriteEnd(), c.createReadWriteEnd());
+
+ t.executeAll();
+
+ assertBitArrayEquals(a.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);
+ assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.ZERO);
+ assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE);
+ }
+
+ @Test
+ void mergerTest()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), out = new CoreWire(t, 8, 1);
+ a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO);
+ c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ new CoreUnidirectionalMerger(t, out.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
+
+ t.executeAll();
+
+ assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+ }
+
+ @Test
+ void fusionTest1()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), out = new CoreWire(t, 8, 1);
+ CoreWire.fuse(a, out, 0, 0, a.width);
+ CoreWire.fuse(b, out, 0, a.width, b.width);
+ CoreWire.fuse(c, out, 0, a.width + b.width, c.width);
+ ReadWriteEnd rA = a.createReadWriteEnd();
+ rA.feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);
+ ReadWriteEnd rB = b.createReadWriteEnd();
+ rB.feedSignals(Bit.ONE, Bit.ZERO);
+ ReadWriteEnd rC = c.createReadWriteEnd();
+ rC.feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ t.executeAll();
+ assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+ out.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
+ t.executeAll();
+ assertBitArrayEquals(rA.getValues(), Bit.X, Bit.X, Bit.X);
+ assertBitArrayEquals(rB.getValues(), Bit.X, Bit.X);
+ assertBitArrayEquals(rC.getValues(), Bit.X, Bit.X, Bit.X);
+ rA.clearSignals();
+ rB.clearSignals();
+ rC.clearSignals();
+ t.executeAll();
+ assertBitArrayEquals(rA.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE);
+ assertBitArrayEquals(rB.getValues(), Bit.ZERO, Bit.ONE);
+ assertBitArrayEquals(rC.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);
+ }
+
+ @Test
+ void fusionTest2()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
+ CoreWire.fuse(a, b);
+ ReadWriteEnd rw = a.createReadWriteEnd();
+ t.executeAll();
+ assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
+
+ rw.feedSignals(Bit.ONE, Bit.U, Bit.Z);
+ t.executeAll();
+ assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.U, Bit.Z);
+ }
+
+ @Test
+ void fusionTest3()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
+ a.createReadWriteEnd().feedSignals(Bit.Z, Bit.U, Bit.X);
+ t.executeAll();
+ CoreWire.fuse(a, b);
+ t.executeAll();
+ assertBitArrayEquals(b.getValues(), Bit.Z, Bit.U, Bit.X);
+ }
+
+ @Test
+ void fusionTest4()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
+ a.createReadWriteEnd();
+ t.executeAll();
+
+ CoreWire.fuse(a, b);
+ t.executeAll();
+ assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
+ }
+
+// @Test
+// void connectorTest()
+// {
+// t.reset();
+// Wire a = new Wire(t, 3, 1), b = new Wire(t, 3, 1);
+// new Connector(t, a.createReadWriteEnd(), b.createReadWriteEnd()).connect();
+//// b.createReadWriteEnd();
+// a.createReadWriteEnd();
+// t.executeAll();
+// assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
+// }
+
+ @Test
+ void triStateBufferTest()
+ {
+ CoreWire a = new CoreWire(t, 1, 1), b = new CoreWire(t, 1, 1), en = new CoreWire(t, 1, 1), notEn = new CoreWire(t, 1, 1);
+ new CoreNotGate(t, 1, en.createReadOnlyEnd(), notEn.createReadWriteEnd());
+ new CoreTriStateBuffer(t, 1, a.createReadOnlyEnd(), b.createReadWriteEnd(), en.createReadOnlyEnd());
+ new CoreTriStateBuffer(t, 1, b.createReadOnlyEnd(), a.createReadWriteEnd(), notEn.createReadOnlyEnd());
+
+ ReadWriteEnd enI = en.createReadWriteEnd(), aI = a.createReadWriteEnd(), bI = b.createReadWriteEnd();
+ enI.feedSignals(Bit.ONE);
+ aI.feedSignals(Bit.ONE);
+ bI.feedSignals(Bit.Z);
+
+ t.executeAll();
+
+ assertEquals(Bit.ONE, b.getValue());
+
+ bI.feedSignals(Bit.ZERO);
+
+ t.executeAll();
+
+ assertEquals(Bit.X, b.getValue());
+ assertEquals(Bit.ONE, a.getValue());
+
+ aI.clearSignals();
+ enI.feedSignals(Bit.ZERO);
+
+ t.executeAll();
+
+ assertEquals(Bit.ZERO, a.getValue());
+
+ }
+
+ @Test
+ void muxTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 3), b = new CoreWire(t, 4, 6), c = new CoreWire(t, 4, 4), select = new CoreWire(t, 2, 5),
+ out = new CoreWire(t, 4, 1);
+ ReadWriteEnd selectIn = select.createReadWriteEnd();
+
+ selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
+ c.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ new CoreMux(t, 1, out.createReadWriteEnd(), select.createReadOnlyEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(),
+ c.createReadOnlyEnd());
+ t.executeAll();
+
+ assertBitArrayEquals(out.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
+ selectIn.feedSignals(Bit.ONE, Bit.ZERO);
+ t.executeAll();
+
+ assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ selectIn.feedSignals(Bit.ONE, Bit.ONE);
+ t.executeAll();
+
+ assertBitArrayEquals(out.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
+
+ }
+
+ @Test
+ void demuxTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 3), b = new CoreWire(t, 4, 6), c = new CoreWire(t, 4, 4), select = new CoreWire(t, 2, 5),
+ in = new CoreWire(t, 4, 1);
+ ReadWriteEnd selectIn = select.createReadWriteEnd();
+
+ selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
+ in.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
+
+ new CoreDemux(t, 1, in.createReadOnlyEnd(), select.createReadOnlyEnd(), a.createReadWriteEnd(), b.createReadWriteEnd(),
+ c.createReadWriteEnd());
+ t.executeAll();
+
+ assertBitArrayEquals(a.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
+ 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.ONE, Bit.ZERO);
+ t.executeAll();
+
+ assertBitArrayEquals(a.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);
+ t.executeAll();
+
+ assertBitArrayEquals(a.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()
+ {
+ CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1);
+ new CoreAndGate(t, 1, c.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ t.executeAll();
+
+ assertBitArrayEquals(c.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ZERO);
+ }
+
+ @Test
+ void orTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1);
+ new CoreOrGate(t, 1, c.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ t.executeAll();
+
+ assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ONE);
+ }
+
+ @Test
+ void nandTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1), d = new CoreWire(t, 4, 1);
+ new CoreNandGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+ c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+
+ t.executeAll();
+
+ assertBitArrayEquals(d.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ONE);
+ }
+
+ @Test
+ void norTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1), d = new CoreWire(t, 4, 1);
+ new CoreNorGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+ b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
+ c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
+
+ t.executeAll();
+
+ assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ZERO, Bit.ONE, Bit.ZERO);
+ }
+
+ @Test
+ void xorTest()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 2), c = new CoreWire(t, 3, 1), d = new CoreWire(t, 3, 1);
+ new CoreXorGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);
+ b.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+ c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ t.executeAll();
+
+ assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ONE, Bit.ONE);
+ }
+
+ @Test
+ void notTest()
+ {
+ CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 2);
+ new CoreNotGate(t, 1, a.createReadOnlyEnd(), b.createReadWriteEnd());
+ a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);
+
+ t.executeAll();
+
+ assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.ZERO, Bit.ZERO);
+ }
+
+ @Test
+ void rsLatchCircuitTest()
+ {
+ CoreWire r = new CoreWire(t, 1, 1), s = new CoreWire(t, 1, 1), t1 = new CoreWire(t, 1, 15), t2 = new CoreWire(t, 1, 1),
+ q = new CoreWire(t, 1, 1), nq = new CoreWire(t, 1, 1);
+
+ new CoreOrGate(t, 1, t2.createReadWriteEnd(), r.createReadOnlyEnd(), nq.createReadOnlyEnd());
+ new CoreOrGate(t, 1, t1.createReadWriteEnd(), s.createReadOnlyEnd(), q.createReadOnlyEnd());
+ new CoreNotGate(t, 1, t2.createReadOnlyEnd(), q.createReadWriteEnd());
+ new CoreNotGate(t, 1, t1.createReadOnlyEnd(), nq.createReadWriteEnd());
+
+ ReadWriteEnd sIn = s.createReadWriteEnd(), rIn = r.createReadWriteEnd();
+
+ sIn.feedSignals(Bit.ONE);
+ rIn.feedSignals(Bit.ZERO);
+
+ t.executeAll();
+
+ assertEquals(Bit.ONE, q.getValue());
+ assertEquals(Bit.ZERO, nq.getValue());
+
+ sIn.feedSignals(Bit.ZERO);
+
+ t.executeAll();
+ assertEquals(Bit.ONE, q.getValue());
+ assertEquals(Bit.ZERO, nq.getValue());
+
+ rIn.feedSignals(Bit.ONE);
+
+ t.executeAll();
+
+ assertEquals(Bit.ZERO, q.getValue());
+ assertEquals(Bit.ONE, nq.getValue());
+ }
+
+ @Test
+ void numericValueTest()
+ {
+ CoreWire a = new CoreWire(t, 4, 1);
+ a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ONE);
+
+ t.executeAll();
+
+ assertEquals(11, a.getValues().getUnsignedValueLong());
+ assertEquals(-5, a.getValues().getSignedValueLong());
+ }
+
+ boolean flag = false;
+
+ @Test
+ void simpleTimelineTest()
+ {
+ Timeline t = new Timeline(3);
+ flag = false;
+ t.addEvent((e) ->
+ {
+ if (!flag)
+ fail("Events executed out of order!");
+ flag = false;
+ }, 15);
+ t.addEvent((e) ->
+ {
+ if (flag)
+ fail("Events executed out of order!");
+ flag = true;
+ }, 10);
+ t.addEvent((e) ->
+ {
+ if (flag)
+ fail("Events executed out of order!");
+ flag = true;
+ }, 20);
+ t.addEvent((e) ->
+ {
+ fail("Only supposed to execute until timestamp 20, not 25");
+ }, 25);
+
+ t.executeUntil(t.laterThan(20), 100);
+
+ if (!flag)
+ fail("Not all events were executed in order!");
+ }
+
+ // TODO: Adapt this test, now that update notifications are issued whenever any input to a wire changes
+ @Disabled("Out of date")
+ @Test
+ void multipleInputs()
+ {
+ CoreWire w = new CoreWire(t, 2, 1);
+ ReadWriteEnd wI1 = w.createReadWriteEnd(), wI2 = w.createReadWriteEnd();
+ wI1.feedSignals(Bit.ONE, Bit.Z);
+ wI2.feedSignals(Bit.Z, Bit.X);
+ t.executeAll();
+ assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.X);
+
+ wI2.feedSignals(Bit.ZERO, Bit.Z);
+ t.executeAll();
+ assertBitArrayEquals(w.getValues(), Bit.X, Bit.Z);
+
+ wI2.feedSignals(Bit.Z, Bit.Z);
+ t.executeAll();
+ assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);
+
+ wI2.feedSignals(Bit.ONE, Bit.Z);
+ ReadEnd rE = w.createReadOnlyEnd();
+ rE.registerObserver((i) -> fail("WireEnd notified observer, although value did not change."));
+ t.executeAll();
+ rE.close();
+ wI1.feedSignals(Bit.X, Bit.X);
+ t.executeAll();
+ wI1.registerObserver((i) -> fail("WireEnd notified observer, although it was closed."));
+ wI1.close();
+ assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);
+ }
+
+ private static void assertBitArrayEquals(BitVector actual, Bit... expected)
+ {
+ assertArrayEquals(expected, actual.getBits());
+ }
+}
--- /dev/null
+package net.mograsim.logic.core.tests;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.WindowConstants;
+
+import net.mograsim.logic.core.components.CoreManualSwitch;
+import net.mograsim.logic.core.components.gates.CoreNotGate;
+import net.mograsim.logic.core.components.gates.CoreOrGate;
+import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.timeline.Timeline.ExecutionResult;
+import net.mograsim.logic.core.wires.CoreWire;
+
+public class GUITest extends JPanel
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private static final int WIRE_DELAY = 40;
+ private static final int OR_DELAY = 100;
+ private static final int NOT_DELAY = 100;
+
+ private Timeline t = new Timeline(11);
+
+ CoreWire r = new CoreWire(t, 1, WIRE_DELAY);
+ CoreWire s = new CoreWire(t, 1, WIRE_DELAY);
+ CoreWire t1 = new CoreWire(t, 1, WIRE_DELAY);
+ CoreWire t2 = new CoreWire(t, 1, WIRE_DELAY);
+ CoreWire q = new CoreWire(t, 1, WIRE_DELAY);
+ CoreWire nq = new CoreWire(t, 1, WIRE_DELAY);
+
+ CoreManualSwitch rIn = new CoreManualSwitch(t, r.createReadWriteEnd());
+ CoreManualSwitch sIn = new CoreManualSwitch(t, s.createReadWriteEnd());
+
+ CoreOrGate or1 = new CoreOrGate(t, OR_DELAY, t2.createReadWriteEnd(), r.createReadOnlyEnd(), nq.createReadOnlyEnd());
+ CoreOrGate or2 = new CoreOrGate(t, OR_DELAY, t1.createReadWriteEnd(), s.createReadOnlyEnd(), q.createReadOnlyEnd());
+ CoreNotGate not1 = new CoreNotGate(t, NOT_DELAY, t2.createReadOnlyEnd(), q.createReadWriteEnd());
+ CoreNotGate not2 = new CoreNotGate(t, NOT_DELAY, t1.createReadOnlyEnd(), nq.createReadWriteEnd());
+
+ Map<CoreManualSwitch, Rectangle> switchMap = new HashMap<>();
+
+ int height;
+ int width;
+ boolean sizeChanged;
+
+ public GUITest()
+ {
+ addMouseListener(new MouseListener()
+ {
+
+ @Override
+ public void mouseReleased(MouseEvent e)
+ {
+ for (Entry<CoreManualSwitch, Rectangle> dim : switchMap.entrySet())
+ {
+ if (dim.getValue().contains(e.getPoint()))
+ {
+ dim.getKey().switchFullOff();
+ repaint();
+ }
+ }
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ for (Entry<CoreManualSwitch, Rectangle> dim : switchMap.entrySet())
+ {
+ if (dim.getValue().contains(e.getPoint()))
+ {
+ dim.getKey().switchFullOn();
+ repaint();
+ }
+ }
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e)
+ {
+ // none
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e)
+ {
+ // none
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ // If you want toggle buttons, use this code instead
+// for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {
+// if (dim.getValue().contains(e.getPoint())) {
+// dim.getKey().toggle();
+// repaint();
+// }
+// }
+ }
+ });
+ }
+
+ public Timeline getTimeline()
+ {
+ return t;
+ }
+
+ @Override
+ public void paint(Graphics some_g)
+ {
+ super.paint(some_g);
+ Graphics2D g = ((Graphics2D) some_g);
+ g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+
+ checkSizeChange();
+ adaptFont(g);
+
+ drawWire(g, r, "r", 2, 9, 4, 9);
+
+ drawWire(g, s, "s", 2, 3, 4, 3);
+
+ drawWire(g, t2, "t2", 5, 8.5, 6, 8.5);
+
+ drawWire(g, t1, "t1", 5, 3.5, 6, 3.5);
+
+ drawWire(g, q, "q", 7, 8.5, 9, 8.5);
+
+ drawWire(g, nq, "nq", 7, 3.5, 9, 3.5);
+
+ drawWire(g, q, "", 7.5, 8.5, 7.5, 7.5);
+ drawWire(g, q, "", 7.5, 7.5, 3, 4.5);
+ drawWire(g, q, "", 3, 4.5, 3, 4);
+ drawWire(g, q, "q", 3, 4, 4, 4);
+
+ drawWire(g, nq, "", 7.5, 3.5, 7.5, 4.5);
+ drawWire(g, nq, "", 7.5, 4.5, 3, 7.5);
+ drawWire(g, nq, "", 3, 7.5, 3, 8);
+ drawWire(g, nq, "nq", 3, 8, 4, 8);
+
+ drawSquare(g, 4, 8, "OR");
+ drawSquare(g, 4, 3, "OR");
+
+ drawSquare(g, 6, 8, "NOT");
+ drawSquare(g, 6, 3, "NOT");
+
+ drawSwitch(g, rIn, "Switch R", 0.5, 8.25, 2, 9.75);
+ drawSwitch(g, sIn, "Switch S", 0.5, 2.25, 2, 3.75);
+
+ drawString(g, "Hint: drag the cursor out of the pressed switch to keep it's state", 5, 0, 0.0, 1.0);
+ }
+
+ private void checkSizeChange()
+ {
+ sizeChanged = height != getHeight() || width != getWidth();
+ if (sizeChanged)
+ {
+ height = getHeight();
+ width = getWidth();
+ }
+ }
+
+ private void adaptFont(Graphics g)
+ {
+ g.setFont(g.getFont().deriveFont(Math.min(height, width) / 40f));
+ }
+
+ @SuppressWarnings("static-method")
+ 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, CoreWire wa, String name, double x1, double y1, double x2, double y2)
+ {
+ setTo(g, wa);
+ g.drawLine(gX(x1), gY(y1), gX(x2), gY(y2));
+ drawString(g, name, (gX(x1) + gX(x2)) / 2, (gY(y1) + gY(y2)) / 2 - 5, 0, 0);
+ }
+
+ private void drawSquare(Graphics g, int posX, int posY, String text)
+ {
+ int x1 = gX(posX) - 5;
+ int x2 = gX(posX + 1) + 5;
+ int y1 = gY(posY) - 5;
+ int y2 = gY(posY + 1) + 5;
+
+ g.setColor(Color.WHITE);
+ g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ setBlack(g);
+ g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
+
+ }
+
+ private void drawSwitch(Graphics g, CoreManualSwitch ms, String text, double posX1, double posY1, double posX2, double posY2)
+ {
+ int x1 = gX(posX1) - 5;
+ int x2 = gX(posX2) + 5;
+ int y1 = gY(posY1) - 5;
+ int y2 = gY(posY2) + 5;
+
+ if (sizeChanged)
+ {
+ Rectangle r = new Rectangle(x1, y1, x2 - x1, y2 - y1);
+ switchMap.put(ms, r);
+ }
+
+ g.setColor(ms.isFullOn() ? Color.getHSBColor(.3f, .5f, 1f) : Color.WHITE);
+ g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ setBlack(g);
+ g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+ drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
+ }
+
+ private static void setBlack(Graphics g)
+ {
+ g.setColor(Color.BLACK);
+ }
+
+ private static void setTo(Graphics g, CoreWire wa)
+ {
+ switch (wa.getValue())
+ {
+ case ONE:
+ g.setColor(Color.GREEN);
+ break;
+ case X:
+ g.setColor(Color.RED);
+ break;
+ case Z:
+ g.setColor(Color.DARK_GRAY);
+ break;
+ case ZERO:
+ g.setColor(Color.BLACK);
+ break;
+ case U:
+ g.setColor(Color.MAGENTA);
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
+ private int gY(double pos)
+ {
+ return (int) (pos * height / 11);
+ }
+
+ private int gX(double pos)
+ {
+ return (int) (pos * width / 11) + 50;
+ }
+
+ public static void main(String[] args)
+ {
+ JFrame f = new JFrame("Test circuit 1.0.0");
+ GUITest gt = new GUITest();
+ f.add(gt);
+ f.setSize(800, 600);
+ f.setLocation(500, 400);
+ f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ f.setVisible(true);
+
+ long begin = System.currentTimeMillis();
+
+ long lastFrame = begin;
+ long updateT = 16;
+
+ while (f.isVisible())
+ {
+ ExecutionResult er = gt.getTimeline().executeUntil(gt.getTimeline().laterThan((lastFrame - begin) * 3), lastFrame + 14);
+// if (t.hasNext())
+// t.executeNext();
+ if (er != ExecutionResult.NOTHING_DONE)
+ gt.repaint(12);
+ try
+ {
+ Thread.sleep(Math.max(updateT - System.currentTimeMillis() + lastFrame, 0));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ lastFrame = System.currentTimeMillis();
+ }
+ }
+}
--- /dev/null
+package net.mograsim.logic.core.tests;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+import java.util.function.LongConsumer;
+
+import net.mograsim.logic.core.components.CoreBitDisplay;
+import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.timeline.TimelineEventHandler;
+import net.mograsim.logic.core.types.Bit;
+import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
+
+public final class TestCoreBitDisplay extends CoreBitDisplay
+{
+
+ public TestCoreBitDisplay(Timeline timeline, ReadEnd in)
+ {
+ super(timeline, in);
+ }
+
+ public void assertDisplays(Bit... expected)
+ {
+ assertArrayEquals(expected, getDisplayedValue().getBits());
+ }
+
+ public void assertAfterSimulationIs(Bit... expected)
+ {
+ timeline.executeAll();
+ assertDisplays(expected);
+ }
+
+ public void assertAfterSimulationIs(LongConsumer r, Bit... expected)
+ {
+ while (timeline.hasNext())
+ {
+ timeline.executeNext();
+ r.accept(timeline.getSimulationTime());
+ }
+ assertDisplays(expected);
+ }
+
+ @Override
+ protected TimelineEventHandler compute()
+ {
+ TimelineEventHandler handler = super.compute();
+ return e ->
+ {
+ handler.handle(e);
+ System.out.println("update: value is " + getDisplayedValue());
+ };
+ }
+}
--- /dev/null
+package net.mograsim.logic.core.types;
+
+import static net.mograsim.logic.core.types.BitVector.*;
+import static net.mograsim.logic.core.types.Bit.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.math.BigInteger;
+import java.util.Iterator;
+
+import org.junit.jupiter.api.Test;
+
+class BitVectorTest
+{
+
+ @Test
+ void testOfBitArray()
+ {
+ BitVector.of(); // should be allowed and work
+
+ assertSame(SINGLE_U, BitVector.of(U));
+ assertSame(SINGLE_X, BitVector.of(X));
+ assertSame(SINGLE_0, BitVector.of(ZERO));
+ assertSame(SINGLE_1, BitVector.of(ONE));
+ assertSame(SINGLE_Z, BitVector.of(Z));
+ }
+
+ @Test
+ void testOfBitInt()
+ {
+ assertEquals(BitVector.of(), BitVector.of(ONE, 0));
+
+ assertSame(SINGLE_U, BitVector.of(U, 1));
+ assertSame(SINGLE_X, BitVector.of(X, 1));
+ assertSame(SINGLE_0, BitVector.of(ZERO, 1));
+ assertSame(SINGLE_1, BitVector.of(ONE, 1));
+ assertSame(SINGLE_Z, BitVector.of(Z, 1));
+
+ assertEquals(BitVector.of(X, X, X), BitVector.of(X, 3));
+ }
+
+ @Test
+ void testGetUnsignedValue()
+ {
+ assertEquals(BigInteger.valueOf(0b101), BitVector.parse("101").getUnsignedValue());
+ assertEquals(BigInteger.valueOf(0b01010), BitVector.parse("01010").getUnsignedValue());
+ assertEquals(BigInteger.valueOf(0), BitVector.parse("0000").getUnsignedValue());
+ assertEquals(BigInteger.valueOf(0b0000000101), BitVector.parse("0000000101").getUnsignedValue());
+ assertEquals(BigInteger.valueOf(0b1010000000), BitVector.parse("1010000000").getUnsignedValue());
+
+ assertThrows(NumberFormatException.class, () -> BitVector.parse("00X1").getUnsignedValue());
+ }
+
+ @Test
+ void testOfLongInt()
+ {
+ assertEquals(BitVector.parse("101"), BitVector.from(0b101L, 3));
+ assertEquals(BitVector.parse("01010"), BitVector.from(0b01010L, 5));
+ assertEquals(BitVector.parse("10101"), BitVector.from(-11L, 5));
+ assertEquals(BitVector.parse("0000"), BitVector.from(0L, 4));
+ }
+
+ @Test
+ void testOfBigIntegerInt()
+ {
+ assertEquals(BitVector.parse("101"), BitVector.from(BigInteger.valueOf(0b101), 3));
+ assertEquals(BitVector.parse("01010"), BitVector.from(BigInteger.valueOf(0b01010), 5));
+ assertEquals(BitVector.parse("10101"), BitVector.from(BigInteger.valueOf(-11), 5));
+ assertEquals(BitVector.parse("0000"), BitVector.from(BigInteger.valueOf(0), 4));
+ }
+
+ @Test
+ void testMutator()
+ {
+ var bv = BitVector.SINGLE_1;
+ var bvm = bv.mutator();
+
+ assertFalse(bvm.isEmpty());
+ assertEquals(ONE, bvm.getLSBit(0));
+ assertEquals(SINGLE_1, bvm.toBitVector());
+ }
+
+ @Test
+ void testGetMSBit()
+ {
+ assertEquals(ONE, SINGLE_1.getMSBit(0));
+ assertEquals(ONE, BitVector.of(ONE, X, X, X).getMSBit(0));
+ assertEquals(ONE, BitVector.of(X, X, X, X, ONE, X).getMSBit(4));
+ }
+
+ @Test
+ void testGetLSBit()
+ {
+ assertEquals(ONE, SINGLE_1.getLSBit(0));
+ assertEquals(ONE, BitVector.of(X, X, X, ONE).getLSBit(0));
+ assertEquals(ONE, BitVector.of(X, X, X, X, ONE, X).getLSBit(1));
+ }
+
+ @Test
+ void testGetBits()
+ {
+ assertArrayEquals(new Bit[] { X, ONE, Z }, BitVector.of(X, ONE, Z).getBits());
+ assertArrayEquals(new Bit[] { X, ONE, Z }, BitVector.parse("X1Z").getBits());
+ }
+
+ @Test
+ void testIsBinary()
+ {
+ assertTrue(SINGLE_0.isBinary());
+ assertTrue(SINGLE_1.isBinary());
+
+ assertFalse(SINGLE_U.isBinary());
+ assertFalse(SINGLE_X.isBinary());
+ assertFalse(SINGLE_Z.isBinary());
+
+ assertTrue(BitVector.of(ONE, ZERO, ONE, ONE, ZERO).isBinary());
+ assertFalse(BitVector.of(ONE, ZERO, ZERO, X).isBinary());
+ }
+
+ @Test
+ void testJoin()
+ {
+ // binary
+ assertEquals(SINGLE_0, SINGLE_0.join(SINGLE_0));
+ assertEquals(SINGLE_X, SINGLE_0.join(SINGLE_1));
+ assertEquals(SINGLE_1, SINGLE_1.join(SINGLE_1));
+
+ // other
+ assertEquals(SINGLE_1, SINGLE_Z.join(SINGLE_1));
+ assertEquals(SINGLE_U, SINGLE_0.join(SINGLE_U));
+ assertEquals(SINGLE_X, SINGLE_X.join(SINGLE_Z));
+
+ // higher length
+ var result = BitVector.of(U, X, ZERO, ONE, Z).join(BitVector.of(ONE, ZERO, ZERO, ONE, Z));
+ assertEquals(BitVector.of(U, X, ZERO, ONE, Z), result);
+ }
+
+ @Test
+ void testAnd()
+ {
+ // binary
+ assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_0));
+ assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_1));
+ assertEquals(SINGLE_1, SINGLE_1.and(SINGLE_1));
+
+ // other
+ assertEquals(SINGLE_X, SINGLE_Z.and(SINGLE_1));
+ assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_U));
+ assertEquals(SINGLE_X, SINGLE_X.and(SINGLE_Z));
+
+ // higher length
+ var result = BitVector.of(U, X, ZERO, ONE, ONE).and(BitVector.of(ONE, ONE, ZERO, ZERO, ONE));
+ assertEquals(BitVector.of(U, X, ZERO, ZERO, ONE), result);
+ }
+
+ @Test
+ void testOr()
+ {
+ // binary
+ assertEquals(SINGLE_0, SINGLE_0.or(SINGLE_0));
+ assertEquals(SINGLE_1, SINGLE_0.or(SINGLE_1));
+ assertEquals(SINGLE_1, SINGLE_1.or(SINGLE_1));
+
+ // other
+ assertEquals(SINGLE_1, SINGLE_Z.or(SINGLE_1));
+ assertEquals(SINGLE_1, SINGLE_1.or(SINGLE_U));
+ assertEquals(SINGLE_X, SINGLE_X.or(SINGLE_Z));
+
+ // higher length
+ var result = BitVector.of(U, X, ZERO, ONE, ZERO).or(BitVector.of(ZERO, ZERO, ZERO, ONE, ONE));
+ assertEquals(BitVector.of(U, X, ZERO, ONE, ONE), result);
+ }
+
+ @Test
+ void testXor()
+ {
+ // binary
+ assertEquals(SINGLE_0, SINGLE_0.xor(SINGLE_0));
+ assertEquals(SINGLE_1, SINGLE_0.xor(SINGLE_1));
+ assertEquals(SINGLE_0, SINGLE_1.xor(SINGLE_1));
+
+ // other
+ assertEquals(SINGLE_X, SINGLE_Z.xor(SINGLE_1));
+ assertEquals(SINGLE_U, SINGLE_0.xor(SINGLE_U));
+ assertEquals(SINGLE_X, SINGLE_X.xor(SINGLE_Z));
+
+ // higher length
+ var result = BitVector.of(U, X, ZERO, ONE, ONE).xor(BitVector.of(ONE, ZERO, ZERO, ZERO, ONE));
+ assertEquals(BitVector.of(U, X, ZERO, ONE, ZERO), result);
+ }
+
+ @Test
+ void testNot()
+ {
+ // binary
+ assertEquals(SINGLE_1, SINGLE_0.not());
+ assertEquals(SINGLE_0, SINGLE_1.not());
+
+ // other
+ assertEquals(SINGLE_U, SINGLE_U.not());
+ assertEquals(SINGLE_X, SINGLE_X.not());
+ assertEquals(SINGLE_X, SINGLE_Z.not());
+
+ // higher length
+ var result = BitVector.of(U, X, ZERO, ONE, Z).not();
+ assertEquals(BitVector.of(U, X, ONE, ZERO, X), result);
+ }
+
+ @Test
+ void testLength()
+ {
+ assertEquals(0, BitVector.of().length());
+ assertEquals(1, SINGLE_0.length());
+ assertEquals(3, BitVector.of(X, X, Z).length());
+ }
+
+ @Test
+ void testConcat()
+ {
+ assertEquals(BitVector.of(U, X), SINGLE_U.concat(SINGLE_X));
+ assertEquals(BitVector.of(Z, X, U, ONE, X), BitVector.of(Z, X, U).concat(BitVector.of(ONE, X)));
+ }
+
+ @Test
+ void testSubVectorInt()
+ {
+ assertEquals(SINGLE_0, SINGLE_0.subVector(0));
+ assertEquals(BitVector.of(), SINGLE_0.subVector(1));
+ assertEquals(SINGLE_0, BitVector.of(ONE, ZERO).subVector(1));
+ assertEquals(BitVector.of(X, Z), BitVector.of(ZERO, U, ONE, X, Z).subVector(3));
+ }
+
+ @Test
+ void testSubVectorIntInt()
+ {
+ assertEquals(SINGLE_0, SINGLE_0.subVector(0, 1));
+ assertEquals(BitVector.of(), SINGLE_0.subVector(0, 0));
+ assertEquals(SINGLE_0, BitVector.of(ONE, ZERO).subVector(1, 2));
+ assertEquals(BitVector.of(ONE, X), BitVector.of(ZERO, U, ONE, X, Z).subVector(2, 4));
+ }
+
+ @Test
+ void testEqualsObject()
+ {
+ assertEquals(SINGLE_X, SINGLE_X);
+ assertNotEquals(SINGLE_0, SINGLE_1);
+
+ assertEquals(BitVector.of(X, Z, U), BitVector.of(X, Z, U));
+ assertNotEquals(BitVector.of(X, Z, U), BitVector.of(X, X, U));
+ }
+
+ @Test
+ void testEqualsWithOffset()
+ {
+ assertTrue(SINGLE_X.equalsWithOffset(SINGLE_X, 0));
+ assertFalse(SINGLE_0.equalsWithOffset(SINGLE_1, 0));
+
+ assertTrue(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(Z, U), 1));
+ assertFalse(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(X, U), 1));
+ assertTrue(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(U), 2));
+ }
+
+ @Test
+ void testParse()
+ {
+ assertEquals(SINGLE_U, BitVector.parse("U"));
+ assertEquals(SINGLE_X, BitVector.parse("X"));
+ assertEquals(SINGLE_0, BitVector.parse("0"));
+ assertEquals(SINGLE_1, BitVector.parse("1"));
+ assertEquals(SINGLE_Z, BitVector.parse("Z"));
+
+ assertEquals(BitVector.of(X, U, Z, ONE, ZERO), BitVector.parse("XUZ10"));
+
+ assertThrows(RuntimeException.class, () -> BitVector.parse("01BX"));
+ }
+
+ @Test
+ void testIterator()
+ {
+ var bv = BitVector.of(U, Z, ONE, ZERO, X);
+ Iterator<Bit> it = bv.iterator();
+
+ assertEquals(U, it.next());
+ assertEquals(Z, it.next());
+ assertEquals(ONE, it.next());
+ assertEquals(ZERO, it.next());
+ assertEquals(X, it.next());
+ assertFalse(it.hasNext());
+ }
+}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src">
- <attributes>
- <attribute name="test" value="true"/>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
- <attributes>
- <attribute name="module" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>net.mograsim.logic.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=11
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.APILeak=warning
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=info
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
-org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=info
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=info
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
-org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=info
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=11
-org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
-org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
-org.eclipse.jdt.core.formatter.align_with_spaces=false
-org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
-org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
-org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
-org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
-org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
-org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
-org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=140
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
-org.eclipse.jdt.core.formatter.lineSplit=140
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
-org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=true
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
-org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
-org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_MoGraSim
-formatter_settings_version=16
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=false
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_modifiers=false
-sp_cleanup.remove_redundant_semicolons=false
-sp_cleanup.remove_redundant_type_arguments=false
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=true
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Logic Tests
-Bundle-SymbolicName: net.mograsim.logic.tests;singleton:=true
-Bundle-Version: 0.1.0.qualifier
-Bundle-Vendor: Mograsim Team
-Fragment-Host: net.mograsim.logic.model;bundle-version="0.1.0"
-Automatic-Module-Name: net.mograsim.logic.tests
-Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.junit.jupiter.api;bundle-version="5.4.0";visibility:=reexport,
- org.junit.jupiter.params;bundle-version="5.4.0";visibility:=reexport,
- org.junit;bundle-version="4.12.0"
+++ /dev/null
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+++ /dev/null
-package net.mograsim.logic.core.tests;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-import net.mograsim.logic.core.components.CoreDemux;
-import net.mograsim.logic.core.components.CoreMux;
-import net.mograsim.logic.core.components.CoreTriStateBuffer;
-import net.mograsim.logic.core.components.CoreUnidirectionalMerger;
-import net.mograsim.logic.core.components.CoreUnidirectionalSplitter;
-import net.mograsim.logic.core.components.gates.CoreAndGate;
-import net.mograsim.logic.core.components.gates.CoreNandGate;
-import net.mograsim.logic.core.components.gates.CoreNorGate;
-import net.mograsim.logic.core.components.gates.CoreNotGate;
-import net.mograsim.logic.core.components.gates.CoreOrGate;
-import net.mograsim.logic.core.components.gates.CoreXorGate;
-import net.mograsim.logic.core.timeline.Timeline;
-import net.mograsim.logic.core.types.Bit;
-import net.mograsim.logic.core.types.BitVector;
-import net.mograsim.logic.core.wires.CoreWire;
-import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
-import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
-
-@SuppressWarnings("unused")
-class CoreComponentTest
-{
- private Timeline t = new Timeline(11);
-
- @BeforeEach
- void resetTimeline()
- {
- t.reset();
- }
-
- @Test
- void circuitExampleTest()
- {
- CoreWire a = new CoreWire(t, 1, 1), b = new CoreWire(t, 1, 1), c = new CoreWire(t, 1, 10), d = new CoreWire(t, 2, 1),
- e = new CoreWire(t, 1, 1), f = new CoreWire(t, 1, 1), g = new CoreWire(t, 1, 1), h = new CoreWire(t, 2, 1),
- i = new CoreWire(t, 2, 1), j = new CoreWire(t, 1, 1), k = new CoreWire(t, 1, 1);
- new CoreAndGate(t, 1, f.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
- new CoreNotGate(t, 1, f.createReadOnlyEnd(), g.createReadWriteEnd());
- new CoreUnidirectionalMerger(t, h.createReadWriteEnd(), c.createReadOnlyEnd(), g.createReadOnlyEnd());
- new CoreMux(t, 1, i.createReadWriteEnd(), e.createReadOnlyEnd(), h.createReadOnlyEnd(), d.createReadOnlyEnd());
- new CoreUnidirectionalSplitter(t, i.createReadOnlyEnd(), k.createReadWriteEnd(), j.createReadWriteEnd());
-
- a.createReadWriteEnd().feedSignals(Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ONE);
- c.createReadWriteEnd().feedSignals(Bit.ZERO);
- d.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE);
- e.createReadWriteEnd().feedSignals(Bit.ZERO);
-
- t.executeAll();
-
- assertEquals(Bit.ONE, j.getValue());
- assertEquals(Bit.ZERO, k.getValue());
- }
-
- @Test
- void splitterTest()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), in = new CoreWire(t, 8, 1);
- in.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
- new CoreUnidirectionalSplitter(t, in.createReadOnlyEnd(), a.createReadWriteEnd(), b.createReadWriteEnd(), c.createReadWriteEnd());
-
- t.executeAll();
-
- assertBitArrayEquals(a.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);
- assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.ZERO);
- assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE);
- }
-
- @Test
- void mergerTest()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), out = new CoreWire(t, 8, 1);
- a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO);
- c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
-
- new CoreUnidirectionalMerger(t, out.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
-
- t.executeAll();
-
- assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
- }
-
- @Test
- void fusionTest1()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 2, 1), c = new CoreWire(t, 3, 1), out = new CoreWire(t, 8, 1);
- CoreWire.fuse(a, out, 0, 0, a.width);
- CoreWire.fuse(b, out, 0, a.width, b.width);
- CoreWire.fuse(c, out, 0, a.width + b.width, c.width);
- ReadWriteEnd rA = a.createReadWriteEnd();
- rA.feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO);
- ReadWriteEnd rB = b.createReadWriteEnd();
- rB.feedSignals(Bit.ONE, Bit.ZERO);
- ReadWriteEnd rC = c.createReadWriteEnd();
- rC.feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
-
- t.executeAll();
- assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
- out.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
- t.executeAll();
- assertBitArrayEquals(rA.getValues(), Bit.X, Bit.X, Bit.X);
- assertBitArrayEquals(rB.getValues(), Bit.X, Bit.X);
- assertBitArrayEquals(rC.getValues(), Bit.X, Bit.X, Bit.X);
- rA.clearSignals();
- rB.clearSignals();
- rC.clearSignals();
- t.executeAll();
- assertBitArrayEquals(rA.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE);
- assertBitArrayEquals(rB.getValues(), Bit.ZERO, Bit.ONE);
- assertBitArrayEquals(rC.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO);
- }
-
- @Test
- void fusionTest2()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
- CoreWire.fuse(a, b);
- ReadWriteEnd rw = a.createReadWriteEnd();
- t.executeAll();
- assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
-
- rw.feedSignals(Bit.ONE, Bit.U, Bit.Z);
- t.executeAll();
- assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.U, Bit.Z);
- }
-
- @Test
- void fusionTest3()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
- a.createReadWriteEnd().feedSignals(Bit.Z, Bit.U, Bit.X);
- t.executeAll();
- CoreWire.fuse(a, b);
- t.executeAll();
- assertBitArrayEquals(b.getValues(), Bit.Z, Bit.U, Bit.X);
- }
-
- @Test
- void fusionTest4()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 1);
- a.createReadWriteEnd();
- t.executeAll();
-
- CoreWire.fuse(a, b);
- t.executeAll();
- assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
- }
-
-// @Test
-// void connectorTest()
-// {
-// t.reset();
-// Wire a = new Wire(t, 3, 1), b = new Wire(t, 3, 1);
-// new Connector(t, a.createReadWriteEnd(), b.createReadWriteEnd()).connect();
-//// b.createReadWriteEnd();
-// a.createReadWriteEnd();
-// t.executeAll();
-// assertBitArrayEquals(b.getValues(), Bit.U, Bit.U, Bit.U);
-// }
-
- @Test
- void triStateBufferTest()
- {
- CoreWire a = new CoreWire(t, 1, 1), b = new CoreWire(t, 1, 1), en = new CoreWire(t, 1, 1), notEn = new CoreWire(t, 1, 1);
- new CoreNotGate(t, 1, en.createReadOnlyEnd(), notEn.createReadWriteEnd());
- new CoreTriStateBuffer(t, 1, a.createReadOnlyEnd(), b.createReadWriteEnd(), en.createReadOnlyEnd());
- new CoreTriStateBuffer(t, 1, b.createReadOnlyEnd(), a.createReadWriteEnd(), notEn.createReadOnlyEnd());
-
- ReadWriteEnd enI = en.createReadWriteEnd(), aI = a.createReadWriteEnd(), bI = b.createReadWriteEnd();
- enI.feedSignals(Bit.ONE);
- aI.feedSignals(Bit.ONE);
- bI.feedSignals(Bit.Z);
-
- t.executeAll();
-
- assertEquals(Bit.ONE, b.getValue());
-
- bI.feedSignals(Bit.ZERO);
-
- t.executeAll();
-
- assertEquals(Bit.X, b.getValue());
- assertEquals(Bit.ONE, a.getValue());
-
- aI.clearSignals();
- enI.feedSignals(Bit.ZERO);
-
- t.executeAll();
-
- assertEquals(Bit.ZERO, a.getValue());
-
- }
-
- @Test
- void muxTest()
- {
- CoreWire a = new CoreWire(t, 4, 3), b = new CoreWire(t, 4, 6), c = new CoreWire(t, 4, 4), select = new CoreWire(t, 2, 5),
- out = new CoreWire(t, 4, 1);
- ReadWriteEnd selectIn = select.createReadWriteEnd();
-
- selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
- c.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
-
- new CoreMux(t, 1, out.createReadWriteEnd(), select.createReadOnlyEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(),
- c.createReadOnlyEnd());
- t.executeAll();
-
- assertBitArrayEquals(out.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
- selectIn.feedSignals(Bit.ONE, Bit.ZERO);
- t.executeAll();
-
- assertBitArrayEquals(out.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
-
- selectIn.feedSignals(Bit.ONE, Bit.ONE);
- t.executeAll();
-
- assertBitArrayEquals(out.getValues(), Bit.Z, Bit.Z, Bit.Z, Bit.Z);
-
- }
-
- @Test
- void demuxTest()
- {
- CoreWire a = new CoreWire(t, 4, 3), b = new CoreWire(t, 4, 6), c = new CoreWire(t, 4, 4), select = new CoreWire(t, 2, 5),
- in = new CoreWire(t, 4, 1);
- ReadWriteEnd selectIn = select.createReadWriteEnd();
-
- selectIn.feedSignals(Bit.ZERO, Bit.ZERO);
- in.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
-
- new CoreDemux(t, 1, in.createReadOnlyEnd(), select.createReadOnlyEnd(), a.createReadWriteEnd(), b.createReadWriteEnd(),
- c.createReadWriteEnd());
- t.executeAll();
-
- assertBitArrayEquals(a.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ZERO);
- 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.ONE, Bit.ZERO);
- t.executeAll();
-
- assertBitArrayEquals(a.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);
- t.executeAll();
-
- assertBitArrayEquals(a.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()
- {
- CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1);
- new CoreAndGate(t, 1, c.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
-
- t.executeAll();
-
- assertBitArrayEquals(c.getValues(), Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ZERO);
- }
-
- @Test
- void orTest()
- {
- CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1);
- new CoreOrGate(t, 1, c.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd());
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
-
- t.executeAll();
-
- assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ONE);
- }
-
- @Test
- void nandTest()
- {
- CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1), d = new CoreWire(t, 4, 1);
- new CoreNandGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
- c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
-
- t.executeAll();
-
- assertBitArrayEquals(d.getValues(), Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ONE);
- }
-
- @Test
- void norTest()
- {
- CoreWire a = new CoreWire(t, 4, 1), b = new CoreWire(t, 4, 3), c = new CoreWire(t, 4, 1), d = new CoreWire(t, 4, 1);
- new CoreNorGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
- b.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ZERO, Bit.ONE);
- c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ZERO);
-
- t.executeAll();
-
- assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ZERO, Bit.ONE, Bit.ZERO);
- }
-
- @Test
- void xorTest()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 2), c = new CoreWire(t, 3, 1), d = new CoreWire(t, 3, 1);
- new CoreXorGate(t, 1, d.createReadWriteEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());
- a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);
- b.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
- c.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
-
- t.executeAll();
-
- assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ONE, Bit.ONE);
- }
-
- @Test
- void notTest()
- {
- CoreWire a = new CoreWire(t, 3, 1), b = new CoreWire(t, 3, 2);
- new CoreNotGate(t, 1, a.createReadOnlyEnd(), b.createReadWriteEnd());
- a.createReadWriteEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);
-
- t.executeAll();
-
- assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.ZERO, Bit.ZERO);
- }
-
- @Test
- void rsLatchCircuitTest()
- {
- CoreWire r = new CoreWire(t, 1, 1), s = new CoreWire(t, 1, 1), t1 = new CoreWire(t, 1, 15), t2 = new CoreWire(t, 1, 1),
- q = new CoreWire(t, 1, 1), nq = new CoreWire(t, 1, 1);
-
- new CoreOrGate(t, 1, t2.createReadWriteEnd(), r.createReadOnlyEnd(), nq.createReadOnlyEnd());
- new CoreOrGate(t, 1, t1.createReadWriteEnd(), s.createReadOnlyEnd(), q.createReadOnlyEnd());
- new CoreNotGate(t, 1, t2.createReadOnlyEnd(), q.createReadWriteEnd());
- new CoreNotGate(t, 1, t1.createReadOnlyEnd(), nq.createReadWriteEnd());
-
- ReadWriteEnd sIn = s.createReadWriteEnd(), rIn = r.createReadWriteEnd();
-
- sIn.feedSignals(Bit.ONE);
- rIn.feedSignals(Bit.ZERO);
-
- t.executeAll();
-
- assertEquals(Bit.ONE, q.getValue());
- assertEquals(Bit.ZERO, nq.getValue());
-
- sIn.feedSignals(Bit.ZERO);
-
- t.executeAll();
- assertEquals(Bit.ONE, q.getValue());
- assertEquals(Bit.ZERO, nq.getValue());
-
- rIn.feedSignals(Bit.ONE);
-
- t.executeAll();
-
- assertEquals(Bit.ZERO, q.getValue());
- assertEquals(Bit.ONE, nq.getValue());
- }
-
- @Test
- void numericValueTest()
- {
- CoreWire a = new CoreWire(t, 4, 1);
- a.createReadWriteEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE, Bit.ONE);
-
- t.executeAll();
-
- assertEquals(11, a.getValues().getUnsignedValueLong());
- assertEquals(-5, a.getValues().getSignedValueLong());
- }
-
- boolean flag = false;
-
- @Test
- void simpleTimelineTest()
- {
- Timeline t = new Timeline(3);
- flag = false;
- t.addEvent((e) ->
- {
- if (!flag)
- fail("Events executed out of order!");
- flag = false;
- }, 15);
- t.addEvent((e) ->
- {
- if (flag)
- fail("Events executed out of order!");
- flag = true;
- }, 10);
- t.addEvent((e) ->
- {
- if (flag)
- fail("Events executed out of order!");
- flag = true;
- }, 20);
- t.addEvent((e) ->
- {
- fail("Only supposed to execute until timestamp 20, not 25");
- }, 25);
-
- t.executeUntil(t.laterThan(20), 100);
-
- if (!flag)
- fail("Not all events were executed in order!");
- }
-
- // TODO: Adapt this test, now that update notifications are issued whenever any input to a wire changes
- @Disabled("Out of date")
- @Test
- void multipleInputs()
- {
- CoreWire w = new CoreWire(t, 2, 1);
- ReadWriteEnd wI1 = w.createReadWriteEnd(), wI2 = w.createReadWriteEnd();
- wI1.feedSignals(Bit.ONE, Bit.Z);
- wI2.feedSignals(Bit.Z, Bit.X);
- t.executeAll();
- assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.X);
-
- wI2.feedSignals(Bit.ZERO, Bit.Z);
- t.executeAll();
- assertBitArrayEquals(w.getValues(), Bit.X, Bit.Z);
-
- wI2.feedSignals(Bit.Z, Bit.Z);
- t.executeAll();
- assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);
-
- wI2.feedSignals(Bit.ONE, Bit.Z);
- ReadEnd rE = w.createReadOnlyEnd();
- rE.registerObserver((i) -> fail("WireEnd notified observer, although value did not change."));
- t.executeAll();
- rE.close();
- wI1.feedSignals(Bit.X, Bit.X);
- t.executeAll();
- wI1.registerObserver((i) -> fail("WireEnd notified observer, although it was closed."));
- wI1.close();
- assertBitArrayEquals(w.getValues(), Bit.ONE, Bit.Z);
- }
-
- private static void assertBitArrayEquals(BitVector actual, Bit... expected)
- {
- assertArrayEquals(expected, actual.getBits());
- }
-}
+++ /dev/null
-package net.mograsim.logic.core.tests;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.WindowConstants;
-
-import net.mograsim.logic.core.components.CoreManualSwitch;
-import net.mograsim.logic.core.components.gates.CoreNotGate;
-import net.mograsim.logic.core.components.gates.CoreOrGate;
-import net.mograsim.logic.core.timeline.Timeline;
-import net.mograsim.logic.core.timeline.Timeline.ExecutionResult;
-import net.mograsim.logic.core.wires.CoreWire;
-
-public class GUITest extends JPanel
-{
-
- private static final long serialVersionUID = 1L;
-
- private static final int WIRE_DELAY = 40;
- private static final int OR_DELAY = 100;
- private static final int NOT_DELAY = 100;
-
- private Timeline t = new Timeline(11);
-
- CoreWire r = new CoreWire(t, 1, WIRE_DELAY);
- CoreWire s = new CoreWire(t, 1, WIRE_DELAY);
- CoreWire t1 = new CoreWire(t, 1, WIRE_DELAY);
- CoreWire t2 = new CoreWire(t, 1, WIRE_DELAY);
- CoreWire q = new CoreWire(t, 1, WIRE_DELAY);
- CoreWire nq = new CoreWire(t, 1, WIRE_DELAY);
-
- CoreManualSwitch rIn = new CoreManualSwitch(t, r.createReadWriteEnd());
- CoreManualSwitch sIn = new CoreManualSwitch(t, s.createReadWriteEnd());
-
- CoreOrGate or1 = new CoreOrGate(t, OR_DELAY, t2.createReadWriteEnd(), r.createReadOnlyEnd(), nq.createReadOnlyEnd());
- CoreOrGate or2 = new CoreOrGate(t, OR_DELAY, t1.createReadWriteEnd(), s.createReadOnlyEnd(), q.createReadOnlyEnd());
- CoreNotGate not1 = new CoreNotGate(t, NOT_DELAY, t2.createReadOnlyEnd(), q.createReadWriteEnd());
- CoreNotGate not2 = new CoreNotGate(t, NOT_DELAY, t1.createReadOnlyEnd(), nq.createReadWriteEnd());
-
- Map<CoreManualSwitch, Rectangle> switchMap = new HashMap<>();
-
- int height;
- int width;
- boolean sizeChanged;
-
- public GUITest()
- {
- addMouseListener(new MouseListener()
- {
-
- @Override
- public void mouseReleased(MouseEvent e)
- {
- for (Entry<CoreManualSwitch, Rectangle> dim : switchMap.entrySet())
- {
- if (dim.getValue().contains(e.getPoint()))
- {
- dim.getKey().switchFullOff();
- repaint();
- }
- }
- }
-
- @Override
- public void mousePressed(MouseEvent e)
- {
- for (Entry<CoreManualSwitch, Rectangle> dim : switchMap.entrySet())
- {
- if (dim.getValue().contains(e.getPoint()))
- {
- dim.getKey().switchFullOn();
- repaint();
- }
- }
- }
-
- @Override
- public void mouseExited(MouseEvent e)
- {
- // none
- }
-
- @Override
- public void mouseEntered(MouseEvent e)
- {
- // none
- }
-
- @Override
- public void mouseClicked(MouseEvent e)
- {
- // If you want toggle buttons, use this code instead
-// for (Entry<ManualSwitch, Rectangle> dim : switchMap.entrySet()) {
-// if (dim.getValue().contains(e.getPoint())) {
-// dim.getKey().toggle();
-// repaint();
-// }
-// }
- }
- });
- }
-
- public Timeline getTimeline()
- {
- return t;
- }
-
- @Override
- public void paint(Graphics some_g)
- {
- super.paint(some_g);
- Graphics2D g = ((Graphics2D) some_g);
- g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
- g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
-
- checkSizeChange();
- adaptFont(g);
-
- drawWire(g, r, "r", 2, 9, 4, 9);
-
- drawWire(g, s, "s", 2, 3, 4, 3);
-
- drawWire(g, t2, "t2", 5, 8.5, 6, 8.5);
-
- drawWire(g, t1, "t1", 5, 3.5, 6, 3.5);
-
- drawWire(g, q, "q", 7, 8.5, 9, 8.5);
-
- drawWire(g, nq, "nq", 7, 3.5, 9, 3.5);
-
- drawWire(g, q, "", 7.5, 8.5, 7.5, 7.5);
- drawWire(g, q, "", 7.5, 7.5, 3, 4.5);
- drawWire(g, q, "", 3, 4.5, 3, 4);
- drawWire(g, q, "q", 3, 4, 4, 4);
-
- drawWire(g, nq, "", 7.5, 3.5, 7.5, 4.5);
- drawWire(g, nq, "", 7.5, 4.5, 3, 7.5);
- drawWire(g, nq, "", 3, 7.5, 3, 8);
- drawWire(g, nq, "nq", 3, 8, 4, 8);
-
- drawSquare(g, 4, 8, "OR");
- drawSquare(g, 4, 3, "OR");
-
- drawSquare(g, 6, 8, "NOT");
- drawSquare(g, 6, 3, "NOT");
-
- drawSwitch(g, rIn, "Switch R", 0.5, 8.25, 2, 9.75);
- drawSwitch(g, sIn, "Switch S", 0.5, 2.25, 2, 3.75);
-
- drawString(g, "Hint: drag the cursor out of the pressed switch to keep it's state", 5, 0, 0.0, 1.0);
- }
-
- private void checkSizeChange()
- {
- sizeChanged = height != getHeight() || width != getWidth();
- if (sizeChanged)
- {
- height = getHeight();
- width = getWidth();
- }
- }
-
- private void adaptFont(Graphics g)
- {
- g.setFont(g.getFont().deriveFont(Math.min(height, width) / 40f));
- }
-
- @SuppressWarnings("static-method")
- 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, CoreWire wa, String name, double x1, double y1, double x2, double y2)
- {
- setTo(g, wa);
- g.drawLine(gX(x1), gY(y1), gX(x2), gY(y2));
- drawString(g, name, (gX(x1) + gX(x2)) / 2, (gY(y1) + gY(y2)) / 2 - 5, 0, 0);
- }
-
- private void drawSquare(Graphics g, int posX, int posY, String text)
- {
- int x1 = gX(posX) - 5;
- int x2 = gX(posX + 1) + 5;
- int y1 = gY(posY) - 5;
- int y2 = gY(posY + 1) + 5;
-
- g.setColor(Color.WHITE);
- g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
- setBlack(g);
- g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
- drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
-
- }
-
- private void drawSwitch(Graphics g, CoreManualSwitch ms, String text, double posX1, double posY1, double posX2, double posY2)
- {
- int x1 = gX(posX1) - 5;
- int x2 = gX(posX2) + 5;
- int y1 = gY(posY1) - 5;
- int y2 = gY(posY2) + 5;
-
- if (sizeChanged)
- {
- Rectangle r = new Rectangle(x1, y1, x2 - x1, y2 - y1);
- switchMap.put(ms, r);
- }
-
- g.setColor(ms.isFullOn() ? Color.getHSBColor(.3f, .5f, 1f) : Color.WHITE);
- g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
- setBlack(g);
- g.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
- drawString(g, text, (x1 + x2) / 2, (y1 + y2) / 2, 0.5, 0.5);
- }
-
- private static void setBlack(Graphics g)
- {
- g.setColor(Color.BLACK);
- }
-
- private static void setTo(Graphics g, CoreWire wa)
- {
- switch (wa.getValue())
- {
- case ONE:
- g.setColor(Color.GREEN);
- break;
- case X:
- g.setColor(Color.RED);
- break;
- case Z:
- g.setColor(Color.DARK_GRAY);
- break;
- case ZERO:
- g.setColor(Color.BLACK);
- break;
- case U:
- g.setColor(Color.MAGENTA);
- break;
- default:
- throw new IllegalArgumentException();
- }
- }
-
- private int gY(double pos)
- {
- return (int) (pos * height / 11);
- }
-
- private int gX(double pos)
- {
- return (int) (pos * width / 11) + 50;
- }
-
- public static void main(String[] args)
- {
- JFrame f = new JFrame("Test circuit 1.0.0");
- GUITest gt = new GUITest();
- f.add(gt);
- f.setSize(800, 600);
- f.setLocation(500, 400);
- f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- f.setVisible(true);
-
- long begin = System.currentTimeMillis();
-
- long lastFrame = begin;
- long updateT = 16;
-
- while (f.isVisible())
- {
- ExecutionResult er = gt.getTimeline().executeUntil(gt.getTimeline().laterThan((lastFrame - begin) * 3), lastFrame + 14);
-// if (t.hasNext())
-// t.executeNext();
- if (er != ExecutionResult.NOTHING_DONE)
- gt.repaint(12);
- try
- {
- Thread.sleep(Math.max(updateT - System.currentTimeMillis() + lastFrame, 0));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- lastFrame = System.currentTimeMillis();
- }
- }
-}
+++ /dev/null
-package net.mograsim.logic.core.tests;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-
-import java.util.function.LongConsumer;
-
-import net.mograsim.logic.core.components.CoreBitDisplay;
-import net.mograsim.logic.core.timeline.Timeline;
-import net.mograsim.logic.core.timeline.TimelineEventHandler;
-import net.mograsim.logic.core.types.Bit;
-import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
-
-public final class TestCoreBitDisplay extends CoreBitDisplay
-{
-
- public TestCoreBitDisplay(Timeline timeline, ReadEnd in)
- {
- super(timeline, in);
- }
-
- public void assertDisplays(Bit... expected)
- {
- assertArrayEquals(expected, getDisplayedValue().getBits());
- }
-
- public void assertAfterSimulationIs(Bit... expected)
- {
- timeline.executeAll();
- assertDisplays(expected);
- }
-
- public void assertAfterSimulationIs(LongConsumer r, Bit... expected)
- {
- while (timeline.hasNext())
- {
- timeline.executeNext();
- r.accept(timeline.getSimulationTime());
- }
- assertDisplays(expected);
- }
-
- @Override
- protected TimelineEventHandler compute()
- {
- TimelineEventHandler handler = super.compute();
- return e ->
- {
- handler.handle(e);
- System.out.println("update: value is " + getDisplayedValue());
- };
- }
-}
+++ /dev/null
-package net.mograsim.logic.core.types;
-
-import static net.mograsim.logic.core.types.BitVector.*;
-import static net.mograsim.logic.core.types.Bit.*;
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.math.BigInteger;
-import java.util.Iterator;
-
-import org.junit.jupiter.api.Test;
-
-class BitVectorTest
-{
-
- @Test
- void testOfBitArray()
- {
- BitVector.of(); // should be allowed and work
-
- assertSame(SINGLE_U, BitVector.of(U));
- assertSame(SINGLE_X, BitVector.of(X));
- assertSame(SINGLE_0, BitVector.of(ZERO));
- assertSame(SINGLE_1, BitVector.of(ONE));
- assertSame(SINGLE_Z, BitVector.of(Z));
- }
-
- @Test
- void testOfBitInt()
- {
- assertEquals(BitVector.of(), BitVector.of(ONE, 0));
-
- assertSame(SINGLE_U, BitVector.of(U, 1));
- assertSame(SINGLE_X, BitVector.of(X, 1));
- assertSame(SINGLE_0, BitVector.of(ZERO, 1));
- assertSame(SINGLE_1, BitVector.of(ONE, 1));
- assertSame(SINGLE_Z, BitVector.of(Z, 1));
-
- assertEquals(BitVector.of(X, X, X), BitVector.of(X, 3));
- }
-
- @Test
- void testGetUnsignedValue()
- {
- assertEquals(BigInteger.valueOf(0b101), BitVector.parse("101").getUnsignedValue());
- assertEquals(BigInteger.valueOf(0b01010), BitVector.parse("01010").getUnsignedValue());
- assertEquals(BigInteger.valueOf(0), BitVector.parse("0000").getUnsignedValue());
- assertEquals(BigInteger.valueOf(0b0000000101), BitVector.parse("0000000101").getUnsignedValue());
- assertEquals(BigInteger.valueOf(0b1010000000), BitVector.parse("1010000000").getUnsignedValue());
-
- assertThrows(NumberFormatException.class, () -> BitVector.parse("00X1").getUnsignedValue());
- }
-
- @Test
- void testOfLongInt()
- {
- assertEquals(BitVector.parse("101"), BitVector.from(0b101L, 3));
- assertEquals(BitVector.parse("01010"), BitVector.from(0b01010L, 5));
- assertEquals(BitVector.parse("10101"), BitVector.from(-11L, 5));
- assertEquals(BitVector.parse("0000"), BitVector.from(0L, 4));
- }
-
- @Test
- void testOfBigIntegerInt()
- {
- assertEquals(BitVector.parse("101"), BitVector.from(BigInteger.valueOf(0b101), 3));
- assertEquals(BitVector.parse("01010"), BitVector.from(BigInteger.valueOf(0b01010), 5));
- assertEquals(BitVector.parse("10101"), BitVector.from(BigInteger.valueOf(-11), 5));
- assertEquals(BitVector.parse("0000"), BitVector.from(BigInteger.valueOf(0), 4));
- }
-
- @Test
- void testMutator()
- {
- var bv = BitVector.SINGLE_1;
- var bvm = bv.mutator();
-
- assertFalse(bvm.isEmpty());
- assertEquals(ONE, bvm.getLSBit(0));
- assertEquals(SINGLE_1, bvm.toBitVector());
- }
-
- @Test
- void testGetMSBit()
- {
- assertEquals(ONE, SINGLE_1.getMSBit(0));
- assertEquals(ONE, BitVector.of(ONE, X, X, X).getMSBit(0));
- assertEquals(ONE, BitVector.of(X, X, X, X, ONE, X).getMSBit(4));
- }
-
- @Test
- void testGetLSBit()
- {
- assertEquals(ONE, SINGLE_1.getLSBit(0));
- assertEquals(ONE, BitVector.of(X, X, X, ONE).getLSBit(0));
- assertEquals(ONE, BitVector.of(X, X, X, X, ONE, X).getLSBit(1));
- }
-
- @Test
- void testGetBits()
- {
- assertArrayEquals(new Bit[] { X, ONE, Z }, BitVector.of(X, ONE, Z).getBits());
- assertArrayEquals(new Bit[] { X, ONE, Z }, BitVector.parse("X1Z").getBits());
- }
-
- @Test
- void testIsBinary()
- {
- assertTrue(SINGLE_0.isBinary());
- assertTrue(SINGLE_1.isBinary());
-
- assertFalse(SINGLE_U.isBinary());
- assertFalse(SINGLE_X.isBinary());
- assertFalse(SINGLE_Z.isBinary());
-
- assertTrue(BitVector.of(ONE, ZERO, ONE, ONE, ZERO).isBinary());
- assertFalse(BitVector.of(ONE, ZERO, ZERO, X).isBinary());
- }
-
- @Test
- void testJoin()
- {
- // binary
- assertEquals(SINGLE_0, SINGLE_0.join(SINGLE_0));
- assertEquals(SINGLE_X, SINGLE_0.join(SINGLE_1));
- assertEquals(SINGLE_1, SINGLE_1.join(SINGLE_1));
-
- // other
- assertEquals(SINGLE_1, SINGLE_Z.join(SINGLE_1));
- assertEquals(SINGLE_U, SINGLE_0.join(SINGLE_U));
- assertEquals(SINGLE_X, SINGLE_X.join(SINGLE_Z));
-
- // higher length
- var result = BitVector.of(U, X, ZERO, ONE, Z).join(BitVector.of(ONE, ZERO, ZERO, ONE, Z));
- assertEquals(BitVector.of(U, X, ZERO, ONE, Z), result);
- }
-
- @Test
- void testAnd()
- {
- // binary
- assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_0));
- assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_1));
- assertEquals(SINGLE_1, SINGLE_1.and(SINGLE_1));
-
- // other
- assertEquals(SINGLE_X, SINGLE_Z.and(SINGLE_1));
- assertEquals(SINGLE_0, SINGLE_0.and(SINGLE_U));
- assertEquals(SINGLE_X, SINGLE_X.and(SINGLE_Z));
-
- // higher length
- var result = BitVector.of(U, X, ZERO, ONE, ONE).and(BitVector.of(ONE, ONE, ZERO, ZERO, ONE));
- assertEquals(BitVector.of(U, X, ZERO, ZERO, ONE), result);
- }
-
- @Test
- void testOr()
- {
- // binary
- assertEquals(SINGLE_0, SINGLE_0.or(SINGLE_0));
- assertEquals(SINGLE_1, SINGLE_0.or(SINGLE_1));
- assertEquals(SINGLE_1, SINGLE_1.or(SINGLE_1));
-
- // other
- assertEquals(SINGLE_1, SINGLE_Z.or(SINGLE_1));
- assertEquals(SINGLE_1, SINGLE_1.or(SINGLE_U));
- assertEquals(SINGLE_X, SINGLE_X.or(SINGLE_Z));
-
- // higher length
- var result = BitVector.of(U, X, ZERO, ONE, ZERO).or(BitVector.of(ZERO, ZERO, ZERO, ONE, ONE));
- assertEquals(BitVector.of(U, X, ZERO, ONE, ONE), result);
- }
-
- @Test
- void testXor()
- {
- // binary
- assertEquals(SINGLE_0, SINGLE_0.xor(SINGLE_0));
- assertEquals(SINGLE_1, SINGLE_0.xor(SINGLE_1));
- assertEquals(SINGLE_0, SINGLE_1.xor(SINGLE_1));
-
- // other
- assertEquals(SINGLE_X, SINGLE_Z.xor(SINGLE_1));
- assertEquals(SINGLE_U, SINGLE_0.xor(SINGLE_U));
- assertEquals(SINGLE_X, SINGLE_X.xor(SINGLE_Z));
-
- // higher length
- var result = BitVector.of(U, X, ZERO, ONE, ONE).xor(BitVector.of(ONE, ZERO, ZERO, ZERO, ONE));
- assertEquals(BitVector.of(U, X, ZERO, ONE, ZERO), result);
- }
-
- @Test
- void testNot()
- {
- // binary
- assertEquals(SINGLE_1, SINGLE_0.not());
- assertEquals(SINGLE_0, SINGLE_1.not());
-
- // other
- assertEquals(SINGLE_U, SINGLE_U.not());
- assertEquals(SINGLE_X, SINGLE_X.not());
- assertEquals(SINGLE_X, SINGLE_Z.not());
-
- // higher length
- var result = BitVector.of(U, X, ZERO, ONE, Z).not();
- assertEquals(BitVector.of(U, X, ONE, ZERO, X), result);
- }
-
- @Test
- void testLength()
- {
- assertEquals(0, BitVector.of().length());
- assertEquals(1, SINGLE_0.length());
- assertEquals(3, BitVector.of(X, X, Z).length());
- }
-
- @Test
- void testConcat()
- {
- assertEquals(BitVector.of(U, X), SINGLE_U.concat(SINGLE_X));
- assertEquals(BitVector.of(Z, X, U, ONE, X), BitVector.of(Z, X, U).concat(BitVector.of(ONE, X)));
- }
-
- @Test
- void testSubVectorInt()
- {
- assertEquals(SINGLE_0, SINGLE_0.subVector(0));
- assertEquals(BitVector.of(), SINGLE_0.subVector(1));
- assertEquals(SINGLE_0, BitVector.of(ONE, ZERO).subVector(1));
- assertEquals(BitVector.of(X, Z), BitVector.of(ZERO, U, ONE, X, Z).subVector(3));
- }
-
- @Test
- void testSubVectorIntInt()
- {
- assertEquals(SINGLE_0, SINGLE_0.subVector(0, 1));
- assertEquals(BitVector.of(), SINGLE_0.subVector(0, 0));
- assertEquals(SINGLE_0, BitVector.of(ONE, ZERO).subVector(1, 2));
- assertEquals(BitVector.of(ONE, X), BitVector.of(ZERO, U, ONE, X, Z).subVector(2, 4));
- }
-
- @Test
- void testEqualsObject()
- {
- assertEquals(SINGLE_X, SINGLE_X);
- assertNotEquals(SINGLE_0, SINGLE_1);
-
- assertEquals(BitVector.of(X, Z, U), BitVector.of(X, Z, U));
- assertNotEquals(BitVector.of(X, Z, U), BitVector.of(X, X, U));
- }
-
- @Test
- void testEqualsWithOffset()
- {
- assertTrue(SINGLE_X.equalsWithOffset(SINGLE_X, 0));
- assertFalse(SINGLE_0.equalsWithOffset(SINGLE_1, 0));
-
- assertTrue(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(Z, U), 1));
- assertFalse(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(X, U), 1));
- assertTrue(BitVector.of(X, Z, U).equalsWithOffset(BitVector.of(U), 2));
- }
-
- @Test
- void testParse()
- {
- assertEquals(SINGLE_U, BitVector.parse("U"));
- assertEquals(SINGLE_X, BitVector.parse("X"));
- assertEquals(SINGLE_0, BitVector.parse("0"));
- assertEquals(SINGLE_1, BitVector.parse("1"));
- assertEquals(SINGLE_Z, BitVector.parse("Z"));
-
- assertEquals(BitVector.of(X, U, Z, ONE, ZERO), BitVector.parse("XUZ10"));
-
- assertThrows(RuntimeException.class, () -> BitVector.parse("01BX"));
- }
-
- @Test
- void testIterator()
- {
- var bv = BitVector.of(U, Z, ONE, ZERO, X);
- Iterator<Bit> it = bv.iterator();
-
- assertEquals(U, it.next());
- assertEquals(Z, it.next());
- assertEquals(ONE, it.next());
- assertEquals(ZERO, it.next());
- assertEquals(X, it.next());
- assertFalse(it.hasNext());
- }
-}