Skip to content
Snippets Groups Projects
Commit 8d35f40d authored by Christian Wulf's avatar Christian Wulf
Browse files

removed TokenCounter because teetime already provides the Counter stage;

updated formatter and clean up settings
parent e6cac26c
No related branches found
No related tags found
No related merge requests found
...@@ -54,6 +54,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line ...@@ -54,6 +54,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
...@@ -99,6 +100,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do ...@@ -99,6 +100,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=insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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
...@@ -146,6 +148,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser ...@@ -146,6 +148,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
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_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
...@@ -223,6 +226,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n ...@@ -223,6 +226,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
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_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
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
......
...@@ -5,16 +5,18 @@ cleanup.add_missing_deprecated_annotations=true ...@@ -5,16 +5,18 @@ cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=false cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=true cleanup.add_serial_version_id=true
cleanup.always_use_blocks=true cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=true cleanup.always_use_parentheses_in_expressions=true
cleanup.always_use_this_for_non_static_field_access=true cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=true cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=true
cleanup.convert_to_enhanced_for_loop=true cleanup.convert_to_enhanced_for_loop=true
cleanup.correct_indentation=true cleanup.correct_indentation=true
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.make_local_variable_final=true cleanup.make_local_variable_final=true
cleanup.make_parameters_final=true cleanup.make_parameters_final=true
cleanup.make_private_fields_final=true cleanup.make_private_fields_final=true
...@@ -29,6 +31,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=tru ...@@ -29,6 +31,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=tru
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=true cleanup.qualify_static_method_accesses_with_declaring_class=true
cleanup.remove_private_constructors=true cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true
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
...@@ -42,18 +45,21 @@ cleanup.remove_unused_private_methods=true ...@@ -42,18 +45,21 @@ cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true cleanup.remove_unused_private_types=true
cleanup.sort_members=false cleanup.sort_members=false
cleanup.sort_members_all=false cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=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_lambda=true
cleanup.use_parentheses_in_expressions=true cleanup.use_parentheses_in_expressions=true
cleanup.use_this_for_non_static_field_access=false 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=true
cleanup.use_this_for_non_static_method_access=true cleanup.use_this_for_non_static_method_access=true
cleanup.use_this_for_non_static_method_access_only_if_necessary=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_TeeTime cleanup.use_type_arguments=false
cleanup_profile=_TeeTime - Clean Up
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=_Kieker - Profile formatter_profile=_TeeTime - Profile
formatter_settings_version=12 formatter_settings_version=12
org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;kieker.test; org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;kieker.test;
......
package teetime.stage;
import teetime.framework.ConsumerStage;
public class TokenCounter extends ConsumerStage<String> {
private long i = 0;
public long getI() {
return i;
}
@Override
protected void execute(final String element) {
i++;
}
}
...@@ -9,8 +9,8 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; ...@@ -9,8 +9,8 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
import teetime.stage.ByteArray2String; import teetime.stage.ByteArray2String;
import teetime.stage.CipherByteArray; import teetime.stage.CipherByteArray;
import teetime.stage.CipherByteArray.CipherMode; import teetime.stage.CipherByteArray.CipherMode;
import teetime.stage.Counter;
import teetime.stage.InitialElementProducer; import teetime.stage.InitialElementProducer;
import teetime.stage.TokenCounter;
import teetime.stage.Tokenizer; import teetime.stage.Tokenizer;
import teetime.stage.ZipByteArray; import teetime.stage.ZipByteArray;
import teetime.stage.ZipByteArray.ZipMode; import teetime.stage.ZipByteArray.ZipMode;
...@@ -18,10 +18,10 @@ import teetime.stage.io.File2ByteArray; ...@@ -18,10 +18,10 @@ import teetime.stage.io.File2ByteArray;
public class TokenizerConfiguration extends AnalysisConfiguration { public class TokenizerConfiguration extends AnalysisConfiguration {
private final PipeFactoryRegistry pipeFactory = PipeFactoryRegistry.INSTANCE; private static final PipeFactoryRegistry pipeFactoryRegistry = PipeFactoryRegistry.INSTANCE;
private final File input; private final File input;
private final String password; private final String password;
private final TokenCounter counter; private final Counter<String> counter;
public TokenizerConfiguration(final String inputFile, final String password) { public TokenizerConfiguration(final String inputFile, final String password) {
this.input = new File(inputFile); this.input = new File(inputFile);
...@@ -33,28 +33,26 @@ public class TokenizerConfiguration extends AnalysisConfiguration { ...@@ -33,28 +33,26 @@ public class TokenizerConfiguration extends AnalysisConfiguration {
CipherByteArray decrypt = new CipherByteArray(this.password, CipherMode.DECRYPT); CipherByteArray decrypt = new CipherByteArray(this.password, CipherMode.DECRYPT);
ByteArray2String b2s = new ByteArray2String(); ByteArray2String b2s = new ByteArray2String();
Tokenizer tokenizer = new Tokenizer(" "); Tokenizer tokenizer = new Tokenizer(" ");
TokenCounter counter = new TokenCounter(); counter = new Counter<String>();
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(init.getOutputPort(), f2b.getInputPort()); init.getOutputPort(), f2b.getInputPort());
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(f2b.getOutputPort(), decomp.getInputPort()); f2b.getOutputPort(), decomp.getInputPort());
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(decomp.getOutputPort(), decrypt.getInputPort()); decomp.getOutputPort(), decrypt.getInputPort());
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(decrypt.getOutputPort(), b2s.getInputPort()); decrypt.getOutputPort(), b2s.getInputPort());
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(b2s.getOutputPort(), tokenizer.getInputPort()); b2s.getOutputPort(), tokenizer.getInputPort());
this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false) pipeFactoryRegistry.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create(
.create(tokenizer.getOutputPort(), counter.getInputPort()); tokenizer.getOutputPort(), counter.getInputPort());
this.getFiniteProducerStages().add(init); this.getFiniteProducerStages().add(init);
this.counter = counter;
} }
public long getTokenCount() { public int getTokenCount() {
return this.counter.getI(); return this.counter.getNumElementsPassed();
} }
} }
...@@ -7,18 +7,17 @@ import teetime.framework.Analysis; ...@@ -7,18 +7,17 @@ import teetime.framework.Analysis;
public class TokenizerTest { public class TokenizerTest {
// Encrypted lorem ipsum
private static String inputFile = "src/test/resources/data/cipherInput.txt";
private static String password = "Password";
private static TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password);
private final static Analysis analysis = new Analysis(configuration);
@Test @Test
public void executeTest() { public void executeTest() {
// Encrypted lorem ipsum
String inputFile = "src/test/resources/data/cipherInput.txt";
String password = "Password";
TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password);
Analysis analysis = new Analysis(configuration);
analysis.init(); analysis.init();
analysis.start(); analysis.start();
Assert.assertEquals(970, configuration.getTokenCount()); Assert.assertEquals(970, configuration.getTokenCount());
} }
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2"> <profiles version="2">
<profile kind="CleanUpProfile" name="Kieker - Clean Up" version="2"> <profile kind="CleanUpProfile" name="TeeTime - Clean Up" version="2">
<setting id="cleanup.format_source_code" value="true"/> <setting id="cleanup.format_source_code" value="true"/>
<setting id="cleanup.add_missing_annotations" value="true"/> <setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="false"/> <setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="false"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12"> <profiles version="12">
<profile kind="CodeFormatterProfile" name="Kieker - Profile" version="12"> <profile kind="CodeFormatterProfile" name="TeeTime - Profile" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> <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.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_after_comma_in_annotation" value="insert"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment