/* * (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); }
/** * * <!-- addAction --> * Add an action to the sequence * * @param action * @throws ScheduleException */ public void addAction(AbstractScheduledAction action) throws ScheduleException { if (isTimed()) { action.setTime(time + (actionSequence.size() * increment)); } else if (action.isTimed()) { throw new ScheduleException( this, "Cannot add timed action " + action.getURI() + " to non-timed sequence"); } actionSequence.addLast(action); }
/** * Constructor * * @param msb the model state broker * @param actionURI the URI of the action sequence in the schedule ontology * @param assertedNonTimed <code>true</code> if the action is asserted non-timed * @param firstAction the first action in the sequence * @throws ScheduleException */ public SequentialActionGroup( ModelStateBroker msb, URI actionURI, boolean assertedNonTimed, AbstractScheduledAction firstAction) throws ScheduleException { super(msb, actionURI, assertedNonTimed); init(firstAction); increment = null; if (firstAction instanceof SequentialActionGroup) { synchroniseWith(firstAction); } else if (firstAction.isTimed()) { throw new ScheduleException( actionURI, "Non-timed action sequence with timed sub-action " + firstAction.getURI()); } }