Search in sources :

Example 1 with BioNetGenUpdaterCallback

use of cbit.vcell.mapping.BioNetGenUpdaterCallback in project vcell by virtualcell.

the class CreateBNGOutputSpec method broadcastRun.

private void broadcastRun() {
    for (BioNetGenUpdaterCallback callback : bngService.getCallbacks()) {
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskStart, message);
        callback.setNewCallbackMessage(tcm);
    }
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) BioNetGenUpdaterCallback(cbit.vcell.mapping.BioNetGenUpdaterCallback)

Example 2 with BioNetGenUpdaterCallback

use of cbit.vcell.mapping.BioNetGenUpdaterCallback in project vcell by virtualcell.

the class ReturnBNGOutput method broadcastRun.

private void broadcastRun() {
    for (BioNetGenUpdaterCallback callback : bngService.getCallbacks()) {
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskStart, message);
        callback.setNewCallbackMessage(tcm);
    }
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) BioNetGenUpdaterCallback(cbit.vcell.mapping.BioNetGenUpdaterCallback)

Example 3 with BioNetGenUpdaterCallback

use of cbit.vcell.mapping.BioNetGenUpdaterCallback in project vcell by virtualcell.

the class ReturnBNGOutput method run.

public void run(Hashtable<String, Object> hashTable) throws Exception {
    if (!bngService.isStopped()) {
        broadcastRun();
    }
    BNGOutputSpec outputSpec = (BNGOutputSpec) hashTable.get("outputSpec");
    for (BioNetGenUpdaterCallback callback : bngService.getCallbacks()) {
        if (callback == owner) {
            // if it's called from the Edit / Test Constraints button we'll do it only after validation
            continue;
        }
        callback.updateBioNetGenOutput(outputSpec);
    }
    long endTime = System.currentTimeMillis();
    long delta = endTime - bngService.getStartTime();
    for (BioNetGenUpdaterCallback callback : bngService.getCallbacks()) {
        if (callback == owner) {
            continue;
        }
        String t = new DecimalFormat("#.#").format((double) delta / 1000);
        String s = "Total run time: " + t + " s.";
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, s);
        callback.setNewCallbackMessage(tcm);
        tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskEnd, "");
        callback.setNewCallbackMessage(tcm);
    }
    // asking the user to validate the new constraints we just tested; done only once
    if (sc != null && owner != null) {
        String t = new DecimalFormat("#.#").format((double) delta / 1000);
        String s = "Total run time: " + t + " s.";
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, s);
        owner.setNewCallbackMessage(tcm);
        if (sc.getNetworkConstraints().isTestConstraintsDifferent()) {
            // only if they changed
            tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskEndNotificationOnly, "");
            owner.setNewCallbackMessage(tcm);
            owner.updateLimitExceededWarnings(outputSpec);
            validateConstraints(outputSpec);
        } else {
            owner.updateLimitExceededWarnings(outputSpec);
            owner.updateOutputSpecToSimulationContext(outputSpec);
            tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskEnd, "");
            owner.setNewCallbackMessage(tcm);
            String string = "The Network constraints are unchanged.";
            tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, string);
            sc.firePropertyChange("appendToConsole", "", tcm);
            if (owner.getIssueManager() != null) {
                owner.getIssueManager().setDirty();
            }
            owner.refreshInterface();
        }
    }
// BNGOutputFileParser.printBNGNetOutput(outputSpec);			// prints all output to console
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) BioNetGenUpdaterCallback(cbit.vcell.mapping.BioNetGenUpdaterCallback) DecimalFormat(java.text.DecimalFormat) BNGOutputSpec(cbit.vcell.bionetgen.BNGOutputSpec)

Example 4 with BioNetGenUpdaterCallback

use of cbit.vcell.mapping.BioNetGenUpdaterCallback in project vcell by virtualcell.

the class RunBioNetGen method broadcastRun.

private void broadcastRun() {
    for (BioNetGenUpdaterCallback callback : bngService.getCallbacks()) {
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskStart, message);
        callback.setNewCallbackMessage(tcm);
    }
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) BioNetGenUpdaterCallback(cbit.vcell.mapping.BioNetGenUpdaterCallback)

Example 5 with BioNetGenUpdaterCallback

use of cbit.vcell.mapping.BioNetGenUpdaterCallback in project vcell by virtualcell.

the class BioNetGenExecutable method setNewOutputString.

@Override
protected void setNewOutputString(String newOutputString) {
    if (newOutputString != null) {
        for (BioNetGenUpdaterCallback callback : getCallbacks()) {
            TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Detail, newOutputString);
            callback.setNewCallbackMessage(tcm);
        }
    }
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) BioNetGenUpdaterCallback(cbit.vcell.mapping.BioNetGenUpdaterCallback)

Aggregations

BioNetGenUpdaterCallback (cbit.vcell.mapping.BioNetGenUpdaterCallback)6 TaskCallbackMessage (cbit.vcell.mapping.TaskCallbackMessage)6 BNGOutputSpec (cbit.vcell.bionetgen.BNGOutputSpec)1 DecimalFormat (java.text.DecimalFormat)1