il.ac.bgu.cs.bp.bpjs.execution.tasks.ResumeBThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BPjs Show documentation
Show all versions of BPjs Show documentation
Provides runtime and analysis for behavioral programs written in
JavaScript. It can run stand-alone (from the commmandline) or be
embedded in larger JVM-based systems.
The newest version!
package il.ac.bgu.cs.bp.bpjs.execution.tasks;
import il.ac.bgu.cs.bp.bpjs.model.BEvent;
import il.ac.bgu.cs.bp.bpjs.model.BProgramSyncSnapshot;
import il.ac.bgu.cs.bp.bpjs.model.BThreadSyncSnapshot;
import org.mozilla.javascript.Context;
/**
* A task that resumes a BThread from a BSync operation.
*/
public class ResumeBThread extends BPEngineTask {
private final BEvent event;
public ResumeBThread(BProgramSyncSnapshot aBpss, BThreadSyncSnapshot aBThread, BEvent selectedEvent, BPEngineTask.Listener l) {
super(aBpss, aBThread, l);
event = selectedEvent;
}
@Override
void callImpl(Context jsContext) {
Object eventInJS = Context.javaToJS(event, btss.getScope());
jsContext.resumeContinuation(btss.getContinuation(), btss.getScope(), eventInJS);
}
@Override
public String toString() {
return String.format("[ResumeBThread: %s event:%s]", btss, event);
}
}