Introducing Spin 6 - Sensitivity

Posted in spin

Processes are driven by time and/or sensitivity. Default sensitivity allows to trigger a process when a port has changed or modified its value. By deriving the default sensitivity class, the developer can define more concrete conditions when to trigger a certain process.

Default Sensitivity

Default sensitivity can be used with connectors of type IInPort (changed) and IPort (modified).

@Override
public void initialize() {
	sensitive(in1.changed());
}

Extended Sensitivity

By deriving the class Sensitivity, the developer can define special conditions, when to fire the process.

Sensitivity<Integer> s2 = new Sensitivity<Integer>(in2, null) {

	@Override
	public void onChanged(Integer current, Integer previous) {
		if (isEnabled()) {
			if (current > 100)
				fire();
		}
	}
};

Print

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive