nus-yam/ex-repair huggingface dataset:
Program: 158782
Project: 158782
Buggy source:
@Override public boolean triggerAbility(TriggeredAbility source,Game game){
  if (source == null) {
    logger.warn("String_Node_Str");
    throw new IllegalArgumentException("String_Node_Str");
  }
  int bookmark=game.bookmarkState();
  TriggeredAbility ability=source.copy();
  MageObject sourceObject=ability.getSourceObject(game);
  if (sourceObject != null) {
    sourceObject.adjustTargets(ability,game);
  }
  if (ability.canChooseTarget(game)) {
    if (ability.isUsesStack()) {
      game.getStack().push(new StackAbility(ability,playerId));
    }
    if (ability.activate(game,false)) {
      if ((ability.isUsesStack() || ability.getRuleVisible()) && !game.isSimulation()) {
        game.informPlayers(ability.getGameLogMessage(game));
      }
      if (!ability.isUsesStack()) {
        ability.resolve(game);
      }
      game.removeBookmark(bookmark);
      return true;
    }
  }
  game.restoreState(bookmark,source.getRule());
  return false;
}

Fixed version (ground truth):
@Override public boolean triggerAbility(TriggeredAbility source,Game game){
  if (source == null) {
    logger.warn("String_Node_Str");
    throw new IllegalArgumentException("String_Node_Str");
  }
  int bookmark=game.bookmarkState();
  TriggeredAbility ability=source.copy();
  MageObject sourceObject=ability.getSourceObject(game);
  if (sourceObject != null) {
    sourceObject.adjustTargets(ability,game);
  }
  if (ability.canChooseTarget(game)) {
    if (ability.isUsesStack()) {
      game.getStack().push(new StackAbility(ability,playerId));
    }
    if (ability.activate(game,false)) {
      if ((ability.isUsesStack() || ability.getRuleVisible()) && !game.isSimulation()) {
        game.informPlayers(ability.getGameLogMessage(game));
      }
      if (!ability.isUsesStack()) {
        ability.resolve(game);
      }
      game.removeBookmark(bookmark);
      return true;
    }
  }
  restoreState(bookmark,source.getRule(),game);
  return false;
}
Program: 158783
Project: 158783
Buggy source:
@Override public boolean activateAbility(ActivatedAbility ability,Game game){
  boolean result;
  if (ability instanceof PassAbility) {
    pass(game);
    return true;
  }
  if (ability instanceof PlayLandAbility) {
    Card card=game.getCard(ability.getSourceId());
    result=playLand(card,game);
  }
 else {
    if (!ability.canActivate(this.playerId,game)) {
      return false;
    }
    if (ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
      result=specialAction((SpecialAction)ability.copy(),game);
    }
 else     if (ability.getAbilityType().equals(AbilityType.MANA)) {
      result=playManaAbility((ManaAbility)ability.copy(),game);
    }
 else     if (ability.getAbilityType().equals(AbilityType.SPELL)) {
      if (ability instanceof FlashbackAbility) {
        result=playAbility(ability.copy(),game);
      }
 else {
        result=cast((SpellAbility)ability,game,false);
      }
    }
 else {
      result=playAbility(ability.copy(),game);
    }
  }
  justActivatedType=null;
  if (result) {
    if (isHuman() && (ability.getAbilityType().equals(AbilityType.SPELL) || ability.getAbilityType().equals(AbilityType.ACTIVATED))) {
      setJustActivatedType(ability.getAbilityType());
    }
    game.getPlayers().resetPassed();
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean activateAbility(ActivatedAbility ability,Game game){
  boolean result;
  if (ability instanceof PassAbility) {
    pass(game);
    return true;
  }
  if (ability instanceof PlayLandAbility) {
    Card card=game.getCard(ability.getSourceId());
    result=playLand(card,game);
  }
 else {
    if (!ability.canActivate(this.playerId,game)) {
      return false;
    }
    if (ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) {
      result=specialAction((SpecialAction)ability.copy(),game);
    }
 else     if (ability.getAbilityType().equals(AbilityType.MANA)) {
      result=playManaAbility((ManaAbility)ability.copy(),game);
    }
 else     if (ability.getAbilityType().equals(AbilityType.SPELL)) {
      if (ability instanceof FlashbackAbility) {
        result=playAbility(ability.copy(),game);
      }
 else {
        result=cast((SpellAbility)ability,game,false);
      }
    }
 else {
      result=playAbility(ability.copy(),game);
    }
  }
  justActivatedType=null;
  if (result) {
    if (isHuman() && (ability.getAbilityType().equals(AbilityType.SPELL) || ability.getAbilityType().equals(AbilityType.ACTIVATED))) {
      if (ability.isUsesStack()) {
        setJustActivatedType(ability.getAbilityType());
      }
    }
    game.getPlayers().resetPassed();
  }
  return result;
}
Program: 158784
Project: 158784
Buggy source:
public DragonToken2(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  color.setWhite(true);
  subtype.add("String_Node_Str");
  power=new MageInt(5);
  toughness=new MageInt(5);
  addAbility(FlyingAbility.getInstance());
  availableImageSetCodes.addAll(Arrays.asList("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public DragonToken2(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  color.setRed(true);
  subtype.add("String_Node_Str");
  power=new MageInt(5);
  toughness=new MageInt(5);
  addAbility(FlyingAbility.getInstance());
  availableImageSetCodes.addAll(Arrays.asList("String_Node_Str","String_Node_Str"));
}
Program: 158785
Project: 158785
Buggy source:
public GoatToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  color.setWhite(true);
  subtype.add("String_Node_Str");
  power=new MageInt(1);
  toughness=new MageInt(1);
  availableImageSetCodes.addAll(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public GoatToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  color.setWhite(true);
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(1);
  availableImageSetCodes.addAll(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 158786
Project: 158786
Buggy source:
@Override public MindRakerEffect copy(){
  return new MindRakerEffect(this);
}

Fixed version (ground truth):
@Override public MindRaker copy(){
  return new MindRaker(this);
}
Program: 158787
Project: 158787
Buggy source:
@Override public MurkStriderEffect copy(){
  return new MurkStriderEffect(this);
}

Fixed version (ground truth):
@Override public MurkStrider copy(){
  return new MurkStrider(this);
}
Program: 158788
Project: 158788
Buggy source:
public TargetSpellOrPermanent(final TargetSpellOrPermanent target){
  super(target);
  this.filter=target.filter.copy();
  this.filterPermanent=target.filterPermanent.copy();
}

Fixed version (ground truth):
public TargetSpellOrPermanent(final TargetSpellOrPermanent target){
  super(target);
  this.filter=target.filter.copy();
}
Program: 158789
Project: 158789
Buggy source:
public FilterPermanent getPermanentFilter(){
  return this.filterPermanent;
}

Fixed version (ground truth):
public FilterPermanent getPermanentFilter(){
  return this.filter.getPermanentFilter();
}
Program: 158790
Project: 158790
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<>();
  for (  StackObject stackObject : game.getStack()) {
    Spell spell=game.getStack().getSpell(stackObject.getId());
    if (spell != null && filter.match(spell,null,sourceControllerId,game) && filter.match(spell,game)) {
      possibleTargets.add(spell.getId());
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filterPermanent,sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game)) {
      possibleTargets.add(permanent.getId());
    }
  }
  return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<>();
  for (  StackObject stackObject : game.getStack()) {
    Spell spell=game.getStack().getSpell(stackObject.getId());
    if (spell != null && filter.match(spell,null,sourceControllerId,game) && filter.match(spell,game)) {
      possibleTargets.add(spell.getId());
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filter.getPermanentFilter(),sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game)) {
      possibleTargets.add(permanent.getId());
    }
  }
  return possibleTargets;
}
Program: 158791
Project: 158791
Buggy source:
/** 
 * Checks if there are enough   {@link mage.game.permanent.Permanent} or {@link mage.game.stack.Spell} that can be selected.  Should not be usedfor Ability targets since this does not check for protection, shroud etc.
 * @param sourceControllerId - controller of the select event
 * @param game
 * @return - true if enough valid {@link mage.game.permanent.Permanent} or {@link mage.game.stack.Spell} exist
 */
@Override public boolean canChoose(UUID sourceControllerId,Game game){
  int count=0;
  for (  StackObject stackObject : game.getStack()) {
    Spell spell=game.getStack().getSpell(stackObject.getId());
    if (spell != null && filter.match(spell,null,sourceControllerId,game) && filter.match(spell,game)) {
      count++;
      if (count >= this.minNumberOfTargets) {
        return true;
      }
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filterPermanent,sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game) && filter.match(permanent,game)) {
      count++;
      if (count >= this.minNumberOfTargets) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if there are enough   {@link mage.game.permanent.Permanent} or{@link mage.game.stack.Spell} that can be selected. Should not be usedfor Ability targets since this does not check for protection, shroud etc.
 * @param sourceControllerId - controller of the select event
 * @param game
 * @return - true if enough valid {@link mage.game.permanent.Permanent} or{@link mage.game.stack.Spell} exist
 */
@Override public boolean canChoose(UUID sourceControllerId,Game game){
  int count=0;
  for (  StackObject stackObject : game.getStack()) {
    Spell spell=game.getStack().getSpell(stackObject.getId());
    if (spell != null && filter.match(spell,null,sourceControllerId,game) && filter.match(spell,game)) {
      count++;
      if (count >= this.minNumberOfTargets) {
        return true;
      }
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filter.getPermanentFilter(),sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game) && filter.match(permanent,game)) {
      count++;
      if (count >= this.minNumberOfTargets) {
        return true;
      }
    }
  }
  return false;
}
Program: 158793
Project: 158793
Buggy source:
@Override public boolean apply(Game game,Ability source){
  TargetPermanent target=(TargetPermanent)source.getTargets().get(0);
  Permanent permanent=game.getPermanent(target.getFirstTarget());
  Player player=game.getPlayer(source.getControllerId());
  if (permanent != null && player != null) {
    int toRemove=source.getManaCostsToPay().getX();
    int removed=0;
    String[] counterNames=permanent.getCounters().keySet().toArray(new String[0]);
    for (    String counterName : counterNames) {
      if (player.chooseUse(Outcome.Neutral,"String_Node_Str" + counterName + "String_Node_Str",source,game)) {
        if (permanent.getCounters().get(counterName).getCount() == 1 || toRemove == 1) {
          permanent.getCounters().removeCounter(counterName,1);
        }
 else {
          int amount=player.getAmount(1,Math.min(permanent.getCounters().get(counterName).getCount(),toRemove - removed),"String_Node_Str",game);
          if (amount > 0) {
            removed+=amount;
            permanent.getCounters().removeCounter(counterName,amount);
          }
        }
      }
      if (removed >= toRemove)       break;
    }
    game.addEffect(new BoostSourceEffect(removed,0,Duration.EndOfTurn),source);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  TargetPermanent target=(TargetPermanent)source.getTargets().get(0);
  Permanent permanent=game.getPermanent(target.getFirstTarget());
  Player player=game.getPlayer(source.getControllerId());
  if (permanent != null && player != null) {
    int toRemove=source.getManaCostsToPay().getX();
    int removed=0;
    String[] counterNames=permanent.getCounters().keySet().toArray(new String[0]);
    for (    String counterName : counterNames) {
      if (player.chooseUse(Outcome.Neutral,"String_Node_Str" + counterName + "String_Node_Str",source,game)) {
        if (permanent.getCounters().get(counterName).getCount() == 1 || toRemove == 1) {
          permanent.getCounters().removeCounter(counterName,1);
          removed++;
        }
 else {
          int amount=player.getAmount(1,Math.min(permanent.getCounters().get(counterName).getCount(),toRemove - removed),"String_Node_Str",game);
          if (amount > 0) {
            removed+=amount;
            permanent.getCounters().removeCounter(counterName,amount);
          }
        }
      }
      if (removed >= toRemove) {
        break;
      }
    }
    game.addEffect(new BoostSourceEffect(removed,0,Duration.EndOfTurn),source);
    return true;
  }
  return false;
}
Program: 158794
Project: 158794
Buggy source:
@Override public Boolean apply(Game game,Permanent permanent){
  if (!permanent.getCardType().contains(CardType.ENCHANTMENT)) {
    permanent.getCardType().add(CardType.ENCHANTMENT);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  if (player != null && sourcePermanent != null) {
    Target target=new TargetPermanent(filter);
    target.setNotTarget(true);
    if (target.canChoose(source.getControllerId(),game)) {
      player.choose(Outcome.Copy,target,source.getSourceId(),game);
      Permanent copyFromPermanent=game.getPermanent(target.getFirstTarget());
      if (copyFromPermanent != null) {
        game.copyPermanent(copyFromPermanent,sourcePermanent,source,applier);
        return true;
      }
    }
  }
  return false;
}
Program: 158795
Project: 158795
Buggy source:
@Override public Boolean apply(Game game,Permanent permanent){
  if (!permanent.getSubtype().contains("String_Node_Str")) {
    permanent.getSubtype().add("String_Node_Str");
  }
  permanent.getAbilities().add(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()));
  return true;
}

Fixed version (ground truth):
@Override public Boolean apply(Game game,MageObject mageObject){
  if (!mageObject.getSubtype().contains("String_Node_Str")) {
    mageObject.getSubtype().add("String_Node_Str");
  }
  mageObject.getAbilities().add(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()));
  return true;
}
Program: 158796
Project: 158796
Buggy source:
@Override public Boolean apply(Game game,Permanent permanent){
  Ability ability=new SimpleActivatedAbility(Zone.BATTLEFIELD,new ReturnToHandSourceEffect(true),new ManaCostsImpl("String_Node_Str"));
  permanent.addAbility(ability,game);
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  if (player != null && sourcePermanent != null) {
    Target target=new TargetPermanent(new FilterControlledCreaturePermanent());
    target.setNotTarget(true);
    if (target.canChoose(source.getSourceId(),source.getControllerId(),game)) {
      player.choose(Outcome.Copy,target,source.getSourceId(),game);
      Permanent copyFromPermanent=game.getPermanent(target.getFirstTarget());
      if (copyFromPermanent != null) {
        game.copyPermanent(copyFromPermanent,sourcePermanent,source,new AbilityApplier(new SimpleActivatedAbility(Zone.BATTLEFIELD,new ReturnToHandSourceEffect(true),new ManaCostsImpl("String_Node_Str"))));
        return true;
      }
    }
  }
  return false;
}
Program: 158797
Project: 158797
Buggy source:
@Override public Boolean apply(Game game,Permanent permanent){
  Ability upkeepAbility=new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(),TargetController.YOU,true);
  upkeepAbility.addTarget(new TargetCreaturePermanent());
  permanent.addAbility(upkeepAbility,source.getSourceId(),game);
  return true;
}

Fixed version (ground truth):
@Override public Boolean apply(Game game,MageObject mageObject){
  Ability upkeepAbility=new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(),TargetController.YOU,true);
  upkeepAbility.addTarget(new TargetCreaturePermanent());
  mageObject.getAbilities().add(upkeepAbility);
  return true;
}
Program: 158799
Project: 158799
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
switch (setTargetPointer) {
case PLAYER:
      for (      Effect effect : getEffects()) {
        effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
      }
    break;
default :
  throw new UnsupportedOperationException(setTargetPointer.toString() + "String_Node_Str");
}
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
switch (setTargetPointer) {
case PLAYER:
      for (      Effect effect : getEffects()) {
        effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
      }
    break;
case NONE:
  break;
default :
throw new UnsupportedOperationException(setTargetPointer.toString() + "String_Node_Str");
}
return true;
}
return false;
}
Program: 158801
Project: 158801
Buggy source:
/** 
 * Abilities that are applied to other objects or applie for a certain time span
 * @param ability
 * @param sourceId
 * @param attachedTo
 */
public void addAbility(Ability ability,UUID sourceId,Card attachedTo){
  if (ability instanceof StaticAbility) {
    for (    Mode mode : ability.getModes().values()) {
      for (      Effect effect : mode.getEffects()) {
        if (effect instanceof ContinuousEffect) {
          addEffect((ContinuousEffect)effect,sourceId,ability);
        }
      }
    }
  }
 else   if (ability instanceof TriggeredAbility) {
    this.triggers.add((TriggeredAbility)ability,sourceId,attachedTo);
  }
  for (  Watcher watcher : ability.getWatchers()) {
    watcher.setControllerId(attachedTo == null ? ability.getControllerId() : attachedTo.getOwnerId());
    watcher.setSourceId(attachedTo == null ? ability.getSourceId() : attachedTo.getId());
    watchers.add(watcher);
  }
  for (  Ability sub : ability.getSubAbilities()) {
    addAbility(sub,sourceId,attachedTo);
  }
}

Fixed version (ground truth):
/** 
 * Abilities that are applied to other objects or applie for a certain time span
 * @param ability
 * @param sourceId
 * @param attachedTo
 */
public void addAbility(Ability ability,UUID sourceId,Card attachedTo){
  if (ability instanceof StaticAbility) {
    for (    Mode mode : ability.getModes().values()) {
      for (      Effect effect : mode.getEffects()) {
        if (effect instanceof ContinuousEffect) {
          addEffect((ContinuousEffect)effect,sourceId,ability);
        }
      }
    }
  }
 else   if (ability instanceof TriggeredAbility) {
    this.triggers.add((TriggeredAbility)ability,sourceId,attachedTo);
  }
  List<Watcher> watcherList=new ArrayList<>(ability.getWatchers());
  for (  Watcher watcher : watcherList) {
    watcher.setControllerId(attachedTo == null ? ability.getControllerId() : attachedTo.getOwnerId());
    watcher.setSourceId(attachedTo == null ? ability.getSourceId() : attachedTo.getId());
    watchers.add(watcher);
  }
  for (  Ability sub : ability.getSubAbilities()) {
    addAbility(sub,sourceId,attachedTo);
  }
}
Program: 158803
Project: 158803
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent targetedLand=game.getPermanent(source.getFirstTarget());
  if (targetedLand != null) {
    Player controller=game.getPlayer(targetedLand.getControllerId());
    targetedLand.destroy(id,game,true);
    int landsInGraveyard=controller.getGraveyard().count(filter,game);
    controller.damage(landsInGraveyard,id,game,false,true);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent targetedLand=game.getPermanent(getTargetPointer().getFirst(game,source));
  if (targetedLand != null) {
    targetedLand.destroy(source.getSourceId(),game,true);
    Player targetController=game.getPlayer(targetedLand.getControllerId());
    if (targetController != null) {
      int landsInGraveyard=targetController.getGraveyard().count(new FilterLandCard(),game);
      targetController.damage(landsInGraveyard,source.getSourceId(),game,false,true);
    }
    return true;
  }
  return false;
}
Program: 158804
Project: 158804
Buggy source:
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(playerPlayedLand);
}

Fixed version (ground truth):
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(watcher.playerPlayedLand);
}
Program: 158805
Project: 158805
Buggy source:
@Override public boolean apply(Game game,Ability source){
  ExileZone zone=game.getExile().getExileZone(CardUtil.getCardExileZoneId(game,source));
  if (zone == null || zone.isEmpty()) {
    return false;
  }
  Card card=zone.getCards(game).iterator().next();
  Player controller=game.getPlayer(source.getControllerId());
  if (card != null && controller != null) {
    if (card.getCardType().contains(CardType.LAND)) {
      if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand()) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str" + card.getLogName() + "String_Node_Str",source,game)) {
          card.setFaceDown(false,game);
          return controller.playLand(card,game);
        }
      }
 else       if (!game.isSimulation()) {
        game.informPlayer(controller,"String_Node_Str");
      }
    }
 else {
      if (card.getSpellAbility() != null) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str" + card.getLogName() + "String_Node_Str",source,game)) {
          card.setFaceDown(false,game);
          return controller.cast(card.getSpellAbility(),game,true);
        }
      }
 else {
        Logger.getLogger(HideawayPlayEffect.class).error("String_Node_Str" + card.getName());
        return false;
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  ExileZone zone=game.getExile().getExileZone(CardUtil.getCardExileZoneId(game,source));
  if (zone == null || zone.isEmpty()) {
    return false;
  }
  Card card=zone.getCards(game).iterator().next();
  Player controller=game.getPlayer(source.getControllerId());
  if (card != null && controller != null) {
    if (card.getCardType().contains(CardType.LAND)) {
      if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand() && MyMainPhaseCondition.getInstance().apply(game,source)) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str" + card.getLogName() + "String_Node_Str",source,game)) {
          card.setFaceDown(false,game);
          return controller.moveCards(card,Zone.EXILED,Zone.BATTLEFIELD,source,game);
        }
      }
 else       if (!game.isSimulation()) {
        game.informPlayer(controller,"String_Node_Str");
      }
    }
 else {
      if (card.getSpellAbility() != null) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str" + card.getLogName() + "String_Node_Str",source,game)) {
          card.setFaceDown(false,game);
          return controller.cast(card.getSpellAbility(),game,true);
        }
      }
 else {
        Logger.getLogger(HideawayPlayEffect.class).error("String_Node_Str" + card.getName());
        return false;
      }
    }
    return true;
  }
  return false;
}
Program: 158807
Project: 158807
Buggy source:
@Override public boolean apply(Game game,Ability source){
  ExileZone exile=game.getExile().getExileZone(exileId);
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null && exile != null) {
    if (zone == Zone.GRAVEYARD) {
      controller.moveCards(exile,zone,Zone.EXILED,source,game);
    }
 else {
      exile=exile.copy();
      for (      UUID cardId : exile) {
        Card card=game.getCard(cardId);
        Player owner=game.getPlayer(card.getOwnerId());
        if (owner != null) {
switch (zone) {
case BATTLEFIELD:
            card.moveToZone(zone,source.getSourceId(),game,tapped);
          if (!game.isSimulation()) {
            game.informPlayers(controller.getLogName() + "String_Node_Str" + card.getName()+ "String_Node_Str"+ zone.toString().toLowerCase());
          }
        break;
case HAND:
      controller.moveCards(card,Zone.EXILED,Zone.HAND,source,game);
    break;
case LIBRARY:
  controller.moveCardToLibraryWithInfo(card,source.getSourceId(),game,Zone.EXILED,true,true);
break;
case GRAVEYARD:
controller.moveCards(card,Zone.EXILED,Zone.GRAVEYARD,source,game);
break;
default :
card.moveToZone(zone,source.getSourceId(),game,tapped);
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + "String_Node_Str" + card.getName()+ "String_Node_Str"+ zone.toString().toLowerCase());
}
}
}
}
game.getExile().getExileZone(exileId).clear();
}
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  ExileZone exile=game.getExile().getExileZone(exileId);
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null && exile != null) {
    if (zone == Zone.GRAVEYARD) {
      controller.moveCards(exile,zone,Zone.EXILED,source,game);
    }
 else {
      exile=exile.copy();
      for (      UUID cardId : exile) {
        Card card=game.getCard(cardId);
        Player owner=game.getPlayer(card.getOwnerId());
        if (owner != null) {
switch (zone) {
case BATTLEFIELD:
            card.moveToZone(zone,source.getSourceId(),game,tapped);
          if (!game.isSimulation()) {
            game.informPlayers(controller.getLogName() + "String_Node_Str" + card.getLogName()+ "String_Node_Str"+ zone.toString().toLowerCase());
          }
        break;
case HAND:
      controller.moveCards(card,Zone.EXILED,Zone.HAND,source,game);
    break;
case LIBRARY:
  controller.moveCardToLibraryWithInfo(card,source.getSourceId(),game,Zone.EXILED,true,true);
break;
case GRAVEYARD:
controller.moveCards(card,Zone.EXILED,Zone.GRAVEYARD,source,game);
break;
default :
card.moveToZone(zone,source.getSourceId(),game,tapped);
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + "String_Node_Str" + card.getLogName()+ "String_Node_Str"+ zone.toString().toLowerCase());
}
}
}
}
game.getExile().getExileZone(exileId).clear();
}
return true;
}
return false;
}
Program: 158808
Project: 158808
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    Card card=game.getCard(event.getTargetId());
    if (card != null) {
      ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      controller.moveCardToLibraryWithInfo(card,source.getSourceId(),game,zEvent.getFromZone(),false,true);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    Card card=game.getCard(event.getTargetId());
    if (card != null) {
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      controller.putCardsOnBottomOfLibrary(cards,game,source,false);
      return true;
    }
  }
  return false;
}
Program: 158809
Project: 158809
Buggy source:
@Override public boolean moveToZone(Zone zone,UUID sourceId,Game game,boolean flag,ArrayList<UUID> appliedEffects){
  if (this.isCopiedSpell() && !zone.equals(Zone.STACK)) {
    return true;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public boolean moveToZone(Zone zone,UUID sourceId,Game game,boolean flag,ArrayList<UUID> appliedEffects){
  if (this.isCopiedSpell() && !zone.equals(Zone.STACK)) {
    return true;
  }
  Card card=game.getCard(getSourceId());
  if (card != null) {
    return card.moveToZone(zone,sourceId,game,flag,appliedEffects);
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 158810
Project: 158810
Buggy source:
/** 
 * Fixes undersized or oversized decks that have been generated. Removes random cards from an oversized deck until it is the correct size. Uses the reserve pool to fill up and undersized deck with cards.
 * @return a fixed list of cards for this deck.
 */
private List<Card> getFixedSpells(){
  Random random=new Random();
  int spellSize=deckCards.size();
  int nonLandSize=(deckSize - landCount);
  if (spellSize < nonLandSize) {
    int spellsNeeded=nonLandSize - spellSize;
    List<Card> spellsToAdd=new ArrayList<>(spellsNeeded);
    for (int i=0; i < spellsNeeded; i++)     spellsToAdd.add(reserveSpells.get(i));
    for (int i=spellsNeeded + 1; i < reserveSpells.size() - 1; i++) {
      int j=random.nextInt(i);
      Card randomCard=reserveSpells.get(j);
      if (isValidSpellCard(randomCard) && j < spellsToAdd.size()) {
        spellsToAdd.set(j,randomCard);
      }
    }
    deckCards.addAll(spellsToAdd);
  }
 else   if (spellSize > (deckSize - landCount)) {
    int spellsRemoved=(spellSize) - (deckSize - landCount);
    for (int i=0; i < spellsRemoved; ++i) {
      deckCards.remove(random.nextInt(deckCards.size()));
    }
  }
  if (deckCards.size() != nonLandSize)   throw new IllegalStateException("String_Node_Str");
  return deckCards;
}

Fixed version (ground truth):
/** 
 * Fixes undersized or oversized decks that have been generated. Removes random cards from an oversized deck until it is the correct size. Uses the reserve pool to fill up and undersized deck with cards.
 * @return a fixed list of cards for this deck.
 */
private List<Card> getFixedSpells(){
  Random random=new Random();
  int spellSize=deckCards.size();
  int nonLandSize=(deckSize - landCount);
  if (spellSize < nonLandSize) {
    int spellsNeeded=nonLandSize - spellSize;
    if (reserveSpells.size() < spellsNeeded) {
      throw new IllegalStateException("String_Node_Str");
    }
    List<Card> spellsToAdd=new ArrayList<>(spellsNeeded);
    for (int i=0; i < spellsNeeded; i++)     spellsToAdd.add(reserveSpells.get(i));
    for (int i=spellsNeeded + 1; i < reserveSpells.size() - 1; i++) {
      int j=random.nextInt(i);
      Card randomCard=reserveSpells.get(j);
      if (isValidSpellCard(randomCard) && j < spellsToAdd.size()) {
        spellsToAdd.set(j,randomCard);
      }
    }
    deckCards.addAll(spellsToAdd);
  }
 else   if (spellSize > (deckSize - landCount)) {
    int spellsRemoved=(spellSize) - (deckSize - landCount);
    for (int i=0; i < spellsRemoved; ++i) {
      deckCards.remove(random.nextInt(deckCards.size()));
    }
  }
  if (deckCards.size() != nonLandSize) {
    throw new IllegalStateException("String_Node_Str");
  }
  return deckCards;
}
Program: 158811
Project: 158811
Buggy source:
/** 
 * Return a random basic land of the chosen color.
 * @param color the color the basic land should produce.
 * @param basicLands list of information about basic lands from the database.
 * @return a single basic land that produces the color needed.
 */
private static Card getBasicLand(ColoredManaSymbol color,Map<String,List<CardInfo>> basicLands){
  Random random=new Random();
  String landName=DeckGeneratorPool.getBasicLandName(color.toString());
  return basicLands.get(landName).get(random.nextInt(basicLands.size() - 1)).getMockCard().copy();
}

Fixed version (ground truth):
/** 
 * Return a random basic land of the chosen color.
 * @param color the color the basic land should produce.
 * @param basicLands list of information about basic lands from the database.
 * @return a single basic land that produces the color needed.
 */
private static Card getBasicLand(ColoredManaSymbol color,Map<String,List<CardInfo>> basicLands){
  Random random=new Random();
  String landName=DeckGeneratorPool.getBasicLandName(color.toString());
  List<CardInfo> basicLandsInfo=basicLands.get(landName);
  return basicLandsInfo.get(random.nextInt(basicLandsInfo.size() - 1)).getMockCard().copy();
}
Program: 158813
Project: 158813
Buggy source:
/** 
 * Inkmoth Nexus has no effect it he attacks becaus it has infect but there are no counters added http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/296553-melira-sylvok-outcast-vs-inkmoth-nexus
 */
@Test public void testInkmothNexusLoseInfect(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str");
  activateAbility(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  attack(2,playerB,"String_Node_Str");
  setStopAt(2,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertTapped("String_Node_Str",true);
  assertTapped("String_Node_Str",true);
  assertCounterCount(playerA,CounterType.POISON,0);
  assertLife(playerA,20);
  assertLife(playerB,20);
}

Fixed version (ground truth):
/** 
 * Inkmoth Nexus has no effect it he attacks becaus it has infect but there are no counters added http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/296553-melira-sylvok-outcast-vs-inkmoth-nexus
 */
@Test public void testInkmothNexusLoseInfect(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  activateAbility(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  attack(2,playerB,"String_Node_Str");
  setStopAt(2,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertPowerToughness(playerA,"String_Node_Str",2,2);
  assertTapped("String_Node_Str",true);
  assertTapped("String_Node_Str",true);
  assertCounterCount(playerA,CounterType.POISON,0);
  assertLife(playerA,20);
  assertLife(playerB,20);
}
Program: 158814
Project: 158814
Buggy source:
public Card getRightHalfCard(){
  return rightHalfCard;
}

Fixed version (ground truth):
public SplitCardHalf getRightHalfCard(){
  return (SplitCardHalf)rightHalfCard;
}
Program: 158815
Project: 158815
Buggy source:
public Card getLeftHalfCard(){
  return leftHalfCard;
}

Fixed version (ground truth):
public SplitCardHalf getLeftHalfCard(){
  return (SplitCardHalf)leftHalfCard;
}
Program: 158816
Project: 158816
Buggy source:
public SplitCard(SplitCard card){
  super(card);
  this.leftHalfCard=card.leftHalfCard.copy();
  this.rightHalfCard=card.rightHalfCard.copy();
}

Fixed version (ground truth):
public SplitCard(SplitCard card){
  super(card);
  this.leftHalfCard=card.getLeftHalfCard().copy();
  ((SplitCardHalf)leftHalfCard).setParentCard(this);
  this.rightHalfCard=card.rightHalfCard.copy();
  ((SplitCardHalf)rightHalfCard).setParentCard(this);
}
Program: 158817
Project: 158817
Buggy source:
@Override Card copy();

Fixed version (ground truth):
@Override SplitCardHalf copy();
Program: 158818
Project: 158818
Buggy source:
@Override public SplitCardHalfImpl copy(){
  return new SplitCardHalfImpl(this);
}

Fixed version (ground truth):
@Override public SplitCardHalf copy(){
  return new SplitCardHalfImpl(this);
}
Program: 158819
Project: 158819
Buggy source:
@Override public Card getMainCard(){
  return splitCardParent;
}

Fixed version (ground truth):
@Override public SplitCard getMainCard(){
  return splitCardParent;
}
Program: 158820
Project: 158820
Buggy source:
public List<Card> getAllCards(Game game){
  List<Card> cards=new ArrayList<Card>();
  for (  ExileZone exile : exileZones.values()) {
    cards.addAll(exile.getCards(game));
  }
  return cards;
}

Fixed version (ground truth):
public List<Card> getAllCards(Game game){
  List<Card> cards=new ArrayList<>();
  for (  ExileZone exile : exileZones.values()) {
    cards.addAll(exile.getCards(game));
  }
  return cards;
}
Program: 158822
Project: 158822
Buggy source:
private synchronized void target(UUID playerId,final String question,final Collection<? extends Ability> abilities,final boolean required,final Map<String,Serializable> options) throws MageException {
  perform(playerId,new Command(){
    @Override public void execute(    UUID playerId){
      getGameSession(playerId).target(question,new CardsView(abilities,game),null,required,options);
    }
  }
);
}

Fixed version (ground truth):
private synchronized void target(UUID playerId,final String question,final Collection<? extends Ability> abilities,final boolean required,final Map<String,Serializable> options) throws MageException {
  perform(playerId,new Command(){
    @Override public void execute(    UUID playerId){
      CardsView cardsView=new CardsView(abilities,game);
      getGameSession(playerId).target(question,cardsView,null,required,options);
    }
  }
);
}
Program: 158823
Project: 158823
Buggy source:
private ShowCardsDialog showCards(String title,CardsView cards,boolean required,Map<String,Serializable> options,PopUpMenuType popupMenuType){
  hideAll();
  ShowCardsDialog showCards=new ShowCardsDialog();
  JPopupMenu popupMenu=null;
  Listener<Event> eventListener=null;
  if (PopUpMenuType.TRIGGER_ORDER.equals(popupMenuType)) {
    popupMenu=getTriggerOrderPopupMenu();
    eventListener=getTriggerOrderEventListener(showCards);
  }
  showCards.loadCards(title,cards,bigCard,Config.dimensionsEnlarged,gameId,required,options,popupMenu,eventListener);
  return showCards;
}

Fixed version (ground truth):
private ShowCardsDialog showCards(String title,CardsView cards,boolean required,Map<String,Serializable> options,PopUpMenuType popupMenuType){
  hideAll();
  ShowCardsDialog showCards=new ShowCardsDialog();
  JPopupMenu popupMenu=null;
  if (PopUpMenuType.TRIGGER_ORDER.equals(popupMenuType)) {
    popupMenu=popupMenuTriggerOrder;
  }
  showCards.loadCards(title,cards,bigCard,Config.dimensionsEnlarged,gameId,required,options,popupMenu,getShowCardsEventListener(showCards));
  return showCards;
}
Program: 158824
Project: 158824
Buggy source:
public void handleTriggerOrderPopupMenuEvent(ActionEvent e){
  UUID abilityId=null;
  String abilityRuleText=null;
  if (cardViewPopupMenu instanceof CardView && cardViewPopupMenu.getAbility() != null) {
    abilityId=cardViewPopupMenu.getAbility().getId();
    if (!cardViewPopupMenu.getAbility().getRules().isEmpty() && !cardViewPopupMenu.getAbility().getRules().equals("String_Node_Str")) {
      abilityRuleText=cardViewPopupMenu.getAbility().getRules().get(0);
    }
  }
switch (e.getActionCommand()) {
case CMD_AUTO_ORDER_FIRST:
    session.sendPlayerAction(TRIGGER_AUTO_ORDER_ABILITY_FIRST,gameId,abilityId);
  break;
case CMD_AUTO_ORDER_LAST:
session.sendPlayerAction(TRIGGER_AUTO_ORDER_ABILITY_LAST,gameId,abilityId);
break;
case CMD_AUTO_ORDER_NAME_FIRST:
if (abilityRuleText != null) {
session.sendPlayerAction(TRIGGER_AUTO_ORDER_NAME_FIRST,gameId,abilityRuleText);
}
break;
case CMD_AUTO_ORDER_NAME_LAST:
if (abilityRuleText != null) {
session.sendPlayerAction(TRIGGER_AUTO_ORDER_NAME_LAST,gameId,abilityRuleText);
}
break;
case CMD_AUTO_ORDER_RESET_ALL:
session.sendPlayerAction(TRIGGER_AUTO_ORDER_RESET_ALL,gameId,null);
break;
}
}

Fixed version (ground truth):
public void handleTriggerOrderPopupMenuEvent(ActionEvent e){
  UUID abilityId=null;
  String abilityRuleText=null;
  if (cardViewPopupMenu instanceof CardView && cardViewPopupMenu.getAbility() != null) {
    abilityId=cardViewPopupMenu.getAbility().getId();
    if (!cardViewPopupMenu.getAbility().getRules().isEmpty() && !cardViewPopupMenu.getAbility().getRules().get(0).isEmpty()) {
      abilityRuleText=cardViewPopupMenu.getAbility().getRules().get(0);
    }
  }
switch (e.getActionCommand()) {
case CMD_AUTO_ORDER_FIRST:
    session.sendPlayerAction(TRIGGER_AUTO_ORDER_ABILITY_FIRST,gameId,abilityId);
  break;
case CMD_AUTO_ORDER_LAST:
session.sendPlayerAction(TRIGGER_AUTO_ORDER_ABILITY_LAST,gameId,abilityId);
break;
case CMD_AUTO_ORDER_NAME_FIRST:
if (abilityRuleText != null) {
session.sendPlayerAction(TRIGGER_AUTO_ORDER_NAME_FIRST,gameId,abilityRuleText);
}
break;
case CMD_AUTO_ORDER_NAME_LAST:
if (abilityRuleText != null) {
session.sendPlayerAction(TRIGGER_AUTO_ORDER_NAME_LAST,gameId,abilityRuleText);
}
break;
case CMD_AUTO_ORDER_RESET_ALL:
session.sendPlayerAction(TRIGGER_AUTO_ORDER_RESET_ALL,gameId,null);
break;
}
}
Program: 158825
Project: 158825
Buggy source:
public GamePanel(){
  initComponents();
  createTriggerOrderPupupMenu();
  this.add(popupMenuCardPanel);
  pickNumber=new PickNumberDialog();
  MageFrame.getDesktop().add(pickNumber,JLayeredPane.MODAL_LAYER);
  this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
  this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
  this.setLayout(new BorderLayout());
  final JLayeredPane jLayeredBackgroundPane=new JLayeredPane();
  jLayeredBackgroundPane.setSize(1024,768);
  this.add(jLayeredBackgroundPane);
  jLayeredBackgroundPane.add(jSplitPane0,JLayeredPane.DEFAULT_LAYER);
  Map<String,JComponent> myUi=getUIComponents(jLayeredBackgroundPane);
  Plugins.getInstance().updateGamePanel(myUi);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      int width=((JComponent)e.getSource()).getWidth();
      int height=((JComponent)e.getSource()).getHeight();
      jLayeredBackgroundPane.setSize(width,height);
      jSplitPane0.setSize(width,height);
      if (height < storedHeight) {
        pnlBattlefield.setSize(0,200);
      }
      storedHeight=height;
      sizeToScreen();
      if (!initialized) {
        String state=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED,null);
        if (state != null && state.equals("String_Node_Str")) {
          jSplitPane0.setDividerLocation(1.0);
        }
        initialized=true;
      }
    }
  }
);
}

Fixed version (ground truth):
public GamePanel(){
  initComponents();
  initPopupMenuTriggerOrder();
  pickNumber=new PickNumberDialog();
  MageFrame.getDesktop().add(pickNumber,JLayeredPane.MODAL_LAYER);
  this.feedbackPanel.setConnectedChatPanel(this.userChatPanel);
  this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);
  this.setLayout(new BorderLayout());
  final JLayeredPane jLayeredBackgroundPane=new JLayeredPane();
  jLayeredBackgroundPane.setSize(1024,768);
  this.add(jLayeredBackgroundPane);
  jLayeredBackgroundPane.add(jSplitPane0,JLayeredPane.DEFAULT_LAYER);
  Map<String,JComponent> myUi=getUIComponents(jLayeredBackgroundPane);
  Plugins.getInstance().updateGamePanel(myUi);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      int width=((JComponent)e.getSource()).getWidth();
      int height=((JComponent)e.getSource()).getHeight();
      jLayeredBackgroundPane.setSize(width,height);
      jSplitPane0.setSize(width,height);
      if (height < storedHeight) {
        pnlBattlefield.setSize(0,200);
      }
      storedHeight=height;
      sizeToScreen();
      if (!initialized) {
        String state=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED,null);
        if (state != null && state.equals("String_Node_Str")) {
          jSplitPane0.setDividerLocation(1.0);
        }
        initialized=true;
      }
    }
  }
);
}
Program: 158826
Project: 158826
Buggy source:
@Override protected void readLine(String line,DeckCardLists deckList){
  if (line.length() == 0 || line.startsWith("String_Node_Str")) {
    return;
  }
  boolean sideboard=false;
  if (line.startsWith("String_Node_Str")) {
    line=line.substring(3).trim();
    sideboard=true;
  }
  int delim=line.indexOf(' ');
  String lineNum=line.substring(0,delim).trim();
  String lineName=line.substring(delim).trim();
  try {
    int num=Integer.parseInt(lineNum);
    CardInfo cardInfo=CardRepository.instance.findPreferedCoreExpansionCard(lineName);
    if (cardInfo == null) {
      sbMessage.append("String_Node_Str").append(lineName).append("String_Node_Str").append(lineCount).append("String_Node_Str");
    }
 else {
      for (int i=0; i < num; i++) {
        if (!sideboard) {
          deckList.getCards().add(new DeckCardInfo(cardInfo.getName(),cardInfo.getCardNumber(),cardInfo.getSetCode()));
        }
 else {
          deckList.getSideboard().add(new DeckCardInfo(cardInfo.getName(),cardInfo.getCardNumber(),cardInfo.getSetCode()));
        }
      }
    }
  }
 catch (  NumberFormatException nfe) {
    sbMessage.append("String_Node_Str").append(lineNum).append("String_Node_Str").append(lineCount).append("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void readLine(String line,DeckCardLists deckList){
  if (line.length() == 0 || line.startsWith("String_Node_Str")) {
    return;
  }
  boolean sideboard=false;
  if (line.startsWith("String_Node_Str")) {
    line=line.substring(3).trim();
    sideboard=true;
  }
  int delim=line.indexOf(' ');
  String lineNum=line.substring(0,delim).trim();
  String lineName=line.substring(delim).trim();
  try {
    int num=Integer.parseInt(lineNum);
    CardInfo cardInfo=CardRepository.instance.findPreferedCoreExpansionCard(lineName,true);
    if (cardInfo == null) {
      sbMessage.append("String_Node_Str").append(lineName).append("String_Node_Str").append(lineCount).append("String_Node_Str");
    }
 else {
      for (int i=0; i < num; i++) {
        if (!sideboard) {
          deckList.getCards().add(new DeckCardInfo(cardInfo.getName(),cardInfo.getCardNumber(),cardInfo.getSetCode()));
        }
 else {
          deckList.getSideboard().add(new DeckCardInfo(cardInfo.getName(),cardInfo.getCardNumber(),cardInfo.getSetCode()));
        }
      }
    }
  }
 catch (  NumberFormatException nfe) {
    sbMessage.append("String_Node_Str").append(lineNum).append("String_Node_Str").append(lineCount).append("String_Node_Str");
  }
}