nus-yam/ex-repair huggingface dataset:
Program: 12635
Project: 12635
Buggy source:
static void read(SBOLDocument SBOLDoc,InputStream in){
  Scanner scanner=new Scanner(in,"String_Node_Str");
  String inputStreamString=scanner.useDelimiter("String_Node_Str").next();
  try {
    DocumentRoot<QName> document=readRDF(new StringReader(inputStreamString));
    boolean sbol2=false;
    for (    NamespaceBinding n : document.getNamespaceBindings()) {
      if (n.getNamespaceURI().equals(Sbol2Terms.sbol2.getNamespaceURI())) {
        sbol2=true;
      }
      SBOLDoc.addNamespaceBinding(NamespaceBinding(n.getNamespaceURI(),n.getPrefix()));
    }
    if (!sbol2) {
      scanner.close();
      readV1(document);
    }
    readTopLevelDocs(SBOLDoc,document);
  }
 catch (  Exception e) {
    scanner.close();
    e.printStackTrace();
  }
  scanner.close();
}

Fixed version (ground truth):
static void read(SBOLDocument SBOLDoc,InputStream in){
  Scanner scanner=new Scanner(in,"String_Node_Str");
  String inputStreamString=scanner.useDelimiter("String_Node_Str").next();
  try {
    DocumentRoot<QName> document=readRDF(new StringReader(inputStreamString));
    for (    NamespaceBinding n : document.getNamespaceBindings()) {
      if (n.getNamespaceURI().equals(Sbol1Terms.sbol1.getNamespaceURI())) {
        scanner.close();
        readV1(SBOLDoc,document);
        return;
      }
    }
    for (    NamespaceBinding n : document.getNamespaceBindings()) {
      SBOLDoc.addNamespaceBinding(NamespaceBinding(n.getNamespaceURI(),n.getPrefix()));
    }
    readTopLevelDocs(SBOLDoc,document);
  }
 catch (  Exception e) {
    scanner.close();
    e.printStackTrace();
  }
  scanner.close();
}
Program: 12636
Project: 12636
Buggy source:
private static SBOLDocument readV1(DocumentRoot<QName> document){
  SBOLDocument SBOLDoc=new SBOLDocument();
  for (  NamespaceBinding n : document.getNamespaceBindings()) {
    if (n.getNamespaceURI().equals(Sbol1Terms.sbol1.getNamespaceURI())) {
      SBOLDoc.addNamespaceBinding(NamespaceBinding(Sbol2Terms.sbol2.getNamespaceURI(),Sbol2Terms.sbol2.getPrefix()));
    }
 else {
      SBOLDoc.addNamespaceBinding(NamespaceBinding(n.getNamespaceURI(),n.getPrefix()));
    }
  }
  SBOLDoc.addNamespaceBinding(NamespaceBinding(Sbol2Terms.prov.getNamespaceURI(),Sbol2Terms.prov.getPrefix()));
  readTopLevelDocsV1(SBOLDoc,document);
  try {
    SBOLValidate.validateCompliance(SBOLDoc);
  }
 catch (  SBOLValidationException e) {
    SBOLDoc.setCompliant(false);
  }
  return SBOLDoc;
}

Fixed version (ground truth):
private static SBOLDocument readV1(SBOLDocument SBOLDoc,DocumentRoot<QName> document){
  for (  NamespaceBinding n : document.getNamespaceBindings()) {
    if (n.getNamespaceURI().equals(Sbol1Terms.sbol1.getNamespaceURI())) {
      SBOLDoc.addNamespaceBinding(NamespaceBinding(Sbol2Terms.sbol2.getNamespaceURI(),Sbol2Terms.sbol2.getPrefix()));
    }
 else {
      SBOLDoc.addNamespaceBinding(NamespaceBinding(n.getNamespaceURI(),n.getPrefix()));
    }
  }
  SBOLDoc.addNamespaceBinding(NamespaceBinding(Sbol2Terms.prov.getNamespaceURI(),Sbol2Terms.prov.getPrefix()));
  readTopLevelDocsV1(SBOLDoc,document);
  try {
    SBOLValidate.validateCompliance(SBOLDoc);
  }
 catch (  SBOLValidationException e) {
    SBOLDoc.setCompliant(false);
  }
  return SBOLDoc;
}
Program: 12637
Project: 12637
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + mapsTos + "String_Node_Str"+ componentDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + mapsTos + "String_Node_Str";
}
Program: 12638
Project: 12638
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + direction + "String_Node_Str"+ mapsTos+ "String_Node_Str"+ moduleDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + direction + "String_Node_Str"+ mapsTos+ "String_Node_Str";
}
Program: 12639
Project: 12639
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + types + "String_Node_Str"+ participations+ "String_Node_Str"+ moduleDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + types + "String_Node_Str"+ participations+ "String_Node_Str";
}
Program: 12640
Project: 12640
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + refinement + "String_Node_Str"+ local+ "String_Node_Str"+ remote+ "String_Node_Str"+ moduleDefinition+ "String_Node_Str"+ module+ "String_Node_Str"+ componentDefinition+ "String_Node_Str"+ componentInstance+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + refinement + "String_Node_Str"+ local+ "String_Node_Str"+ remote+ "String_Node_Str";
}
Program: 12641
Project: 12641
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + mapsTos + "String_Node_Str"+ definition+ "String_Node_Str"+ moduleDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + mapsTos + "String_Node_Str"+ definition+ "String_Node_Str";
}
Program: 12642
Project: 12642
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + roles + "String_Node_Str"+ participant+ "String_Node_Str"+ moduleDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + roles + "String_Node_Str"+ participant+ "String_Node_Str";
}
Program: 12643
Project: 12643
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + locations + "String_Node_Str"+ component+ "String_Node_Str"+ componentDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + locations + "String_Node_Str"+ component+ "String_Node_Str";
}
Program: 12644
Project: 12644
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + restriction + "String_Node_Str"+ subject+ "String_Node_Str"+ object+ "String_Node_Str"+ componentDefinition+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + restriction + "String_Node_Str"+ subject+ "String_Node_Str"+ object+ "String_Node_Str";
}
Program: 12645
Project: 12645
Buggy source:
/** 
 * Appends the specified   {@code ModuleDefinition} object to the end of the list of module definitions.
 */
void addModuleDefinition(ModuleDefinition newModuleDefinition){
  addTopLevel(newModuleDefinition,moduleDefinitions,"String_Node_Str",collections,componentDefinitions,genericTopLevels,models,sequences);
}

Fixed version (ground truth):
/** 
 * Appends the specified   {@code ModuleDefinition} object to the end of the list of module definitions.
 */
void addModuleDefinition(ModuleDefinition newModuleDefinition){
  addTopLevel(newModuleDefinition,moduleDefinitions,"String_Node_Str",collections,componentDefinitions,genericTopLevels,models,sequences);
  for (  FunctionalComponent functionalComponent : newModuleDefinition.getFunctionalComponents()) {
    functionalComponent.setSBOLDocument(this);
    for (    MapsTo mapsTo : functionalComponent.getMapsTos()) {
      mapsTo.setSBOLDocument(this);
    }
  }
  for (  Module module : newModuleDefinition.getModules()) {
    module.setSBOLDocument(this);
    for (    MapsTo mapsTo : module.getMapsTos()) {
      mapsTo.setSBOLDocument(this);
    }
  }
  for (  Interaction interaction : newModuleDefinition.getInteractions()) {
    interaction.setSBOLDocument(this);
    for (    Participation participation : interaction.getParticipations()) {
      participation.setSBOLDocument(this);
    }
  }
}
Program: 12646
Project: 12646
Buggy source:
/** 
 * Appends the specified element to the end of the list of component definitions.
 */
void addComponentDefinition(ComponentDefinition newComponentDefinition){
  addTopLevel(newComponentDefinition,componentDefinitions,"String_Node_Str",collections,genericTopLevels,models,moduleDefinitions,sequences);
}

Fixed version (ground truth):
/** 
 * Appends the specified element to the end of the list of component definitions.
 */
void addComponentDefinition(ComponentDefinition newComponentDefinition){
  addTopLevel(newComponentDefinition,componentDefinitions,"String_Node_Str",collections,genericTopLevels,models,moduleDefinitions,sequences);
  for (  Component component : newComponentDefinition.getComponents()) {
    component.setSBOLDocument(this);
    for (    MapsTo mapsTo : component.getMapsTos()) {
      mapsTo.setSBOLDocument(this);
    }
  }
  for (  SequenceAnnotation sequenceAnnotation : newComponentDefinition.getSequenceAnnotations()) {
    sequenceAnnotation.setSBOLDocument(this);
    for (    Location location : sequenceAnnotation.getLocations()) {
      location.setSBOLDocument(this);
    }
  }
  for (  SequenceConstraint sequenceConstraint : newComponentDefinition.getSequenceConstraints()) {
    sequenceConstraint.setSBOLDocument(this);
  }
}
Program: 12647
Project: 12647
Buggy source:
@Test public void Test_Sequence_CopyCreate_Create(){
  String prURI="String_Node_Str";
  String prPrefix="String_Node_Str";
  SBOLDocument document=new SBOLDocument();
  document.setDefaultURIprefix(prURI);
  document.setTypesInURIs(true);
  String prURI1="String_Node_Str";
  String prPrefix1="String_Node_Str";
  SBOLDocument document2=new SBOLDocument();
  document.setDefaultURIprefix(prURI1);
  document.setTypesInURIs(true);
  String SequenceDisplayID="String_Node_Str";
  String SequenceVersion="String_Node_Str";
  String SequenceElements="String_Node_Str";
  String SequenceURI="String_Node_Str" + SequenceDisplayID;
  String createCopyID="String_Node_Str";
  String createCopyVersion="String_Node_Str";
  String createCopyURI="String_Node_Str";
  URI SeqURI=URI.create(SequenceURI);
  Sequence seq=document.createSequence(SequenceDisplayID,SequenceVersion,SequenceElements,SeqURI);
  Sequence seq2=(Sequence)document2.createCopy(seq,SequenceURI,SequenceDisplayID,SequenceVersion);
  Sequence seq3=(Sequence)document2.createCopy(seq);
  seq2.unsetWasDerivedFrom();
  seq3.unsetWasDerivedFrom();
  assertTrue(seq.equals(seq2));
  assertTrue(seq.equals(seq3));
  assertEquals(seq,seq3);
}

Fixed version (ground truth):
@Test public void Test_Sequence_CopyCreate_Create(){
  String prURI="String_Node_Str";
  String prPrefix="String_Node_Str";
  SBOLDocument document=new SBOLDocument();
  document.setDefaultURIprefix(prURI);
  document.setTypesInURIs(true);
  String prURI1="String_Node_Str";
  String prPrefix1="String_Node_Str";
  SBOLDocument document2=new SBOLDocument();
  document.setDefaultURIprefix(prURI1);
  document.setTypesInURIs(true);
  String SequenceDisplayID="String_Node_Str";
  String SequenceVersion="String_Node_Str";
  String SequenceElements="String_Node_Str";
  String SequenceURI="String_Node_Str" + SequenceDisplayID;
  String createCopyID="String_Node_Str";
  String createCopyVersion="String_Node_Str";
  String createCopyURI="String_Node_Str";
  URI SeqURI=URI.create(SequenceURI);
  Sequence seq=document.createSequence(SequenceDisplayID,SequenceVersion,SequenceElements,SeqURI);
  Sequence seq2=(Sequence)document2.createCopy(seq,SequenceURI,SequenceDisplayID,SequenceVersion);
  Sequence seq3=(Sequence)document2.createCopy(seq);
  seq2.unsetWasDerivedFrom();
  seq3.unsetWasDerivedFrom();
  assertTrue(seq.equals(seq3));
  assertEquals(seq,seq3);
}
Program: 12648
Project: 12648
Buggy source:
/** 
 * Test if the display ID is set.
 * @return {@code true} if it is not {@code null}
 */
boolean isSetDisplayId(){
  return displayId != null;
}

Fixed version (ground truth):
/** 
 * Test if the display ID is set.
 * @return {@code true} if it is not {@code null}
 */
public boolean isSetDisplayId(){
  return displayId != null;
}
Program: 12649
Project: 12649
Buggy source:
/** 
 * Test if the persistent identity URI is set.
 * @return {@code true} if it is not {@code null}
 */
boolean isSetPersistentIdentity(){
  return persistentIdentity != null;
}

Fixed version (ground truth):
/** 
 * Test if the persistent identity URI is set.
 * @return {@code true} if it is not {@code null}
 */
public boolean isSetPersistentIdentity(){
  return persistentIdentity != null;
}
Program: 12651
Project: 12651
Buggy source:
@Override protected boolean checkDescendantsURIcompliance(){
  return isURIcompliant(this.getIdentity());
}

Fixed version (ground truth):
@Override protected boolean checkDescendantsURIcompliance(){
  return isTopLevelURIformCompliant(this.getIdentity());
}
Program: 12653
Project: 12653
Buggy source:
@Override protected boolean checkDescendantsURIcompliance(){
  return isURIcompliant(this.getIdentity());
}

Fixed version (ground truth):
@Override protected boolean checkDescendantsURIcompliance(){
  return isTopLevelURIformCompliant(this.getIdentity());
}
Program: 12654
Project: 12654
Buggy source:
@SafeVarargs protected final <I extends Identified>void addChildSafely(I child,Map<URI,I> siblingsMap,String typeName,Map<URI,? extends Identified>... maps){
  if (isChildURIcompliant(this.getIdentity(),child.getIdentity())) {
    URI persistentId=URI.create(extractPersistentId(child.getIdentity()));
    if (keyExistsInAnyMap(persistentId,maps))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ persistentId+ "String_Node_Str"+ typeName);
    if (siblingsMap.containsKey(child.getIdentity()))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ persistentId+ "String_Node_Str"+ typeName);
    siblingsMap.put(child.getIdentity(),child);
    I latest=siblingsMap.get(persistentId);
    if (latest == null) {
      siblingsMap.put(persistentId,child);
    }
 else {
      if (isFirstVersionNewer(extractVersion(child.getIdentity()),extractVersion(latest.getIdentity()))) {
        siblingsMap.put(persistentId,child);
      }
    }
  }
 else {
    if (keyExistsInAnyMap(child.getIdentity(),maps))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ typeName);
    if (siblingsMap.containsKey(child.getIdentity()))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ typeName);
    siblingsMap.put(child.getIdentity(),child);
  }
}

Fixed version (ground truth):
@SafeVarargs protected final <I extends Identified>void addChildSafely(I child,Map<URI,I> siblingsMap,String typeName,Map<URI,? extends Identified>... maps){
  if (isChildURIformCompliant(this.getIdentity(),child.getIdentity())) {
    URI persistentId=URI.create(extractPersistentId(child.getIdentity()));
    if (keyExistsInAnyMap(persistentId,maps))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ persistentId+ "String_Node_Str"+ typeName);
    if (siblingsMap.containsKey(child.getIdentity()))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ persistentId+ "String_Node_Str"+ typeName);
    siblingsMap.put(child.getIdentity(),child);
    I latest=siblingsMap.get(persistentId);
    if (latest == null) {
      siblingsMap.put(persistentId,child);
    }
 else {
      if (isFirstVersionNewer(extractVersion(child.getIdentity()),extractVersion(latest.getIdentity()))) {
        siblingsMap.put(persistentId,child);
      }
    }
  }
 else {
    if (keyExistsInAnyMap(child.getIdentity(),maps))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ typeName);
    if (siblingsMap.containsKey(child.getIdentity()))     throw new IllegalArgumentException("String_Node_Str" + child.identity + "String_Node_Str"+ typeName);
    siblingsMap.put(child.getIdentity(),child);
  }
}
Program: 12655
Project: 12655
Buggy source:
@Override protected boolean checkDescendantsURIcompliance(){
  return isURIcompliant(this.getIdentity());
}

Fixed version (ground truth):
@Override protected boolean checkDescendantsURIcompliance(){
  return isTopLevelURIformCompliant(this.getIdentity());
}
Program: 12660
Project: 12660
Buggy source:
@Override protected boolean checkDescendantsURIcompliance(){
  return isURIcompliant(this.getIdentity());
}

Fixed version (ground truth):
@Override protected boolean checkDescendantsURIcompliance(){
  return isTopLevelURIformCompliant(this.getIdentity());
}
Program: 12666
Project: 12666
Buggy source:
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLReader.setVersion("String_Node_Str");
    SBOLReader.setTypesInURI(true);
    SBOLDocument document1=SBOLReader.read(file);
    document1=SBOLTestUtils.writeAndRead(document1);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLReader.setVersion("String_Node_Str");
    SBOLReader.setTypesInURI(true);
    SBOLDocument document1=SBOLReader.read(file);
    SBOLDocument document2=new SBOLDocument();
    for (    ComponentDefinition cd : document1.getComponentDefinitions()) {
      document2.createCopy(cd);
    }
    document2=SBOLTestUtils.writeAndRead(document2);
    SBOLWriter.writeRDF(document2,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12667
Project: 12667
Buggy source:
/** 
 * Returns the type of the nested   {@code value} property.
 * @return the type of the nested QName {@code value} property if its value isof a NestedDocument type (see  {@link uk.ac.ncl.intbio.core.datatree.NestedDocument}), or   {@code null} otherwise.
 */
public QName getNestedQName(){
  if (value.getValue() instanceof NestedDocument<?>) {
    return ((NestedDocument<QName>)value.getValue()).getType();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the type of the nested   {@code value} property.
 * @return the nested QName of the {@code value} property if its value isof a nested list of Annotations, or  {@code null} otherwise.
 */
public QName getNestedQName(){
  if (value.getValue() instanceof NestedDocument<?>) {
    return ((NestedDocument<QName>)value.getValue()).getType();
  }
  return null;
}
Program: 12668
Project: 12668
Buggy source:
/** 
 * Returns a string representation of the   {@code value} property.
 * @return a string representation of the {@code value} property if its value is of a StringLiteral type defined by  {@link uk.ac.ncl.intbio.core.datatree.StringLiteral}, or   {@code null}otherwise.
 */
public String getStringValue(){
  if (value.getValue() instanceof StringLiteral) {
    return ((Literal<QName>)value.getValue()).getValue().toString();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a string representation of the   {@code value} property.
 * @return a string representation of the {@code value} property if its value is of String type, or  {@code null} otherwise.
 */
public String getStringValue(){
  if (value.getValue() instanceof StringLiteral) {
    return ((Literal<QName>)value.getValue()).getValue().toString();
  }
  return null;
}
Program: 12669
Project: 12669
Buggy source:
/** 
 * Returns a URI representation of the   {@code value} property.
 * @return a URI representation of the {@code value} property if itsthe value is of a UriLiteral type defined by  {@link uk.ac.ncl.intbio.core.datatree.UriLiteral},  or   {@code null} otherwise.
 */
public URI getURIValue(){
  if (value.getValue() instanceof UriLiteral) {
    return ((UriLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a URI representation of the   {@code value} property.
 * @return a URI representation of the {@code value} property if itsthe value is of a URI type, or  {@code null} otherwise.
 */
public URI getURIValue(){
  if (value.getValue() instanceof UriLiteral) {
    return ((UriLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}
Program: 12670
Project: 12670
Buggy source:
/** 
 * Returns a Double representation of the   {@code value} property.
 * @return a Double representation of the {@code value} property if its value is of a DoubleLiteral type defined by  {@link uk.ac.ncl.intbio.core.datatree.DoubleLiteral}, or   {@code null}otherwise.
 */
public Double getDoubleValue(){
  if (value.getValue() instanceof DoubleLiteral) {
    return ((DoubleLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a Double representation of the   {@code value} property.
 * @return a Double representation of the {@code value} property if its value is of Double type, or  {@code null} otherwise.
 */
public Double getDoubleValue(){
  if (value.getValue() instanceof DoubleLiteral) {
    return ((DoubleLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}
Program: 12671
Project: 12671
Buggy source:
/** 
 * Returns the list of Annotations of the nested   {@code value} property.
 * @return the list of Annotations of the nested {@code value} property if its value isof a NestedDocument type (see  {@link uk.ac.ncl.intbio.core.datatree.NestedDocument}), or   {@code null} otherwise.
 */
public List<Annotation> getAnnotations(){
  if (value.getValue() instanceof NestedDocument<?>) {
    List<Annotation> annotations=new ArrayList<>();
    for (    NamedProperty<QName> namedProperty : ((NestedDocument<QName>)value.getValue()).getProperties()) {
      annotations.add(new Annotation(namedProperty));
    }
    return annotations;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the list of Annotations of the nested   {@code value} property.
 * @return the list of Annotations of the nested {@code value} property if its value isof a nested list of Annotations, or  {@code null} otherwise.
 */
public List<Annotation> getAnnotations(){
  if (value.getValue() instanceof NestedDocument<?>) {
    List<Annotation> annotations=new ArrayList<>();
    for (    NamedProperty<QName> namedProperty : ((NestedDocument<QName>)value.getValue()).getProperties()) {
      annotations.add(new Annotation(namedProperty));
    }
    return annotations;
  }
  return null;
}
Program: 12672
Project: 12672
Buggy source:
/** 
 * Returns a Integer representation of the   {@code value} property.
 * @return a Integer representation of the {@code value} property if its value is of a IntegerLiteral type defined by  {@link uk.ac.ncl.intbio.core.datatree.IntegerLiteral}, or   {@code null}otherwise.
 */
public Integer getIntegerValue(){
  if (value.getValue() instanceof IntegerLiteral) {
    return ((IntegerLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a Integer representation of the   {@code value} property.
 * @return a Integer representation of the {@code value} property if its value is of Integer type, or  {@code null} otherwise.
 */
public Integer getIntegerValue(){
  if (value.getValue() instanceof IntegerLiteral) {
    return ((IntegerLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}
Program: 12673
Project: 12673
Buggy source:
/** 
 * Returns the identity URI of the nested   {@code value} property.
 * @return the identity URI of the nested QName {@code value} property if its value isof a NestedDocument type (see  {@link uk.ac.ncl.intbio.core.datatree.NestedDocument}), or   {@code null} otherwise.
 */
public URI getNestedIdentity(){
  if (value.getValue() instanceof NestedDocument<?>) {
    return ((NestedDocument<QName>)value.getValue()).getIdentity();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the identity URI of the nested   {@code value} property.
 * @return the identity URI of the nested QName {@code value} property if its value isof a nested list of Annotations, or  {@code null} otherwise.
 */
public URI getNestedIdentity(){
  if (value.getValue() instanceof NestedDocument<?>) {
    return ((NestedDocument<QName>)value.getValue()).getIdentity();
  }
  return null;
}
Program: 12675
Project: 12675
Buggy source:
/** 
 * Returns a Boolean representation of the   {@code value} property.
 * @return a Boolean representation of the {@code value} property if its value is of a BooleanLiteral type defined by  {@link uk.ac.ncl.intbio.core.datatree.BooleanLiteral}, or   {@code null}otherwise.
 */
public Boolean getBooleanValue(){
  if (value.getValue() instanceof BooleanLiteral) {
    return ((BooleanLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a Boolean representation of the   {@code value} property.
 * @return a Boolean representation of the {@code value} property if its value is of Boolean type, or  {@code null} otherwise.
 */
public Boolean getBooleanValue(){
  if (value.getValue() instanceof BooleanLiteral) {
    return ((BooleanLiteral<QName>)value.getValue()).getValue();
  }
  return null;
}
Program: 12676
Project: 12676
Buggy source:
/** 
 * Adds the URI of the given Sequence instance to this ComponentDefinition object's set of reference Sequence URIs. <p> If this ComponentDefinition object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited. <p> This method creates a compliant Sequence URI with the default URI prefix for this SBOLDocument instance, and the given   {@code sequence} and {@code version}. It then calls   {@link #addSequence(URI)} with this Sequence URI.
 * @param sequence
 * @param version
 * @return {@code true} if this set did not already contain the given Sequence instance URI.
 * @throws SBOLException if the associated SBOLDocument is not compliant
 */
public boolean addSequence(String sequence,String version){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  URI sequenceURI=URIcompliance.createCompliantURI(sbolDocument.getDefaultURIprefix(),TopLevel.SEQUENCE,sequence,version,sbolDocument.isTypesInURIs());
  return addSequence(sequenceURI);
}

Fixed version (ground truth):
/** 
 * Adds the URI of the given Sequence instance to this ComponentDefinition object's set of reference Sequence URIs. <p> If this ComponentDefinition object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited. <p> This method creates a compliant Sequence URI with the default URI prefix for this SBOLDocument instance, and the given   {@code sequence} and {@code version}. It then calls   {@link #addSequence(URI)} with this Sequence URI.
 * @param sequenceId
 * @param version
 * @return {@code true} if this set did not already contain the given Sequence instance URI.
 * @throws SBOLException if the associated SBOLDocument is not compliant
 */
public boolean addSequence(String sequenceId,String version){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  URI sequenceURI=URIcompliance.createCompliantURI(sbolDocument.getDefaultURIprefix(),TopLevel.SEQUENCE,sequenceId,version,sbolDocument.isTypesInURIs());
  return addSequence(sequenceURI);
}
Program: 12677
Project: 12677
Buggy source:
/** 
 * Adds the given type URI to this ComponentDefinition's set of reference type URIs. <p> If this ComponentDefinition object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param typeURI
 * @return @return {@code true} if this set did not already contain the given Sequence instance URI.
 * @throws SBOLException if the associated SBOLDocument is not compliant
 */
public boolean addType(URI typeURI){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  return types.add(typeURI);
}

Fixed version (ground truth):
/** 
 * Adds the given type URI to this ComponentDefinition's set of reference type URIs. <p> If this ComponentDefinition object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param typeURI
 * @return @return {@code true} if this set did not already contain the given Sequence instance URI.
 * @throws SBOLException if the associated SBOLDocument is not compliant
 */
public boolean addType(URI typeURI){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (typeURI.equals(DNA) || typeURI.equals(RNA) || typeURI.equals(PROTEIN)|| typeURI.equals(SMALL_MOLECULE)) {
    if (this.containsType(DNA) || this.containsType(RNA) || this.containsType(PROTEIN)|| this.containsType(SMALL_MOLECULE)) {
      throw new IllegalArgumentException("String_Node_Str" + this.getIdentity() + "String_Node_Str");
    }
  }
  return types.add(typeURI);
}
Program: 12679
Project: 12679
Buggy source:
/** 
 * Returns the FunctionalComponent instance matching the given   {@code componentURI} from thisModuleDefinition object's list of FunctionalComponent instances.
 * @param componentURI
 * @return the matching FunctionalComponent instance if present, or{@code null} otherwise.
 */
public FunctionalComponent getFunctionalComponent(URI componentURI){
  return functionalComponents.get(componentURI);
}

Fixed version (ground truth):
/** 
 * Returns the FunctionalComponent instance matching the given   {@code componentURI} from thisModuleDefinition object's list of FunctionalComponent instances.
 * @param functionalComponentURI
 * @return the matching FunctionalComponent instance if present, or{@code null} otherwise.
 */
public FunctionalComponent getFunctionalComponent(URI functionalComponentURI){
  return functionalComponents.get(functionalComponentURI);
}
Program: 12680
Project: 12680
Buggy source:
protected boolean isComplete(){
  if (sbolDocument == null)   return false;
  if (sequences.isEmpty()) {
    return false;
  }
  for (  Component component : getComponents()) {
    if (component.getDefinition() == null)     return false;
  }
  return true;
}

Fixed version (ground truth):
protected boolean isComplete(){
  if (sbolDocument == null)   return false;
  for (  URI sequenceURI : sequences) {
    if (sbolDocument.getSequence(sequenceURI) == null)     return false;
  }
  for (  Component component : getComponents()) {
    if (component.getDefinition() == null)     return false;
  }
  return true;
}
Program: 12682
Project: 12682
Buggy source:
/** 
 * Sets the access property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param access
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws if the given {@code access} argument is {@code null}
 */
public void setAccess(AccessType access){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (access == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.access=access;
}

Fixed version (ground truth):
/** 
 * Sets the access property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param access
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws IllegalArgumentException if the given {@code access} argument is {@code null}
 */
public void setAccess(AccessType access){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (access == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.access=access;
}
Program: 12683
Project: 12683
Buggy source:
/** 
 * Sets the definition property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param definition
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws if the given {@code definition} argument is {@code null}
 * @throws IllegalArgumentException if the associated SBOLDocument instance already completely specifies all URIs and the given definition URI is not found in them.
 */
public void setDefinition(URI definition){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (definition == null) {
    throw new IllegalArgumentException("String_Node_Str" + this.getIdentity() + "String_Node_Str");
  }
  if (sbolDocument != null && sbolDocument.isComplete()) {
    if (sbolDocument.getComponentDefinition(definition) == null) {
      throw new IllegalArgumentException("String_Node_Str" + definition + "String_Node_Str");
    }
  }
  this.definition=definition;
}

Fixed version (ground truth):
/** 
 * Sets the definition property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param definition
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws IllegalArgumentException if the given {@code definition} argument is {@code null}
 * @throws IllegalArgumentException if the associated SBOLDocument instance already completely specifies all URIs and the given definition URI is not found in them.
 */
public void setDefinition(URI definition){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (definition == null) {
    throw new IllegalArgumentException("String_Node_Str" + this.getIdentity() + "String_Node_Str");
  }
  if (sbolDocument != null && sbolDocument.isComplete()) {
    if (sbolDocument.getComponentDefinition(definition) == null) {
      throw new IllegalArgumentException("String_Node_Str" + definition + "String_Node_Str");
    }
  }
  this.definition=definition;
}
Program: 12684
Project: 12684
Buggy source:
/** 
 * Sets the participant property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param participant
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws if the given {@code participant} argument is {@code null}
 * @throws IllegalArgumentException if the associated ModuleDefinition instance is not {@code null} andgiven  {@code participant} URI is not found in its list of FunctionalComponent instances.
 */
public void setParticipant(URI participant){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (participant == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (moduleDefinition != null && moduleDefinition.getFunctionalComponent(participant) == null) {
    throw new IllegalArgumentException("String_Node_Str" + participant + "String_Node_Str");
  }
  this.participant=participant;
}

Fixed version (ground truth):
/** 
 * Sets the participant property of this object to the given one. <p> If this object belongs to an SBOLDocument instance, then the SBOLDcouement instance is checked for compliance first. Only a compliant SBOLDocument instance is allowed to be edited.
 * @param participant
 * @throws SBOLException if the associated SBOLDocument is not compliant.
 * @throws IllegalArgumentException if the given {@code participant} argument is {@code null}
 * @throws IllegalArgumentException if the associated ModuleDefinition instance is not {@code null} andgiven  {@code participant} URI is not found in its list of FunctionalComponent instances.
 */
public void setParticipant(URI participant){
  if (sbolDocument != null)   sbolDocument.checkReadOnly();
  if (participant == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (moduleDefinition != null && moduleDefinition.getFunctionalComponent(participant) == null) {
    throw new IllegalArgumentException("String_Node_Str" + participant + "String_Node_Str");
  }
  this.participant=participant;
}
Program: 12685
Project: 12685
Buggy source:
/** 
 * Test if the given object's identity URI is compliant with the form   {@code} ⟨prefix⟩/(⟨displayId⟩/)1,4}⟨version⟩. The prefix is established by the owner of this object. The number of displayIds can range from 1 to 4, depending on the level of the given object. If the given index is 0, then  {@code objURI} is checked as a top-level URI for compliance;if the given index is 1, then  {@code objURI} is checked as a child of a top-level URI for compliance;if the given index is 2, then  {@code objURI} is checked as a grand child of a top-level URI for compliance; andif the given index is 3, then  {@code objURI} is checked as a great grand child of a top-level URI for compliance.
 * @param objURI
 * @param index
 * @return <code>true</code> if the identity URI is compliant, <code>false</code> otherwise.
 */
static final boolean isURIcompliant(URI objURI,int index){
  if (index < 0 || index > 3) {
    return false;
  }
  Pattern r;
  String URIstr=objURI.toString();
  if (index == 0) {
    r=Pattern.compile(toplevelURIpattern);
  }
 else   if (index == 1) {
    r=Pattern.compile(childURIpattern);
  }
 else   if (index == 2) {
    r=Pattern.compile(grandchildURIpattern);
  }
 else {
    r=Pattern.compile(greatGrandchildURIpattern);
  }
  Matcher m=r.matcher(URIstr);
  if (!m.matches()) {
  }
  return m.matches();
}

Fixed version (ground truth):
/** 
 * Test if the given object's identity URI is compliant with the form   {@code ⟨prefix⟩/(⟨displayId⟩/)}{1,4}⟨version⟩. The prefix is established by the owner of this object. The number of displayIds can range from 1 to 4, depending on the level of the given object. If the given index is 0, then   {@code objURI} is checked as a top-level URI for compliance;if the given index is 1, then  {@code objURI} is checked as a child of a top-level URI for compliance;if the given index is 2, then  {@code objURI} is checked as a grand child of a top-level URI for compliance; andif the given index is 3, then  {@code objURI} is checked as a great grand child of a top-level URI for compliance.
 * @param objURI
 * @param index
 * @return <code>true</code> if the identity URI is compliant, <code>false</code> otherwise.
 */
static final boolean isURIcompliant(URI objURI,int index){
  if (index < 0 || index > 3) {
    return false;
  }
  Pattern r;
  String URIstr=objURI.toString();
  if (index == 0) {
    r=Pattern.compile(toplevelURIpattern);
  }
 else   if (index == 1) {
    r=Pattern.compile(childURIpattern);
  }
 else   if (index == 2) {
    r=Pattern.compile(grandchildURIpattern);
  }
 else {
    r=Pattern.compile(greatGrandchildURIpattern);
  }
  Matcher m=r.matcher(URIstr);
  if (!m.matches()) {
  }
  return m.matches();
}
Program: 12686
Project: 12686
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}
Program: 12688
Project: 12688
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}
Program: 12689
Project: 12689
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  int count=0;
  for (  Participation participation : this.getParticipations()) {
    if (!participation.isSetDisplayId())     participation.setDisplayId("String_Node_Str" + ++count);
    participation.updateCompliantURI(this.getPersistentIdentity().toString(),participation.getDisplayId(),version);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  int count=0;
  for (  Participation participation : this.getParticipations()) {
    if (!participation.isSetDisplayId())     participation.setDisplayId("String_Node_Str" + ++count);
    participation.updateCompliantURI(this.getPersistentIdentity().toString(),participation.getDisplayId(),version);
    this.removeChildSafely(participation,this.participations);
    this.addParticipation(participation);
    String participantId=extractDisplayId(participation.getParticipantURI());
    participation.setParticipant(createCompliantURI(URIprefix,participantId,version));
  }
}
Program: 12690
Project: 12690
Buggy source:
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}
Program: 12692
Project: 12692
Buggy source:
/** 
 * Assume this SequenceAnnotation object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 * @param URIprefix
 * @param parentDisplayId
 * @param version
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  int count=0;
  for (  Location location : this.getLocations()) {
    if (!location.isSetDisplayId())     location.setDisplayId("String_Node_Str" + ++count);
    location.updateCompliantURI(this.getPersistentIdentity().toString(),location.getDisplayId(),version);
  }
}

Fixed version (ground truth):
/** 
 * Assume this SequenceAnnotation object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 * @param URIprefix
 * @param parentDisplayId
 * @param version
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  String componentId=extractDisplayId(component);
  this.setComponent(createCompliantURI(URIprefix,componentId,version));
  int count=0;
  for (  Location location : this.getLocations()) {
    if (!location.isSetDisplayId())     location.setDisplayId("String_Node_Str" + ++count);
    location.updateCompliantURI(this.getPersistentIdentity().toString(),location.getDisplayId(),version);
    this.removeChildSafely(location,this.locations);
    this.addLocation(location);
  }
}
Program: 12694
Project: 12694
Buggy source:
private Collection(Collection collection){
  super(collection.getIdentity());
  Set<URI> newMembers=new HashSet<>();
  for (  URI member : collection.getMemberURIs()) {
    newMembers.add(member);
  }
  this.setMembers(newMembers);
}

Fixed version (ground truth):
private Collection(Collection collection){
  super(collection.getIdentity());
  this.members=new HashSet<>();
  Set<URI> newMembers=new HashSet<>();
  for (  URI member : collection.getMemberURIs()) {
    newMembers.add(member);
  }
  this.setMembers(newMembers);
}