Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
API
Commits
3fe40487
Commit
3fe40487
authored
May 19, 2015
by
Björn Richerzhagen
Browse files
Sanity checks in the PeriodicOperation
- isStopped is true, if the OP is not yet started
parent
560ff1d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/operation/PeriodicOperation.java
View file @
3fe40487
...
...
@@ -32,7 +32,7 @@ import de.tudarmstadt.maki.simonstrator.api.util.Distribution;
public
abstract
class
PeriodicOperation
<
T
extends
HostComponent
,
R
>
extends
AbstractOperation
<
T
,
R
>
{
private
boolean
stopped
=
fals
e
;
private
boolean
stopped
=
tru
e
;
private
Distribution
intervalDist
;
...
...
@@ -157,6 +157,10 @@ public abstract class PeriodicOperation<T extends HostComponent, R> extends
* Same functionality like scheduleImmediately
*/
public
void
start
()
{
if
(!
isStopped
())
{
throw
new
AssertionError
(
"Periodic Operation already running - ignoring start()!"
);
}
this
.
scheduleImmediately
();
}
...
...
@@ -167,6 +171,10 @@ public abstract class PeriodicOperation<T extends HostComponent, R> extends
* The delay for the first execution
*/
public
void
startWithDelay
(
long
delay
)
{
if
(!
isStopped
())
{
throw
new
AssertionError
(
"Periodic Operation already running - ignoring start()!"
);
}
this
.
scheduleWithDelay
(
delay
);
}
...
...
@@ -176,12 +184,12 @@ public abstract class PeriodicOperation<T extends HostComponent, R> extends
super
.
scheduleWithDelay
(
delay
);
}
@Override
public
void
scheduleImmediately
()
{
this
.
stopped
=
false
;
super
.
scheduleImmediately
();
}
/**
* True, if the operation is currently stopped or was not yet scheduled to
* start.
*
* @return
*/
public
boolean
isStopped
()
{
return
stopped
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment