| import java.util.*; |
| |
| public class ABug { |
| |
| private String drinkBear(String amount) { |
| String firstTime = "asdf"; |
| |
| if (firstTime == null) |
| return "loser"; |
| |
| ArrayList<String> bottles = new ArrayList<>(); |
| bottles.add("asdf"); |
| |
| Inner inner = new Inner(bottles).invoke(); |
| if (inner.is()) return null; |
| boolean no33pr = inner.isNo33pr(); |
| int first = inner.getFirst(); |
| int last = inner.getLast(); |
| char[] tripel = inner.getTripel(); |
| int rCount = inner.getrCount(); |
| int wCount = inner.getwCount(); |
| int nCount = inner.getnCount(); |
| int money = inner.getMoney(); |
| List<String> errors = inner.getErrors(); |
| |
| boolean unhappy = no33pr && first || no33pr && last; |
| |
| String result = amount + Arrays.toString(tripel) + rCount + wCount + nCount + money + errors; |
| |
| if (!unhappy) |
| result += "happy"; |
| |
| |
| return result; |
| } |
| |
| private class Inner { |
| private boolean myResult; |
| private ArrayList<String> bottles; |
| private List<String> errors; |
| private int money; |
| private int nCount; |
| private int rCount; |
| private int wCount; |
| private char[] tripel; |
| private boolean no33pr; |
| private int first; |
| private int last; |
| |
| public Inner(ArrayList<String> bottles) { |
| this.bottles = bottles; |
| } |
| |
| boolean is() { |
| return myResult; |
| } |
| |
| public List<String> getErrors() { |
| return errors; |
| } |
| |
| public int getMoney() { |
| return money; |
| } |
| |
| public int getnCount() { |
| return nCount; |
| } |
| |
| public int getrCount() { |
| return rCount; |
| } |
| |
| public int getwCount() { |
| return wCount; |
| } |
| |
| public char[] getTripel() { |
| return tripel; |
| } |
| |
| public boolean isNo33pr() { |
| return no33pr; |
| } |
| |
| public int getFirst() { |
| return first; |
| } |
| |
| public int getLast() { |
| return last; |
| } |
| |
| public Inner invoke() { |
| errors = new ArrayList<>(); |
| |
| money = 0; |
| nCount = 0; |
| rCount = 0; |
| wCount = 0; |
| tripel = new char[bottles.size()]; |
| no33pr = false; |
| first = 0; |
| last = 0; |
| if (true) { |
| myResult = true; |
| return this; |
| } |
| myResult = false; |
| return this; |
| } |
| } |
| } |