Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nelson Tavares de Sousa
TeeTime-Framework
Commits
2ec4223d
Commit
2ec4223d
authored
9 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
refactored WordCounter
parent
56739651
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/stage/string/WordCounter.java
+5
-14
5 additions, 14 deletions
src/main/java/teetime/stage/string/WordCounter.java
src/test/java/teetime/framework/TraversorTest.java
+1
-2
1 addition, 2 deletions
src/test/java/teetime/framework/TraversorTest.java
with
6 additions
and
16 deletions
src/main/java/teetime/stage/string/WordCounter.java
+
5
−
14
View file @
2ec4223d
...
...
@@ -15,13 +15,10 @@
*/
package
teetime.stage.string
;
import
java.util.ArrayList
;
import
teetime.framework.AbstractCompositeStage
;
import
teetime.framework.ConfigurationContext
;
import
teetime.framework.InputPort
;
import
teetime.framework.OutputPort
;
import
teetime.framework.Stage
;
import
teetime.stage.MappingCounter
;
import
teetime.stage.util.CountingMap
;
...
...
@@ -36,24 +33,18 @@ import teetime.stage.util.CountingMap;
*/
public
final
class
WordCounter
extends
AbstractCompositeStage
{
// This fields are needed for the methods to work.
private
final
Tokenizer
tokenizer
=
new
Tokenizer
(
" "
);
private
final
MappingCounter
<
String
>
mapCounter
=
new
MappingCounter
<
String
>();
private
final
ArrayList
<
Stage
>
lastStages
=
new
ArrayList
<
Stage
>();
private
final
Tokenizer
tokenizer
;
private
final
MappingCounter
<
String
>
mapCounter
;
// The connection of the different stages is realized within the construction of a instance of this class.
public
WordCounter
(
final
ConfigurationContext
context
)
{
super
(
context
);
this
.
lastStages
.
add
(
this
.
mapCounter
);
this
.
tokenizer
=
new
Tokenizer
(
" "
);
final
ToLowerCase
toLowerCase
=
new
ToLowerCase
();
this
.
mapCounter
=
new
MappingCounter
<
String
>();
connectPorts
(
this
.
tokenizer
.
getOutputPort
(),
toLowerCase
.
getInputPort
());
connectPorts
(
toLowerCase
.
getOutputPort
(),
this
.
mapCounter
.
getInputPort
());
// connectStages(wordcharacterFilter.getOutputPort(), this.mapCounter.getInputPort());
}
public
Stage
getFirstStage
()
{
return
this
.
tokenizer
;
}
public
InputPort
<
String
>
getInputPort
()
{
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/framework/TraversorTest.java
+
1
−
2
View file @
2ec4223d
...
...
@@ -83,8 +83,7 @@ public class TraversorTest {
connectPorts
(
distributor
.
getNewOutputPort
(),
wc
.
getInputPort
());
connectPorts
(
wc
.
getOutputPort
(),
merger
.
getNewInputPort
());
// Add WordCounter as a threadable stage, so it runs in its own thread
addThreadableStage
(
wc
.
getFirstStage
());
addThreadableStage
(
wc
.
getInputPort
().
getOwningStage
());
}
// Connect the stages of the last part
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment