Search in sources :

Example 6 with ApplicationMessage

use of cbit.vcell.solvers.ApplicationMessage in project vcell by virtualcell.

the class GibsonSolver method propertyChange.

/**
 * Insert the method's description here.
 * Creation date: (10/11/2006 11:16:02 AM)
 */
public void propertyChange(java.beans.PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getSource() == getMathExecutable() && event.getPropertyName().equals("applicationMessage")) {
        String messageString = (String) event.getNewValue();
        if (messageString == null || messageString.length() == 0) {
            return;
        }
        ApplicationMessage appMessage = getApplicationMessage(messageString);
        if (appMessage != null && appMessage.getMessageType() == ApplicationMessage.PROGRESS_MESSAGE) {
            try {
                printToFile(appMessage.getProgress());
            } catch (IOException e) {
                e.printStackTrace(System.out);
            }
        }
    }
}
Also used : ApplicationMessage(cbit.vcell.solvers.ApplicationMessage) IOException(java.io.IOException)

Example 7 with ApplicationMessage

use of cbit.vcell.solvers.ApplicationMessage in project vcell by virtualcell.

the class SundialsSolver method getApplicationMessage.

/**
 * Insert the method's description here.
 * Creation date: (6/27/01 3:25:11 PM)
 * @return cbit.vcell.solvers.ApplicationMessage
 * @param message java.lang.String
 */
protected ApplicationMessage getApplicationMessage(String message) {
    // 
    if (message.startsWith(PROGRESS_PREFIX)) {
        String progressString = message.substring(message.lastIndexOf(SEPARATOR) + 1, message.indexOf("%"));
        double progress = Double.parseDouble(progressString) / 100.0;
        TimeBounds timeBounds = simTask.getSimulation().getSolverTaskDescription().getTimeBounds();
        double startTime = timeBounds.getStartingTime();
        double endTime = timeBounds.getEndingTime();
        setCurrentTime(startTime + (endTime - startTime) * progress);
        return new ApplicationMessage(ApplicationMessage.PROGRESS_MESSAGE, progress, -1, null, message);
    } else if (message.startsWith(DATA_PREFIX)) {
        double timepoint = Double.parseDouble(message.substring(message.lastIndexOf(SEPARATOR) + 1));
        setCurrentTime(timepoint);
        return new ApplicationMessage(ApplicationMessage.DATA_MESSAGE, getProgress(), timepoint, null, message);
    } else {
        throw new RuntimeException("unrecognized message");
    }
}
Also used : TimeBounds(cbit.vcell.solver.TimeBounds) ApplicationMessage(cbit.vcell.solvers.ApplicationMessage)

Example 8 with ApplicationMessage

use of cbit.vcell.solvers.ApplicationMessage in project vcell by virtualcell.

the class NFSimSolver method propertyChange.

/**
 * Insert the method's description here. Creation date: (10/11/2006 11:16:02
 * AM)
 */
public void propertyChange(java.beans.PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getSource() == getMathExecutable() && event.getPropertyName().equals("applicationMessage")) {
        String messageString = (String) event.getNewValue();
        if (messageString == null || messageString.length() == 0) {
            return;
        }
        ApplicationMessage appMessage = getApplicationMessage(messageString);
        if (appMessage != null && appMessage.getMessageType() == ApplicationMessage.PROGRESS_MESSAGE) {
            fireSolverPrinted(getCurrentTime());
        }
    }
}
Also used : ApplicationMessage(cbit.vcell.solvers.ApplicationMessage)

Example 9 with ApplicationMessage

use of cbit.vcell.solvers.ApplicationMessage in project vcell by virtualcell.

the class NFSimSolver method getApplicationMessage.

/**
 * show progress. Creation date: (7/13/2006 9:00:41 AM)
 *
 * @return cbit.vcell.solvers.ApplicationMessage
 * @param message
 *            java.lang.String
 */
protected ApplicationMessage getApplicationMessage(String message) {
    String SEPARATOR = ":";
    String DATA_PREFIX = "data:";
    String PROGRESS_PREFIX = "progress:";
    if (message.startsWith(DATA_PREFIX)) {
        double timepoint = Double.parseDouble(message.substring(message.lastIndexOf(SEPARATOR) + 1));
        setCurrentTime(timepoint);
        return new ApplicationMessage(ApplicationMessage.DATA_MESSAGE, getProgress(), timepoint, null, message);
    } else if (message.startsWith(PROGRESS_PREFIX)) {
        String progressString = message.substring(message.lastIndexOf(SEPARATOR) + 1, message.indexOf("%"));
        double progress = Double.parseDouble(progressString) / 100.0;
        // setCurrentTime(startTime + (endTime-startTime)*progress);
        return new ApplicationMessage(ApplicationMessage.PROGRESS_MESSAGE, progress, -1, null, message);
    } else {
        throw new RuntimeException("unrecognized message");
    }
}
Also used : ApplicationMessage(cbit.vcell.solvers.ApplicationMessage)

Example 10 with ApplicationMessage

use of cbit.vcell.solvers.ApplicationMessage in project vcell by virtualcell.

the class SmoldynSolver method propertyChange.

/**
 * Insert the method's description here.
 * Creation date: (10/11/2006 11:16:02 AM)
 */
public void propertyChange(java.beans.PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getSource() == getMathExecutable() && event.getPropertyName().equals("applicationMessage")) {
        String messageString = (String) event.getNewValue();
        if (messageString == null || messageString.length() == 0) {
            return;
        }
        ApplicationMessage appMessage = getApplicationMessage(messageString);
        if (appMessage != null && appMessage.getMessageType() == ApplicationMessage.PROGRESS_MESSAGE) {
            fireSolverPrinted(getCurrentTime());
        }
    }
}
Also used : ApplicationMessage(cbit.vcell.solvers.ApplicationMessage)

Aggregations

ApplicationMessage (cbit.vcell.solvers.ApplicationMessage)10 IOException (java.io.IOException)3 TimeBounds (cbit.vcell.solver.TimeBounds)1