Example #1
0
 private final int $ASSIGN$_tentativeInputPosition(int newValue) {
   if ($CHECKPOINT != null && $CHECKPOINT.getTimestamp() > 0) {
     $RECORD$_tentativeInputPosition.add(
         null, _tentativeInputPosition, $CHECKPOINT.getTimestamp());
   }
   return _tentativeInputPosition = newValue;
 }
Example #2
0
 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;
 }
Example #3
0
  /** 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);
        }
      }
    }
  }
Example #4
0
 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;
   }
 }
Example #5
0
  /**
   * 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);
        }
      }
    }
  }
Example #6
0
 private final IOPort $ASSIGN$_port(IOPort newValue) {
   if ($CHECKPOINT != null && $CHECKPOINT.getTimestamp() > 0) {
     $RECORD$_port.add(null, _port, $CHECKPOINT.getTimestamp());
   }
   return _port = newValue;
 }