diff --git a/simpleexample2/.gitignore b/simpleexample2/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1b6985c0094c8e3db5f1c6e2c4d66b82f325284f --- /dev/null +++ b/simpleexample2/.gitignore @@ -0,0 +1,5 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/simpleexample2/build.gradle b/simpleexample2/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..cda0331a2f73d475b5b7b61640fe082d65135feb --- /dev/null +++ b/simpleexample2/build.gradle @@ -0,0 +1,8 @@ +allprojects { + repositories { + jcenter() + maven { + url "https://plugins.gradle.org/m2/" + } + } +} diff --git a/simpleexample2/core/.gitignore b/simpleexample2/core/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1b6985c0094c8e3db5f1c6e2c4d66b82f325284f --- /dev/null +++ b/simpleexample2/core/.gitignore @@ -0,0 +1,5 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/simpleexample2/core/build.gradle b/simpleexample2/core/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..0bc50ccc896ef7bbb1e4a95ce221151b50752061 --- /dev/null +++ b/simpleexample2/core/build.gradle @@ -0,0 +1,49 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Java Library project to get you started. + * For more details take a look at the Java Libraries chapter in the Gradle + * User Manual available at https://docs.gradle.org/5.4.1/userguide/java_library_plugin.html + */ + +plugins { + // java library + id 'java-library' + + // test coverage + id 'jacoco' + + // code quality with SpotBugs + id 'com.github.spotbugs' version '2.0.0' + // code quality with checkstyle + id 'checkstyle' +} + +sourceCompatibility = JavaVersion.VERSION_1_10 +targetCompatibility = JavaVersion.VERSION_1_10 + +spotbugs { + // see http://gradle.monochromeroad.com/docs/dsl/org.gradle.api.plugins.quality.FindBugsExtension.html + ignoreFailures = true +} + +// To generate an HTML report instead of XML +tasks.withType(com.github.spotbugs.SpotBugsTask) { + reports { + xml.enabled = false + html.enabled = true + } +} + +checkstyle { + configFile = project.file("config/checkstyle/google_checks.xml") +} + +dependencies { + // persistens + // api means that those consuming our library 'inherits' this as a compile dependency + api 'com.fasterxml.jackson.core:jackson-databind:2.9.8' + + // Use JUnit test framework + testImplementation 'junit:junit:4.12' +} diff --git a/simpleexample2/core/config/checkstyle/eclipse-java-google-style.xml b/simpleexample2/core/config/checkstyle/eclipse-java-google-style.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c502f8e60d68816ab28b946755a21a43ae91078 --- /dev/null +++ b/simpleexample2/core/config/checkstyle/eclipse-java-google-style.xml @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<profiles version="13"> +<profile kind="CodeFormatterProfile" name="GoogleStyle" version="13"> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_comment_inline_tags" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="1040"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type.count_dependent" value="1585|-1|1585"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression.count_dependent" value="16|4|80"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration.count_dependent" value="16|4|48"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration.count_dependent" value="16|4|49"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments" value="16"/> +<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration.count_dependent" value="16|4|48"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants.count_dependent" value="16|5|48"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count_dependent" value="16|4|48"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="1585"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/> +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_field_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comment_prefix" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="1585"/> +<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter.count_dependent" value="1040|-1|1040"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package.count_dependent" value="1585|-1|1585"/> +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.force_if_else_statement_brace" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="3"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="1585"/> +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class" value="20"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable.count_dependent" value="1585|-1|1585"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependent" value="1585|-1|1585"/> +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="1585"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration.count_dependent" value="16|4|48"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method.count_dependent" value="1585|-1|1585"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="1585"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments.count_dependent" value="16|-1|16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration.count_dependent" value="16|5|80"/> +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.alignment_for_for_statement" value="16"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> +</profile> +</profiles> \ No newline at end of file diff --git a/simpleexample2/core/config/checkstyle/google_checks.xml b/simpleexample2/core/config/checkstyle/google_checks.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef32ef159babe0d8f94601170a6db23ca49e814e --- /dev/null +++ b/simpleexample2/core/config/checkstyle/google_checks.xml @@ -0,0 +1,270 @@ +<?xml version="1.0"?> +<!DOCTYPE module PUBLIC + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> + +<!-- + Checkstyle configuration that checks the Google coding conventions from Google Java Style + that can be found at https://google.github.io/styleguide/javaguide.html + + Checkstyle is very configurable. Be sure to read the documentation at + http://checkstyle.sf.net (or in your downloaded distribution). + + To completely disable a check, just comment it out or delete it from the file. + + Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov. + --> + +<module name = "Checker"> + <property name="charset" value="UTF-8"/> + + <property name="severity" value="warning"/> + + <property name="fileExtensions" value="java, properties, xml"/> + <!-- Excludes all 'module-info.java' files --> + <!-- See https://checkstyle.org/config_filefilters.html --> + <module name="BeforeExecutionExclusionFileFilter"> + <property name="fileNamePattern" value="module\-info\.java$"/> + </module> + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + </module> + + <module name="TreeWalker"> + <module name="OuterTypeFilename"/> + <module name="IllegalTokenText"> + <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> + <property name="format" + value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> + <property name="message" + value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> + </module> + <module name="AvoidEscapedUnicodeCharacters"> + <property name="allowEscapesForControlCharacters" value="true"/> + <property name="allowByTailComment" value="true"/> + <property name="allowNonPrintableEscapes" value="true"/> + </module> + <module name="LineLength"> + <property name="max" value="100"/> + <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> + </module> + <module name="AvoidStarImport"/> + <module name="OneTopLevelClass"/> + <module name="NoLineWrap"/> + <module name="EmptyBlock"> + <property name="option" value="TEXT"/> + <property name="tokens" + value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> + </module> + <module name="NeedBraces"/> + <module name="LeftCurly"/> + <module name="RightCurly"> + <property name="id" value="RightCurlySame"/> + <property name="tokens" + value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, + LITERAL_DO"/> + </module> + <module name="RightCurly"> + <property name="id" value="RightCurlyAlone"/> + <property name="option" value="alone"/> + <property name="tokens" + value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, + INSTANCE_INIT"/> + </module> + <module name="WhitespaceAround"> + <property name="allowEmptyConstructors" value="true"/> + <property name="allowEmptyLambdas" value="true"/> + <property name="allowEmptyMethods" value="true"/> + <property name="allowEmptyTypes" value="true"/> + <property name="allowEmptyLoops" value="true"/> + <message key="ws.notFollowed" + value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> + <message key="ws.notPreceded" + value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> + </module> + <module name="OneStatementPerLine"/> + <module name="MultipleVariableDeclarations"/> + <module name="ArrayTypeStyle"/> + <module name="MissingSwitchDefault"/> + <module name="FallThrough"/> + <module name="UpperEll"/> + <module name="ModifierOrder"/> + <module name="EmptyLineSeparator"> + <property name="allowNoEmptyLineBetweenFields" value="true"/> + </module> + <module name="SeparatorWrap"> + <property name="id" value="SeparatorWrapDot"/> + <property name="tokens" value="DOT"/> + <property name="option" value="nl"/> + </module> + <module name="SeparatorWrap"> + <property name="id" value="SeparatorWrapComma"/> + <property name="tokens" value="COMMA"/> + <property name="option" value="EOL"/> + </module> + <module name="SeparatorWrap"> + <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 --> + <property name="id" value="SeparatorWrapEllipsis"/> + <property name="tokens" value="ELLIPSIS"/> + <property name="option" value="EOL"/> + </module> + <module name="SeparatorWrap"> + <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 --> + <property name="id" value="SeparatorWrapArrayDeclarator"/> + <property name="tokens" value="ARRAY_DECLARATOR"/> + <property name="option" value="EOL"/> + </module> + <module name="SeparatorWrap"> + <property name="id" value="SeparatorWrapMethodRef"/> + <property name="tokens" value="METHOD_REF"/> + <property name="option" value="nl"/> + </module> + <module name="PackageName"> + <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> + <message key="name.invalidPattern" + value="Package name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="TypeName"> + <message key="name.invalidPattern" + value="Type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="MemberName"> + <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> + <message key="name.invalidPattern" + value="Member name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="ParameterName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Parameter name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="LambdaParameterName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="CatchParameterName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="LocalVariableName"> + <property name="tokens" value="VARIABLE_DEF"/> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Local variable name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="ClassTypeParameterName"> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" + value="Class type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="MethodTypeParameterName"> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" + value="Method type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="InterfaceTypeParameterName"> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" + value="Interface type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="NoFinalizer"/> + <module name="GenericWhitespace"> + <message key="ws.followed" + value="GenericWhitespace ''{0}'' is followed by whitespace."/> + <message key="ws.preceded" + value="GenericWhitespace ''{0}'' is preceded with whitespace."/> + <message key="ws.illegalFollow" + value="GenericWhitespace ''{0}'' should followed by whitespace."/> + <message key="ws.notPreceded" + value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> + </module> + <module name="Indentation"> + <property name="basicOffset" value="2"/> + <property name="braceAdjustment" value="0"/> + <property name="caseIndent" value="2"/> + <property name="throwsIndent" value="4"/> + <property name="lineWrappingIndentation" value="4"/> + <property name="arrayInitIndent" value="2"/> + </module> + <module name="AbbreviationAsWordInName"> + <property name="ignoreFinal" value="false"/> + <property name="allowedAbbreviationLength" value="1"/> + </module> + <module name="OverloadMethodsDeclarationOrder"/> + <module name="VariableDeclarationUsageDistance"/> + <module name="CustomImportOrder"> + <property name="sortImportsInGroupAlphabetically" value="true"/> + <property name="separateLineBetweenGroups" value="true"/> + <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/> + </module> + <module name="MethodParamPad"/> + <module name="NoWhitespaceBefore"> + <property name="tokens" + value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/> + <property name="allowLineBreaks" value="true"/> + </module> + <module name="ParenPad"/> + <module name="OperatorWrap"> + <property name="option" value="NL"/> + <property name="tokens" + value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, + LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> + </module> + <module name="AnnotationLocation"> + <property name="id" value="AnnotationLocationMostCases"/> + <property name="tokens" + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> + </module> + <module name="AnnotationLocation"> + <property name="id" value="AnnotationLocationVariables"/> + <property name="tokens" value="VARIABLE_DEF"/> + <property name="allowSamelineMultipleAnnotations" value="true"/> + </module> + <module name="NonEmptyAtclauseDescription"/> + <!-- Removed due to instantiation exception + <module name="InvalidJavadocPosition"/> + --> + <module name="JavadocTagContinuationIndentation"/> + <module name="SummaryJavadoc"> + <property name="forbiddenSummaryFragments" + value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> + </module> + <module name="JavadocParagraph"/> + <module name="AtclauseOrder"> + <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> + <property name="target" + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> + </module> + <module name="JavadocMethod"> + <property name="scope" value="public"/> + <property name="allowMissingParamTags" value="true"/> + <property name="allowMissingThrowsTags" value="true"/> + <property name="allowMissingReturnTag" value="true"/> + <property name="allowedAnnotations" value="Override, Test"/> + <property name="allowThrowsTagsForSubclasses" value="true"/> + </module> + <!-- Removed due to instantiation exception + <module name="MissingJavadocMethod"> + <property name="scope" value="public"/> + <property name="minLineCount" value="2"/> + <property name="allowedAnnotations" value="Override, Test"/> + </module> + --> + <module name="MethodName"> + <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> + <message key="name.invalidPattern" + value="Method name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="SingleLineJavadoc"> + <property name="ignoreInlineTags" value="false"/> + </module> + <module name="EmptyCatchBlock"> + <property name="exceptionVariableName" value="expected"/> + </module> + <module name="CommentsIndentation"/> + </module> +</module> diff --git a/simpleexample2/core/gradle/wrapper/gradle-wrapper.jar b/simpleexample2/core/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5c2d1cf016b3885f6930543d57b744ea8c220a1a Binary files /dev/null and b/simpleexample2/core/gradle/wrapper/gradle-wrapper.jar differ diff --git a/simpleexample2/core/gradle/wrapper/gradle-wrapper.properties b/simpleexample2/core/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f4d7b2bf616f7674854ff527df47b371b72472da --- /dev/null +++ b/simpleexample2/core/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/simpleexample2/core/gradlew b/simpleexample2/core/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..b0d6d0ab5deb588123dd658f0b079934ee05a72e --- /dev/null +++ b/simpleexample2/core/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/simpleexample2/core/gradlew.bat b/simpleexample2/core/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..15e1ee37a70d7dfdfd8cf727022e117b6f6153a7 --- /dev/null +++ b/simpleexample2/core/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/simpleexample2/core/settings.gradle b/simpleexample2/core/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..3cef4f141cba6aa82304930a5d9ca12e154cd8b3 --- /dev/null +++ b/simpleexample2/core/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html + */ + +rootProject.name = 'core' diff --git a/simpleexample2/core/src/main/java/core/Library.java b/simpleexample2/core/src/main/java/core/Library.java new file mode 100644 index 0000000000000000000000000000000000000000..2d14c4b1720efc1e1e07dd794a261d591fa398c4 --- /dev/null +++ b/simpleexample2/core/src/main/java/core/Library.java @@ -0,0 +1,10 @@ +/* + * This Java source file was generated by the Gradle 'init' task. + */ +package core; + +public class Library { + public boolean someLibraryMethod() { + return true; + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/core/LatLong.java b/simpleexample2/core/src/main/java/simpleex/core/LatLong.java new file mode 100644 index 0000000000000000000000000000000000000000..68d10a1f3614a1eb6e74cdd4ef5383f46e84aec7 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/core/LatLong.java @@ -0,0 +1,127 @@ +package simpleex.core; + +public class LatLong { + + public static final String SEPARATOR = ","; + + private final double latitude; + private final double longitude; + + public LatLong(final double latitude, final double longitude) { + super(); + this.latitude = latitude; + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public double getLongitude() { + return longitude; + } + + @Override + public String toString() { + return latitude + SEPARATOR + longitude; + } + + @Override + public int hashCode() { + final int prime = 31; + long temp = Double.doubleToLongBits(latitude); + int result = prime + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(longitude); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final LatLong other = (LatLong) obj; + return (Double.doubleToLongBits(latitude) == Double.doubleToLongBits(other.latitude) + && Double.doubleToLongBits(longitude) == Double.doubleToLongBits(other.longitude)); + } + + public static LatLong valueOf(final String s) { + return valueOf(s, SEPARATOR); + } + + public static LatLong valueOf(final String s, final String sep) { + final int pos = s.indexOf(sep); + if (pos < 0) { + throw new IllegalArgumentException("No '" + sep + "' in " + s); + } + final double lat = Double.valueOf(s.substring(0, pos).trim()); + final double lon = Double.valueOf(s.substring(pos + sep.length()).trim()); + + return new LatLong(lat, lon); + } + + /* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + /* :: : */ + /* :: This routine calculates the distance between two points (given the : */ + /* :: latitude/longitude of those points). It is being used to calculate : */ + /* :: the distance between two locations using GeoDataSource (TM) products : */ + /* :: : */ + /* :: Definitions: : */ + /* :: South latitudes are negative, east longitudes are positive : */ + /* :: : */ + /* :: Passed to function: : */ + /* :: lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees) : */ + /* :: lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees) : */ + /* :: Worldwide cities and other features databases with latitude longitude : */ + /* :: are available at http://www.geodatasource.com : */ + /* :: : */ + /* :: For enquiries, please contact sales@geodatasource.com : */ + /* :: : */ + /* :: Official Web site: http://www.geodatasource.com : */ + /* :: : */ + /* :: GeoDataSource.com (C) All Rights Reserved 2015 : */ + /* :: : */ + /* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + public static double distance(final double lat1, final double lon1, final double lat2, + final double lon2) { + if (lon1 == lon2 && lat1 == lat2) { + return 0.0; + } + final double theta = lon1 - lon2; + double dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2)) + + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta)); + dist = Math.acos(dist); + // convert to degrees + dist = rad2deg(dist); + dist = dist * 60 * 1.1515; + // convert to meters + dist = dist * 1609.344; + return dist; + } + + public static double distance(final LatLong latLong1, final LatLong latLong2) { + return distance(latLong1.latitude, latLong1.longitude, latLong2.latitude, latLong2.longitude); + } + + public double distance(final LatLong latLong2) { + return distance(latitude, longitude, latLong2.latitude, latLong2.longitude); + } + + /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + /* :: This function converts decimal degrees to radians : */ + /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + private static double deg2rad(final double deg) { + return (deg * Math.PI / 180.0); + } + + /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + /* :: This function converts radians to decimal degrees : */ + /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ + private static double rad2deg(final double rad) { + return (rad * 180 / Math.PI); + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/core/LatLongs.java b/simpleexample2/core/src/main/java/simpleex/core/LatLongs.java new file mode 100644 index 0000000000000000000000000000000000000000..a5e6fa1f80842ef38730d0402f43bb1398064223 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/core/LatLongs.java @@ -0,0 +1,70 @@ +package simpleex.core; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +public class LatLongs implements Iterable<LatLong> { + + final List<LatLong> latLongs = new ArrayList<>(); + + public LatLongs() {} + + public LatLongs(final double... latLongsArray) { + addLatLongs(latLongsArray); + } + + public LatLongs(final LatLong... latLongs) { + addLatLongs(latLongs); + } + + public LatLongs(final Collection<LatLong> latLongs) { + addLatLongs(latLongs); + } + + @Override + public Iterator<LatLong> iterator() { + return latLongs.iterator(); + } + + public int getLatLongCount() { + return latLongs.size(); + } + + public LatLong getLatLong(final int num) { + return latLongs.get(num); + } + + public void setLatLong(final int num, final LatLong latLong) { + latLongs.set(num, latLong); + } + + public int addLatLong(final LatLong latLong) { + final int pos = latLongs.size(); + latLongs.add(latLong); + return pos; + } + + public final int addLatLongs(final Collection<LatLong> latLongs) { + final int pos = this.latLongs.size(); + this.latLongs.addAll(latLongs); + return pos; + } + + public final int addLatLongs(final LatLong... latLongs) { + return addLatLongs(List.of(latLongs)); + } + + public final int addLatLongs(final double... latLongsArray) { + final Collection<LatLong> latLongs = new ArrayList<>(latLongsArray.length / 2); + for (int i = 0; i < latLongsArray.length; i += 2) { + latLongs.add(new LatLong(latLongsArray[i], latLongsArray[i + 1])); + } + return addLatLongs(latLongs); + } + + public LatLong removeLatLong(final int num) { + return latLongs.remove(num); + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/core/README.md b/simpleexample2/core/src/main/java/simpleex/core/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c49c61ac1b36d020f77a4836e7eee24ecfe35a91 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/core/README.md @@ -0,0 +1,15 @@ +# Kildekode for domenelaget + +Domenelaget utgjøres av en samling av geo-lokasjoner representert vha. to klasse: + +- LatLong - en geo-lokasjon, representert vha. lengde og breddegrad +- LatLongs - en samling LatLong-objekter + +```plantuml +class LatLong { + double latitude + double longitude +} +class LatLongs +LatLongs *--> "*" LatLong: "latLongs" +``` diff --git a/simpleexample2/core/src/main/java/simpleex/json/LatLongDeserializer.java b/simpleexample2/core/src/main/java/simpleex/json/LatLongDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..ddf7f3ba2534dc2a8f7c348df7eee2930036e56b --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/LatLongDeserializer.java @@ -0,0 +1,40 @@ +package simpleex.json; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import simpleex.core.LatLong; + +public class LatLongDeserializer extends JsonDeserializer<LatLong> { + + private static final int ARRAY_JSON_NODE_SIZE = 2; + + @Override + public LatLong deserialize(final JsonParser jsonParser, final DeserializationContext deserContext) + throws IOException, JsonProcessingException { + final JsonNode jsonNode = jsonParser.getCodec().readTree(jsonParser); + return deserialize(jsonNode); + } + + public LatLong deserialize(final JsonNode jsonNode) throws JsonProcessingException { + if (jsonNode instanceof ObjectNode) { + final ObjectNode objectNode = (ObjectNode) jsonNode; + final double latitude = objectNode.get(LatLongSerializer.LATITUDE_FIELD_NAME).asDouble(); + final double longitude = objectNode.get(LatLongSerializer.LONGITUDE_FIELD_NAME).asDouble(); + return new LatLong(latitude, longitude); + } else if (jsonNode instanceof ArrayNode) { + final ArrayNode locationArray = (ArrayNode) jsonNode; + if (locationArray.size() == ARRAY_JSON_NODE_SIZE) { + final double latitude = locationArray.get(0).asDouble(); + final double longitude = locationArray.get(1).asDouble(); + return new LatLong(latitude, longitude); + } + } + return null; + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/json/LatLongSerializer.java b/simpleexample2/core/src/main/java/simpleex/json/LatLongSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..59dfeb6fb57eccbacf6f91b8c16fb0d44d7c2c9a --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/LatLongSerializer.java @@ -0,0 +1,24 @@ +package simpleex.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import simpleex.core.LatLong; + +public class LatLongSerializer extends JsonSerializer<LatLong> { + + public static final String LONGITUDE_FIELD_NAME = "longitude"; + public static final String LATITUDE_FIELD_NAME = "latitude"; + + @Override + public void serialize(final LatLong latLon, final JsonGenerator jsonGen, + final SerializerProvider provider) throws IOException { + jsonGen.writeStartObject(); + jsonGen.writeFieldName(LATITUDE_FIELD_NAME); + jsonGen.writeNumber(latLon.getLatitude()); + jsonGen.writeFieldName(LONGITUDE_FIELD_NAME); + jsonGen.writeNumber(latLon.getLongitude()); + jsonGen.writeEndObject(); + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/json/LatLongsDeserializer.java b/simpleexample2/core/src/main/java/simpleex/json/LatLongsDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..8e14f6bf4e0274920b6f75f43eff6f699d833f99 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/LatLongsDeserializer.java @@ -0,0 +1,34 @@ +package simpleex.json; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; + +public class LatLongsDeserializer extends JsonDeserializer<LatLongs> { + + private final LatLongDeserializer latLongDeserializer = new LatLongDeserializer(); + + @Override + public LatLongs deserialize(final JsonParser jsonParser, + final DeserializationContext deserContext) throws IOException, JsonProcessingException { + final JsonNode jsonNode = jsonParser.getCodec().readTree(jsonParser); + if (jsonNode instanceof ArrayNode) { + final ArrayNode latLongsArray = (ArrayNode) jsonNode; + final Collection<LatLong> latLongs = new ArrayList<>(latLongsArray.size()); + for (final JsonNode latLongNode : latLongsArray) { + final LatLong latLong = latLongDeserializer.deserialize(latLongNode); + latLongs.add(latLong); + } + return new LatLongs(latLongs); + } + return null; + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/json/LatLongsModule.java b/simpleexample2/core/src/main/java/simpleex/json/LatLongsModule.java new file mode 100644 index 0000000000000000000000000000000000000000..5359613e1c889d9ab4750aed813371ba0bbda054 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/LatLongsModule.java @@ -0,0 +1,37 @@ +package simpleex.json; + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.module.SimpleDeserializers; +import com.fasterxml.jackson.databind.module.SimpleSerializers; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; + +public class LatLongsModule extends Module { + + @Override + public String getModuleName() { + return "LatLongsModule"; + } + + @Override + public Version version() { + return Version.unknownVersion(); + } + + private final SimpleSerializers serializers = new SimpleSerializers(); + private final SimpleDeserializers deserializers = new SimpleDeserializers(); + + public LatLongsModule() { + serializers.addSerializer(LatLong.class, new LatLongSerializer()); + serializers.addSerializer(LatLongs.class, new LatLongsSerializer()); + deserializers.addDeserializer(LatLong.class, new LatLongDeserializer()); + deserializers.addDeserializer(LatLongs.class, new LatLongsDeserializer()); + } + + @Override + public void setupModule(final SetupContext context) { + context.addSerializers(serializers); + context.addDeserializers(deserializers); + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/json/LatLongsSerializer.java b/simpleexample2/core/src/main/java/simpleex/json/LatLongsSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..4812b5288e440a94919182e209afba8d0d459023 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/LatLongsSerializer.java @@ -0,0 +1,21 @@ +package simpleex.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; + +public class LatLongsSerializer extends JsonSerializer<LatLongs> { + + @Override + public void serialize(final LatLongs latLongs, final JsonGenerator jsonGen, + final SerializerProvider provider) throws IOException { + jsonGen.writeStartArray(latLongs.getLatLongCount()); + for (final LatLong latLong : latLongs) { + jsonGen.writeObject(latLong); + } + jsonGen.writeEndArray(); + } +} diff --git a/simpleexample2/core/src/main/java/simpleex/json/README.md b/simpleexample2/core/src/main/java/simpleex/json/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b3e4cbd394cf1c76f71403db172e3404cd96ed06 --- /dev/null +++ b/simpleexample2/core/src/main/java/simpleex/json/README.md @@ -0,0 +1,5 @@ +# Kildekode for persistenslaget + +Persistenslaget bruker [Jackson-biblioteket](https://github.com/FasterXML/jackson) for å serialisere objekter til [JSON](https://www.json.org). + +For hver [domeneklasse](../core/README.md) finnes tilsvarende klasser for serialisering (konvertering av domeneobjekter til tekststrøm) og deserialisering (parsing av tekststrøm og opprettelse av tilsvarende domeneobjekter). I tillegg finnes det en klasse, **JacksonConfigurator**, som inneholder diverse metoder for å lage og konfigurere **ObjectMapper**- og **SimpleModule**-objektene som trengs for å serialisere og deserialisere objekter. diff --git a/simpleexample2/core/src/test/java/core/LibraryTest.java b/simpleexample2/core/src/test/java/core/LibraryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4b2d800c5c332304381795fc4075a39b386af0ad --- /dev/null +++ b/simpleexample2/core/src/test/java/core/LibraryTest.java @@ -0,0 +1,14 @@ +/* + * This Java source file was generated by the Gradle 'init' task. + */ +package core; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LibraryTest { + @Test public void testSomeLibraryMethod() { + Library classUnderTest = new Library(); + assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod()); + } +} diff --git a/simpleexample2/core/src/test/java/simpleex/core/LatLongTest.java b/simpleexample2/core/src/test/java/simpleex/core/LatLongTest.java new file mode 100644 index 0000000000000000000000000000000000000000..683577453314caf827d79a3e4d22fa0a7264f8a1 --- /dev/null +++ b/simpleexample2/core/src/test/java/simpleex/core/LatLongTest.java @@ -0,0 +1,71 @@ +package simpleex.core; + +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; + +public class LatLongTest { + + @Test + public void testToString() { + final LatLong latLong = new LatLong(63.0, 10.0); + Assert.assertEquals(Double.toString(63) + "," + Double.toString(10), latLong.toString()); + } + + @Test + public void testValueOf() { + testLatLong(LatLong.valueOf("63.0, 10.0"), 63.0, 10.0); + testLatLong(LatLong.valueOf("63.0, 10.0", ","), 63.0, 10.0); + testLatLong(LatLong.valueOf("63.0; 10.0", ";"), 63.0, 10.0); + try { + testLatLong(LatLong.valueOf("63.0; 10.0", ","), 63.0, 10.0); + Assert.fail("Should throw IllegalArgumentException"); + } catch (final IllegalArgumentException e) { + // ok + } catch (final Exception e) { + Assert.fail("Should throw IllegalArgumentException"); + } + } + + private void testLatLong(final LatLong latLong, final double lat, final double lon) { + Assert.assertEquals(lat, latLong.getLatitude(), 0.0); + Assert.assertEquals(lon, latLong.getLongitude(), 0.0); + } + + @Test + public void testEquals() { + Assert.assertTrue(new LatLong(63.0, 10.0).equals(new LatLong(63.0, 10.0))); + Assert.assertFalse(new LatLong(10.0, 63.0).equals(new LatLong(63.0, 10.0))); + Assert.assertFalse(new LatLong(10.0, 63.0).equals(null)); + } + + @Test + public void testHashCode() { + final Map<LatLong, String> map = new HashMap<>(); + map.put(new LatLong(63.0, 10.0), "first"); + map.put(new LatLong(63.0, 10.0), "second"); + Assert.assertEquals(1, map.size()); + Assert.assertEquals("second", map.get(new LatLong(63.0, 10.0))); + } + + @Test + public void testDistance() { + final LatLong trd = new LatLong(63.4217137055, 10.4221522734); + final LatLong str = new LatLong(63.0339713594, 10.2946225585); + + checkDistance(trd.distance(trd), 0.0, 10.0); + checkDistance(str.distance(str), 0.0, 10.0); + checkDistance(trd.distance(str), 43000.0, 45000.0); + checkDistance(str.distance(trd), 43000.0, 45000.0); + + checkDistance(LatLong.distance(trd, trd), 0.0, 10.0); + checkDistance(LatLong.distance(str, str), 0.0, 10.0); + checkDistance(LatLong.distance(trd, str), 43000.0, 45000.0); + checkDistance(LatLong.distance(str, trd), 43000.0, 45000.0); + } + + private void checkDistance(final double d, final double lower, final double upper) { + Assert.assertTrue(d + " isn't between " + lower + " and " + upper, d <= upper && d >= lower); + } +} diff --git a/simpleexample2/core/src/test/java/simpleex/core/LatLongsTest.java b/simpleexample2/core/src/test/java/simpleex/core/LatLongsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dee7f31471ce0842eeb73c18ecff5c0c17be779f --- /dev/null +++ b/simpleexample2/core/src/test/java/simpleex/core/LatLongsTest.java @@ -0,0 +1,66 @@ +package simpleex.core; + +import java.util.Arrays; +import java.util.Iterator; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class LatLongsTest { + + private LatLongs latLongs; + + @Before + public void setUp() { + latLongs = new LatLongs(); + } + + @Test + public void testEmptyConstructor() { + Assert.assertEquals(0, latLongs.getLatLongCount()); + } + + private static void checkLatLongs(final LatLongs latLongs1, final LatLong... latLongs2) { + Assert.assertEquals(latLongs2.length, latLongs1.getLatLongCount()); + final Iterator<LatLong> it = latLongs1.iterator(); + for (int i = 0; i < latLongs2.length; i++) { + Assert.assertTrue(it.hasNext()); + Assert.assertEquals(latLongs2[i], latLongs1.getLatLong(i)); + Assert.assertEquals(latLongs2[i], it.next()); + } + Assert.assertFalse(it.hasNext()); + } + + @Test + public void testConstructor() { + checkLatLongs(new LatLongs(63.0, 10.3, 63.1, 10.2), new LatLong(63.0, 10.3), + new LatLong(63.1, 10.2)); + checkLatLongs(new LatLongs(new LatLong(63.0, 10.3), new LatLong(63.1, 10.2)), + new LatLong(63.0, 10.3), new LatLong(63.1, 10.2)); + checkLatLongs(new LatLongs(Arrays.asList(new LatLong(63.1, 10.2), new LatLong(63.1, 10.1))), + new LatLong(63.1, 10.2), new LatLong(63.1, 10.1)); + } + + @Test + public void testAddLatLong() { + latLongs.addLatLong(new LatLong(63.0, 10.3)); + Assert.assertEquals(1, latLongs.getLatLongCount()); + latLongs.addLatLong(new LatLong(63.1, 10.2)); + Assert.assertEquals(2, latLongs.getLatLongCount()); + } + + @Test + public void testAddLatLongs() { + final LatLongs lls1 = new LatLongs(); + lls1.addLatLongs(63.0, 10.3, 63.1, 10.2); + checkLatLongs(lls1, new LatLong(63.0, 10.3), new LatLong(63.1, 10.2)); + + final LatLongs lls2 = new LatLongs(); + lls2.addLatLongs(new LatLong(63.0, 10.3), new LatLong(63.1, 10.2)); + checkLatLongs(lls2, new LatLong(63.0, 10.3), new LatLong(63.1, 10.2)); + + final LatLongs lls3 = new LatLongs(); + lls3.addLatLongs(Arrays.asList(new LatLong(63.1, 10.2), new LatLong(63.1, 10.1))); + checkLatLongs(lls3, new LatLong(63.1, 10.2), new LatLong(63.1, 10.1)); + } +} diff --git a/simpleexample2/core/src/test/java/simpleex/core/README.md b/simpleexample2/core/src/test/java/simpleex/core/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5eaccc223c7fa8cb0a7c73124c16712ed68f5800 --- /dev/null +++ b/simpleexample2/core/src/test/java/simpleex/core/README.md @@ -0,0 +1 @@ +# Testkode for domenelaget diff --git a/simpleexample2/core/src/test/java/simpleex/json/LatLongsJsonTest.java b/simpleexample2/core/src/test/java/simpleex/json/LatLongsJsonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c233c8d4b19494927df665aec4715c036b1352ea --- /dev/null +++ b/simpleexample2/core/src/test/java/simpleex/json/LatLongsJsonTest.java @@ -0,0 +1,36 @@ +package simpleex.json; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Assert; +import org.junit.Test; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; + +public class LatLongsJsonTest { + + private final ObjectMapper objectMapper = new ObjectMapper(); + { + objectMapper.registerModule(new LatLongsModule()); + } + + protected void assertEqualsIgnoreWhitespace(final String expected, final String actual) + throws Exception { + Assert.assertEquals(expected, actual.replaceAll("\\s+", "")); + } + + @Test + public void testLatLongsSerialization() throws Exception { + final String actualJson = objectMapper.writeValueAsString(new LatLongs(new LatLong(63.1, 12.3), new LatLong(63.0, 12.4))); + final String expectedJson = "[{\"latitude\":63.1,\"longitude\":12.3},{\"latitude\":63.0,\"longitude\":12.4}]"; + assertEqualsIgnoreWhitespace(expectedJson, actualJson); + } + + @Test + public void testLatLongsDeserialization() throws Exception { + final String json = "[{\"latitude\":63.1,\"longitude\":12.3}, [63.0,12.4]]"; + final LatLongs latLongs = objectMapper.readValue(json, LatLongs.class); + Assert.assertEquals(2, latLongs.getLatLongCount()); + Assert.assertEquals(new LatLong(63.1, 12.3), latLongs.getLatLong(0)); + Assert.assertEquals(new LatLong(63.0, 12.4), latLongs.getLatLong(1)); + } +} diff --git a/simpleexample2/core/src/test/java/simpleex/json/README.md b/simpleexample2/core/src/test/java/simpleex/json/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9a62d5ea7e4ad81749e497741faf5a5064325f0f --- /dev/null +++ b/simpleexample2/core/src/test/java/simpleex/json/README.md @@ -0,0 +1 @@ +# Testkode for persistenslaget diff --git a/simpleexample2/fxui/.gitignore b/simpleexample2/fxui/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1b6985c0094c8e3db5f1c6e2c4d66b82f325284f --- /dev/null +++ b/simpleexample2/fxui/.gitignore @@ -0,0 +1,5 @@ +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/simpleexample2/fxui/build.gradle b/simpleexample2/fxui/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..0132f1096faba03226037552a214c8c021f99b9d --- /dev/null +++ b/simpleexample2/fxui/build.gradle @@ -0,0 +1,71 @@ +plugins { + // java application with main method + id 'application' + // use javafx modules + id 'org.openjfx.javafxplugin' version '0.0.8' + + // test coverage + id 'jacoco' + + // code quality with SpotBugs + id 'com.github.spotbugs' version '2.0.0' + // code quality with checkstyle + id 'checkstyle' +} + +repositories { + flatDir { + dirs 'libs' + } +} + +application { + sourceCompatibility = JavaVersion.VERSION_1_10 + targetCompatibility = JavaVersion.VERSION_1_10 + mainClassName = 'simpleex.ui.FxApp' // application plugin +} + +// javafx specific way of specifying dependencies +javafx { + version = '11' + modules = [ 'javafx.controls', 'javafx.fxml' ] + // run with --debug-jvm flag and + // launch debugger using Remote Java Application debug launch configuration +} + +test { + // don't run UI test on server (that cannot run javafx) + if (project.hasProperty('ci') && "$ci" == 'gitlab') { + exclude 'simpleex/ui/*' + } +} + +spotbugs { + // see http://gradle.monochromeroad.com/docs/dsl/org.gradle.api.plugins.quality.FindBugsExtension.html + ignoreFailures = true +} + +// To generate an HTML report instead of XML +tasks.withType(com.github.spotbugs.SpotBugsTask) { + reports { + xml.enabled = false + html.enabled = true + } +} + +checkstyle { + configFile = project.file("../core/config/checkstyle/google_checks.xml") +} + +dependencies { + implementation project(':core') + // brukergrensesnitt + implementation name: 'fx-map-control-1.0' + + testImplementation 'junit:junit:4.12' + + // brukergrensesnitt + testImplementation 'org.testfx:testfx-core:4.0.16-alpha' + testImplementation 'org.testfx:testfx-junit:4.0.16-alpha' + testImplementation 'org.mockito:mockito-core:2.28.2' +} diff --git a/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.jar b/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5c2d1cf016b3885f6930543d57b744ea8c220a1a Binary files /dev/null and b/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.jar differ diff --git a/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.properties b/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f4d7b2bf616f7674854ff527df47b371b72472da --- /dev/null +++ b/simpleexample2/fxui/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/simpleexample2/fxui/gradlew b/simpleexample2/fxui/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..b0d6d0ab5deb588123dd658f0b079934ee05a72e --- /dev/null +++ b/simpleexample2/fxui/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/simpleexample2/fxui/gradlew.bat b/simpleexample2/fxui/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..15e1ee37a70d7dfdfd8cf727022e117b6f6153a7 --- /dev/null +++ b/simpleexample2/fxui/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/simpleexample2/fxui/settings.gradle b/simpleexample2/fxui/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9e279d4eef2ea4a7bf912cfa0285b46697bf6322 --- /dev/null +++ b/simpleexample2/fxui/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html + */ + +rootProject.name = 'fxui' diff --git a/simpleexample2/fxui/src/main/java/fxui/Library.java b/simpleexample2/fxui/src/main/java/fxui/Library.java new file mode 100644 index 0000000000000000000000000000000000000000..8c9ecf64eac81dadd5a8046fa5aec4c8f4196e84 --- /dev/null +++ b/simpleexample2/fxui/src/main/java/fxui/Library.java @@ -0,0 +1,10 @@ +/* + * This Java source file was generated by the Gradle 'init' task. + */ +package fxui; + +public class Library { + public boolean someLibraryMethod() { + return true; + } +} diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/DraggableNodeController.java b/simpleexample2/fxui/src/main/java/simpleex/ui/DraggableNodeController.java new file mode 100644 index 0000000000000000000000000000000000000000..e3325203ee6663ea025d2be677f24a93cda970ea --- /dev/null +++ b/simpleexample2/fxui/src/main/java/simpleex/ui/DraggableNodeController.java @@ -0,0 +1,90 @@ +package simpleex.ui; + +import javafx.event.EventHandler; +import javafx.geometry.Point2D; +import javafx.scene.Node; +import javafx.scene.input.MouseEvent; + +public class DraggableNodeController { + + private final NodeDraggedHandler nodeDraggedHandler; + + public DraggableNodeController() { + this(null); + } + + public DraggableNodeController(final NodeDraggedHandler nodeDraggedHandler) { + this.nodeDraggedHandler = (nodeDraggedHandler != null ? nodeDraggedHandler : (node, x, y) -> {}); + } + + private boolean immediate = false; + + public void setImmediate(final boolean immediate) { + this.immediate = immediate; + } + + private Node currentNode = null; + private Point2D startPoint = null; + private Point2D startTranslate = null; + + private final EventHandler<MouseEvent> mousePressedHandler = this::mousePressed; + private final EventHandler<MouseEvent> mouseDraggedHandler = this::mouseDragged; + private final EventHandler<MouseEvent> mouseReleasedHandler = this::mouseReleased; + + public void attach(final Node node) { + node.setOnMousePressed(mousePressedHandler); + node.setOnMouseDragged(mouseDraggedHandler); + node.setOnMouseReleased(mouseReleasedHandler); + } + + public void detach(final Node node) { + node.setOnMousePressed(null); + node.setOnMouseDragged(null); + node.setOnMouseReleased(null); + } + + private void mousePressed(final MouseEvent mouseEvent) { + if (currentNode == null && mouseEvent.getSource() instanceof Node) { + currentNode = (Node) mouseEvent.getSource(); + startPoint = new Point2D(mouseEvent.getSceneX(), mouseEvent.getSceneY()); + startTranslate = new Point2D(currentNode.getTranslateX(), currentNode.getTranslateY()); + mouseEvent.consume(); + } + } + + private void mouseDragged(final MouseEvent mouseEvent) { + if (currentNode != null && currentNode == mouseEvent.getSource()) { + final double dx = mouseEvent.getSceneX() - startPoint.getX(); + final double dy = mouseEvent.getSceneY() - startPoint.getY(); + updateNode(dx, dy); + } + } + + protected void updateNode(final double dx, final double dy) { + if (immediate) { + nodeDraggedHandler.nodeDragged(currentNode, dx, dy); + startPoint = startPoint.add(dx, dy); + } else if (currentNode != null) { + currentNode.setTranslateX(startTranslate.getX() + dx); + currentNode.setTranslateY(startTranslate.getY() + dy); + } + } + + private void mouseReleased(final MouseEvent mouseEvent) { + if (currentNode != null && currentNode == mouseEvent.getSource()) { + final double dx = mouseEvent.getSceneX() - startPoint.getX(); + final double dy = mouseEvent.getSceneY() - startPoint.getY(); + if (!immediate) { + currentNode.setTranslateX(startTranslate.getX()); + currentNode.setTranslateY(startTranslate.getY()); + } + final Node node = currentNode; + currentNode = null; + nodeDraggedHandler.nodeDragged(node, dx, dy); + } + } + + public interface NodeDraggedHandler { + public void nodeDragged(Node currentNode2, double dx, double dy); + } +} diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/FxApp.java b/simpleexample2/fxui/src/main/java/simpleex/ui/FxApp.java new file mode 100644 index 0000000000000000000000000000000000000000..a776467a8353cc25cc98d0b3a55aa22934c70e72 --- /dev/null +++ b/simpleexample2/fxui/src/main/java/simpleex/ui/FxApp.java @@ -0,0 +1,31 @@ +package simpleex.ui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; +import simpleex.core.LatLongs; + +public class FxApp extends Application { + + @Override + public void start(final Stage stage) throws Exception { + final FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FxApp.fxml")); + final Parent root = fxmlLoader.load(); + final FxAppController controller = fxmlLoader.getController(); + controller.setLatLongs(new LatLongs(63.1, 11.2, 63.2, 11.0)); + final Scene scene = new Scene(root); + stage.setScene(scene); + stage.show(); + } + + public static void main(final String[] args) { + // only needed on ios + System.setProperty("os.target", "ios"); + System.setProperty("os.name", "iOS"); + System.setProperty("glass.platform", "ios"); + System.setProperty("targetos.name", "iOS"); + launch(args); + } +} diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/FxAppController.java b/simpleexample2/fxui/src/main/java/simpleex/ui/FxAppController.java new file mode 100644 index 0000000000000000000000000000000000000000..c0044403e211629f96e00db954afcaad010dce8e --- /dev/null +++ b/simpleexample2/fxui/src/main/java/simpleex/ui/FxAppController.java @@ -0,0 +1,238 @@ +package simpleex.ui; + +import com.fasterxml.jackson.databind.ObjectMapper; +import fxmapcontrol.Location; +import fxmapcontrol.MapBase; +import fxmapcontrol.MapItemsControl; +import fxmapcontrol.MapNode; +import fxmapcontrol.MapProjection; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import javafx.collections.FXCollections; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.geometry.Point2D; +import javafx.scene.Node; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonType; +import javafx.scene.control.ListView; +import javafx.scene.control.Slider; +import javafx.stage.FileChooser; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; +import simpleex.json.LatLongsModule; + +/* +@startuml +class FxAppController +class LatLongs +class BorderPane +class "ListView<LatLong>" as ListView +class "fxmapcontrol.MapBase" as MapBase + +BorderPane *--> ListView: "left" +BorderPane *--> MapBase: "center" + +FxAppController --> LatLongs: "latLongs" +FxAppController --> MapBase: "mapView" +FxAppController --> ListView: "locationListView" +@enduml + */ + +public class FxAppController { + + private LatLongs latLongs; + + public FxAppController() { + latLongs = new LatLongs(); + } + + public LatLongs getLatLongs() { + return latLongs; + } + + // to make it testable + public void setLatLongs(final LatLongs latLongs) { + this.latLongs = latLongs; + updateLocationViewList(0); + } + + // @FXML + // private FileMenuController fileMenuController; + + @FXML + private ListView<LatLong> locationListView; + + @FXML + private MapBase mapView; + + private MapItemsControl<MapNode> markersParent; + private MapMarker marker = null; + private DraggableNodeController draggableMapController = null; + private DraggableNodeController draggableMarkerController = null; + + @FXML + private Slider zoomSlider; + + @FXML + private void initialize() { + // map stuff + // mapView.getChildren().add(MapTileLayer.getOpenStreetMapLayer()); + zoomSlider.valueProperty() + .addListener((prop, oldValue, newValue) -> mapView.setZoomLevel(zoomSlider.getValue())); + zoomSlider.setValue(8); + markersParent = new MapItemsControl<MapNode>(); + mapView.getChildren().add(markersParent); + draggableMapController = new DraggableNodeController(this::handleMapDragged); + draggableMapController.setImmediate(true); + draggableMapController.attach(mapView); + draggableMarkerController = new DraggableNodeController(this::handleMarkerDragged); + // the location list + locationListView.getSelectionModel().selectedIndexProperty() + .addListener((prop, oldValue, newValue) -> updateMapMarker(true)); + } + + private void handleMapDragged(final Node node, final double dx, final double dy) { + final MapProjection projection = mapView.getProjection(); + final Point2D point = projection.locationToViewportPoint(mapView.getCenter()); + final Location newCenter = projection.viewportPointToLocation(point.add(-dx, -dy)); + mapView.setCenter(newCenter); + } + + private void handleMarkerDragged(final Node node, final double dx, final double dy) { + final MapProjection projection = mapView.getProjection(); + final Point2D point = projection.locationToViewportPoint(marker.getLocation()); + final Location newLocation = projection.viewportPointToLocation(point.add(dx, dy)); + getLatLongs().setLatLong(locationListView.getSelectionModel().getSelectedIndex(), + location2LatLong(newLocation)); + updateLocationViewListSelection(false); + } + + private LatLong location2LatLong(final Location newLocation) { + return new LatLong(newLocation.getLatitude(), newLocation.getLongitude()); + } + + private void updateMapMarker(final boolean centerOnMarker) { + final int num = locationListView.getSelectionModel().getSelectedIndex(); + if (num < 0 || num >= getLatLongs().getLatLongCount()) { + markersParent.getItems().clear(); + if (draggableMarkerController != null) { + draggableMarkerController.detach(marker); + } + marker = null; + } else { + final LatLong latLong = getLatLongs().getLatLong(num); + if (marker == null) { + marker = new MapMarker(latLong); + markersParent.getItems().add(marker); + if (draggableMarkerController != null) { + draggableMarkerController.attach(marker); + } + } else { + marker.setLocation(latLong); + } + if (centerOnMarker) { + mapView.setCenter(marker.getLocation()); + } + } + } + + @FXML + private void handleAddLocation() { + final Location center = mapView.getCenter(); + final int pos = getLatLongs().addLatLong(location2LatLong(center)); + updateLocationViewList(pos); + } + + private void updateLocationViewListSelection(final Boolean updateMapMarker) { + final int selectedIndex = locationListView.getSelectionModel().getSelectedIndex(); + updateLocationViewListItem(selectedIndex); + if (updateMapMarker != null) { + updateMapMarker(updateMapMarker); + } + } + + private void updateLocationViewListItem(final int index) { + locationListView.getItems().set(index, getLatLongs().getLatLong(index)); + } + + private void updateLocationViewList(int selectedIndex) { + final LatLong[] latLongs = new LatLong[getLatLongs().getLatLongCount()]; + for (int i = 0; i < latLongs.length; i++) { + latLongs[i] = getLatLongs().getLatLong(i); + } + final int oldSelectionIndex = locationListView.getSelectionModel().getSelectedIndex(); + locationListView.setItems(FXCollections.observableArrayList(latLongs)); + if (selectedIndex < 0 || selectedIndex >= latLongs.length) { + selectedIndex = oldSelectionIndex; + } + if (selectedIndex >= 0 && selectedIndex < getLatLongs().getLatLongCount()) { + locationListView.getSelectionModel().select(selectedIndex); + } + } + + // File menu items + + private FileChooser fileChooser; + + private FileChooser getFileChooser() { + if (fileChooser == null) { + fileChooser = new FileChooser(); + } + return fileChooser; + } + + @FXML + void handleOpenAction(final ActionEvent event) { + final FileChooser fileChooser = getFileChooser(); + final File selection = fileChooser.showOpenDialog(null); + if (selection != null) { + try (InputStream input = new FileInputStream(selection) ){ + setLatLongs(getObjectMapper().readValue(input, LatLongs.class)); + } catch (final IOException e) { + showExceptionDialog("Oops, problem when opening " + selection, e); + } + } + } + + private ObjectMapper objectMapper; + + public ObjectMapper getObjectMapper() { + if (objectMapper == null) { + objectMapper = new ObjectMapper(); + objectMapper.registerModule(new LatLongsModule()); + } + return objectMapper; + } + + private void showExceptionDialog(final String message) { + final Alert alert = new Alert(AlertType.ERROR, message, ButtonType.CLOSE); + alert.showAndWait(); + } + + private void showExceptionDialog(final String message, final Exception e) { + showExceptionDialog(message + ": " + e.getLocalizedMessage()); + } + + private void showSaveExceptionDialog(final File location, final Exception e) { + showExceptionDialog("Oops, problem saving to " + location, e); + } + + @FXML + void handleSaveAction() { + final FileChooser fileChooser = getFileChooser(); + final File selection = fileChooser.showSaveDialog(null); + if (selection != null ) { + try (OutputStream outputStream = new FileOutputStream(selection, false)) { + getObjectMapper().writeValue(outputStream, getLatLongs()); + } catch (final IOException e) { + showSaveExceptionDialog(selection, e); + } + } + } +} diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/MapMarker.java b/simpleexample2/fxui/src/main/java/simpleex/ui/MapMarker.java new file mode 100644 index 0000000000000000000000000000000000000000..47ece587946e59d25e8cbe4e1d8941b849da1794 --- /dev/null +++ b/simpleexample2/fxui/src/main/java/simpleex/ui/MapMarker.java @@ -0,0 +1,22 @@ +package simpleex.ui; + +import fxmapcontrol.Location; +import fxmapcontrol.MapItem; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; +import simpleex.core.LatLong; + +public class MapMarker extends MapItem<LatLong> { + + public MapMarker(final LatLong latLong) { + setLocation(latLong); + final Circle circle = new Circle(); + circle.setRadius(5); + circle.setFill(Color.BLUE); + getChildren().add(circle); + } + + public final void setLocation(final LatLong latLong) { + setLocation(new Location(latLong.getLatitude(), latLong.getLongitude())); + } +} diff --git a/simpleexample2/fxui/src/main/java/simpleex/ui/README.md b/simpleexample2/fxui/src/main/java/simpleex/ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5bea24d88df8862fe2502f303b239e07c57e7c4c --- /dev/null +++ b/simpleexample2/fxui/src/main/java/simpleex/ui/README.md @@ -0,0 +1,24 @@ +# Kildekode for brukergrensesnittet + +Brukergrensesnittet er laget med JavaFX og FXML. + +Brukergrensesnittet er enkelt og består av en liste og et kart. Lista viser innholdet i et **LatLongs**-objekt, altså en samling **LatLong**-objekter. Når man velger et element, så vises det elementet som et punkt på kartet. En kan flytte punktet, forskyve kartet, zoome inn og ut og opprette nye **LatLong**-objekter. + +Kartet implementeres av ([FxMapControl](https://github.com/ClemensFischer/FX-Map-Control), og siden biblioteket ikke er tilgjengelig i et sentral repository, så har vi bygget og lagt ved jar-filen. + +I tillegg kan en lagre og lese inn **LatLongs**-objektet fra **Open...**- og **Save...**-aksjoner i en **File**-meny. + +```plantuml +class FxAppController +class LatLongs +class BorderPane +class "ListView<LatLong>" as ListView +class "fxmapcontrol.MapBase" as MapBase + +BorderPane *--> ListView: "left" +BorderPane *--> MapBase: "center" + +FxAppController --> LatLongs: "latLongs" +FxAppController --> MapBase: "mapView" +FxAppController --> ListView: "locationListView" +``` diff --git a/simpleexample2/fxui/src/main/resources/simpleex/ui/FxApp.fxml b/simpleexample2/fxui/src/main/resources/simpleex/ui/FxApp.fxml new file mode 100644 index 0000000000000000000000000000000000000000..01fbe1d975b5c4b7a779cdd25b8924703f597bda --- /dev/null +++ b/simpleexample2/fxui/src/main/resources/simpleex/ui/FxApp.fxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.control.ListView?> +<?import javafx.scene.control.Slider?> +<?import fxmapcontrol.MapBase?> +<?import javafx.scene.control.Button?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.control.Label?> +<?import fxmapcontrol.MapTileLayer?> +<?import fxmapcontrol.TileSource?> +<?import javafx.scene.control.MenuBar?> + +<?import javafx.scene.control.Menu?> +<?import javafx.scene.control.MenuItem?> +<?import javafx.scene.control.SeparatorMenuItem?> + +<BorderPane xmlns:fx="http://javafx.com/fxml" + fx:controller="simpleex.ui.FxAppController" + prefHeight="750" prefWidth="1000"> + <top> + <VBox> + <MenuBar > + <menus> + <Menu text="File"> + <items> + <MenuItem text="Open..." accelerator="Meta+O" onAction="#handleOpenAction"/> + <MenuItem text="Save" accelerator="Meta+S" onAction="#handleSaveAction"/> + </items> + </Menu> + </menus> + </MenuBar> + </VBox> + </top> + <left> + <VBox fillWidth="true"> + <ListView fx:id="locationListView"/> + <Button text="Add location" onAction="#handleAddLocation"/> + </VBox> + </left> + <center> + <VBox> + <MapBase fx:id="mapView"> + <MapTileLayer name="OpenStreetMap" minZoomLevel="0" maxZoomLevel="17"> + <tileSource> + <TileSource urlFormat="http://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"/> + <!-- + <TileSource urlFormat="https://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/> + <TileSource urlFormat="http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom={z}&x={x}&y={y}"/> + <TileSource urlFormat="http://mt1.google.com/vt/lyrs=m@129&hl=en&s=Galileo&z={z}&x={x}&y={y}"/> + --> + </tileSource> + </MapTileLayer> + </MapBase> + <Slider fx:id="zoomSlider" min="1" max="20" value="9"/> + </VBox> + </center> +</BorderPane> diff --git a/simpleexample2/fxui/src/main/resources/simpleex/ui/README.md b/simpleexample2/fxui/src/main/resources/simpleex/ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..72bf916c136978d42303004ff93a8ade81030f13 --- /dev/null +++ b/simpleexample2/fxui/src/main/resources/simpleex/ui/README.md @@ -0,0 +1,3 @@ +# Ressurser for brukergrensesnittet + +Brukergrensesnittet er laget med JavaFX og FXML, og her ligger FXML-fila som brukes. diff --git a/simpleexample2/fxui/src/test/java/fxui/LibraryTest.java b/simpleexample2/fxui/src/test/java/fxui/LibraryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4649b26b84f2e297d0176d07609221a619501418 --- /dev/null +++ b/simpleexample2/fxui/src/test/java/fxui/LibraryTest.java @@ -0,0 +1,14 @@ +/* + * This Java source file was generated by the Gradle 'init' task. + */ +package fxui; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LibraryTest { + @Test public void testSomeLibraryMethod() { + Library classUnderTest = new Library(); + assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod()); + } +} diff --git a/simpleexample2/fxui/src/test/java/simpleex/ui/FxAppTest.java b/simpleexample2/fxui/src/test/java/simpleex/ui/FxAppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0b3f7d1793f8f2181bbffaa5b2393f687d8eb5c3 --- /dev/null +++ b/simpleexample2/fxui/src/test/java/simpleex/ui/FxAppTest.java @@ -0,0 +1,108 @@ +package simpleex.ui; + +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import fxmapcontrol.Location; +import fxmapcontrol.MapBase; +import java.util.ArrayList; +import java.util.List; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.testfx.framework.junit.ApplicationTest; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ListView; +import javafx.stage.Stage; +import simpleex.core.LatLong; +import simpleex.core.LatLongs; + +public class FxAppTest extends ApplicationTest { + + @BeforeClass + public static void headless() { + if (Boolean.valueOf(System.getProperty("gitlab-ci", "false"))) { + System.setProperty("prism.verbose", "true"); // optional + System.setProperty("java.awt.headless", "true"); + System.setProperty("testfx.robot", "glass"); + System.setProperty("testfx.headless", "true"); + System.setProperty("glass.platform", "Monocle"); + System.setProperty("monocle.platform", "Headless"); + System.setProperty("prism.order", "sw"); + System.setProperty("prism.text", "t2k"); + System.setProperty("testfx.setup.timeout", "2500"); + } + } + + private FxAppController controller; + private LatLongs latLongs; + + @Override + public void start(final Stage stage) throws Exception { + final FXMLLoader loader = new FXMLLoader(getClass().getResource("FxApp.fxml")); + final Parent root = loader.load(); + this.controller = loader.getController(); + setUpLatLongs(); + final Scene scene = new Scene(root); + stage.setScene(scene); + stage.show(); + } + + private List<LatLong> latLongList; + + private void setUpLatLongs() { + // test data + latLongList = new ArrayList<>(List.of(new LatLong(63.1, 11.2), new LatLong(63.2, 11.0))); + // "mocked" (faked) LatLongs object with very specific and limited behavior + latLongs = mock(LatLongs.class); + // get nth LatLong object + when(latLongs.getLatLong(anyInt())) + .then(invocation -> latLongList.get(invocation.getArgument(0))); + // get the number of LatLong objects + when(latLongs.getLatLongCount()).then(invocation -> latLongList.size()); + // iterator for LatLong objects + when(latLongs.iterator()).then(invocation -> latLongList.iterator()); + controller.setLatLongs(latLongs); + } + + @Test + public void testController() { + Assert.assertNotNull(this.controller); + } + + @Test + public void testLocationListView() { + final ListView<?> locationListView = lookup("#locationListView").query(); + // list contains equals elements in same order + Assert.assertEquals(latLongList, locationListView.getItems()); + // first list element is auto-selected + Assert.assertEquals(0, locationListView.getSelectionModel().getSelectedIndex()); + } + + @Test + public void testMapView() { + final MapBase mapView = lookup("#mapView").query(); + // center of map view is approx. the first LatLong object + final Location center = mapView.getCenter(); + final double epsilon = 0.000001; // round-off error + Assert.assertEquals(latLongList.get(0).getLatitude(), center.getLatitude(), epsilon); + Assert.assertEquals(latLongList.get(0).getLongitude(), center.getLongitude(), epsilon); + } + + @Test + public void testAddLocation() { + // needs map center + final Location center = ((MapBase) lookup("#mapView").query()).getCenter(); + // add behavior for add + final LatLong latLong = new LatLong(center.getLatitude(), center.getLongitude()); + when(latLongs.addLatLong(latLong)).thenReturn(2); // add center + + // make test less sensitive to exact button text + final Button addLocButton = lookup(node -> node instanceof Button + && ((Button) node).getText().toLowerCase().startsWith("add loc")).query(); + clickOn(addLocButton); + } +} diff --git a/simpleexample2/fxui/src/test/java/simpleex/ui/README.md b/simpleexample2/fxui/src/test/java/simpleex/ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5244c0323b90835965a84752d6d99fecee2e037c --- /dev/null +++ b/simpleexample2/fxui/src/test/java/simpleex/ui/README.md @@ -0,0 +1 @@ +# Testkode for brukergrensesnittet diff --git a/simpleexample2/fxui/src/test/resources/simpleex/ui/FxApp.fxml b/simpleexample2/fxui/src/test/resources/simpleex/ui/FxApp.fxml new file mode 100644 index 0000000000000000000000000000000000000000..01fbe1d975b5c4b7a779cdd25b8924703f597bda --- /dev/null +++ b/simpleexample2/fxui/src/test/resources/simpleex/ui/FxApp.fxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.control.ListView?> +<?import javafx.scene.control.Slider?> +<?import fxmapcontrol.MapBase?> +<?import javafx.scene.control.Button?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.control.Label?> +<?import fxmapcontrol.MapTileLayer?> +<?import fxmapcontrol.TileSource?> +<?import javafx.scene.control.MenuBar?> + +<?import javafx.scene.control.Menu?> +<?import javafx.scene.control.MenuItem?> +<?import javafx.scene.control.SeparatorMenuItem?> + +<BorderPane xmlns:fx="http://javafx.com/fxml" + fx:controller="simpleex.ui.FxAppController" + prefHeight="750" prefWidth="1000"> + <top> + <VBox> + <MenuBar > + <menus> + <Menu text="File"> + <items> + <MenuItem text="Open..." accelerator="Meta+O" onAction="#handleOpenAction"/> + <MenuItem text="Save" accelerator="Meta+S" onAction="#handleSaveAction"/> + </items> + </Menu> + </menus> + </MenuBar> + </VBox> + </top> + <left> + <VBox fillWidth="true"> + <ListView fx:id="locationListView"/> + <Button text="Add location" onAction="#handleAddLocation"/> + </VBox> + </left> + <center> + <VBox> + <MapBase fx:id="mapView"> + <MapTileLayer name="OpenStreetMap" minZoomLevel="0" maxZoomLevel="17"> + <tileSource> + <TileSource urlFormat="http://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"/> + <!-- + <TileSource urlFormat="https://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/> + <TileSource urlFormat="http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom={z}&x={x}&y={y}"/> + <TileSource urlFormat="http://mt1.google.com/vt/lyrs=m@129&hl=en&s=Galileo&z={z}&x={x}&y={y}"/> + --> + </tileSource> + </MapTileLayer> + </MapBase> + <Slider fx:id="zoomSlider" min="1" max="20" value="9"/> + </VBox> + </center> +</BorderPane> diff --git a/simpleexample2/gradle/wrapper/gradle-wrapper.jar b/simpleexample2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5c2d1cf016b3885f6930543d57b744ea8c220a1a Binary files /dev/null and b/simpleexample2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/simpleexample2/gradle/wrapper/gradle-wrapper.properties b/simpleexample2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..f4d7b2bf616f7674854ff527df47b371b72472da --- /dev/null +++ b/simpleexample2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/simpleexample2/gradlew b/simpleexample2/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..b0d6d0ab5deb588123dd658f0b079934ee05a72e --- /dev/null +++ b/simpleexample2/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/simpleexample2/gradlew.bat b/simpleexample2/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..15e1ee37a70d7dfdfd8cf727022e117b6f6153a7 --- /dev/null +++ b/simpleexample2/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/simpleexample2/settings.gradle b/simpleexample2/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..25b02a8acff6333080322490b76aa783fe9f0179 --- /dev/null +++ b/simpleexample2/settings.gradle @@ -0,0 +1,12 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html + */ + +rootProject.name = 'simpleexample2' +include 'core' +include 'fxui'