Search in sources :

Example 1 with FFXClient

use of ffx.ui.commands.FFXClient in project ffx by mjschnie.

the class TinkerSimulation method connect.

/**
 * <p>
 * connect</p>
 *
 * @return a boolean.
 */
public boolean connect() {
    if (isFinished()) {
        return false;
    }
    if (isConnected()) {
        return true;
    }
    // Create a timer to regularly wake up this TinkerSimulation.
    if (timer == null) {
        timer = new Timer(delay, this);
        timer.setCoalesce(true);
        timer.setDelay(10);
        timer.start();
    }
    // Create the FFXClient to monitor messages to/from TINKER.
    if (client == null) {
        client = new FFXClient(address);
    }
    // Try to connect.
    client.connect();
    // If connected, change to our "steady-state" timer delay.
    if (client.isConnected()) {
        timer.setDelay(delay);
        return true;
    }
    // the timer wakes up.
    return false;
}
Also used : Timer(javax.swing.Timer) FFXClient(ffx.ui.commands.FFXClient)

Aggregations

FFXClient (ffx.ui.commands.FFXClient)1 Timer (javax.swing.Timer)1