nus-yam/ex-repair huggingface dataset:
Program: 39387
Project: 39387
Buggy source:
/** 
 * Returns IAtomContainer without Hydrogen. If an GraphAtomContainer has atom single atom which is atom Hydrogen then its not removed.
 * @param atomContainer
 * @return IAtomContainer without Hydrogen. If an GraphAtomContainer hasatom single atom which is atom Hydrogen then its not removed.
 */
public static IAtomContainer convertExplicitToImplicitHydrogens(IAtomContainer atomContainer){
  IAtomContainer mol=atomContainer.getBuilder().newInstance(IAtomContainer.class,atomContainer);
  setNullHCountToZero(mol);
  if (mol.getAtomCount() > 1) {
    mol=removeHydrogensExceptSingleAndPreserveAtomID(mol);
  }
 else   if (mol.getAtomCount() == 1 && !atomContainer.atoms().iterator().next().getSymbol().equalsIgnoreCase("String_Node_Str")) {
    convertImplicitToExplicitHydrogens(mol);
    mol=removeHydrogensExceptSingleAndPreserveAtomID(mol);
  }
 else   if (mol.getAtomCount() == 1 && atomContainer.atoms().iterator().next().getSymbol().equalsIgnoreCase("String_Node_Str")) {
    System.err.println("String_Node_Str");
  }
  mol.setProperties(atomContainer.getProperties());
  mol.setFlags(atomContainer.getFlags());
  if (atomContainer.getID() != null) {
    mol.setID(atomContainer.getID());
  }
  return mol;
}

Fixed version (ground truth):
/** 
 * Returns IAtomContainer without Hydrogen. If an GraphAtomContainer has atom single atom which is atom Hydrogen then its not removed.
 * @param atomContainer
 * @return IAtomContainer without Hydrogen. If an GraphAtomContainer hasatom single atom which is atom Hydrogen then its not removed.
 */
public static IAtomContainer convertExplicitToImplicitHydrogens(IAtomContainer atomContainer){
  IAtomContainer mol=atomContainer.getBuilder().newInstance(IAtomContainer.class,atomContainer);
  if (mol.getAtomCount() > 1) {
    mol=removeHydrogensExceptSingleAndPreserveAtomID(mol);
  }
 else   if (mol.getAtomCount() == 1 && !atomContainer.atoms().iterator().next().getSymbol().equalsIgnoreCase("String_Node_Str")) {
    convertImplicitToExplicitHydrogens(mol);
    mol=removeHydrogensExceptSingleAndPreserveAtomID(mol);
  }
 else   if (mol.getAtomCount() == 1 && atomContainer.atoms().iterator().next().getSymbol().equalsIgnoreCase("String_Node_Str")) {
    System.err.println("String_Node_Str");
  }
  mol.setProperties(atomContainer.getProperties());
  mol.setFlags(atomContainer.getFlags());
  if (atomContainer.getID() != null) {
    mol.setID(atomContainer.getID());
  }
  return mol;
}
Program: 39388
Project: 39388
Buggy source:
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  if (mcsAtomSolution != null) {
    Map<IAtom,IAtom> mappingsByAtoms=mcsAtomSolution.getMappingsByAtoms();
    mappingsByAtoms.entrySet().stream().map((mapping) -> {
      mapping.getKey().setFlag(999,true);
      return mapping;
    }
).forEach((mapping) -> {
      mapping.getValue().setFlag(999,true);
    }
);
    totalBondEnergy=getEnergy(educt,product);
  }
  return totalBondEnergy;
}

Fixed version (ground truth):
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  if (mcsAtomSolution != null) {
    Map<IAtom,IAtom> mappingsByAtoms=mcsAtomSolution.getMappingsByAtoms();
    mappingsByAtoms.entrySet().stream().map((mapping) -> {
      mapping.getKey().setFlag(999,true);
      return mapping;
    }
).forEach((mapping) -> {
      mapping.getValue().setFlag(999,true);
    }
);
    totalBondEnergy=getEnergy(educt,product);
  }
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  return totalBondEnergy;
}
Program: 39389
Project: 39389
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else   if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
    return false;
  }
 else {
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    VF2Sub mapper;
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
    return false;
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    VF2Sub mapper;
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}
Program: 39390
Project: 39390
Buggy source:
@Test public void case4(){
  HashMap<String,String> map=new HashMap<String,String>();
  SmilesParser sp=new SmilesParser(DefaultChemObjectBuilder.getInstance());
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  List<IAtomContainer> jobs=new ArrayList<IAtomContainer>();
  for (  String s : map.values()) {
    try {
      jobs.add(sp.parseSmiles(s));
    }
 catch (    InvalidSmilesException ex) {
      Logger.getLogger(TestMCSS.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  long startTime=Calendar.getInstance().getTimeInMillis();
  MCSS mcss=new MCSS(jobs,JobType.SINGLE,5);
  for (  IAtomContainer ac : mcss.getCalculateMCSS()) {
    Assert.assertEquals(1,ac.getAtomCount());
  }
  long endCalcTime=Calendar.getInstance().getTimeInMillis();
}

Fixed version (ground truth):
@Test public void case4(){
  HashMap<String,String> map=new HashMap<>();
  SmilesParser sp=new SmilesParser(DefaultChemObjectBuilder.getInstance());
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  List<IAtomContainer> jobs=new ArrayList<>();
  for (  String s : map.values()) {
    try {
      jobs.add(sp.parseSmiles(s));
    }
 catch (    InvalidSmilesException ex) {
      Logger.getLogger(TestMCSS.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  long startTime=Calendar.getInstance().getTimeInMillis();
  MCSS mcss=new MCSS(jobs,JobType.SINGLE,5);
  for (  IAtomContainer ac : mcss.getCalculateMCSS()) {
    System.out.println("String_Node_Str" + getMCSSSmiles(ac));
    Assert.assertEquals(1,ac.getAtomCount());
  }
  long endCalcTime=Calendar.getInstance().getTimeInMillis();
}
Program: 39391
Project: 39391
Buggy source:
@Test public void case5(){
  HashMap<String,String> map=new HashMap<String,String>();
  SmilesParser sp=new SmilesParser(DefaultChemObjectBuilder.getInstance());
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  List<IAtomContainer> jobs=new ArrayList<IAtomContainer>();
  for (  String s : map.values()) {
    try {
      IAtomContainer ac=sp.parseSmiles(s);
      int i=1;
      for (      IAtom a : ac.atoms()) {
        a.setID(i + "String_Node_Str");
        i++;
      }
      jobs.add(ac);
    }
 catch (    InvalidSmilesException ex) {
      Logger.getLogger(TestMCSS.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  long startTime=Calendar.getInstance().getTimeInMillis();
  MCSS mcss=new MCSS(jobs,JobType.SINGLE,5,true,true,false);
  for (  IAtomContainer ac : mcss.getCalculateMCSS()) {
    Assert.assertEquals(21,ac.getAtomCount());
  }
  long endCalcTime=Calendar.getInstance().getTimeInMillis();
}

Fixed version (ground truth):
@Test public void case5(){
  HashMap<String,String> map=new HashMap<>();
  SmilesParser sp=new SmilesParser(DefaultChemObjectBuilder.getInstance());
  map.put("String_Node_Str","String_Node_Str");
  map.put("String_Node_Str","String_Node_Str");
  List<IAtomContainer> jobs=new ArrayList<>();
  for (  String s : map.values()) {
    try {
      IAtomContainer ac=sp.parseSmiles(s);
      int i=1;
      for (      IAtom a : ac.atoms()) {
        a.setID(i + "String_Node_Str");
        i++;
      }
      jobs.add(ac);
    }
 catch (    InvalidSmilesException ex) {
      Logger.getLogger(TestMCSS.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  long startTime=Calendar.getInstance().getTimeInMillis();
  MCSS mcss=new MCSS(jobs,JobType.SINGLE,5,true,true,false);
  for (  IAtomContainer ac : mcss.getCalculateMCSS()) {
    Assert.assertEquals(21,ac.getAtomCount());
  }
  long endCalcTime=Calendar.getInstance().getTimeInMillis();
}
Program: 39392
Project: 39392
Buggy source:
@Override public synchronized Double sortResults(Map<Integer,AtomAtomMapping> allAtomEnergyMCS,Map<Integer,Double> energySelectionMap) throws CDKException {
  for (  Integer Key : allAtomEnergyMCS.keySet()) {
    AtomAtomMapping mcsAtom=allAtomEnergyMCS.get(Key);
    Double Energies=getMappedMoleculeEnergies(mcsAtom);
    energySelectionMap.put(Key,Energies);
  }
  energySelectionMap=sortMapByValueInAscendingOrder(energySelectionMap);
  double lowestEnergyScore=MAX_ENERGY;
  for (  Integer key : energySelectionMap.keySet()) {
    lowestEnergyScore=energySelectionMap.get(key);
    break;
  }
  return lowestEnergyScore;
}

Fixed version (ground truth):
@Override public synchronized Double sortResults(Map<Integer,AtomAtomMapping> allAtomEnergyMCS,Map<Integer,Double> energySelectionMap) throws CDKException {
  for (  Integer Key : allAtomEnergyMCS.keySet()) {
    AtomAtomMapping mcsAtom=allAtomEnergyMCS.get(Key);
    Double energies=getMappedMoleculeEnergies(mcsAtom);
    energySelectionMap.put(Key,energies);
  }
  energySelectionMap=sortMapByValueInAscendingOrder(energySelectionMap);
  double lowestEnergyScore=MAX_ENERGY;
  for (  Integer key : energySelectionMap.keySet()) {
    lowestEnergyScore=energySelectionMap.get(key);
    break;
  }
  return lowestEnergyScore;
}
Program: 39393
Project: 39393
Buggy source:
private synchronized static double getBondEnergy(IBond bond,BondEnergies bondEnergy){
  double energy=0.0;
  if ((bond.getAtom(0).getFlag(0) == true && bond.getAtom(1).getFlag(0) == false) || (bond.getAtom(0).getFlag(0) == false && bond.getAtom(1).getFlag(0) == true)) {
    Integer val=bondEnergy.getEnergies(bond.getAtom(0),bond.getAtom(1),bond.getOrder());
    if (val != null) {
      energy=val;
    }
  }
  return energy;
}

Fixed version (ground truth):
private synchronized static double getBondEnergy(IBond bond,BondEnergies bondEnergy){
  double energy=0.0;
  if ((bond.getAtom(0).getFlag(0) == true && bond.getAtom(1).getFlag(999) == false) || (bond.getAtom(0).getFlag(0) == false && bond.getAtom(1).getFlag(999) == true)) {
    int val=bondEnergy.getEnergies(bond.getAtom(0),bond.getAtom(1),bond.getOrder());
    energy=val;
  }
  return energy;
}
Program: 39394
Project: 39394
Buggy source:
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(0,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(0,false);
  }
  if (mcsAtomSolution != null) {
    for (    IAtom eAtom : mcsAtomSolution.getMappingsByAtoms().keySet()) {
      IAtom pAtom=mcsAtomSolution.getMappingsByAtoms().get(eAtom);
      eAtom.setFlag(0,true);
      pAtom.setFlag(0,true);
    }
    totalBondEnergy=getEnergy(educt,product);
  }
  return totalBondEnergy;
}

Fixed version (ground truth):
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  if (mcsAtomSolution != null) {
    for (    IAtom eAtom : mcsAtomSolution.getMappingsByAtoms().keySet()) {
      IAtom pAtom=mcsAtomSolution.getMappingsByAtoms().get(eAtom);
      eAtom.setFlag(999,true);
      pAtom.setFlag(999,true);
    }
    totalBondEnergy=getEnergy(educt,product);
  }
  return totalBondEnergy;
}
Program: 39395
Project: 39395
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
    return false;
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}
Program: 39396
Project: 39396
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
 else {
      List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
      VF2Sub mapper;
      if (getQuery() instanceof IQueryAtomContainer) {
        mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
      }
 else {
        mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
      }
      isSubgraph=mapper.isSubgraph();
      List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
      if (isSubgraph) {
        mappingsVF2.addAll(atomMappings);
      }
 else {
        return false;
      }
      setVFMappings(mappingsVF2);
    }
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else   if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
    return false;
  }
 else {
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    VF2Sub mapper;
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}
Program: 39397
Project: 39397
Buggy source:
private synchronized static double getBondEnergy(IBond bond,BondEnergies bondEnergy){
  double energy=0.0;
  if ((bond.getAtom(0).getFlag(0) == true && bond.getAtom(1).getFlag(999) == false) || (bond.getAtom(0).getFlag(0) == false && bond.getAtom(1).getFlag(999) == true)) {
    int val=bondEnergy.getEnergies(bond.getAtom(0),bond.getAtom(1),bond.getOrder());
    energy=val;
  }
  return energy;
}

Fixed version (ground truth):
private synchronized static double getBondEnergy(IBond bond,BondEnergies bondEnergy){
  double energy=0.0;
  if ((bond.getAtom(0).getFlag(999) == true && bond.getAtom(1).getFlag(999) == false) || (bond.getAtom(0).getFlag(999) == false && bond.getAtom(1).getFlag(999) == true)) {
    int val=bondEnergy.getEnergies(bond.getAtom(0),bond.getAtom(1),bond.getOrder());
    energy=val;
  }
  return energy;
}
Program: 39398
Project: 39398
Buggy source:
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  if (mcsAtomSolution != null) {
    for (    IAtom eAtom : mcsAtomSolution.getMappingsByAtoms().keySet()) {
      IAtom pAtom=mcsAtomSolution.getMappingsByAtoms().get(eAtom);
      eAtom.setFlag(999,true);
      pAtom.setFlag(999,true);
    }
    totalBondEnergy=getEnergy(educt,product);
  }
  return totalBondEnergy;
}

Fixed version (ground truth):
private synchronized Double getMappedMoleculeEnergies(AtomAtomMapping mcsAtomSolution) throws CDKException {
  double totalBondEnergy=-9999.0;
  IAtomContainer educt=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getQuery());
  IAtomContainer product=DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class,chemfilter.getTarget());
  for (int i=0; i < educt.getAtomCount(); i++) {
    educt.getAtom(i).setFlag(999,false);
  }
  for (int i=0; i < product.getAtomCount(); i++) {
    product.getAtom(i).setFlag(999,false);
  }
  if (mcsAtomSolution != null) {
    Map<IAtom,IAtom> mappingsByAtoms=mcsAtomSolution.getMappingsByAtoms();
    mappingsByAtoms.entrySet().stream().map((mapping) -> {
      mapping.getKey().setFlag(999,true);
      return mapping;
    }
).forEach((mapping) -> {
      mapping.getValue().setFlag(999,true);
    }
);
    totalBondEnergy=getEnergy(educt,product);
  }
  return totalBondEnergy;
}
Program: 39399
Project: 39399
Buggy source:
private boolean isCandidateFeasible(Match candidate){
  for (  INode queryAtom : map.keySet()) {
    if (queryAtom.equals(candidate.getQueryNode()) || map.get(queryAtom).equals(candidate.getTargetAtom())) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isCandidateFeasible(Match candidate){
  for (  INode queryAtom : map.keySet()) {
    if (queryAtom.equals(candidate.getQueryNode())) {
      return false;
    }
    if (map.get(queryAtom).equals(candidate.getTargetAtom())) {
      return false;
    }
  }
  return true;
}
Program: 39400
Project: 39400
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void backTrack(){
  if (queryPath.isEmpty() || isGoal()) {
    map.clear();
    return;
  }
  if (isHeadMapped()) {
    return;
  }
  map.clear();
  for (int i=0; i < queryPath.size() - 1; i++) {
    map.put(queryPath.get(i),targetPath.get(i));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void backTrack(){
  if (queryPath.isEmpty() || isGoal()) {
    map.clear();
    return;
  }
  if (isHeadMapped()) {
    return;
  }
  map.clear();
  for (int i=0; i < queryPath.size() - 1; i++) {
    if (map.containsKey(queryPath.get(i))) {
      continue;
    }
    if (map.containsValue(targetPath.get(i))) {
      continue;
    }
    map.put(queryPath.get(i),targetPath.get(i));
  }
}
Program: 39401
Project: 39401
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean isMatchFeasible(Match match){
  if (map.containsKey(match.getQueryNode()) || map.containsValue(match.getTargetAtom())) {
    return false;
  }
  if (!matchAtoms(match)) {
    return false;
  }
  return matchBonds(match);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isMatchFeasible(Match match){
  if (map.containsKey(match.getQueryNode())) {
    return false;
  }
  if (map.containsValue(match.getTargetAtom())) {
    return false;
  }
  if (!matchAtoms(match)) {
    return false;
  }
  return matchBonds(match);
}
Program: 39402
Project: 39402
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && isBondMatchFlag() && isBondTypeMatch(targetBond)) {
    return true;
  }
 else   if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && isShouldMatchRings()) {
    if (queryBond.getFlag(CDKConstants.ISAROMATIC) && targetBond.getFlag(CDKConstants.ISAROMATIC)) {
      return true;
    }
    return !queryBond.getFlag(CDKConstants.ISAROMATIC) && !targetBond.getFlag(CDKConstants.ISAROMATIC);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && isBondMatchFlag() && isBondTypeMatch(targetBond)) {
    return true;
  }
 else   if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && isShouldMatchRings()) {
    if (queryBond.getFlag(CDKConstants.ISAROMATIC) && targetBond.getFlag(CDKConstants.ISAROMATIC)) {
      return true;
    }
 else     if (!queryBond.getFlag(CDKConstants.ISAROMATIC) && !targetBond.getFlag(CDKConstants.ISAROMATIC)) {
      return true;
    }
  }
 else   if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && !isShouldMatchRings()) {
    return true;
  }
  return false;
}
Program: 39404
Project: 39404
Buggy source:
/** 
 * Initialize query and target molecules. Note: Here its assumed that hydrogens are implicit and user has called these two methods percieveAtomTypesAndConfigureAtoms and CDKAromicityDetector before initializing calling this method.
 * @param query query mol
 * @param target target mol This is the algorithm factory and entry port forall the MCS algorithm in the Isomorphism supported algorithm {@link org.openscience.cdk.smsd.interfaces.Algorithm} types: <OL> <lI>0:Default, <lI>1: MCSPlus, <lI>2: VFLibMCS, <lI>3: CDKMCS </OL>
 * @param algorithmType {@link org.openscience.cdk.smsd.interfaces.Algorithm}
 * @param bondTypeFlag Match bond types (i.e. double to double etc)
 * @param matchRings Match ring atoms and ring size
 * @param matchAtomType
 */
@TestMethod("String_Node_Str") public Isomorphism(IAtomContainer query,IAtomContainer target,Algorithm algorithmType,boolean bondTypeFlag,boolean matchRings,boolean matchAtomType){
  super(query,target,bondTypeFlag,matchRings,matchAtomType);
  this.algorithmType=algorithmType;
  mcsBuilder(getQuery(),getTarget());
  setSubgraph(isSubgraph());
}

Fixed version (ground truth):
/** 
 * Initialize query and target molecules. Note: Here its assumed that hydrogens are implicit and user has called these two methods percieveAtomTypesAndConfigureAtoms and CDKAromicityDetector before initializing calling this method.
 * @param query query mol
 * @param target target mol This is the algorithm factory and entry port forall the MCS algorithm in the Isomorphism supported algorithm {@link org.openscience.cdk.smsd.interfaces.Algorithm} types: <OL> <lI>0:Default, <lI>1: MCSPlus, <lI>2: VFLibMCS, <lI>3: CDKMCS </OL>
 * @param algorithmType {@link org.openscience.cdk.smsd.interfaces.Algorithm}
 * @param bondTypeFlag Match bond types (i.e. double to double etc)
 * @param matchRings Match ring atoms and ring size
 * @param matchAtomType
 */
@TestMethod("String_Node_Str") public Isomorphism(IAtomContainer query,IAtomContainer target,Algorithm algorithmType,boolean bondTypeFlag,boolean matchRings,boolean matchAtomType){
  super(query,target,bondTypeFlag,matchRings,matchAtomType);
  this.algorithmType=algorithmType;
  if (isMatchRings()) {
    try {
      MoleculeInitializer.initializeMolecule(getQuery());
      MoleculeInitializer.initializeMolecule(getTarget());
    }
 catch (    CDKException ex) {
    }
  }
  mcsBuilder(getQuery(),getTarget());
  setSubgraph(isSubgraph());
}
Program: 39405
Project: 39405
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (isMatchRings() && (isAliphaticAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      return false;
    }
 else     if (isMatchRings() && (isRingAtom(getQueryAtom()) && isAliphaticAtom(targetAtom))) {
      return false;
    }
 else     if (isMatchRings() && isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)) {
      if (!isRingSizeMatch(targetAtom)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (isMatchRings() && isRingAtom(getQueryAtom()) && !isRingAtom(targetAtom)) {
      return false;
    }
    if (isMatchRings() && !isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)) {
      return false;
    }
    if (isMatchRings() && isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)&& !isRingSizeMatch(targetAtom)) {
      return false;
    }
  }
  return true;
}
Program: 39406
Project: 39406
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (isMatchRings() && (isAliphaticAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      return false;
    }
 else     if (isMatchRings() && (isRingAtom(getQueryAtom()) && isAliphaticAtom(targetAtom))) {
      return false;
    }
 else     if (isMatchRings() && isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)) {
      if (!isRingSizeMatch(targetAtom)) {
        return false;
      }
    }
 else     if (!isMatchRings()) {
      return matchAtomType(targetAtom);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (!matchAtomType(targetAtom)) {
      return false;
    }
    if (isMatchRings() && isRingAtom(getQueryAtom()) && !isRingAtom(targetAtom)) {
      return false;
    }
    if (isMatchRings() && !isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)) {
      return false;
    }
    if (isMatchRings() && isRingAtom(getQueryAtom()) && isRingAtom(targetAtom)&& !isRingSizeMatch(targetAtom)) {
      return false;
    }
  }
  return true;
}
Program: 39407
Project: 39407
Buggy source:
private VFMCSState(VFMCSState state,Match match){
  this.candidates=new ArrayList<Match>();
  this.queryPath=new ArrayList<INode>(state.queryPath);
  this.targetPath=new ArrayList<IAtom>(state.targetPath);
  this.map=state.map;
  this.query=state.query;
  this.target=state.target;
  map.put(match.getQueryNode(),match.getTargetAtom());
  queryPath.add(match.getQueryNode());
  targetPath.add(match.getTargetAtom());
  loadCandidates(match);
}

Fixed version (ground truth):
private VFMCSState(VFMCSState state,Match match){
  this.candidates=new ArrayList<>();
  this.queryPath=new ArrayList<>(state.queryPath);
  this.targetPath=new ArrayList<>(state.targetPath);
  this.map=state.map;
  this.query=state.query;
  this.target=state.target;
  map.put(match.getQueryNode(),match.getTargetAtom());
  queryPath.add(match.getQueryNode());
  targetPath.add(match.getTargetAtom());
  loadCandidates(match);
}
Program: 39408
Project: 39408
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Map<INode,IAtom> getMap(){
  return Collections.synchronizedMap(new HashMap<INode,IAtom>(map));
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Map<INode,IAtom> getMap(){
  return Collections.synchronizedMap(new HashMap<>(map));
}
Program: 39409
Project: 39409
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void backTrack(){
  if (queryPath.isEmpty() || isGoal()) {
    map.clear();
    return;
  }
  if (isHeadMapped()) {
    return;
  }
  map.clear();
  for (int i=0; i < queryPath.size() - 1; i++) {
    map.put(queryPath.get(i),targetPath.get(i));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void backTrack(){
  if (queryPath.isEmpty() || isGoal()) {
    map.clear();
    return;
  }
  if (isHeadMapped()) {
    return;
  }
  map.clear();
  for (int i=0; i < queryPath.size() - 1; i++) {
    if (map.containsKey(queryPath.get(i))) {
      continue;
    }
    if (map.containsValue(targetPath.get(i))) {
      continue;
    }
    map.put(queryPath.get(i),targetPath.get(i));
  }
}
Program: 39410
Project: 39410
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean isMatchFeasible(Match match){
  if (map.containsKey(match.getQueryNode()) || map.containsValue(match.getTargetAtom())) {
    return false;
  }
  if (!matchAtoms(match)) {
    return false;
  }
  if (!matchBonds(match)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isMatchFeasible(Match match){
  if (map.containsKey(match.getQueryNode()) || map.containsValue(match.getTargetAtom())) {
    return false;
  }
  if (!matchAtoms(match)) {
    return false;
  }
  return matchBonds(match);
}
Program: 39411
Project: 39411
Buggy source:
public String getQRefName(){
  String suffix=argumentHandler.getSuffix();
  return argumentHandler.getQueryMolOutName() + suffix + "String_Node_Str";
}

Fixed version (ground truth):
public String getQRefName(){
  String suffix=argumentHandler.getSuffix();
  String fileName=argumentHandler.getQueryMolOutName() == null ? "String_Node_Str" : argumentHandler.getQueryMolOutName();
  if (!fileName.equals("String_Node_Str")) {
    fileName=argumentHandler.getQueryMolOutName().equals("String_Node_Str") ? "String_Node_Str" : argumentHandler.getQueryMolOutName();
  }
  return fileName + suffix + "String_Node_Str";
}
Program: 39412
Project: 39412
Buggy source:
public String getTRefName(){
  String suffix=argumentHandler.getSuffix();
  return argumentHandler.getTargetMolOutName() + suffix + "String_Node_Str";
}

Fixed version (ground truth):
public String getTRefName(){
  String suffix=argumentHandler.getSuffix();
  String fileName=argumentHandler.getTargetMolOutName() == null ? "String_Node_Str" : argumentHandler.getTargetMolOutName();
  if (!fileName.equals("String_Node_Str")) {
    fileName=argumentHandler.getTargetMolOutName().equals("String_Node_Str") ? "String_Node_Str" : argumentHandler.getTargetMolOutName();
  }
  return fileName + suffix + "String_Node_Str";
}
Program: 39413
Project: 39413
Buggy source:
/** 
 * @param mol
 * @throws IllegalArgumentException
 * @throws IOException
 * @throws CDKException
 */
public void writeTargetMol(IAtomContainer mol) throws IllegalArgumentException, IOException, CDKException {
  String suffix=argumentHandler.getSuffix();
  String fileName=argumentHandler.getQueryMolOutName() == null ? "String_Node_Str" : argumentHandler.getQueryMolOutName();
  if (!fileName.equals("String_Node_Str")) {
    fileName=argumentHandler.getQueryMolOutName().equals("String_Node_Str") ? "String_Node_Str" : argumentHandler.getQueryMolOutName();
  }
  String tRefName=fileName + suffix + "String_Node_Str";
  writeMolToMolfile(mol,tRefName);
}

Fixed version (ground truth):
/** 
 * @param mol
 * @throws IllegalArgumentException
 * @throws IOException
 * @throws CDKException
 */
public void writeTargetMol(IAtomContainer mol) throws IllegalArgumentException, IOException, CDKException {
  String suffix=argumentHandler.getSuffix();
  String fileName=argumentHandler.getTargetMolOutName() == null ? "String_Node_Str" : argumentHandler.getTargetMolOutName();
  if (!fileName.equals("String_Node_Str")) {
    fileName=argumentHandler.getTargetMolOutName().equals("String_Node_Str") ? "String_Node_Str" : argumentHandler.getTargetMolOutName();
  }
  String tRefName=fileName + suffix + "String_Node_Str";
  writeMolToMolfile(mol,tRefName);
}
Program: 39414
Project: 39414
Buggy source:
void printImageOptionsHelp(){
  Params params=imageGenerator.getParams();
  System.out.println("String_Node_Str");
  for (  Field field : params.getClass().getFields()) {
    try {
      System.out.println(field.getName() + "String_Node_Str" + field.get(params));
    }
 catch (    IllegalArgumentException e) {
      logger.error("String_Node_Str",e);
    }
catch (    IllegalAccessException e) {
      logger.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
void printImageOptionsHelp(){
  Params params=imageGenerator.getParams();
  System.out.println("String_Node_Str");
  for (  Field field : params.getClass().getFields()) {
    try {
      System.out.println(field.getName() + "String_Node_Str" + field.get(params));
    }
 catch (    IllegalArgumentException|IllegalAccessException e) {
      logger.error("String_Node_Str",e);
    }
  }
}
Program: 39415
Project: 39415
Buggy source:
@Override public synchronized boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final Fragment other=(Fragment)obj;
  if (this.getContainer() != other.getContainer() && (this.getContainer() == null || (this.getContainer().getAtomCount() != other.getContainer().getAtomCount()))) {
    return false;
  }
  if (this.getFingerprint() != other.getFingerprint() && (this.getFingerprint() == null || !this.getFingerprint().equals(other.getFingerprint()))) {
    return false;
  }
  if (this.fingerprintAsLong != other.fingerprintAsLong) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public synchronized boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final Fragment other=(Fragment)obj;
  if (this.getContainer() != other.getContainer() && (this.getContainer() == null || (this.getContainer().getAtomCount() != other.getContainer().getAtomCount()))) {
    return false;
  }
  if (this.getFingerprint() != other.getFingerprint() && (this.getFingerprint() == null || !this.getFingerprint().equals(other.getFingerprint()))) {
    return false;
  }
  return this.fingerprintAsLong == other.fingerprintAsLong;
}
Program: 39417
Project: 39417
Buggy source:
private synchronized void singleMapping(){
  SingleMappingHandler mcs;
  mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchBonds(),isMatchRings());
  clearMaps();
  getMCSList().addAll(mcs.getAllAtomMapping());
}

Fixed version (ground truth):
private synchronized void singleMapping(){
  SingleMappingHandler mcs;
  mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchRings());
  clearMaps();
  getMCSList().addAll(mcs.getAllAtomMapping());
}
Program: 39418
Project: 39418
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph=false;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    singleMapping(isMatchBonds());
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}
Program: 39419
Project: 39419
Buggy source:
private synchronized void singleMapping(boolean shouldMatchBonds){
  SingleMappingHandler mcs;
  if (!(getQuery() instanceof IQueryAtomContainer) && !(getTarget() instanceof IQueryAtomContainer)) {
    mcs=new SingleMappingHandler(getQuery(),getTarget(),shouldMatchBonds,isMatchRings());
  }
 else {
    mcs=new SingleMappingHandler((IQueryAtomContainer)getQuery(),getTarget());
  }
  getMCSList().addAll(mcs.getAllAtomMapping());
}

Fixed version (ground truth):
private synchronized boolean singleMapping(){
  SingleMappingHandler mcs;
  if (!(getQuery() instanceof IQueryAtomContainer) && !(getTarget() instanceof IQueryAtomContainer)) {
    mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchRings());
  }
 else {
    mcs=new SingleMappingHandler((IQueryAtomContainer)getQuery(),getTarget());
  }
  return mcs.getAllAtomMapping() != null && !mcs.getAllAtomMapping().isEmpty();
}
Program: 39420
Project: 39420
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph=false;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    singleMapping(isMatchBonds());
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
 else {
      List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
      VF2Sub mapper;
      if (getQuery() instanceof IQueryAtomContainer) {
        mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
      }
 else {
        mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
      }
      isSubgraph=mapper.isSubgraph();
      List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
      if (isSubgraph) {
        mappingsVF2.addAll(atomMappings);
      }
 else {
        return false;
      }
      setVFMappings(mappingsVF2);
    }
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
 else {
      List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
      VF2Sub mapper;
      if (getQuery() instanceof IQueryAtomContainer) {
        mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
      }
 else {
        mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
      }
      isSubgraph=mapper.isSubgraph();
      List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
      if (isSubgraph) {
        mappingsVF2.addAll(atomMappings);
      }
 else {
        return false;
      }
      setVFMappings(mappingsVF2);
    }
  }
  return isSubgraph;
}
Program: 39421
Project: 39421
Buggy source:
/** 
 * Constructor
 * @param queryBond query GraphMolecule
 * @param shouldMatchBonds bond match flag
 * @param matchAtomTypes
 */
public DefaultBondMatcher(IBond queryBond,boolean shouldMatchBonds,boolean matchAtomTypes){
  super();
  this.queryBond=queryBond;
  this.shouldMatchBonds=shouldMatchBonds;
  this.matchAtomTypes=matchAtomTypes;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param queryBond query GraphMolecule
 * @param shouldMatchBonds bond match flag
 * @param shouldMatchRings
 * @param matchAtomTypes
 */
public DefaultBondMatcher(IBond queryBond,boolean shouldMatchBonds,boolean shouldMatchRings,boolean matchAtomTypes){
  super();
  this.queryBond=queryBond;
  this.shouldMatchBonds=shouldMatchBonds;
  this.shouldMatchRings=shouldMatchRings;
  this.matchAtomTypes=matchAtomTypes;
}
Program: 39422
Project: 39422
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && (!isBondMatchFlag() || (isBondMatchFlag() && isBondTypeMatch(targetBond)))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && isBondMatchFlag() && isBondTypeMatch(targetBond)) {
    return true;
  }
 else   if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && isShouldMatchRings()) {
    if (queryBond.getFlag(CDKConstants.ISAROMATIC) && targetBond.getFlag(CDKConstants.ISAROMATIC)) {
      return true;
    }
    return !queryBond.getFlag(CDKConstants.ISAROMATIC) && !targetBond.getFlag(CDKConstants.ISAROMATIC);
  }
  return false;
}