private final int $ASSIGN$_tentativeInputPosition(int newValue) { if ($CHECKPOINT != null && $CHECKPOINT.getTimestamp() > 0) { $RECORD$_tentativeInputPosition.add( null, _tentativeInputPosition, $CHECKPOINT.getTimestamp()); } return _tentativeInputPosition = newValue; }
public final Object $SET$CHECKPOINT(Checkpoint checkpoint) { if ($CHECKPOINT != checkpoint) { Checkpoint oldCheckpoint = $CHECKPOINT; if (checkpoint != null) { $RECORD$$CHECKPOINT.add($CHECKPOINT, checkpoint.getTimestamp()); FieldRecord.pushState($RECORDS); } $CHECKPOINT = checkpoint; oldCheckpoint.setCheckpoint(checkpoint); checkpoint.addObject(this); } return this; }
/** Record the current state of all the actors in this composite actor. */ public void markState() { Set<Checkpoint> checkpoints = new HashSet<Checkpoint>(); Iterator objectsIter = containedObjectsIterator(); while (objectsIter.hasNext()) { Object object = objectsIter.next(); if (object instanceof Rollbackable) { Rollbackable rollbackObject = (Rollbackable) object; Checkpoint checkpoint = rollbackObject.$GET$CHECKPOINT(); if (!checkpoints.contains(checkpoint)) { // FIXME: older states should be discarded. checkpoint.createCheckpoint(); checkpoints.add(checkpoint); } } } }
private final int $ASSIGN$SPECIAL$_tentativeInputPosition(int operator, long newValue) { if ($CHECKPOINT != null && $CHECKPOINT.getTimestamp() > 0) { $RECORD$_tentativeInputPosition.add( null, _tentativeInputPosition, $CHECKPOINT.getTimestamp()); } switch (operator) { case 0: return _tentativeInputPosition += newValue; case 1: return _tentativeInputPosition -= newValue; case 2: return _tentativeInputPosition *= newValue; case 3: return _tentativeInputPosition /= newValue; case 4: return _tentativeInputPosition &= newValue; case 5: return _tentativeInputPosition |= newValue; case 6: return _tentativeInputPosition ^= newValue; case 7: return _tentativeInputPosition %= newValue; case 8: return _tentativeInputPosition <<= newValue; case 9: return _tentativeInputPosition >>= newValue; case 10: return _tentativeInputPosition >>>= newValue; case 11: return _tentativeInputPosition++; case 12: return _tentativeInputPosition--; case 13: return ++_tentativeInputPosition; case 14: return --_tentativeInputPosition; default: return _tentativeInputPosition; } }
/** * Restore the previously recorded state to all the actors in this composite actor. * * @exception IllegalActionException Not thowned. */ public void goToMarkedState() throws IllegalActionException { Set<Checkpoint> checkpoints = new HashSet<Checkpoint>(); Iterator objectsIter = containedObjectsIterator(); while (objectsIter.hasNext()) { Object object = objectsIter.next(); if (object instanceof Rollbackable) { Rollbackable rollbackObject = (Rollbackable) object; Checkpoint checkpoint = rollbackObject.$GET$CHECKPOINT(); if (!checkpoints.contains(checkpoint)) { // Rollback with the current timestamp. // States taken at the time when the timestamp is created // are restored to the actors managed by this checkpoint // object. checkpoint.rollback(checkpoint.getTimestamp(), true); checkpoints.add(checkpoint); } } } }
private final IOPort $ASSIGN$_port(IOPort newValue) { if ($CHECKPOINT != null && $CHECKPOINT.getTimestamp() > 0) { $RECORD$_port.add(null, _port, $CHECKPOINT.getTimestamp()); } return _port = newValue; }