nus-yam/ex-repair huggingface dataset:
Program: 73477
Project: 73477
Buggy source:
/** 
 * Create an instance of OntologyGraphTableau for the specified effigy, if it is an effigy for an instance of FSMActor.
 * @param effigy The effigy for an FSMActor.
 * @return A new OntologyGraphTableau, if the effigy is a PtolemyEffigythat references an FSMActor, or null otherwise.
 * @exception Exception If an exception occurs when creating thetableau.
 */
public Tableau createTableau(Effigy effigy) throws Exception {
  if (!(effigy instanceof PtolemyEffigy)) {
    return null;
  }
  Tableau tableau=(Tableau)effigy.getEntity("String_Node_Str");
  if (tableau != null) {
    return tableau;
  }
  NamedObj model=((PtolemyEffigy)effigy).getModel();
  if (model instanceof OntologySolverModel) {
    LibraryAttribute library=(LibraryAttribute)getAttribute("String_Node_Str",LibraryAttribute.class);
    tableau=new OntologySolverTableau((PtolemyEffigy)effigy,"String_Node_Str",library);
    return tableau;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Create an instance of OntologyGraphTableau for the specified effigy, if it is an effigy for an instance of OntologySolverModel.
 * @param effigy The effigy for an OntologySolverModel.
 * @return A new OntologySolverTableau, if the effigy is a PtolemyEffigythat references an OntologySolverModel, or null otherwise.
 * @exception Exception If an exception occurs when creating thetableau.
 */
public Tableau createTableau(Effigy effigy) throws Exception {
  if (!(effigy instanceof PtolemyEffigy)) {
    return null;
  }
  Tableau tableau=(Tableau)effigy.getEntity("String_Node_Str");
  if (tableau != null) {
    return tableau;
  }
  NamedObj model=((PtolemyEffigy)effigy).getModel();
  if (model instanceof OntologySolverModel) {
    LibraryAttribute library=(LibraryAttribute)getAttribute("String_Node_Str",LibraryAttribute.class);
    tableau=new OntologySolverTableau((PtolemyEffigy)effigy,"String_Node_Str",library);
    return tableau;
  }
 else {
    return null;
  }
}
Program: 73478
Project: 73478
Buggy source:
/** 
 * Create the graph frame that displays the model associated with this tableau together with the specified library. This method creates a FSMGraphFrame. If a subclass uses another frame, this method should be overridden to create that frame.
 * @param model The Ptolemy II model to display in the graph frame.
 * @param defaultLibrary The default library, or null to not specifyone.
 */
public void createGraphFrame(CompositeEntity model,LibraryAttribute defaultLibrary){
  ExtendedGraphFrame frame=new ActorGraphFrame(model,this,defaultLibrary);
  try {
    setFrame(frame);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex);
  }
  frame.setBackground(BACKGROUND_COLOR);
  frame.pack();
  frame.centerOnScreen();
  frame.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Create the graph frame that displays the model associated with this tableau together with the specified library.
 * @param model The Ptolemy II model to display in the graph frame.
 * @param defaultLibrary The default library, or null to not specifyone.
 */
public void createGraphFrame(CompositeEntity model,LibraryAttribute defaultLibrary){
  ExtendedGraphFrame frame=new ActorGraphFrame(model,this,defaultLibrary);
  try {
    setFrame(frame);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException(ex);
  }
  frame.setBackground(BACKGROUND_COLOR);
  frame.pack();
  frame.centerOnScreen();
  frame.setVisible(true);
}
Program: 73479
Project: 73479
Buggy source:
/** 
 * Create a new FSM editor tableau with the specified container, name, and default library.
 * @param container The container.
 * @param name The name.
 * @param defaultLibrary The default library, or null to not specify one.
 * @exception IllegalActionException If the model associated withthe container effigy is not an FSMActor.
 * @exception NameDuplicationException If the container alreadycontains an object with the specified name.
 */
public OntologySolverTableau(PtolemyEffigy container,String name,LibraryAttribute defaultLibrary) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  NamedObj model=container.getModel();
  if (!(model instanceof OntologySolverModel)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  createGraphFrame((OntologySolverModel)model,defaultLibrary);
}

Fixed version (ground truth):
/** 
 * Create a new OntologySolverModel tableau with the specified container, name, and default library.
 * @param container The container.
 * @param name The name.
 * @param defaultLibrary The default library, or null to not specify one.
 * @exception IllegalActionException If the model associated withthe container effigy is not an OntologySolverModel.
 * @exception NameDuplicationException If the container alreadycontains an object with the specified name.
 */
public OntologySolverTableau(PtolemyEffigy container,String name,LibraryAttribute defaultLibrary) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  NamedObj model=container.getModel();
  if (!(model instanceof OntologySolverModel)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  createGraphFrame((OntologySolverModel)model,defaultLibrary);
}
Program: 73482
Project: 73482
Buggy source:
/** 
 * Construct a structure that holds a real-time event. This event saves the token to be transmitted, the port and channel this token should be deliverd to, and the time this token should be delivered at.
 * @param port The destination port.
 * @param channel The destination channel.
 * @param token The token to be delivered.
 * @param deliveryTag The time of delivery of this token.
 */
public RealTimeEvent(IOPort port,int channel,Token token,Tag deliveryTag,Tag timestampTag){
  this.port=port;
  this.channel=channel;
  this.token=token;
  this.deliveryTag=deliveryTag;
  this.timestampTag=timestampTag;
}

Fixed version (ground truth):
/** 
 * Construct a structure that holds a real-time event. This event saves the token to be transmitted, the port and channel this token should be deliverd to, and the time this token should be delivered at.
 * @param port The destination port.
 * @param channel The destination channel.
 * @param token The token to be delivered.
 * @param deliveryTag The platform time of delivery of this token.
 */
public RealTimeEvent(IOPort port,int channel,Token token,Tag deliveryTag,Tag timestampTag){
  this.port=port;
  this.channel=channel;
  this.token=token;
  this.deliveryTag=deliveryTag;
  this.timestampTag=timestampTag;
}
Program: 73483
Project: 73483
Buggy source:
/** 
 * Check if timed interrupt has just occurred.
 * @return true if a timed interrupt has occured. Return false otherwise. 
 * @exception IllegalActionException If failed to get physical tag or if timeinterrupt occurred in the past. 
 */
private boolean _timedInterruptOccurred() throws IllegalActionException {
  if (_timedInterruptWakeUpTimes.isEmpty()) {
    return false;
  }
  Time topTimedInterruptWakeUpTime=_timedInterruptWakeUpTimes.get(0);
  int result=topTimedInterruptWakeUpTime.compareTo(getPlatformPhysicalTag(PLATFORM_TIMER).timestamp);
  if (result < 0) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + topTimedInterruptWakeUpTime.toString() + "String_Node_Str"+ getPlatformPhysicalTag(PLATFORM_TIMER).timestamp+ "String_Node_Str");
  }
 else   if (result == 0) {
    _timedInterruptWakeUpTimes.remove(0);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if timed interrupt has just occurred.
 * @return true if a timed interrupt has occured. Return false otherwise. 
 * @exception IllegalActionException If failed to get physical tag or if timeinterrupt occurred in the past. 
 */
private boolean _timedInterruptOccurred() throws IllegalActionException {
  if (_timedInterruptTimes.isEmpty()) {
    return false;
  }
  TimedEvent timedEvent=_timedInterruptTimes.get(0);
  Time topTimedInterruptWakeUpTime=timedEvent.timeStamp;
  int result=topTimedInterruptWakeUpTime.compareTo(getPlatformPhysicalTag(PLATFORM_TIMER).timestamp);
  if (result < 0) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + topTimedInterruptWakeUpTime.toString() + "String_Node_Str"+ getPlatformPhysicalTag(PLATFORM_TIMER).timestamp+ "String_Node_Str");
  }
 else   if (result == 0) {
    _timedInterruptTimes.remove(0);
    _eventsWithTimedInterrupt.remove(timedEvent.contents);
    return true;
  }
  return false;
}
Program: 73485
Project: 73485
Buggy source:
/** 
 * Construct a real time clock, with all the times and clock drifts set to default values: All clock drifts are initialized to Time 1.0, and the oracle time is initialized to Time 0.0. However the corresponding platform is intialized to the initialClockSynchronizationError paramter.
 */
public RealTimeClock(double initialClockSynchronizationError) throws IllegalActionException {
  _lastPlatformTime=new Time(PtidesBasicDirector.this,initialClockSynchronizationError);
  _clockDrift=new Time(PtidesBasicDirector.this,1.0);
  _previousClockDrift=new Time(PtidesBasicDirector.this,1.0);
  _lastOracleTime=new Time(PtidesBasicDirector.this);
}

Fixed version (ground truth):
/** 
 * Construct a real time clock, with all the times and clock drifts set to default values: All clock drifts are initialized to Time 1.0, and the oracle time is initialized to Time 0.0. However the corresponding platform is intialized to the initialClockSynchronizationError paramter.
 */
public RealTimeClock(double initialClockSynchronizationError) throws IllegalActionException {
  _lastPlatformTime=new Time(PtidesBasicDirector.this,initialClockSynchronizationError);
  _clockDrift=new Time(PtidesBasicDirector.this,1.0);
  _lastOracleTime=new Time(PtidesBasicDirector.this);
}
Program: 73488
Project: 73488
Buggy source:
/** 
 * Return the concept from the given subset of concepts that is the least or greatest.
 * @param subset The set of concepts in question. 
 * @param direction The directionality of the extremity. CPO.HIGHERfor greatest, and CPO.LOWER for least.
 * @return The concept at the extremity, if it exists. Null, if nosuch concept exists.
 */
private Concept _superlativeElement(Object[] subset,int direction){
  if (subset != null && subset.length > 0) {
    Concept greatest=(Concept)subset[0];
    for (    Object concept : subset) {
      if (compare(concept,greatest) == direction) {
        greatest=(Concept)concept;
      }
    }
    return greatest;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the concept from the given subset of concepts that is the least or greatest.
 * @param subset The set of concepts in question. 
 * @param direction The directionality of the extremity. CPO.HIGHERfor greatest, and CPO.LOWER for least.
 * @return The concept at the extremity, if it exists. Null, if nosuch concept exists.
 */
private Concept _superlativeElement(Object[] subset,int direction){
  if (subset != null && subset.length > 0) {
    Concept greatest=(Concept)subset[0];
    for (    Object concept : subset) {
      if (compare(concept,greatest) == CPO.INCOMPARABLE) {
        return null;
      }
 else       if (compare(concept,greatest) == direction) {
        greatest=(Concept)concept;
      }
    }
    return greatest;
  }
  return null;
}
Program: 73489
Project: 73489
Buggy source:
/** 
 * Return the size of the collection mapped to the specified key.
 * @param key The specified key.
 * @return The size of the collection, or zero if key isnot in the map.
 */
public int size(Object key){
  Collection values=_map.get(key);
  if (values == null) {
    return 0;
  }
 else {
    return values.size();
  }
}

Fixed version (ground truth):
/** 
 * Return the size of the collection mapped to the specified key.
 * @param key The specified key.
 * @return The size of the collection, or zero if key isnot in the map.
 */
public int size(Object key){
  Collection<V> values=_map.get(key);
  if (values == null) {
    return 0;
  }
 else {
    return values.size();
  }
}
Program: 73490
Project: 73490
Buggy source:
/** 
 * Return a view of the collection containing all values in the map. This is a collection containing the union of each collection mapped to the keys.
 * @return A view of all values contained in this map.
 */
public Collection values(){
  Collection result=new ArrayList();
  for (  Object object : _map.values()) {
    Collection values=(Collection)object;
    result.addAll(values);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return a view of the collection containing all values in the map. This is a collection containing the union of each collection mapped to the keys.
 * @return A view of all values contained in this map.
 */
public Collection<V> values(){
  Collection<V> result=new ArrayList<V>();
  for (  Collection<V> values : _map.values()) {
    result.addAll(values);
  }
  return result;
}
Program: 73491
Project: 73491
Buggy source:
/** 
 * Remove a specified value from the map. The value is removed from the collection mapped to the specified key. If this is the last value removed from the given key, the specified key is also removed from the map. Subsequent call to get(key) will return null.
 * @param key The specified key to remove the value from.
 * @param value The specified value to remove.
 * @return The value removed, or null if nothing is removed.
 */
public Object remove(K key,V value){
  Collection values=_map.get(key);
  if (values == null) {
    return null;
  }
 else {
    Object object=values.remove(value);
    if (values.size() == 0) {
      _map.remove(key);
    }
    return object;
  }
}

Fixed version (ground truth):
/** 
 * Remove a specified value from the map. The value is removed from the collection mapped to the specified key. If this is the last value removed from the given key, the specified key is also removed from the map. Subsequent call to get(key) will return null.
 * @param key The specified key to remove the value from.
 * @param value The specified value to remove.
 * @return The value removed, or null if nothing is removed.
 */
public Object remove(K key,V value){
  Collection<V> values=_map.get(key);
  if (values == null) {
    return null;
  }
 else {
    Object object=values.remove(value);
    if (values.size() == 0) {
      _map.remove(key);
    }
    return object;
  }
}
Program: 73492
Project: 73492
Buggy source:
/** 
 * Create a new function for inferring the monotonicity concept over a relational node, given the operator at the node, the monotonicity ontology.
 * @param operator Token for the operator at this node.
 * @param monotonicityOntology The monotonicity ontology.
 * @throws IllegalActionException If a function cannot be created.
 */
public ASTPtRelationalNodeFunction(ptolemy.data.expr.Token operator,Ontology monotonicityOntology,Ontology domainOntology) throws IllegalActionException {
  super("String_Node_Str",2,monotonicityOntology,domainOntology);
  _operator=operator.toString();
}

Fixed version (ground truth):
/** 
 * Create a new function for inferring the monotonicity concept over a relational node, given the operator at the node, the monotonicity ontology.
 * @param operator Token for the operator at this node.
 * @param monotonicityOntology The monotonicity ontology.
 * @param domainOntology The ontology over which the expressioncontaining this relational node is defined.
 * @throws IllegalActionException If a function cannot be created.
 */
public ASTPtRelationalNodeFunction(ptolemy.data.expr.Token operator,Ontology monotonicityOntology,Ontology domainOntology) throws IllegalActionException {
  super("String_Node_Str",2,monotonicityOntology,domainOntology);
  _operator=operator.toString();
}
Program: 73493
Project: 73493
Buggy source:
/** 
 * Convert the argument token into a RecordToken having this type, if lossless conversion can be done.  The argument must be an RecordToken, and its type must be a subtype of this record type.  The argument token must have at least the fields of this type.  Extra fields in the argument token that are not in this type are removed.
 * @param token A token.
 * @return An RecordToken.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token token) throws IllegalActionException {
  if (!isCompatible(token.getType())) {
    throw new IllegalArgumentException(Token.notSupportedConversionMessage(token,this.toString()));
  }
  RecordToken recordToken=(RecordToken)token;
  Object[] labelArray=recordToken.labelSet().toArray();
  String[] labelStringArray=new String[labelArray.length];
  Token[] values=new Token[labelArray.length];
  for (int i=0; i < labelArray.length; i++) {
    String label=(String)labelArray[i];
    Token fieldToken=recordToken.get(label);
    Type newFieldType=get(label);
    if (newFieldType != null) {
      values[i]=newFieldType.convert(fieldToken);
    }
 else {
      values[i]=fieldToken;
    }
    labelStringArray[i]=label;
  }
  return new RecordToken(labelStringArray,values);
}

Fixed version (ground truth):
/** 
 * Convert the argument token into a RecordToken having this type, if lossless conversion can be done.  The argument must be a RecordToken, and its type must be a subtype of this record type.  The argument token must have at least the fields of this type.  Extra fields in the argument token that are not in this type are removed.
 * @param token A token.
 * @return An RecordToken.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token token) throws IllegalActionException {
  if (!isCompatible(token.getType())) {
    throw new IllegalArgumentException(Token.notSupportedConversionMessage(token,this.toString()));
  }
  RecordToken recordToken=(RecordToken)token;
  Object[] labelArray=recordToken.labelSet().toArray();
  String[] labelStringArray=new String[labelArray.length];
  Token[] values=new Token[labelArray.length];
  for (int i=0; i < labelArray.length; i++) {
    String label=(String)labelArray[i];
    Token fieldToken=recordToken.get(label);
    Type newFieldType=get(label);
    if (newFieldType != null) {
      values[i]=newFieldType.convert(fieldToken);
    }
 else {
      values[i]=fieldToken;
    }
    labelStringArray[i]=label;
  }
  if (recordToken instanceof OrderedRecordToken) {
    return new OrderedRecordToken(labelStringArray,values);
  }
 else {
    return new RecordToken(labelStringArray,values);
  }
}
Program: 73494
Project: 73494
Buggy source:
/** 
 * Return the value of this token as a string. The syntax is similar to the ML record: <code>{<i>label</i> = <i>value</i>, <i>label</i> = <i>value</i>, ...}</code> The record fields are listed in the their original order
 * @return A String beginning with "{" that contains label and valuepairs separated by commas, ending with "}".
 */
public String toString(){
  Object[] labelsObjects=_fields.keySet().toArray();
  StringBuffer stringRepresentation=new StringBuffer("String_Node_Str");
  int size=labelsObjects.length;
  for (int i=0; i < size; i++) {
    String label=(String)labelsObjects[i];
    String value=get(label).toString();
    if (i != 0) {
      stringRepresentation.append("String_Node_Str");
    }
    stringRepresentation.append(label + "String_Node_Str" + value);
  }
  return stringRepresentation.toString() + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return the value of this token as a string. The syntax is similar to that of a record, but using square braces instead of curly braces, <code>[<i>label</i> = <i>value</i>, <i>label</i> = <i>value</i>, ...]</code> The record fields are listed in the their original order
 * @return A String beginning with "[" that contains label and valuepairs separated by commas, ending with "]".
 */
public String toString(){
  Object[] labelsObjects=_fields.keySet().toArray();
  StringBuffer stringRepresentation=new StringBuffer("String_Node_Str");
  int size=labelsObjects.length;
  for (int i=0; i < size; i++) {
    String label=(String)labelsObjects[i];
    String value=get(label).toString();
    if (i != 0) {
      stringRepresentation.append("String_Node_Str");
    }
    stringRepresentation.append(label + "String_Node_Str" + value);
  }
  return stringRepresentation.toString() + "String_Node_Str";
}
Program: 73495
Project: 73495
Buggy source:
/** 
 * Compare two concepts in the ontology. The arguments must be instances of   {@link Concept}, otherwise an exception will be thrown. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the first argument is lower than, equal to, higher than, or incomparable with the second argument in the property hierarchy, respectively.
 * @param e1 An instance of {@link Concept}.
 * @param e2 An instance of {@link Concept}.
 * @return One of CPO.LOWER, CPO.SAME, CPO.HIGHER, CPO.INCOMPARABLE.
 * @exception IllegalArgumentException If one or both arguments are notinstances of  {@link Concept}.
 */
public int compare(Object e1,Object e2){
  if (!(e1 instanceof Concept) || !(e2 instanceof Concept)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + e1 + "String_Node_Str"+ e2);
  }
  if ((e1 instanceof FiniteConcept) && (e2 instanceof FiniteConcept)) {
    return _dag.compare(e1,e2);
  }
 else   if (e1 instanceof InfiniteConcept) {
    try {
      return ((InfiniteConcept)e1).compare((Concept)e2);
    }
 catch (    IllegalActionException e) {
      return CPO.INCOMPARABLE;
    }
  }
 else {
    try {
      int oppositeResult=((InfiniteConcept)e2).compare((Concept)e1);
      return DirectedAcyclicGraph.reverseCompareCode(oppositeResult);
    }
 catch (    IllegalActionException e) {
      return CPO.INCOMPARABLE;
    }
  }
}

Fixed version (ground truth):
/** 
 * Compare two concepts in the ontology. The arguments must be instances of   {@link Concept}, otherwise an exception will be thrown. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the first argument is lower than, equal to, higher than, or incomparable with the second argument in the property hierarchy, respectively.
 * @param e1 An instance of {@link Concept}.
 * @param e2 An instance of {@link Concept}.
 * @return One of CPO.LOWER, CPO.SAME, CPO.HIGHER, CPO.INCOMPARABLE.
 * @exception IllegalArgumentException If one or both arguments are notinstances of  {@link Concept}.
 */
public int compare(Object e1,Object e2){
  if (!(e1 instanceof Concept) || !(e2 instanceof Concept)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + e1 + "String_Node_Str"+ e2);
  }
  if ((e1 instanceof FiniteConcept) && (e2 instanceof FiniteConcept)) {
    return _dag.compare(e1,e2);
  }
 else   if (e1 instanceof InfiniteConcept) {
    try {
      return ((InfiniteConcept)e1).compare((Concept)e2);
    }
 catch (    IllegalActionException e) {
      return CPO.INCOMPARABLE;
    }
  }
 else   if (e2 instanceof InfiniteConcept) {
    try {
      int oppositeResult=((InfiniteConcept)e2).compare((Concept)e1);
      return DirectedAcyclicGraph.reverseCompareCode(oppositeResult);
    }
 catch (    IllegalActionException e) {
      return CPO.INCOMPARABLE;
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + e1 + "String_Node_Str"+ e2+ "String_Node_Str");
  }
}
Program: 73496
Project: 73496
Buggy source:
/** 
 * Compute the least upper bound (LUB) of two elements. The LUB of two elements is the least element in the concept graph that is greater than or the same as both of the two elements.
 * @param e1 An Object representing an element in this concept graph.
 * @param e2 An Object representing an element in this concept graph.
 * @return A Concept representing the LUB of the two specifiedelements, or <code>null</code> if the LUB does not exist.
 * @exception IllegalArgumentException If at least one of thespecified Objects is not an element of this concept graph.
 */
public Concept leastUpperBound(Object e1,Object e2){
  if (!(e1 instanceof Concept) || !(e2 instanceof Concept)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + e1 + "String_Node_Str"+ e2);
  }
  if ((e1 instanceof FiniteConcept) && (e2 instanceof FiniteConcept)) {
    Concept lub=(Concept)_dag.leastUpperBound(e1,e2);
    if (lub instanceof FlatTokenRepresentativeConcept && !lub.equals(e1) && !lub.equals(e2)) {
      lub=leastUpperBound(((FiniteConcept)lub).getCoverSetAbove().toArray());
    }
    return lub;
  }
 else   if (e1 instanceof InfiniteConcept) {
    return ((InfiniteConcept)e1).leastUpperBound((Concept)e2);
  }
 else {
    return ((InfiniteConcept)e2).leastUpperBound((Concept)e1);
  }
}

Fixed version (ground truth):
/** 
 * Compute the least upper bound (LUB) of two elements. The LUB of two elements is the least element in the concept graph that is greater than or the same as both of the two elements.
 * @param e1 An Object representing an element in this concept graph.
 * @param e2 An Object representing an element in this concept graph.
 * @return A Concept representing the LUB of the two specifiedelements, or <code>null</code> if the LUB does not exist.
 * @exception IllegalArgumentException If at least one of thespecified Objects is not an element of this concept graph.
 */
public Concept leastUpperBound(Object e1,Object e2){
  if (!(e1 instanceof Concept) || !(e2 instanceof Concept)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + e1 + "String_Node_Str"+ e2);
  }
  if ((e1 instanceof FiniteConcept) && (e2 instanceof FiniteConcept)) {
    Concept lub=(Concept)_dag.leastUpperBound(e1,e2);
    if (lub instanceof FlatTokenRepresentativeConcept && !lub.equals(e1) && !lub.equals(e2)) {
      lub=leastUpperBound(((FiniteConcept)lub).getCoverSetAbove().toArray());
    }
    return lub;
  }
 else   if (e1 instanceof InfiniteConcept) {
    return ((InfiniteConcept)e1).leastUpperBound((Concept)e2);
  }
 else   if (e2 instanceof InfiniteConcept) {
    return ((InfiniteConcept)e2).leastUpperBound((Concept)e1);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + e1 + "String_Node_Str"+ e2+ "String_Node_Str");
  }
}
Program: 73497
Project: 73497
Buggy source:
/** 
 * Update the cached transition lists. This method is read-synchronized on the workspace.
 */
private void _updateTransitionLists(){
  try {
    workspace().getReadAccess();
    _nonpreemptiveTransitionList.clear();
    _preemptiveTransitionList.clear();
    _errorTransitionList.clear();
    Iterator transitions=outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      if (transition.isPreemptive()) {
        _preemptiveTransitionList.add(transition);
      }
 else       if (transition.isErrorTransition()) {
        _errorTransitionList.add(transition);
        _nonpreemptiveTransitionList.add(transition);
      }
 else {
        _nonpreemptiveTransitionList.add(transition);
      }
    }
    _transitionListVersion=workspace().getVersion();
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Update the cached transition lists. This method is read-synchronized on the workspace.
 */
private void _updateTransitionLists(){
  try {
    workspace().getReadAccess();
    _nonpreemptiveTransitionList.clear();
    _preemptiveTransitionList.clear();
    _errorTransitionList.clear();
    Iterator transitions=outgoingPort.linkedRelationList().iterator();
    while (transitions.hasNext()) {
      Transition transition=(Transition)transitions.next();
      if (transition.isPreemptive()) {
        _preemptiveTransitionList.add(transition);
      }
 else       if (transition.isErrorTransition()) {
        _errorTransitionList.add(transition);
      }
 else {
        _nonpreemptiveTransitionList.add(transition);
      }
    }
    _transitionListVersion=workspace().getVersion();
  }
  finally {
    workspace().doneReading();
  }
}
Program: 73499
Project: 73499
Buggy source:
/** 
 * Return whether the port is a networkPort. this method is default to return false, i.e., an output port to the outside of the platform is by default an actuator port.
 * @exception IllegalActionException If token of networkPort cannot beevaluated.
 */
public static boolean isNetworkPort(IOPort port) throws IllegalActionException {
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  if (parameter != null) {
    return ((BooleanToken)parameter.getToken()).booleanValue();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return whether the port is a networkPort. this method is default to return false, i.e., an output port to the outside of the platform is by default an actuator port.
 * @exception IllegalActionException If token of networkPort cannot beevaluated.
 */
public static boolean isNetworkPort(IOPort port) throws IllegalActionException {
  if (port.isInput()) {
    Double networkTotalDelay=_getNetworkTotalDelay(port);
    return (networkTotalDelay != null);
  }
  IllegalActionException up=new IllegalActionException(port,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  throw up;
}
Program: 73501
Project: 73501
Buggy source:
/** 
 * Return the model time of the enclosing director, which is our model of time in the physical environment.
 * @return the model time of the enclosing director, which is a model oftime in the physical environment.
 * @exception IllegalActionException If enclosing director is nota DE of PtidesTopLevelDirector, or if the platform synchronization error is non-zero and the enclosing director is not a PtidesTopLevelDirector.
 */
public Tag getPhysicalTag() throws IllegalActionException {
  Tag tag=new Tag();
  Director director=this;
  while (director instanceof PtidesBasicDirector) {
    director=((Actor)director.getContainer().getContainer()).getDirector();
  }
  if (!(director instanceof DEDirector)) {
    IllegalActionException up=new IllegalActionException(director,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    throw up;
  }
  if (director instanceof PtidesTopLevelDirector) {
    tag.timestamp=((PtidesTopLevelDirector)director).getSimulatedPhysicalTime((Actor)getContainer());
    tag.microstep=((PtidesTopLevelDirector)director).getMicrostep();
  }
 else {
    if (getSynchronizationError() != 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    tag.timestamp=director.getModelTime();
    tag.microstep=((DEDirector)director).getMicrostep();
  }
  return tag;
}

Fixed version (ground truth):
/** 
 * Return the model time of the enclosing director, which is our model of time in the physical environment.
 * @return the model time of the enclosing director, which is a model oftime in the physical environment.
 * @exception IllegalActionException If enclosing director is nota DE of PtidesTopLevelDirector, or if the platform synchronization error is non-zero and the enclosing director is not a PtidesTopLevelDirector.
 */
public Tag getPhysicalTag() throws IllegalActionException {
  Tag tag=new Tag();
  Director executiveDrector=((Actor)getContainer()).getExecutiveDirector();
  if (executiveDrector instanceof PtidesTopLevelDirector) {
    tag.timestamp=((PtidesTopLevelDirector)executiveDrector).getSimulatedPhysicalTime((Actor)getContainer());
    tag.microstep=((PtidesTopLevelDirector)executiveDrector).getMicrostep();
  }
 else {
    if (getSynchronizationError() != 0.0) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    tag.timestamp=executiveDrector.getModelTime();
    tag.microstep=((DEDirector)executiveDrector).getMicrostep();
  }
  return tag;
}
Program: 73503
Project: 73503
Buggy source:
/** 
 * Return whether we want to preempt the currently executing actor and instead execute the earliest event on the event queue. This base class returns false, indicating that the currently executing actor is never preempted.
 * @return False.
 * @exception IllegalActionException If false.
 */
protected boolean _preemptExecutingActor() throws IllegalActionException {
  return false;
}

Fixed version (ground truth):
/** 
 * Return whether we want to preempt the currently executing actor and instead execute the earliest event on the event queue. This base class returns false, indicating that the currently executing actor is never preempted.
 * @return False.
 * @exception IllegalActionException Not thrown in this base class. Derivedclasses may throw it if unable to preempt the currently exeucting actor.
 */
protected boolean _preemptExecutingActor() throws IllegalActionException {
  return false;
}
Program: 73504
Project: 73504
Buggy source:
/** 
 * Construct a structure that holds a real-time event. This event saves the token to be transmitted, the port and channel this token should be deliverd to, and the time this token should be delivered at.
 * @param port The destination port.
 * @param channel The destination channel.
 * @param token The token to be delivered.
 * @param tag The time of delivery of this token.
 */
public RealTimeEvent(IOPort port,int channel,Token token,Tag tag){
  this.port=port;
  this.channel=channel;
  this.token=token;
  this.deliveryTag=tag;
}

Fixed version (ground truth):
/** 
 * Construct a structure that holds a real-time event. This event saves the token to be transmitted, the port and channel this token should be deliverd to, and the time this token should be delivered at.
 * @param port The destination port.
 * @param channel The destination channel.
 * @param token The token to be delivered.
 * @param deliveryTag The time of delivery of this token.
 */
public RealTimeEvent(IOPort port,int channel,Token token,Tag deliveryTag,Tag timestampTag){
  this.port=port;
  this.channel=channel;
  this.token=token;
  this.deliveryTag=deliveryTag;
  this.timestampTag=timestampTag;
}
Program: 73505
Project: 73505
Buggy source:
/** 
 * Return the network delay of the port.
 * @param port The port with network delay.
 * @exception IllegalActionException If token of networkDelay parametercannot be evaluated.
 */
private static double _getNetworkDelay(IOPort port) throws IllegalActionException {
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  if (parameter != null) {
    return ((DoubleToken)parameter.getToken()).doubleValue();
  }
  return 0.0;
}

Fixed version (ground truth):
/** 
 * Return the network delay of the port, if the parameter exists.
 * @param port The port with network delay.
 * @return 
 * @exception IllegalActionException If token of networkDelay parametercannot be evaluated.
 */
private static Double _getNetworkDelay(IOPort port) throws IllegalActionException {
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  if (parameter != null) {
    return Double.valueOf(((DoubleToken)parameter.getToken()).doubleValue());
  }
  return null;
}
Program: 73509
Project: 73509
Buggy source:
/** 
 * Return the executionTime parameter.
 * @param port The port at which execution time is denoted.
 * @param actor an Actor object.
 * @return executionTime parameter.
 * @exception IllegalActionException If excution time fromPtidesActorProperties cannot be obtained.
 */
protected static double _getExecutionTime(IOPort port,Actor actor) throws IllegalActionException {
  Double result=null;
  if (port != null) {
    result=PtidesActorProperties.getExecutionTime(port);
  }
  if (result != null) {
    return result.doubleValue();
  }
 else {
    return PtidesActorProperties.getExecutionTime(actor);
  }
}

Fixed version (ground truth):
/** 
 * Return the executionTime parameter.
 * @param port The port at which execution time is denoted.
 * @param actor an Actor object.
 * @return executionTime parameter.
 * @exception IllegalActionException If excution time from PtidesActorProperties cannot be obtained.
 */
protected static double _getExecutionTime(IOPort port,Actor actor) throws IllegalActionException {
  Double result=null;
  if (port != null) {
    result=PtidesActorProperties.getExecutionTime(port);
  }
  if (result != null) {
    return result.doubleValue();
  }
 else {
    return PtidesActorProperties.getExecutionTime(actor);
  }
}
Program: 73510
Project: 73510
Buggy source:
/** 
 * Create new variables, initialize the actors and request a refiring at the current time of the executive director. This overrides the base class to throw an exception if there is no executive director.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void initialize() throws IllegalActionException {
  _currentlyExecutingStack=new Stack<DoubleTimedEvent>();
  _realTimeInputEventQueue=new PriorityQueue<RealTimeEvent>();
  _realTimeOutputEventQueue=new PriorityQueue<RealTimeEvent>();
  _lastConsumedTag=new HashMap<NamedObj,Tag>();
  _pureEventDeadlines=new HashMap<NamedObj,Time>();
  _pureEventDelays=new HashMap<NamedObj,Time>();
  _pureEventSourcePorts=new HashMap<NamedObj,IOPort>();
  _physicalTimeExecutionStarted=null;
  _schedulerFinishTime=new Time(this,Double.NEGATIVE_INFINITY);
  _sensorInterruptOccurred=false;
  _scheduleNewEvent=false;
  _timedInterruptWakeUpTime=null;
  _lastExecutingActor=null;
  super.initialize();
  NamedObj container=getContainer();
  if (!(container instanceof Actor)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Director executiveDirector=((Actor)container).getExecutiveDirector();
  if (executiveDirector == null) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  executiveDirector.fireAtCurrentTime((Actor)container);
  _setIcon(_getIdleIcon(),true);
}

Fixed version (ground truth):
/** 
 * Create new variables, initialize the actors and request a refiring at the current time of the executive director. This overrides the base class to throw an exception if there is no executive director.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void initialize() throws IllegalActionException {
  _currentlyExecutingStack=new Stack<DoubleTimedEvent>();
  _realTimeInputEventQueue=new PriorityQueue<RealTimeEvent>();
  _realTimeOutputEventQueue=new PriorityQueue<RealTimeEvent>();
  _lastConsumedTag=new HashMap<NamedObj,Tag>();
  _pureEventDeadlines=new HashMap<NamedObj,Time>();
  _pureEventDelays=new HashMap<NamedObj,Time>();
  _pureEventSourcePorts=new HashMap<NamedObj,IOPort>();
  _physicalTimeExecutionStarted=null;
  _schedulerFinishTime=new Time(this,Double.NEGATIVE_INFINITY);
  _sensorInterruptOccurred=false;
  _scheduleNewEvent=false;
  _timedInterruptWakeUpTime=null;
  _lastExecutingActor=null;
  super.initialize();
  (((Actor)getContainer()).getExecutiveDirector()).fireAtCurrentTime((Actor)getContainer());
  _setIcon(_getIdleIcon(),true);
}
Program: 73511
Project: 73511
Buggy source:
/** 
 * Return the value stored in realTimeDelay parameter.
 * @param port The port the realTimeDelay is associated with.
 * @return realTimeDelay parameter
 * @exception IllegalActionException If the token of the realTimeDelayparameter cannot be evaluated.
 */
protected double _getRealTimeDelay(IOPort port) throws IllegalActionException {
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  if (parameter != null) {
    return ((DoubleToken)parameter.getToken()).doubleValue();
  }
 else {
    return 0.0;
  }
}

Fixed version (ground truth):
/** 
 * Return the value stored in realTimeDelay parameter.
 * @param port The port the realTimeDelay is associated with.
 * @return realTimeDelay parameter
 * @exception IllegalActionException If the token of the realTimeDelayparameter cannot be evaluated.
 */
private static Double _getRealTimeDelay(IOPort port) throws IllegalActionException {
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  if (parameter != null) {
    return Double.valueOf(((DoubleToken)parameter.getToken()).doubleValue());
  }
  return null;
}
Program: 73512
Project: 73512
Buggy source:
/** 
 * Returns the event that was selected to preempt in _preemptExecutingActor. If no event was selected, return the event of smallest deadline that is safe to process. This is when _eventToProcess is last used in this iteration, so it should be cleared to null, so that later iterations will not see the same events stored in _eventToProcess.
 */
protected PtidesEvent _getNextSafeEvent() throws IllegalActionException {
  PtidesEvent tempEvent;
  if (_eventToProcess == null) {
    _getSmallestDeadlineSafeEventFromQueue();
  }
  tempEvent=_eventToProcess;
  _eventToProcess=null;
  return tempEvent;
}

Fixed version (ground truth):
/** 
 * Return the event that was selected to preempt in _preemptExecutingActor. If no event was selected, return the event of smallest deadline that is safe to process. This is when _eventToProcess is last used in this iteration, so it should be cleared to null, so that later iterations will not see the same events stored in _eventToProcess.
 */
protected PtidesEvent _getNextSafeEvent() throws IllegalActionException {
  PtidesEvent tempEvent;
  if (_eventToProcess == null) {
    _getSmallestDeadlineSafeEventFromQueue();
  }
  tempEvent=_eventToProcess;
  _eventToProcess=null;
  return tempEvent;
}
Program: 73513
Project: 73513
Buggy source:
/** 
 * Clears what's stored in _eventToProcess, and call the super method of preinitialize.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  _eventToProcess=null;
  _calculateDeadline();
}

Fixed version (ground truth):
/** 
 * Clear what's stored in _eventToProcess, and call the super method of preinitialize.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  _eventToProcess=null;
  _calculateDeadline();
}
Program: 73514
Project: 73514
Buggy source:
/** 
 * Sets the relativeDeadline parameter for an input port.
 * @param inputPort The port to set the parameter.
 * @param dependency The value of the relativeDeadline to be set.
 * @exception IllegalActionException If unsuccessful in getting the attribute.
 */
protected void _setDeadline(IOPort inputPort,SuperdenseDependency dependency) throws IllegalActionException {
  Parameter parameter=(Parameter)(inputPort).getAttribute("String_Node_Str");
  if (parameter == null) {
    try {
      parameter=new Parameter(inputPort,"String_Node_Str");
    }
 catch (    NameDuplicationException e) {
      throw new IllegalActionException("String_Node_Str");
    }
  }
  parameter.setToken(new DoubleToken(dependency.timeValue()));
}

Fixed version (ground truth):
/** 
 * Set the relativeDeadline parameter for an input port.
 * @param inputPort The port to set the parameter.
 * @param dependency The value of the relativeDeadline to be set.
 * @exception IllegalActionException If unsuccessful in getting the attribute.
 */
protected void _setDeadline(IOPort inputPort,SuperdenseDependency dependency) throws IllegalActionException {
  Parameter parameter=(Parameter)(inputPort).getAttribute("String_Node_Str");
  if (parameter == null) {
    try {
      parameter=new Parameter(inputPort,"String_Node_Str");
    }
 catch (    NameDuplicationException e) {
      throw new IllegalActionException("String_Node_Str");
    }
  }
  parameter.setToken(new DoubleToken(dependency.timeValue()));
}
Program: 73516
Project: 73516
Buggy source:
/** 
 * This method finds the event in the queue that is of the smallest deadline The event found is stored in _eventToProcess. It then stores the index of the event in _peekingIndex.
 * @return false if no event is found. returns false, otherwise returns true.
 * @exception IllegalActionException
 */
protected boolean _getSmallestDeadlineSafeEventFromQueue() throws IllegalActionException {
  _eventToProcess=null;
  Time smallestDeadline=new Time(this,Double.POSITIVE_INFINITY);
  int result=0;
  for (int eventIndex=0; eventIndex < _eventQueue.size(); eventIndex++) {
    PtidesEvent event=((PtidesListEventQueue)_eventQueue).get(eventIndex);
    if (event.isPureEvent()) {
      if (event.actor().inputPortList().size() == 0) {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + event.actor() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
    if (_safeToProcess(event) && !_currentlyFiring(event.actor())) {
      Time absNextDeadline=_getAbsoluteDeadline(event);
      if (absNextDeadline.compareTo(smallestDeadline) < 0) {
        smallestDeadline=absNextDeadline;
        _eventToProcess=event;
        result=eventIndex;
      }
 else       if (absNextDeadline.compareTo(smallestDeadline) == 0) {
        if (_eventToProcess == null) {
          _eventToProcess=event;
          result=eventIndex;
        }
      }
    }
  }
  if (_eventToProcess == null) {
    return false;
  }
 else {
    _peekingIndex=result;
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Find the event in the queue that is of the smallest deadline The event found is stored in _eventToProcess. It then stores the index of the event in _peekingIndex.
 * @return false if no event is found. returns false, otherwise returns true.
 * @exception IllegalActionException
 */
protected boolean _getSmallestDeadlineSafeEventFromQueue() throws IllegalActionException {
  _eventToProcess=null;
  Time smallestDeadline=new Time(this,Double.POSITIVE_INFINITY);
  int result=0;
  for (int eventIndex=0; eventIndex < _eventQueue.size(); eventIndex++) {
    PtidesEvent event=((PtidesListEventQueue)_eventQueue).get(eventIndex);
    if (event.isPureEvent()) {
      if (event.actor().inputPortList().size() == 0) {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + event.actor() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
    if (_safeToProcess(event) && !_currentlyFiring(event.actor())) {
      Time absNextDeadline=_getAbsoluteDeadline(event);
      if (absNextDeadline.compareTo(smallestDeadline) < 0) {
        smallestDeadline=absNextDeadline;
        _eventToProcess=event;
        result=eventIndex;
      }
 else       if (absNextDeadline.compareTo(smallestDeadline) == 0) {
        if (_eventToProcess == null) {
          _eventToProcess=event;
          result=eventIndex;
        }
      }
    }
  }
  if (_eventToProcess == null) {
    return false;
  }
 else {
    _peekingIndex=result;
    return true;
  }
}