/* * (non-Javadoc) * * @see * uk.ac.hutton.obiama.model.AbstractScheduledActivity#synchroniseWith(uk * .ac.hutton.obiama.model.AbstractScheduledActivity) */ @Override public void synchroniseWith(AbstractScheduledAction event) throws ScheduleException { if (!isTimed()) { throw new ScheduleException( this, "Non-timed action sequence cannot be synchronised with " + event.getURI()); } super.synchroniseWith(event); }
/** * Constructor for timed sequences * * @param msb the model state broker * @param actionURI the URI of the action sequence in the schedule ontology * @param firstAction the first action in the sequence * @param time the time at which the sequence starts * @param increment the time gap between consecutive members of the sequence * @throws ScheduleException */ public SequentialActionGroup( ModelStateBroker msb, URI actionURI, AbstractScheduledAction firstAction, double time, double increment) throws ScheduleException { super(msb, actionURI, time); init(firstAction); if (increment <= 0.0 || Double.isNaN(increment) || Double.isInfinite(increment)) { throw new ScheduleException( actionURI, "non-positive, infinite, or not-a-number increment: " + increment); } this.increment = increment; firstAction.synchroniseWith(this); }
/** * * <!-- synchroniseWith --> * Synchronise two sequences. They must have the same start time and increment. * * @param event the sequence to synchronise with * @throws ScheduleException */ public void synchroniseWith(SequentialActionGroup event) throws ScheduleException { boolean wasTimed = isTimed(); super.synchroniseWith(event); if (!wasTimed && event.isTimed()) { this.increment = event.increment; } else if (this.increment != event.increment) { throw new ScheduleException( this, "(time " + time + ", increment" + increment + ") cannot be synchronised with " + event.getURI() + " (time " + event.time + ", increment " + event.increment + ")"); } }