Added filter and count methods, and test code about.

This commit is contained in:
Christian P. MOMON 2020-08-15 03:33:42 +02:00
parent fbb55f8a7f
commit 56085f105b
6 changed files with 821 additions and 31 deletions

View file

@ -23,7 +23,11 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
@ -34,26 +38,39 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_record_components=16
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
@ -62,6 +79,7 @@ org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
@ -71,11 +89,17 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false
org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_html=true
@ -84,9 +108,11 @@ org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.line_length=120
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
@ -100,6 +126,7 @@ org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false
org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_empty_lines=false
@ -108,6 +135,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -116,6 +144,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -131,6 +160,8 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
@ -160,12 +191,16 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -182,6 +217,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not ins
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
@ -198,6 +234,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
@ -217,6 +255,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not in
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
@ -243,10 +282,13 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
@ -260,6 +302,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
@ -275,6 +319,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
@ -302,24 +347,62 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=200 org.eclipse.jdt.core.formatter.lineSplit=200
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.text_block_indentation=0
org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -13,28 +13,36 @@ cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.correct_indentation=false cleanup.correct_indentation=false
cleanup.format_source_code=true cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false cleanup.insert_inferred_type_arguments=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true cleanup.make_variable_declarations_final=true
cleanup.merge_conditional_blocks=false
cleanup.never_use_blocks=false cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true cleanup.never_use_parentheses_in_expressions=true
cleanup.number_suffix=false
cleanup.organize_imports=false cleanup.organize_imports=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
cleanup.remove_redundant_type_arguments=false cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true cleanup.remove_unused_imports=true
@ -43,24 +51,30 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true cleanup.remove_unused_private_types=true
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.sort_members=true cleanup.sort_members=true
cleanup.sort_members_all=false cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup_profile=_Devinsy-strings cleanup_profile=_Devinsy-strings
cleanup_settings_version=2 cleanup_settings_version=2
eclipse.preferences.version=1 eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Devinsy-strings formatter_profile=_Devinsy-strings
formatter_settings_version=12 formatter_settings_version=19
jautodoc.cleanup.add_header=false jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.gettersetter.use.is=true

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2008-2010,2013-2015,2017-2018 Christian Pierre MOMON * Copyright (C) 2008-2020 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -25,14 +25,15 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** /**
* The <code>StringList</code> class is a collection of String objects with * The <code>StringList</code> class is a collection of String objects with specific methods. It makes possible to build
* specific methods. It makes possible to build a string without any copy. The * a string without any copy. The goal is to optimize the building of strings where they are lot of concatenation
* goal is to optimize the building of strings where they are lot of * action.
* concatenation action.
* *
*/ */
public class StringList extends ArrayList<String> implements CharSequence, Appendable public class StringList extends ArrayList<String> implements CharSequence, Appendable
@ -42,8 +43,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
public static final String LINE_SEPARATOR = "\n"; public static final String LINE_SEPARATOR = "\n";
/** /**
* Constructs an empty list with an initial capacity of ten (see ArrayList * Constructs an empty list with an initial capacity of ten (see ArrayList constructor).
* constructor).
*/ */
public StringList() public StringList()
{ {
@ -93,8 +93,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Constructs a list of string of the specified collection, in the order they * Constructs a list of string of the specified collection, in the order they are returned by the collection's
* are returned by the collection's iterator. * iterator.
* *
* @param source * @param source
* the source * the source
@ -336,8 +336,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string of the specified collection, in the order they are * Appends the string of the specified collection, in the order they are returned by the collection's iterator.
* returned by the collection's iterator.
* *
* @param strings * @param strings
* the strings * the strings
@ -541,8 +540,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the char argument to this string list, * Appends the string representation of the char argument to this string list, then append a break line too.
* then append a break line too.
* *
* @param character * @param character
* the character * the character
@ -559,8 +557,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string of the specified collection, in the order they are * Appends the string of the specified collection, in the order they are returned by the collection's iterator. Then
* returned by the collection's iterator. Then append a return line. * append a return line.
* *
* @param string * @param string
* the string * the string
@ -1142,6 +1140,144 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result; return result;
} }
/**
* Count blank strings.
*
* @return the blank string count.
*/
public int countBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count not blank strings.
*
* @return the not blank string count.
*/
public int countNotBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param regex
* the regex
* @return the string count matching the regex.
*/
public int countStrings(final String regex)
{
int result;
result = 0;
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result += 1;
}
}
}
}
//
return result;
}
/**
* Filter the strings matching a regex.
*
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public StringList filter(final String regex)
{
StringList result;
result = new StringList(this.size());
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result.add(string);
}
}
}
}
result.trimToSize();
//
return result;
}
/**
* Filter blank strings.
*
* @return the not Blank string list
*/
public StringList filterBlankStrings()
{
StringList result;
result = new StringList(this.size());
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result.add(string);
}
}
//
return result;
}
/** /**
* Gets the by index. * Gets the by index.
* *
@ -1589,8 +1725,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns the length of the string list concatenation. Null strings are * Returns the length of the string list concatenation. Null strings are ignored.
* ignored.
* *
* @return the int * @return the int
*/ */
@ -1612,8 +1747,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Merge all strings of the list into in single string. At the end of operation, * Merge all strings of the list into in single string. At the end of operation, the new string is the first of the
* the new string is the first of the list and the size list is 1. * list and the size list is 1.
* *
* @return the string list * @return the string list
*/ */
@ -1943,8 +2078,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns an array containing all of the strings in this list in proper * Returns an array containing all of the strings in this list in proper sequence (from first to last element).
* sequence (from first to last element).
* *
* @return the string[] * @return the string[]
*/ */
@ -1964,9 +2098,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns a string containing the concatenation of the strings of this list. * Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* Between each string of this list, a separator argument string is concatenated * separator argument string is concatenated too.
* too.
* *
* @param separator * @param separator
* the separator * the separator
@ -1990,9 +2123,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns a string containing the concatenation of the strings of this list. * Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* Between each string of this list, a separator argument string is concatenated * separator argument string is concatenated too.
* too.
* *
* @param separator * @param separator
* the separator * the separator

View file

@ -380,6 +380,79 @@ public class StringsUtils
return result; return result;
} }
/**
* Count blank strings.
*
* @param source
* the string list to compute.
* @return the blank string count.
*/
public static int countBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countBlankStrings();
}
//
return result;
}
/**
* Count not blank strings.
*
* @param source
* the string list to compute.
* @return the not blank string count.
*/
public static int countNotBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countNotBlankStrings();
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param source
* the string list to compute
* @param regex
* the regex
* @return the string count matching the regex.
*/
public static int countStrings(final StringList source, final String regex)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countStrings(regex);
}
//
return result;
}
/** /**
* Checks if is contained. * Checks if is contained.
* *
@ -418,6 +491,56 @@ public class StringsUtils
return result; return result;
} }
/**
* Filter the strings matching a regex.
*
* @param source
* the string list to compute.
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public static StringList filter(final StringList source, final String regex)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filter(regex);
}
//
return result;
}
/**
* Filter blank strings.
*
* @param source
* the string list to compute.
* @return the not Blank string list
*/
public static StringList filterBlankStrings(final StringList source)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filterBlankStrings();
}
//
return result;
}
/** /**
* Find longest. * Find longest.
* *
@ -1428,8 +1551,8 @@ public class StringsUtils
* *
* @param source * @param source
* the source * the source
* @return If argument is null then returns an empty string, otherwise returns a * @return If argument is null then returns an empty string, otherwise returns a string concatenation of the
* string concatenation of the argument. * argument.
*/ */
public static String toStringNotNull(final String[] source) public static String toStringNotNull(final String[] source)
{ {

View file

@ -520,6 +520,225 @@ public class StringListTest
this.logger.debug("===== test done."); this.logger.debug("===== test done.");
} }
/**
* Test count blank strings.
*/
@Test
public void testCountBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.countBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(2, source.countBlankStrings());
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountNotBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countNotBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.countNotBlankStrings());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.countNotBlankStrings());
}
//
this.logger.debug("===== test done.");
}
/**
* Test count strings.
*/
@Test
public void testCountStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
Assert.assertEquals(0, source.countStrings("a*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.countStrings(".*\\d.*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, source.countStrings(null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.countStrings(".*\\d.*"));
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter.
*/
@Test
public void testFilter()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
Assert.assertEquals(0, source.filter("a*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.filter(".*\\d.*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, source.filter(null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.filter(".*\\d.*").size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter blank strings.
*/
@Test
public void testFilterBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, source.filterBlankStrings().size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, source.filterBlankStrings().size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, source.filterBlankStrings().size());
}
//
this.logger.debug("===== test done.");
}
/** /**
* Test iterator of char 01. * Test iterator of char 01.
*/ */

View file

@ -195,6 +195,133 @@ public class StringsUtilsTest
Assert.assertTrue(StringsUtils.containsNull(source)); Assert.assertTrue(StringsUtils.containsNull(source));
} }
/**
* Test count blank strings.
*/
@Test
public void testCountBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(2, StringsUtils.countBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountNotBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countNotBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, "a*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countStrings(source, ".*\\d.*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countStrings(source, ".*\\d.*"));
}
//
this.logger.debug("===== test done.");
}
@Test @Test
public void testEqualsAny01() public void testEqualsAny01()
{ {
@ -209,6 +336,98 @@ public class StringsUtilsTest
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "aBc")); Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
} }
/**
* Test filter.
*/
@Test
public void testFilter()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, "a*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filter(source, ".*\\d.*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filter(source, ".*\\d.*").size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter blank strings.
*/
@Test
public void testFilterBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filterBlankStrings(source).size());
}
//
this.logger.debug("===== test done.");
}
/** /**
* Test find smallest 01. * Test find smallest 01.
*/ */