本文整理匯總了Java中edu.mit.csail.sdg.alloy4.WorkerEngine.stop方法的典型用法代碼示例。如果您正苦於以下問題:Java WorkerEngine.stop方法的具體用法?Java WorkerEngine.stop怎麽用?Java WorkerEngine.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.mit.csail.sdg.alloy4.WorkerEngine
的用法示例。
在下文中一共展示了WorkerEngine.stop方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doStop
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** This method stops the current run or check (how==0 means DONE, how==1 means FAIL, how==2 means STOP). */
Runner doStop(Integer how) {
if (wrap) return wrapMe(how);
int h = how;
if (h!=0) {
if (h==2 && WorkerEngine.isBusy()) { WorkerEngine.stop(); log.logBold("\nSolving Stopped.\n"); log.logDivider(); }
WorkerEngine.stop();
}
runmenu.setEnabled(true);
runbutton.setVisible(true);
showbutton.setEnabled(true);
stopbutton.setVisible(false);
if (latestAutoInstance.length()>0) {
String f=latestAutoInstance;
latestAutoInstance="";
if (subrunningTask==2) viz.loadXML(f, true); else if (AutoVisualize.get() || subrunningTask==1) doVisualize("XML: "+f);
}
return null;
}
示例2: doQuit
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** This method performs File->Quit. */
public Runner doQuit() {
if (!wrap)
if (text.closeAll()) {
try {
WorkerEngine.stop();
} finally {
System.exit(0);
}
}
return wrapMe();
}
示例3: doStop
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/**
* This method stops the current run or check (how==0 means DONE, how==1
* means FAIL, how==2 means STOP).
*/
Runner doStop(Integer how) {
if (wrap)
return wrapMe(how);
int h = how;
if (h != 0) {
if (h == 2 && WorkerEngine.isBusy()) {
WorkerEngine.stop();
log.logBold("\nSolving Stopped.\n");
log.logDivider();
}
WorkerEngine.stop();
}
runmenu.setEnabled(true);
runbutton.setVisible(true);
showbutton.setEnabled(true);
stopbutton.setVisible(false);
if (latestAutoInstance.length() > 0) {
String f = latestAutoInstance;
latestAutoInstance = "";
if (subrunningTask == 2)
viz.loadXML(f, true);
else if (AutoVisualize.get() || subrunningTask == 1)
doVisualize("XML: " + f);
}
return null;
}
示例4: compute
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
public String compute(Object input) {
final String arg = (String) input;
OurUtil.show(frame);
if (WorkerEngine.isBusy())
throw new RuntimeException(
"Alloy4 is currently executing a SAT solver command. Please wait until that command has finished.");
SimpleCallback1 cb = new SimpleCallback1(SimpleGUI.this, viz, log, VerbosityPref.get().ordinal(),
latestAlloyVersionName, latestAlloyVersion);
SimpleTask2 task = new SimpleTask2();
task.filename = arg;
try {
WorkerEngine.run(task, SubMemory.get(), SubStack.get(), alloyHome() + fs + "binary", "", cb);
// task.run(cb);
} catch (Throwable ex) {
WorkerEngine.stop();
log.logBold("Fatal Error: Solver failed due to unknown reason.\n"
+ "One possible cause is that, in the Options menu, your specified\n"
+ "memory size is larger than the amount allowed by your OS.\n"
+ "Also, please make sure \"java\" is in your program path.\n");
log.logDivider();
log.flush();
doStop(2);
return arg;
}
subrunningTask = 2;
runmenu.setEnabled(false);
runbutton.setVisible(false);
showbutton.setEnabled(false);
stopbutton.setVisible(true);
return arg;
}
示例5: doQuit
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** This method performs File->Quit. */
private Runner doQuit() {
if (!wrap) if (text.closeAll()) {
try { WorkerEngine.stop(); } finally { System.exit(0); }
}
return wrapMe();
}
示例6: doRun
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** This method executes a particular RUN or CHECK command. */
private Runner doRun(Integer commandIndex) {
if (wrap)
return wrapMe(commandIndex);
final int index = commandIndex;
if (WorkerEngine.isBusy())
return null;
if (index == (-2))
subrunningTask = 1;
else
subrunningTask = 0;
latestAutoInstance = "";
if (index >= 0)
latestCommand = index;
if (index == -1 && commands != null) {
latestCommand = commands.size() - 1;
if (latestCommand < 0)
latestCommand = 0;
}
// To update the accelerator to point to the command actually chosen
doRefreshRun();
OurUtil.enableAll(runmenu);
if (commands == null)
return null;
if (commands.size() == 0 && index != -2 && index != -3) {
log.logRed("There are no commands to execute.\n\n");
return null;
}
int i = index;
if (i >= commands.size())
i = commands.size() - 1;
SimpleCallback1 cb = new SimpleCallback1(this, null, log, VerbosityPref.get().ordinal(), latestAlloyVersionName,
latestAlloyVersion);
SimpleTask1 task = new SimpleTask1();
A4Options opt = new A4Options();
opt.tempDirectory = alloyHome() + fs + "tmp";
opt.solverDirectory = alloyHome() + fs + "binary";
opt.recordKodkod = RecordKodkod.get();
opt.noOverflow = NoOverflow.get();
opt.unrolls = Version.experimental ? Unrolls.get() : (-1);
opt.skolemDepth = SkolemDepth.get();
opt.coreMinimization = CoreMinimization.get();
opt.inferPartialInstance = InferPartialInstance.get();
opt.coreGranularity = CoreGranularity.get();
opt.originalFilename = Util.canon(text.get().getFilename());
opt.solver = Solver.get();
task.bundleIndex = i;
task.bundleWarningNonFatal = WarningNonfatal.get();
task.map = text.takeSnapshot();
task.options = opt.dup();
task.resolutionMode = (Version.experimental && ImplicitThis.get()) ? 2 : 1;
task.tempdir = maketemp();
try {
runmenu.setEnabled(false);
runbutton.setVisible(false);
showbutton.setEnabled(false);
stopbutton.setVisible(true);
int newmem = SubMemory.get(), newstack = SubStack.get();
if (newmem != subMemoryNow || newstack != subStackNow)
WorkerEngine.stop();
if ("yes".equals(System.getProperty("debug")) && VerbosityPref.get() == Verbosity.FULLDEBUG)
WorkerEngine.runLocally(task, cb);
else
WorkerEngine.run(task, newmem, newstack, alloyHome() + fs + "binary", "", cb);
subMemoryNow = newmem;
subStackNow = newstack;
} catch (Throwable ex) {
WorkerEngine.stop();
log.logBold("Fatal Error: Solver failed due to unknown reason.\n"
+ "One possible cause is that, in the Options menu, your specified\n"
+ "memory size is larger than the amount allowed by your OS.\n"
+ "Also, please make sure \"java\" is in your program path.\n");
log.logDivider();
log.flush();
doStop(2);
}
return null;
}
示例7: doRun
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** This method executes a particular RUN or CHECK command. */
private Runner doRun(Integer commandIndex) {
if (wrap) return wrapMe(commandIndex);
final int index = commandIndex;
if (WorkerEngine.isBusy()) return null;
if (index==(-2)) subrunningTask=1; else subrunningTask=0;
latestAutoInstance="";
if (index>=0) latestCommand=index;
if (index==-1 && commands!=null) {
latestCommand=commands.size()-1;
if (latestCommand<0) latestCommand=0;
}
// To update the accelerator to point to the command actually chosen
doRefreshRun();
OurUtil.enableAll(runmenu);
if (commands==null) return null;
if (commands.size()==0 && index!=-2 && index!=-3) { log.logRed("There are no commands to execute.\n\n"); return null; }
int i=index;
if (i>=commands.size()) i=commands.size()-1;
SimpleCallback1 cb = new SimpleCallback1(this, null, log, Verbosity.get().ordinal(), latestAlloyVersionName, latestAlloyVersion);
SimpleTask1 task = new SimpleTask1();
A4Options opt = new A4Options();
opt.tempDirectory = alloyHome() + fs + "tmp";
opt.solverDirectory = alloyHome() + fs + "binary";
opt.recordKodkod = RecordKodkod.get();
opt.noOverflow = NoOverflow.get();
opt.unrolls = Version.experimental ? Unrolls.get() : (-1);
opt.skolemDepth = SkolemDepth.get();
opt.coreMinimization = CoreMinimization.get();
opt.coreGranularity = CoreGranularity.get();
opt.originalFilename = Util.canon(text.get().getFilename());
opt.solver = SatSolver.get();
task.bundleIndex = i;
task.bundleWarningNonFatal = WarningNonfatal.get();
task.map = text.takeSnapshot();
task.options = opt.dup();
task.resolutionMode = (Version.experimental && ImplicitThis.get()) ? 2 : 1;
task.tempdir = maketemp();
try {
runmenu.setEnabled(false);
runbutton.setVisible(false);
showbutton.setEnabled(false);
stopbutton.setVisible(true);
int newmem = SubMemory.get(), newstack = SubStack.get();
if (newmem != subMemoryNow || newstack != subStackNow) WorkerEngine.stop();
if ("yes".equals(System.getProperty("debug")) && Verbosity.get()==Verbosity.FULLDEBUG)
WorkerEngine.runLocally(task, cb);
else
WorkerEngine.run(task, newmem, newstack, alloyHome() + fs + "binary", "", cb);
subMemoryNow = newmem;
subStackNow = newstack;
} catch(Throwable ex) {
WorkerEngine.stop();
log.logBold("Fatal Error: Solver failed due to unknown reason.\n" +
"One possible cause is that, in the Options menu, your specified\n" +
"memory size is larger than the amount allowed by your OS.\n" +
"Also, please make sure \"java\" is in your program path.\n");
log.logDivider();
log.flush();
doStop(2);
}
return null;
}
示例8: SimpleGUI
import edu.mit.csail.sdg.alloy4.WorkerEngine; //導入方法依賴的package包/類
/** The constructor; this method will be called by the AWT event thread, using the "invokeLater" method. */
private SimpleGUI (final String[] args) {
// Register an exception handler for uncaught exceptions
MailBug.setup();
// Enable better look-and-feel
if (Util.onMac() || Util.onWindows()) {
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Alloy Analyzer "+Version.version());
System.setProperty("com.apple.mrj.application.growbox.intrudes","true");
System.setProperty("com.apple.mrj.application.live-resize","true");
System.setProperty("com.apple.macos.useScreenMenuBar","true");
System.setProperty("apple.laf.useScreenMenuBar","true");
try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { }
}
// Figure out the desired x, y, width, and height
int screenWidth=OurUtil.getScreenWidth(), screenHeight=OurUtil.getScreenHeight();
int width=AnalyzerWidth.get();
if (width<=0) width=screenWidth/10*8; else if (width<100) width=100;
if (width>screenWidth) width=screenWidth;
int height=AnalyzerHeight.get();
if (height<=0) height=screenHeight/10*8; else if (height<100) height=100;
if (height>screenHeight) height=screenHeight;
int x=AnalyzerX.get(); if (x<0) x=screenWidth/10; if (x>screenWidth-100) x=screenWidth-100;
int y=AnalyzerY.get(); if (y<0) y=screenHeight/10; if (y>screenHeight-100) y=screenHeight-100;
// Put up a slash screen
final JFrame frame = new JFrame("Alloy Analyzer");
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.pack();
if (!Util.onMac() && !Util.onWindows()) {
String gravity = System.getenv("_JAVA_AWT_WM_STATIC_GRAVITY");
if (gravity==null || gravity.length()==0) {
// many Window managers do not respect ICCCM2; this should help avoid the Title Bar being shifted "off screen"
if (x<30) { if (x<0) x=0; width=width-(30-x); x=30; }
if (y<30) { if (y<0) y=0; height=height-(30-y); y=30; }
}
if (width<100) width=100;
if (height<100) height=100;
}
frame.setSize(width,height);
frame.setLocation(x,y);
frame.setVisible(true);
frame.setTitle("Alloy Analyzer "+Version.version()+" loading... please wait...");
final int windowWidth = width;
// We intentionally call setVisible(true) first before settings the "please wait" title,
// since we want the minimized window title on Linux/FreeBSD to just say Alloy Analyzer
// Test the allowed memory sizes
final WorkerEngine.WorkerCallback c = new WorkerEngine.WorkerCallback() {
private final List<Integer> allowed = new ArrayList<Integer>();
private final List<Integer> toTry = new ArrayList<Integer>(Arrays.asList(256,512,768,1024,1536,2048,2560,3072,3584,4096));
private int mem;
public synchronized void callback(Object msg) {
if (toTry.size()==0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() { SimpleGUI.this.frame=frame; SimpleGUI.this.finishInit(args, allowed, windowWidth); }
});
return;
}
try { mem=toTry.remove(0); WorkerEngine.stop(); WorkerEngine.run(dummyTask, mem, 128, "", "", this); return; } catch(IOException ex) { fail(); }
}
public synchronized void done() {
//System.out.println("Alloy4 can use "+mem+"M"); System.out.flush();
allowed.add(mem);
callback(null);
}
public synchronized void fail() {
//System.out.println("Alloy4 cannot use "+mem+"M"); System.out.flush();
callback(null);
}
};
c.callback(null);
}