Program: 73449
Project: 73449
Buggy source:
/** 
 * Given a platform physical tag, get the corresonding oracle physical tag. This assumes there's a one-to-one mapping from the platform's tag to the oracle tag, and vise versa. We also assume the platform tag to be continuous. If the platform time of interest is less than the last saved platform time of the corresponding clock, throw an exception.
 * @param platformTag The platform timestamp and microstep.
 * @param clockId The ID of the corresponding platform clock.
 * @return The oracle tag associated with the platform tag. Returns nullif the platform time of interest is less than the last saved platform time of the corresponding clock.
 * @exception IllegalActionException If the clock ID is not recognized.
 */
protected Time _getOraclePhysicalTimeForPlatformPhysicalTime(Time platformTime,int clockId) throws IllegalActionException {
  RealTimeClock realTimeClock;
  if (clockId == EXECUTION_TIMER) {
    realTimeClock=_executionTimeClock;
  }
 else   if (clockId == PLATFORM_TIMER) {
    realTimeClock=_platformTimeClock;
  }
 else {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Time timeDifference=platformTime.subtract(realTimeClock._lastPlatformTime);
  if (timeDifference.compareTo(_zero) < 0) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
  if (realTimeClock._clockDrift.equals(_zero)) {
    return (realTimeClock._lastOracleTime.subtract(realTimeClock._lastPlatformTime)).add(platformTime);
  }
  return (timeDifference.divide(realTimeClock._clockDrift)).add(realTimeClock._lastOracleTime);
}

Fixed version (ground truth):
/** 
 * Given a platform physical tag, get the corresonding oracle physical tag. This assumes there's a one-to-one mapping from the platform's tag to the oracle tag, and vise versa. We also assume the platform tag to be continuous. If the platform time of interest is less than the last saved platform time of the corresponding clock, throw an exception.
 * @param platformTime The platform timestamp.
 * @param clockId The ID of the corresponding platform clock.
 * @return The oracle tag associated with the platform tag. Returns nullif the platform time of interest is less than the last saved platform time of the corresponding clock.
 * @exception IllegalActionException If the clock ID is not recognized.
 */
protected Time _getOraclePhysicalTimeForPlatformPhysicalTime(Time platformTime,int clockId) throws IllegalActionException {
  RealTimeClock realTimeClock;
  if (clockId == EXECUTION_TIMER) {
    realTimeClock=_executionTimeClock;
  }
 else   if (clockId == PLATFORM_TIMER) {
    realTimeClock=_platformTimeClock;
  }
 else {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Time timeDifference=platformTime.subtract(realTimeClock._lastPlatformTime);
  if (timeDifference.compareTo(_zero) < 0) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
  if (realTimeClock._clockDrift.equals(_zero)) {
    return (realTimeClock._lastOracleTime.subtract(realTimeClock._lastPlatformTime)).add(platformTime);
  }
  return (timeDifference.divide(realTimeClock._clockDrift)).add(realTimeClock._lastOracleTime);
}