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
c6d65e0a
Commit
c6d65e0a
authored
10 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
fixed EveryXthPrinter
parent
560d5cce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/teetime/stage/io/EveryXthPrinter.java
+21
-10
21 additions, 10 deletions
src/main/java/teetime/stage/io/EveryXthPrinter.java
with
21 additions
and
10 deletions
src/main/java/teetime/stage/io/EveryXthPrinter.java
+
21
−
10
View file @
c6d65e0a
...
...
@@ -3,6 +3,7 @@ package teetime.stage.io;
import
java.util.List
;
import
teetime.framework.InputPort
;
import
teetime.framework.OutputPort
;
import
teetime.framework.Stage
;
import
teetime.framework.TerminationStrategy
;
import
teetime.framework.pipe.IPipeFactory
;
...
...
@@ -12,48 +13,58 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
import
teetime.framework.signal.ISignal
;
import
teetime.framework.validation.InvalidPortConnection
;
import
teetime.stage.EveryXthStage
;
import
teetime.stage.basic.distributor.Distributor
;
public
final
class
EveryXthPrinter
<
T
>
extends
Stage
{
private
final
EveryXthStage
<
T
>
everyXthStage
;
private
final
Printer
<
T
>
printer
;
private
final
Distributor
<
T
>
distributor
;
public
EveryXthPrinter
(
final
int
threshold
)
{
everyXthStage
=
new
EveryXthStage
<
T
>(
threshold
);
printer
=
new
Printer
<
T
>();
distributor
=
new
Distributor
<
T
>();
EveryXthStage
<
T
>
everyXthStage
=
new
EveryXthStage
<
T
>(
threshold
);
Printer
<
T
>
printer
=
new
Printer
<
T
>();
IPipeFactory
pipeFactory
=
PipeFactoryRegistry
.
INSTANCE
.
getPipeFactory
(
ThreadCommunication
.
INTRA
,
PipeOrdering
.
ARBITRARY
,
false
);
pipeFactory
.
create
(
distributor
.
getNewOutputPort
(),
everyXthStage
.
getInputPort
());
pipeFactory
.
create
(
everyXthStage
.
getOutputPort
(),
printer
.
getInputPort
());
}
@Override
protected
void
executeWithPorts
()
{
everyXthStage
.
executeWithPorts
();
distributor
.
executeWithPorts
();
}
@Override
public
void
validateOutputPorts
(
final
List
<
InvalidPortConnection
>
invalidPortConnections
)
{
printe
r
.
validateOutputPorts
(
invalidPortConnections
);
distributo
r
.
validateOutputPorts
(
invalidPortConnections
);
}
@Override
protected
void
onSignal
(
final
ISignal
signal
,
final
InputPort
<?>
inputPort
)
{
everyXthStage
.
onSignal
(
signal
,
inputPort
);
distributor
.
onSignal
(
signal
,
inputPort
);
}
@Override
protected
TerminationStrategy
getTerminationStrategy
()
{
return
everyXthStage
.
getTerminationStrategy
();
return
distributor
.
getTerminationStrategy
();
}
@Override
protected
void
terminate
()
{
everyXthStage
.
terminate
();
distributor
.
terminate
();
}
@Override
protected
boolean
shouldBeTerminated
()
{
return
everyXthStage
.
shouldBeTerminated
();
return
distributor
.
shouldBeTerminated
();
}
public
InputPort
<
T
>
getInputPort
()
{
return
distributor
.
getInputPort
();
}
public
OutputPort
<
T
>
getNewOutputPort
()
{
return
distributor
.
getNewOutputPort
();
}
}
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