Added new Reset behaviour that was removed from Stop.
[artf485115]
This commit is contained in:
parent
f067ff3122
commit
9a25cb9dbd
4 changed files with 66 additions and 13 deletions
|
|
@ -180,6 +180,17 @@ public class UeControlExecutor implements Runnable{
|
|||
public void setNextBehaviour(int i) {
|
||||
if(0 <= i && i < behaviours.size())
|
||||
currentlyActive = behaviours.get(i);
|
||||
else
|
||||
currentlyActive = null;
|
||||
}
|
||||
public int getBehaviourIndex(UeBehaviour b) {
|
||||
return behaviours.indexOf(b);
|
||||
}
|
||||
public UeBehaviour getRunningBehaviour(){
|
||||
return currentlyActive;
|
||||
}
|
||||
public List<UeBehaviour> getBehaviourList() {
|
||||
return behaviours;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -188,6 +199,10 @@ public class UeControlExecutor implements Runnable{
|
|||
public void setLogPath(String path){
|
||||
csvPath = path;
|
||||
}
|
||||
public CSVWriter getCsvLogger() {
|
||||
return csvLogger;
|
||||
}
|
||||
|
||||
public void setThroughputListener(ThroughputListener listener){
|
||||
throughputListener = listener;
|
||||
}
|
||||
|
|
@ -198,17 +213,6 @@ public class UeControlExecutor implements Runnable{
|
|||
throughputUpdateRunnable.deviceBasedThroughput = enable;
|
||||
}
|
||||
|
||||
public List<UeBehaviour> getBehaviourList() {
|
||||
return behaviours;
|
||||
}
|
||||
public UeBehaviour getRunningBehaviour(){
|
||||
return currentlyActive;
|
||||
}
|
||||
public CSVWriter getCsvLogger() {
|
||||
return csvLogger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static interface ExecutionListener {
|
||||
public void executionStarted();
|
||||
|
|
|
|||
35
app/src/main/java/com/ericsson/uecontrol/core/logic/UeBehaviourReset.java
Executable file
35
app/src/main/java/com/ericsson/uecontrol/core/logic/UeBehaviourReset.java
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
package com.ericsson.uecontrol.core.logic;
|
||||
|
||||
import com.ericsson.uecontrol.core.UeBehaviour;
|
||||
import com.ericsson.uecontrol.core.UeControlExecutor;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Created by ezivkoc on 2015-01-19.
|
||||
*/
|
||||
public class UeBehaviourReset extends UeBehaviour {
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourReset.class);
|
||||
|
||||
|
||||
@Override
|
||||
protected void execute() throws Exception {
|
||||
UeControlExecutor executor = super.getExecutor();
|
||||
Thread.sleep(VISUAL_SLEEP_PERIOD); // Sleep as a visual queue
|
||||
|
||||
if(!super.stopExecution()) {
|
||||
executor.setNextBehaviour(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Reset";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Will reset execution";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11,6 +11,7 @@ import org.apache.log4j.Logger;
|
|||
public class UeBehaviourStop extends UeBehaviour {
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourStop.class);
|
||||
|
||||
private transient boolean stopped = false;
|
||||
|
||||
@Override
|
||||
protected void execute() throws Exception {
|
||||
|
|
@ -18,12 +19,24 @@ public class UeBehaviourStop extends UeBehaviour {
|
|||
Thread.sleep(VISUAL_SLEEP_PERIOD); // Sleep as a visual queue
|
||||
|
||||
if(!super.stopExecution()) {
|
||||
executor.terminateNonBlock();
|
||||
executor.setNextBehaviour(0);
|
||||
if(!stopped) {
|
||||
executor.terminateNonBlock();
|
||||
stopped = true;
|
||||
//executor.setNextBehaviour( // Skipp this behaviour when execution starts
|
||||
// executor.getBehaviourIndex(this)+1 );
|
||||
}
|
||||
else
|
||||
stopped = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
stopped = false;
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Stop";
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourVideoStreaming</item>
|
||||
|
||||
<item>com.ericsson.uecontrol.core.logic.UeBehaviourIterator</item>
|
||||
<item>com.ericsson.uecontrol.core.logic.UeBehaviourReset</item>
|
||||
<item>com.ericsson.uecontrol.core.logic.UeBehaviourStop</item>
|
||||
<item>com.ericsson.uecontrol.core.logic.UeBehaviourSynchronize</item>
|
||||
</string-array>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue