protected Value<State> forward(Value<State> input, Character c) {
        Value<State> output = new Value<State>();
        for (State j : input.keySet()) {
            if (j.allows(c)) {
                double val = input.getValue(j);
                State i = j.next(c);
                if (i != null) {
                    output.setValue(i, val * j.prNext(c));
                }
                output.addValue(I, val * j.prRestart(c));
            } else {
                if(j == I) {
                    output.addValue(I, input.getValue(j) * EPSILON);
                }
            }
        }
        return output;
    }