コード例 #1
0
ファイル: B5W.java プロジェクト: paul678/jflap
  public boolean isInLang(String s) {
    char[] list = new char[] {'a', 'b'};
    if (LemmaMath.otherCharactersFound(s, list)) return false;
    if (!s.startsWith("bbbbb")) return false;

    int a, b;
    String temp = s.substring(5);
    a = LemmaMath.countInstances(temp, 'a');
    b = LemmaMath.countInstances(temp, 'b');
    if (2 * a == 3 * b) return true;
    return false;
  }
コード例 #2
0
ファイル: B5W.java プロジェクト: paul678/jflap
 public void chooseI() {
   i = LemmaMath.flipCoin();
 }