nus-yam/ex-repair huggingface dataset:
Program: 166604
Project: 166604
Buggy source:
private synchronized Logger doGetLogger(String name){
  Logger logger=loggers.get(name);
  if (logger == null) {
    final ChronicleLogWriter writer=manager.createWriter(name);
    if (manager.isSimple(name)) {
      logger=new ChronicleLogger.Text(writer,name,ChronicleLogLevel.WARN);
    }
 else     if (manager.isBinary(name)) {
      logger=new ChronicleLogger.Binary(writer,name,manager.cfg().getLevel(name));
    }
 else     if (manager.isText(name)) {
      logger=new ChronicleLogger.Text(writer,name,manager.cfg().getLevel(name));
    }
    if (logger != null) {
      loggers.put(name,logger);
    }
 else {
      System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
    }
  }
  return logger;
}

Fixed version (ground truth):
private synchronized Logger doGetLogger(String name) throws IOException {
  Logger logger=loggers.get(name);
  if (logger == null) {
    final ChronicleLogWriter writer=manager.createWriter(name);
    if (manager.isSimple(name)) {
      logger=new ChronicleLogger.Text(writer,name,ChronicleLogLevel.WARN);
    }
 else     if (manager.isBinary(name)) {
      logger=new ChronicleLogger.Binary(writer,name,manager.cfg().getLevel(name));
    }
 else     if (manager.isText(name)) {
      logger=new ChronicleLogger.Text(writer,name,manager.cfg().getLevel(name));
    }
    if (logger != null) {
      loggers.put(name,logger);
    }
 else {
      System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
    }
  }
  return logger;
}
Program: 166605
Project: 166605
Buggy source:
private synchronized Logger doGetLogger(String name){
  Logger logger=loggers.get(name);
  if (logger == null) {
    final ChronicleLogWriter writer=manager.createWriter(name);
    if (manager.isSimple(name)) {
      logger=new ChronicleLogger.Text(writer,name,ChronicleLogLevel.WARN);
    }
 else     if (manager.isBinary(name)) {
      logger=new ChronicleLogger.Binary(writer,name,manager.cfg().getLevel(name));
    }
 else     if (manager.isText(name)) {
      logger=new ChronicleLogger.Text(writer,name,manager.cfg().getLevel(name));
    }
    if (logger != null) {
      loggers.put(name,logger);
    }
 else {
      System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
    }
  }
  return logger;
}

Fixed version (ground truth):
private synchronized Logger doGetLogger(String name) throws IOException {
  Logger logger=loggers.get(name);
  if (logger == null) {
    final ChronicleLogWriter writer=manager.createWriter(name);
    if (manager.isSimple(name)) {
      logger=new ChronicleLogger.Text(writer,name,ChronicleLogLevel.WARN);
    }
 else     if (manager.isBinary(name)) {
      logger=new ChronicleLogger.Binary(writer,name,manager.cfg().getLevel(name));
    }
 else     if (manager.isText(name)) {
      logger=new ChronicleLogger.Text(writer,name,manager.cfg().getLevel(name));
    }
    if (logger != null) {
      loggers.put(name,logger);
    }
 else {
      System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
    }
  }
  return logger;
}
Program: 166606
Project: 166606
Buggy source:
public static void main(String... args){
  Options opt=new OptionsBuilder().include("String_Node_Str" + Slf4jBenchmark.class.getSimpleName() + "String_Node_Str").forks(1).verbosity(VerboseMode.EXTRA).build();
  new Runner(opt).run();
}

Fixed version (ground truth):
public static void main(String... args) throws Exception {
  Options opt=new OptionsBuilder().include("String_Node_Str" + Slf4jBenchmark.class.getSimpleName() + "String_Node_Str").forks(1).verbosity(VerboseMode.EXTRA).build();
  new Runner(opt).run();
}
Program: 166607
Project: 166607
Buggy source:
/** 
 * @param name
 * @param name
 * @return
 * @throws java.io.IOException
 */
public ChronicleLogWriter createWriter(String name){
  if (this.cfg == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final String path=cfg.getString(name,ChronicleLogConfig.KEY_PATH);
  if (path != null) {
    ChronicleLogWriter appender=writers.get(path);
    if (appender == null) {
      final Integer stDepth=cfg.getInteger(ChronicleLogConfig.KEY_STACK_TRACE_DEPTH);
      final String type=cfg.getString(name,ChronicleLogConfig.KEY_TYPE);
      if (!isSimple(name)) {
        if (isBinary(name)) {
          appender=new ChronicleLogWriters.BinaryWriter(newChronicle(type,path,name));
        }
 else         if (isText(name)) {
          appender=new ChronicleLogWriters.TextWriter(newChronicle(type,path,name),ChronicleLogConfig.DEFAULT_DATE_FORMAT,stDepth);
        }
      }
 else {
        appender=new ChronicleLogWriters.SimpleWriter(System.out);
      }
      if (appender.getChronicle() instanceof IndexedChronicle) {
        appender=new ChronicleLogWriters.SynchronizedWriter(appender);
      }
      this.writers.put(path,appender);
    }
    return appender;
  }
 else {
    throw new IllegalArgumentException(new StringBuilder().append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
  }
}

Fixed version (ground truth):
/** 
 * @param name
 * @param name
 * @return
 * @throws java.io.IOException
 */
public ChronicleLogWriter createWriter(String name) throws IOException {
  if (this.cfg == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final String path=cfg.getString(name,ChronicleLogConfig.KEY_PATH);
  if (path != null) {
    ChronicleLogWriter appender=writers.get(path);
    if (appender == null) {
      final Integer stDepth=cfg.getInteger(ChronicleLogConfig.KEY_STACK_TRACE_DEPTH);
      final String type=cfg.getString(name,ChronicleLogConfig.KEY_TYPE);
      if (!isSimple(name)) {
        if (isBinary(name)) {
          appender=new ChronicleLogWriters.BinaryWriter(newChronicle(type,path,name));
        }
 else         if (isText(name)) {
          appender=new ChronicleLogWriters.TextWriter(newChronicle(type,path,name),ChronicleLogConfig.DEFAULT_DATE_FORMAT,stDepth);
        }
      }
 else {
        appender=new ChronicleLogWriters.SimpleWriter(System.out);
      }
      if (appender.getChronicle() instanceof IndexedChronicle) {
        appender=new ChronicleLogWriters.SynchronizedWriter(appender);
      }
      this.writers.put(path,appender);
    }
    return appender;
  }
 else {
    throw new IllegalArgumentException(new StringBuilder().append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").toString());
  }
}
Program: 166608
Project: 166608
Buggy source:
/** 
 * @param type
 * @param path
 * @param name
 * @return
 * @throws java.io.IOException
 */
private Chronicle newChronicle(String type,String path,String name){
  if (ChronicleLogConfig.TYPE_INDEXED.equalsIgnoreCase(type)) {
    return newIndexedChronicle(path,name);
  }
 else   if (ChronicleLogConfig.TYPE_VANILLA.equalsIgnoreCase(type)) {
    return newVanillaChronicle(path,name);
  }
  throw new IllegalArgumentException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param type
 * @param path
 * @param name
 * @return
 * @throws java.io.IOException
 */
private Chronicle newChronicle(String type,String path,String name) throws IOException {
  if (ChronicleLogConfig.TYPE_INDEXED.equalsIgnoreCase(type)) {
    return newIndexedChronicle(path,name);
  }
 else   if (ChronicleLogConfig.TYPE_VANILLA.equalsIgnoreCase(type)) {
    return newVanillaChronicle(path,name);
  }
  throw new IllegalArgumentException("String_Node_Str");
}
Program: 166609
Project: 166609
Buggy source:
/** 
 * Return an appropriate   {@link ChronicleLogger} instance by name.<p/>
 */
@Override public Logger getLogger(String name){
  try {
    return doGetLogger(name);
  }
 catch (  Exception e) {
    System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").append("String_Node_Str").append(e.getMessage()).toString());
  }
  return NOPLogger.NOP_LOGGER;
}

Fixed version (ground truth):
/** 
 * Return an appropriate   {@link ChronicleLogger} instance by name.
 */
@Override public Logger getLogger(String name){
  try {
    return doGetLogger(name);
  }
 catch (  Exception e) {
    System.err.println(new StringBuilder("String_Node_Str").append("String_Node_Str").append(name).append("String_Node_Str").append("String_Node_Str").append(e.getMessage()).toString());
  }
  return NOPLogger.NOP_LOGGER;
}
Program: 166610
Project: 166610
Buggy source:
public void setDateFormat(String dateFormat){
}

Fixed version (ground truth):
public void setDateFormat(String dateFormat){
  this.dateFormat=dateFormat;
  this.timeStampFormatter=TimeStampFormatter.fromDateFormat(dateFormat);
}
Program: 166613
Project: 166613
Buggy source:
@Override public boolean execute(String action,JSONArray args,CallbackContext callbackContext) throws JSONException {
  String number=args.getString(0);
  if (number.startsWith("String_Node_Str") == false) {
    number=String.format("String_Node_Str",number);
  }
  if (((TelephonyManager)cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
    callbackContext.error("String_Node_Str");
  }
  try {
    Intent intent=new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(Uri.encode(number)));
    cordova.getActivity().startActivity(intent);
    callbackContext.success();
  }
 catch (  Exception e) {
    callbackContext.error("String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(String action,JSONArray args,CallbackContext callbackContext) throws JSONException {
  String number=args.getString(0);
  if (number.startsWith("String_Node_Str") == false) {
    number=String.format("String_Node_Str",number);
  }
  if (((TelephonyManager)cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
    callbackContext.error("String_Node_Str");
  }
  try {
    Intent intent=new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(number));
    cordova.getActivity().startActivity(intent);
    callbackContext.success();
  }
 catch (  Exception e) {
    callbackContext.error("String_Node_Str");
  }
  return true;
}
Program: 166614
Project: 166614
Buggy source:
@Override protected void onStart(){
  view=new WebmakerWebView(this,this,pageName,routeParams);
  RelativeLayout layout=(RelativeLayout)findViewById(id);
  layout.addView(view);
  super.onStart();
}

Fixed version (ground truth):
@Override protected void onStart(){
  if (!mIsRestart) {
    view=new WebmakerWebView(this,this,pageName,routeParams);
    RelativeLayout layout=(RelativeLayout)findViewById(id);
    layout.addView(view);
  }
  super.onStart();
}
Program: 166615
Project: 166615
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Resources res=getResources();
  ColorDrawable plum=new ColorDrawable(getResources().getColor(R.color.plum));
  int shadowPlum=res.getColor(R.color.shadow_plum);
  ActionBar actionBar=getActionBar();
  actionBar.setBackgroundDrawable(plum);
  Window window=getWindow();
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  window.setStatusBarColor(shadowPlum);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    Resources res=getResources();
    ColorDrawable plum=new ColorDrawable(getResources().getColor(R.color.plum));
    int shadowPlum=res.getColor(R.color.shadow_plum);
    ActionBar actionBar=getActionBar();
    if (actionBar != null)     actionBar.setBackgroundDrawable(plum);
    Window window=getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.setStatusBarColor(shadowPlum);
  }
}
Program: 166616
Project: 166616
Buggy source:
/** 
 * Called when the activity is created, based off of the intent details either turn on or off the flashlight
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_flashlight);
  currentlyOn=false;
}

Fixed version (ground truth):
/** 
 * Called when the activity is created, based off of the intent details either turn on or off the flashlight
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d("String_Node_Str","String_Node_Str");
  setContentView(R.layout.activity_flashlight);
  currentlyOn=false;
}
Program: 166617
Project: 166617
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  boolean onOrOff=intent.getBooleanExtra("String_Node_Str",false);
  if (onOrOff != currentlyOn) {
    currentlyOn=onOrOff;
    turnOnOrOff(onOrOff);
  }
 else   if (!onOrOff) {
    finish();
  }
  GoogleNowUtil.resetGoogleNow(this);
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  setIntent(getIntent().putExtra("String_Node_Str",intent.getBooleanExtra("String_Node_Str",false)));
}
Program: 166619
Project: 166619
Buggy source:
/** 
 * Called when the surfaceholder is created. Add the camera to the holder
 */
public void surfaceCreated(SurfaceHolder holder){
  mHolder=holder;
  try {
    mCamera.setPreviewDisplay(mHolder);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Called when the surfaceholder is created. Add the camera to the holder
 */
public void surfaceCreated(SurfaceHolder holder){
  mHolder=holder;
  try {
    mCamera.setPreviewDisplay(mHolder);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  GoogleNowUtil.resetGoogleNow(this);
}
Program: 166621
Project: 166621
Buggy source:
/** 
 * look for a non-empty level 
 */
protected void nextNonEmptyLevel(){
  int cl=currentLevel;
  do {
    if (!levelEmpty[cl=DISTRIBUTOR[levelIndex % distributorLength]]) {
      levelIndex++;
      break;
    }
    levelIndex=(levelIndex + 1) % distributorLength;
  }
 while (true);
  currentLevel=cl;
  if (currentLevel < fireCompleteLevelThreshold) {
    currentCounter=1;
  }
 else {
    currentCounter=this.level[currentLevel].size();
  }
}

Fixed version (ground truth):
/** 
 * look for a non-empty level 
 */
protected void nextNonEmptyLevel(){
  int cl=currentLevel;
  do {
    if (!levelEmpty(cl=DISTRIBUTOR[levelIndex % distributorLength])) {
      levelIndex++;
      break;
    }
    levelIndex=(levelIndex + 1) % distributorLength;
  }
 while (true);
  currentLevel=cl;
  if (currentLevel < fireCompleteLevelThreshold) {
    currentCounter=1;
  }
 else {
    currentCounter=this.level[currentLevel].size();
  }
}
Program: 166622
Project: 166622
Buggy source:
/** 
 * thresholdLevel = 0 disables "fire level completely" threshold effect 
 */
public LevelBag(final int levels,final int capacity,final int thresholdLevel){
  this.levels=levels;
  this.fireCompleteLevelThreshold=thresholdLevel;
  this.capacity=capacity;
  nameTable=new HashMap<>(capacity);
  level=new Level[this.levels];
  levelEmpty=new boolean[this.levels];
  Arrays.fill(levelEmpty,true);
  DISTRIBUTOR=Distributor.get(this.levels).order;
  distributorLength=DISTRIBUTOR.length;
  clear();
}

Fixed version (ground truth):
/** 
 * thresholdLevel = 0 disables "fire level completely" threshold effect 
 */
public LevelBag(final int levels,final int capacity,final int thresholdLevel){
  this.levels=levels;
  this.fireCompleteLevelThreshold=thresholdLevel;
  this.capacity=capacity;
  nameTable=new HashMap<>(capacity);
  level=new Level[this.levels];
  DISTRIBUTOR=Distributor.get(this.levels).order;
  distributorLength=DISTRIBUTOR.length;
  clear();
}
Program: 166623
Project: 166623
Buggy source:
/** 
 * Insert an item into the itemTable, and return the overflow
 * @param newItem The Item to put in
 * @return null if nothing overflowed, non-null if an overflow Item, whichmay be the attempted input item (in which case it was not inserted)
 */
@Override public E addItem(final E newItem){
  E oldItem=null;
  final int inLevel=getLevel(newItem);
  if (size() >= capacity) {
    int outLevel=0;
    while (levelEmpty[outLevel]) {
      outLevel++;
    }
    if (outLevel > inLevel) {
      return newItem;
    }
 else {
      oldItem=takeOutFirst(outLevel);
    }
  }
  if (this.level[inLevel] == null) {
    this.level[inLevel]=new Level(inLevel,inLevel + capacity / levels);
  }
  level[inLevel].add(newItem);
  nameTable.put(newItem.name(),newItem);
  addMass(newItem);
  return oldItem;
}

Fixed version (ground truth):
/** 
 * Insert an item into the itemTable, and return the overflow
 * @param newItem The Item to put in
 * @return null if nothing overflowed, non-null if an overflow Item, whichmay be the attempted input item (in which case it was not inserted)
 */
@Override public E addItem(final E newItem){
  E oldItem=null;
  final int inLevel=getLevel(newItem);
  if (size() >= capacity) {
    int outLevel=0;
    while (levelEmpty(outLevel)) {
      outLevel++;
    }
    if (outLevel > inLevel) {
      return newItem;
    }
 else {
      oldItem=takeOutFirst(outLevel);
    }
  }
  if (this.level[inLevel] == null) {
    this.level[inLevel]=new Level<E>();
  }
  level[inLevel].add(newItem);
  nameTable.put(newItem.name(),newItem);
  addMass(newItem);
  return oldItem;
}
Program: 166624
Project: 166624
Buggy source:
@Override public Iterator<E> iterator(){
  return new Iterator<E>(){
    int l=level.length - 1;
    private Iterator<E> levelIterator;
    private E next;
    final int size=size();
    int count=0;
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
    @Override public boolean hasNext(){
      if (next != null) {
        return true;
      }
      if (l >= 0 && levelIterator == null) {
        while (levelEmpty[l]) {
          if (--l == -1)           return false;
        }
        levelIterator=level[l].descendingIterator();
      }
      if (levelIterator == null) {
        return false;
      }
      next=levelIterator.next();
      count++;
      if (levelIterator.hasNext()) {
        return true;
      }
 else {
        levelIterator=null;
        l--;
        return count <= size;
      }
    }
    @Override public E next(){
      final E e=next;
      next=null;
      return e;
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<E> iterator(){
  return new Iterator<E>(){
    int l=level.length - 1;
    private Iterator<E> levelIterator;
    private E next;
    final int size=size();
    int count=0;
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
    @Override public boolean hasNext(){
      if (next != null) {
        return true;
      }
      if (l >= 0 && levelIterator == null) {
        while (levelEmpty(l)) {
          if (--l == -1)           return false;
        }
        levelIterator=level[l].iterator();
      }
      if (levelIterator == null) {
        return false;
      }
      next=levelIterator.next();
      count++;
      if (levelIterator.hasNext()) {
        return true;
      }
 else {
        levelIterator=null;
        l--;
        return count <= size;
      }
    }
    @Override public E next(){
      final E e=next;
      next=null;
      return e;
    }
  }
;
}
Program: 166625
Project: 166625
Buggy source:
@Override public E takeNext(){
  if (size() == 0) {
    return null;
  }
  if (levelEmpty[currentLevel] || (currentCounter == 0)) {
    nextNonEmptyLevel();
  }
  if (levelEmpty[currentLevel]) {
    throw new IllegalStateException("String_Node_Str");
  }
  final E selected=takeOutFirst(currentLevel);
  currentCounter--;
  return selected;
}

Fixed version (ground truth):
@Override public E takeNext(){
  if (size() == 0) {
    return null;
  }
  if (levelEmpty(currentLevel) || (currentCounter == 0)) {
    nextNonEmptyLevel();
  }
  if (levelEmpty(currentLevel)) {
    throw new IllegalStateException("String_Node_Str");
  }
  final E selected=takeOutFirst(currentLevel);
  currentCounter--;
  return selected;
}
Program: 166626
Project: 166626
Buggy source:
public E removeFirst(){
  final E e=items.iterator().next();
  items.remove(e);
  if (e != null) {
    setLevelEmpty(items.isEmpty());
  }
  return e;
}

Fixed version (ground truth):
public E removeFirst(){
  final E e=this.iterator().next();
  this.remove(e);
  return e;
}
Program: 166627
Project: 166627
Buggy source:
public boolean add(final E e){
  if (e == null)   throw new IllegalStateException("String_Node_Str");
  if (items.add(e)) {
    setLevelEmpty(false);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean add(final E e){
  if (e == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  return super.add(e);
}
Program: 166628
Project: 166628
Buggy source:
@Override public boolean hasNext(){
  if (next != null) {
    return true;
  }
  if (l >= 0 && levelIterator == null) {
    while (levelEmpty[l]) {
      if (--l == -1)       return false;
    }
    levelIterator=level[l].descendingIterator();
  }
  if (levelIterator == null) {
    return false;
  }
  next=levelIterator.next();
  count++;
  if (levelIterator.hasNext()) {
    return true;
  }
 else {
    levelIterator=null;
    l--;
    return count <= size;
  }
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  if (next != null) {
    return true;
  }
  if (l >= 0 && levelIterator == null) {
    while (levelEmpty(l)) {
      if (--l == -1)       return false;
    }
    levelIterator=level[l].iterator();
  }
  if (levelIterator == null) {
    return false;
  }
  next=levelIterator.next();
  count++;
  if (levelIterator.hasNext()) {
    return true;
  }
 else {
    levelIterator=null;
    l--;
    return count <= size;
  }
}
Program: 166629
Project: 166629
Buggy source:
@Override public E take(final K name){
  final E oldItem=nameTable.remove(name);
  if (oldItem == null) {
    return null;
  }
  final int expectedLevel=getLevel(oldItem);
  if (!levelEmpty[expectedLevel]) {
    if (level[expectedLevel].remove(oldItem)) {
      removeMass(oldItem);
      return oldItem;
    }
  }
  for (int l=0; l < levels; l++) {
    if ((!levelEmpty[l]) && (l != expectedLevel)) {
      if (level[l].remove(oldItem)) {
        removeMass(oldItem);
        return oldItem;
      }
    }
  }
  if (MiscFlags.DEBUG) {
    final int ns=nameTable.size();
    final int is=sizeItems();
    if (ns == is)     return null;
    throw new IllegalStateException("String_Node_Str" + nameTable.size() + "String_Node_Str"+ sizeItems()+ "String_Node_Str"+ oldItem+ "String_Node_Str"+ this.getClass().getSimpleName());
  }
  return oldItem;
}

Fixed version (ground truth):
@Override public E take(final K name){
  final E oldItem=nameTable.remove(name);
  if (oldItem == null) {
    return null;
  }
  final int expectedLevel=getLevel(oldItem);
  if (!levelEmpty(expectedLevel)) {
    if (level[expectedLevel].remove(oldItem)) {
      removeMass(oldItem);
      return oldItem;
    }
  }
  for (int l=0; l < levels; l++) {
    if ((!levelEmpty(l)) && (l != expectedLevel)) {
      if (level[l].remove(oldItem)) {
        removeMass(oldItem);
        return oldItem;
      }
    }
  }
  if (MiscFlags.DEBUG) {
    final int ns=nameTable.size();
    final int is=sizeItems();
    if (ns == is)     return null;
    throw new IllegalStateException("String_Node_Str" + nameTable.size() + "String_Node_Str"+ sizeItems()+ "String_Node_Str"+ oldItem+ "String_Node_Str"+ this.getClass().getSimpleName());
  }
  return oldItem;
}
Program: 166630
Project: 166630
Buggy source:
/** 
 * TODO refactor : paste from preceding method
 */
public String toStringLong(final int minLevel){
  StringBuilder buf=new StringBuilder(32).append("String_Node_Str").append(getClass().getSimpleName()).append("String_Node_Str").append(showSizes());
  for (int i=levels; i >= minLevel; i--) {
    if (!levelEmpty[i - 1]) {
      buf=buf.append("String_Node_Str").append(i).append("String_Node_Str");
      for (      final E e : level[i - 1]) {
        buf=buf.append(e.toStringLong()).append('\n');
      }
    }
  }
  buf.append("String_Node_Str").append(getClass().getSimpleName());
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * TODO refactor : paste from preceding method
 */
public String toStringLong(final int minLevel){
  StringBuilder buf=new StringBuilder(32).append("String_Node_Str").append(getClass().getSimpleName()).append("String_Node_Str").append(showSizes());
  for (int i=levels; i >= minLevel; i--) {
    if (!levelEmpty(i - 1)) {
      buf=buf.append("String_Node_Str").append(i).append("String_Node_Str");
      for (      final E e : level[i - 1]) {
        buf=buf.append(e.toStringLong()).append('\n');
      }
    }
  }
  buf.append("String_Node_Str").append(getClass().getSimpleName());
  return buf.toString();
}
Program: 166631
Project: 166631
Buggy source:
public int numEmptyLevels(LevelBag bag){
  int empty=0;
  for (int i=0; i < bag.level.length; i++) {
    if (bag.levelEmpty[i]) {
      empty++;
    }
  }
  return empty;
}

Fixed version (ground truth):
public int numEmptyLevels(LevelBag bag){
  int empty=0;
  for (int i=0; i < bag.level.length; i++) {
    if (bag.level[i].isEmpty()) {
      empty++;
    }
  }
  return empty;
}
Program: 166632
Project: 166632
Buggy source:
public int getLevelSize(LevelBag lb,final int level){
  return (lb.levelEmpty[level]) ? 0 : lb.level[level].size();
}

Fixed version (ground truth):
public int getLevelSize(LevelBag lb,final int level){
  return (lb.level[level] == null) ? 0 : lb.level[level].size();
}
Program: 166633
Project: 166633
Buggy source:
/** 
 * Generate <?how =/> g>? question for g! goal. only called by processGoal
 * @param nal The derivation context
 */
public static void questionFromGoal(final Task task,final DerivationContext nal){
  if (nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING || nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
    final List<Term> qu=new ArrayList<>();
    if (nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
      if (!(task.sentence.term instanceof Equivalence) && !(task.sentence.term instanceof Implication)) {
        final Variable how=new Variable("String_Node_Str");
        final Implication imp2=Implication.make(how,task.sentence.term,TemporalRules.ORDER_FORWARD);
        if (!(task.sentence.term instanceof Operation)) {
          qu.add(imp2);
        }
      }
    }
    if (nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING) {
      qu.add(task.sentence.term);
    }
    for (    final Term q : qu) {
      if (q != null) {
        final Stamp st=new Stamp(task.sentence.stamp,nal.time.time());
        st.setOccurrenceTime(task.sentence.getOccurenceTime());
        final Sentence s=new Sentence(q,Symbols.QUESTION_MARK,null,st);
        if (s != null) {
          final BudgetValue budget=new BudgetValue(task.getPriority() * nal.narParameters.CURIOSITY_DESIRE_PRIORITY_MUL,task.getDurability() * nal.narParameters.CURIOSITY_DESIRE_DURABILITY_MUL,1,nal.narParameters);
          nal.singlePremiseTask(s,budget);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate &lt;?how =/&gt; g&gt;? question for g! goal. only called by processGoal
 * @param task the task for which the question should be processed
 * @param nal The derivation context
 */
public static void questionFromGoal(final Task task,final DerivationContext nal){
  if (nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING || nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
    final List<Term> qu=new ArrayList<>();
    if (nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
      if (!(task.sentence.term instanceof Equivalence) && !(task.sentence.term instanceof Implication)) {
        final Variable how=new Variable("String_Node_Str");
        final Implication imp2=Implication.make(how,task.sentence.term,TemporalRules.ORDER_FORWARD);
        if (!(task.sentence.term instanceof Operation)) {
          qu.add(imp2);
        }
      }
    }
    if (nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING) {
      qu.add(task.sentence.term);
    }
    for (    final Term q : qu) {
      if (q != null) {
        final Stamp st=new Stamp(task.sentence.stamp,nal.time.time());
        st.setOccurrenceTime(task.sentence.getOccurenceTime());
        final Sentence s=new Sentence(q,Symbols.QUESTION_MARK,null,st);
        if (s != null) {
          final BudgetValue budget=new BudgetValue(task.getPriority() * nal.narParameters.CURIOSITY_DESIRE_PRIORITY_MUL,task.getDurability() * nal.narParameters.CURIOSITY_DESIRE_DURABILITY_MUL,1,nal.narParameters);
          nal.singlePremiseTask(s,budget);
        }
      }
    }
  }
}
Program: 166634
Project: 166634
Buggy source:
/** 
 * Handle the feedback of the operation that was processed as a judgment The purpose is to start a new operation frame which makes the operation concept  interpret current events as preconditions and future events as postconditions to the invoked operation. <p> called in processJudgment only
 * @param task The judgement task be checked
 * @param nal The derivation context
 * @return Whether to continue the processing of the task
 */
public static void handleOperationFeedback(Task task,DerivationContext nal){
  if (task.isInput() && !task.sentence.isEternal() && task.sentence.term instanceof Operation) {
    final Operation op=(Operation)task.sentence.term;
    final Operator o=(Operator)op.getPredicate();
    if (!(o instanceof Believe) && !(o instanceof Want) && !(o instanceof Wonder)&& !(o instanceof Evaluate)&& !(o instanceof Anticipate)) {
      TemporalInferenceControl.NewOperationFrame(nal.memory,task);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handle the feedback of the operation that was processed as a judgment The purpose is to start a new operation frame which makes the operation concept  interpret current events as preconditions and future events as postconditions to the invoked operation. <p> called in processJudgment only
 * @param task The judgement task be checked
 * @param nal The derivation context
 */
public static void handleOperationFeedback(Task task,DerivationContext nal){
  if (task.isInput() && !task.sentence.isEternal() && task.sentence.term instanceof Operation) {
    final Operation op=(Operation)task.sentence.term;
    final Operator o=(Operator)op.getPredicate();
    if (!(o instanceof Believe) && !(o instanceof Want) && !(o instanceof Wonder)&& !(o instanceof Evaluate)&& !(o instanceof Anticipate)) {
      TemporalInferenceControl.NewOperationFrame(nal.memory,task);
    }
  }
}
Program: 166635
Project: 166635
Buggy source:
/** 
 * Recognize an existing belief task as solution to the what question task, which contains a query variable <p> called only in GeneralInferenceControl.insertTaskLink on concept selection
 * @param concept The concept which potentially outdated anticipations should be processed
 * @paramt t The belief task
 * @param nal The derivation context
 */
public static void ProcessWhatQuestion(final Concept concept,final Task ques,final DerivationContext nal){
  if (!(ques.sentence.isJudgment()) && ques.getTerm().hasVarQuery()) {
    boolean newAnswer=false;
    for (    final TaskLink t : concept.taskLinks) {
      final Term[] u=new Term[]{ques.getTerm(),t.getTerm()};
      if (!t.getTerm().hasVarQuery() && Variables.unify(Symbols.VAR_QUERY,u)) {
        final Concept c=nal.memory.concept(t.getTerm());
        if (c == null) {
          continue;
        }
synchronized (c) {
          final List<Task> answers=ques.sentence.isQuest() ? c.desires : c.beliefs;
          if (c != null && answers.size() > 0) {
            final Task taskAnswer=answers.get(0);
            if (taskAnswer != null) {
              newAnswer|=trySolution(taskAnswer.sentence,ques,nal,false);
            }
          }
        }
      }
    }
    if (newAnswer && ques.isInput()) {
      nal.memory.emit(Events.Answer.class,ques,ques.getBestSolution());
    }
  }
}

Fixed version (ground truth):
/** 
 * Recognize an existing belief task as solution to the what question task, which contains a query variable <p> called only in GeneralInferenceControl.insertTaskLink on concept selection
 * @param concept The concept which potentially outdated anticipations should be processed
 * @param ques The belief task
 * @param nal The derivation context
 */
public static void ProcessWhatQuestion(final Concept concept,final Task ques,final DerivationContext nal){
  if (!(ques.sentence.isJudgment()) && ques.getTerm().hasVarQuery()) {
    boolean newAnswer=false;
    for (    final TaskLink t : concept.taskLinks) {
      final Term[] u=new Term[]{ques.getTerm(),t.getTerm()};
      if (!t.getTerm().hasVarQuery() && Variables.unify(Symbols.VAR_QUERY,u)) {
        final Concept c=nal.memory.concept(t.getTerm());
        if (c == null) {
          continue;
        }
synchronized (c) {
          final List<Task> answers=ques.sentence.isQuest() ? c.desires : c.beliefs;
          if (c != null && answers.size() > 0) {
            final Task taskAnswer=answers.get(0);
            if (taskAnswer != null) {
              newAnswer|=trySolution(taskAnswer.sentence,ques,nal,false);
            }
          }
        }
      }
    }
    if (newAnswer && ques.isInput()) {
      nal.memory.emit(Events.Answer.class,ques,ques.getBestSolution());
    }
  }
}
Program: 166637
Project: 166637
Buggy source:
/** 
 * returns the period in time: currentTime - lastForgetTime and sets the lastForgetTime to currentTime 
 */
public long setLastForgetTime(final long currentTime){
  final long period;
  if (this.lastForgetTime == -1)   period=0;
 else   period=currentTime - lastForgetTime;
  lastForgetTime=currentTime;
  return period;
}

Fixed version (ground truth):
/** 
 * computes the period and sets the current time to the period
 * @return period in time: currentTime - lastForgetTime
 */
public long setLastForgetTime(final long currentTime){
  final long period;
  if (this.lastForgetTime == -1)   period=0;
 else   period=currentTime - lastForgetTime;
  lastForgetTime=currentTime;
  return period;
}
Program: 166638
Project: 166638
Buggy source:
public TruthValue getTruth(){
  return truth;
}

Fixed version (ground truth):
/** 
 * @return truth of the sentence, truths are properties of sentences
 */
public TruthValue getTruth(){
  return truth;
}
Program: 166639
Project: 166639
Buggy source:
/** 
 * Get the truth value (or desire value) of the sentence
 * @return Truth value, null for question
 */
public void discountConfidence(Parameters narParameters){
  truth.setConfidence(truth.getConfidence() * narParameters.DISCOUNT_RATE).setAnalytic(false);
}

Fixed version (ground truth):
/** 
 * discounts the truth value of the sentence
 */
public void discountConfidence(Parameters narParameters){
  truth.setConfidence(truth.getConfidence() * narParameters.DISCOUNT_RATE).setAnalytic(false);
}
Program: 166640
Project: 166640
Buggy source:
/** 
 * Recognize a Judgment
 * @return Whether the object is a Judgment
 */
public boolean isJudgment(){
  return (punctuation == Symbols.JUDGMENT_MARK);
}

Fixed version (ground truth):
/** 
 * @return property, whether the object is a judgment
 */
public boolean isJudgment(){
  return (punctuation == Symbols.JUDGMENT_MARK);
}
Program: 166641
Project: 166641
Buggy source:
/** 
 * Revisible?
 */
public boolean getRevisible(){
  return revisible;
}

Fixed version (ground truth):
/** 
 * @return property of the ability to revise the sentence
 */
public boolean getRevisible(){
  return revisible;
}
Program: 166642
Project: 166642
Buggy source:
public T getTerm(){
  return term;
}

Fixed version (ground truth):
/** 
 * @return term of the sentence, terms are properties of sentences
 */
public T getTerm(){
  return term;
}
Program: 166643
Project: 166643
Buggy source:
/** 
 * Recognize a Question
 * @return Whether the object is a Question
 */
public boolean isQuestion(){
  return (punctuation == Symbols.QUESTION_MARK);
}

Fixed version (ground truth):
/** 
 * @return property, whether the object is a question
 */
public boolean isQuestion(){
  return (punctuation == Symbols.QUESTION_MARK);
}
Program: 166644
Project: 166644
Buggy source:
public boolean isEternal(){
  return stamp.isEternal();
}

Fixed version (ground truth):
/** 
 * @return classification if the sentence is true for ever
 */
public boolean isEternal(){
  return stamp.isEternal();
}
Program: 166645
Project: 166645
Buggy source:
/** 
 * Recognize a Quest
 * @return Whether the object is a Quest
 */
public boolean isQuest(){
  return (punctuation == Symbols.QUEST_MARK);
}

Fixed version (ground truth):
/** 
 * @return property, whether the sentence is a quest
 */
public boolean isQuest(){
  return (punctuation == Symbols.QUEST_MARK);
}
Program: 166646
Project: 166646
Buggy source:
/** 
 * To produce the hashcode of a sentence
 * @return A hashcode
 */
@Override public int hashCode(){
  return hash;
}

Fixed version (ground truth):
/** 
 * To produce the hashcode of a sentence
 * @return a hashcode
 */
@Override public int hashCode(){
  return hash;
}
Program: 166647
Project: 166647
Buggy source:
/** 
 * Clone with a different Term 
 */
public final Sentence clone(final Term t){
  return new Sentence(t,punctuation,truth != null ? new TruthValue(truth) : null,stamp.clone());
}

Fixed version (ground truth):
/** 
 * clone with a different term
 * @param t term which has to get cloned
 * @return sentence with the cloned term as a property
 */
public final Sentence clone(final Term t){
  return new Sentence(t,punctuation,truth != null ? new TruthValue(truth) : null,stamp.clone());
}
Program: 166649
Project: 166649
Buggy source:
/** 
 * Recognize a Goal
 * @return Whether the object is a Goal
 */
public boolean isGoal(){
  return (punctuation == Symbols.GOAL_MARK);
}

Fixed version (ground truth):
/** 
 * @return property, whether the sentence is a goal
 */
public boolean isGoal(){
  return (punctuation == Symbols.GOAL_MARK);
}
Program: 166652
Project: 166652
Buggy source:
/** 
 * {(--, (&&, A, (--, B))), (--, B)} |- (--, A)
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue reduceConjunctionNeg(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  return reduceConjunction(v1,negation(v2,narParameters),narParameters);
}

Fixed version (ground truth):
/** 
 * {(--, (&amp;&amp;, A, (--, B))), (--, B)} |- (--, A)
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue reduceConjunctionNeg(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  return reduceConjunction(v1,negation(v2,narParameters),narParameters);
}
Program: 166653
Project: 166653
Buggy source:
/** 
 * {(&&, <#x() ==> M>, <#x() ==> P>), S ==> M} |- <S ==> P>
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue anonymousAnalogy(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final TruthValue v0=new TruthValue(f1,w2c(c1,narParameters),narParameters);
  return analogy(v2,v0,narParameters);
}

Fixed version (ground truth):
/** 
 * {(&amp;&amp;, &lt;#x() ==&gt; M&gt;, &lt;#x() ==&gt; P&gt;), S ==&gt; M} |- &lt;S ==&gt; P&gt;
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue anonymousAnalogy(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final TruthValue v0=new TruthValue(f1,w2c(c1,narParameters),narParameters);
  return analogy(v2,v0,narParameters);
}
Program: 166654
Project: 166654
Buggy source:
/** 
 * {<M ==> S>, <M ==> P>} |- <S ==> P>
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue induction(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  return abduction(v2,v1,narParameters);
}

Fixed version (ground truth):
/** 
 * {&lt;M ==&gt; S&gt;, &lt;M ==&gt; P&gt;} |- &lt;S ==&gt; P&gt;
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue induction(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  return abduction(v2,v1,narParameters);
}
Program: 166655
Project: 166655
Buggy source:
/** 
 * {<M --> S>, <M <-> P>} |- <M --> (S&P)>
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue intersection(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f=and(f1,f2);
  final float c=and(c1,c2);
  return new TruthValue(f,c,narParameters);
}

Fixed version (ground truth):
/** 
 * {&lt;M --&gt; S&gt;, &lt;M &lt;-&gt; P&gt;} |- &lt;M --&gt; (S&amp;P)&gt;
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue intersection(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f=and(f1,f2);
  final float c=and(c1,c2);
  return new TruthValue(f,c,narParameters);
}
Program: 166656
Project: 166656
Buggy source:
/** 
 * {<A ==> B>} |- <B ==> A>
 * @param v1 Truth value of the premise
 * @return Truth value of the conclusion
 */
public static final TruthValue conversion(final TruthValue v1,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final float w=and(f1,c1);
  final float c=w2c(w,narParameters);
  return new TruthValue(1,c,narParameters);
}

Fixed version (ground truth):
/** 
 * {&lt;A ==&gt; B&gt;} |- &lt;B ==&gt; A&gt;
 * @param v1 Truth value of the premise
 * @return Truth value of the conclusion
 */
public static final TruthValue conversion(final TruthValue v1,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final float w=and(f1,c1);
  final float c=w2c(w,narParameters);
  return new TruthValue(1,c,narParameters);
}
Program: 166657
Project: 166657
Buggy source:
/** 
 * {<M ==> S>, <M ==> P>} |- <S <=> P>
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue comparison(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f0=or(f1,f2);
  final float f=(f0 == 0) ? 0 : (and(f1,f2) / f0);
  final float w=and(f0,c1,c2);
  final float c=w2c(w,narParameters);
  return new TruthValue(f,c,narParameters);
}

Fixed version (ground truth):
/** 
 * {&lt;M ==&gt; S&gt;, &lt;M ==&gt; P&gt;} |- &lt;S &lt;=&gt; P&gt;
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue comparison(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f0=or(f1,f2);
  final float f=(f0 == 0) ? 0 : (and(f1,f2) / f0);
  final float w=and(f0,c1,c2);
  final float c=w2c(w,narParameters);
  return new TruthValue(f,c,narParameters);
}
Program: 166658
Project: 166658
Buggy source:
/** 
 * {(--, (&&, A, B)), B} |- (--, A)
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue reduceConjunction(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final TruthValue v0=intersection(negation(v1,narParameters),v2,narParameters);
  return negation(deduction(v0,1f,narParameters),narParameters);
}

Fixed version (ground truth):
/** 
 * {(--, (&amp;&amp;, A, B)), B} |- (--, A)
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue reduceConjunction(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final TruthValue v0=intersection(negation(v1,narParameters),v2,narParameters);
  return negation(deduction(v0,1f,narParameters),narParameters);
}
Program: 166659
Project: 166659
Buggy source:
/** 
 * {M, <P ==> M>} |- P
 * @param v1 Truth value of the first premise
 * @param reliance Confidence of the second (analytical) premise
 * @return Truth value of the conclusion
 */
public static final TruthValue abduction(final TruthValue v1,final float reliance,Parameters narParameters){
  if (v1.getAnalytic()) {
    return new TruthValue(0.5f,0f,narParameters);
  }
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final float w=and(c1,reliance);
  final float c=w2c(w,narParameters);
  return new TruthValue(f1,c,true,narParameters);
}

Fixed version (ground truth):
/** 
 * {M, &lt;P ==&gt; M&gt;} |- P
 * @param v1 Truth value of the first premise
 * @param reliance Confidence of the second (analytical) premise
 * @return Truth value of the conclusion
 */
public static final TruthValue abduction(final TruthValue v1,final float reliance,Parameters narParameters){
  if (v1.getAnalytic()) {
    return new TruthValue(0.5f,0f,narParameters);
  }
  final float f1=v1.getFrequency();
  final float c1=v1.getConfidence();
  final float w=and(c1,reliance);
  final float c=w2c(w,narParameters);
  return new TruthValue(f1,c,true,narParameters);
}
Program: 166660
Project: 166660
Buggy source:
/** 
 * {<S <=> M>, <M <=> P>} |- <S <=> P>
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue resemblance(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f=and(f1,f2);
  final float c=and(c1,c2,or(f1,f2));
  return new TruthValue(f,c,narParameters);
}

Fixed version (ground truth):
/** 
 * {&lt;S &lt;=&gt; M&gt;, &lt;M &lt;=&gt; P&gt;} |- &lt;S &lt;=&gt; P&gt;
 * @param v1 Truth value of the first premise
 * @param v2 Truth value of the second premise
 * @return Truth value of the conclusion
 */
public static final TruthValue resemblance(final TruthValue v1,final TruthValue v2,Parameters narParameters){
  final float f1=v1.getFrequency();
  final float f2=v2.getFrequency();
  final float c1=v1.getConfidence();
  final float c2=v2.getConfidence();
  final float f=and(f1,f2);
  final float c=and(c1,c2,or(f1,f2));
  return new TruthValue(f,c,narParameters);
}