Crypt analysis

http://www.careercup.com/question?id=5116391780777984

http://www.1point3acres.com/bbs/forum.php?mod=viewthread&tid=146022&extra=page%3D1%26filter%3Dsortid%26sortid%3D311%26searchoption%5B3046%5D%5Bvalue%5D%3D32%26searchoption%5B3046%5D%5Btype%5D%3Dradio%26sortid%3D311


class EvelExpression implements Expression {
    String input1, input2, result;
    Set<Character> chars;
    public EvelExpression(String s1, String s2, String result) {
        input1 = s1;
        input2 = s2;
        this.result = result;
        chars = new HashSet<>();
    }

    private void addCharacter(Set<Character> chars, String s) {
        for (int pos = 0; pos < s.length(); pos++) {. more info on 1point3acres.com
            chars.add(s.charAt(pos));
        }
    }

    Set<Character> getChars() {. 1point3acres.com/bbs
        addCharacter(chars, s1);  
        addCharacter(chars, s2);
        addCharacter(chars, result);
        return chars;
    }

    private int getNum(String s, Map<Character, Integer> proposedSolution) {
        int res = 0;
        for (int pos = 0; pos < s.length()(); pos++) {
            res = res * 10 + proposedSolution.get(s.charAt(pos));
        }
        return res;
    }

    boolean eval(Map<Character, Integer> proposedSolution) {
        int num1 = getNum(input1, proposedSolution), num2 = getNum(input2, proposedSolution);
        int res = getNum(result, proposedSolution);
        return res == (num1 + num2); 
    }
}