Program: 75269
Project: 75269
Buggy source:
/** 
 * Return true if describing this class in MoML is redundant. This will return true if setPersistent() has been called with argument false, irrespective of other conditions. If setPersistent() has not been called, or has been called with argument true, then things are more complicated. If the <i>depth</i> argument is 0 or if this object is not derived, then this method returns false, indicating that MoML should be exported. Otherwise, whether to export MoML depends on whether the MoML specifies information that should be created by propagation rather than explicitly represented in MoML.  If this is a derived object, then whether its information can be created by propagation depends on whether the object from which that propagation would occur is included in the MoML, which depends on the <i>depth</i> argument. This method uses the <i>depth</i> argument to determine whether the exported MoML both contains an object that implies the existence of this object and contains an object that implies the value of this object.  If both conditions are satisfied, then it returns false.  Finally, if we haven't already returned false, then check all the contained objects, and if any of them requires a MoML description, then return false. Otherwise, return true.
 * @param depth The depth of the requested MoML.
 * @return Return true to suppress MoML export.
 */
protected boolean _isMoMLSuppressed(int depth){
  if (_isPersistent != null) {
    return !_isPersistent.booleanValue();
  }
  if (_derivedLevel > depth) {
    return false;
  }
  if (_override != null && _override.size() > depth + 1) {
    return false;
  }
  Iterator objects=containedObjectsIterator();
  while (objects.hasNext()) {
    NamedObj object=(NamedObj)objects.next();
    if (!object._isMoMLSuppressed(depth + 1)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if describing this class in MoML is redundant. This will return true if setPersistent() has been called with argument false, irrespective of other conditions. If setPersistent() has not been called, or has been called with argument true, then things are more complicated. If the <i>depth</i> argument is 0 or if this object is not derived, then this method returns false, indicating that MoML should be exported. Otherwise, whether to export MoML depends on whether the MoML specifies information that should be created by propagation rather than explicitly represented in MoML.  If this is a derived object, then whether its information can be created by propagation depends on whether the object from which that propagation would occur is included in the MoML, which depends on the <i>depth</i> argument. This method uses the <i>depth</i> argument to determine whether the exported MoML both contains an object that implies the existence of this object and contains an object that implies the value of this object.  If both conditions are satisfied, then it returns false.  Finally, if we haven't already returned false, then check all the contained objects, and if any of them requires a MoML description, then return false. Otherwise, return true.
 * @param depth The depth of the requested MoML.
 * @return Return true to suppress MoML export.
 */
protected boolean _isMoMLSuppressed(int depth){
  if (_isPersistent != null) {
    return !_isPersistent.booleanValue();
  }
  if (_derivedLevel > depth) {
    return false;
  }
  if (_override != null) {
    if (_override.size() > depth + 1) {
      return false;
    }
    if (_override.size() == 1 && ((Integer)_override.get(0)).intValue() == 0) {
      return false;
    }
  }
  Iterator objects=containedObjectsIterator();
  while (objects.hasNext()) {
    NamedObj object=(NamedObj)objects.next();
    if (!object._isMoMLSuppressed(depth + 1)) {
      return false;
    }
  }
  return true;
}