コード例 #1
0
  @Override
  public boolean equals(Object inputO) {
    if (this == inputO) {
      return true;
    }

    if (!(inputO instanceof AdvancedState)) {
      return false;
    }

    AdvancedState compare = (AdvancedState) inputO;

    if (!((names.containsAll(compare.getNames()) && (compare.getNames().containsAll(names))))) {
      return false;
    }

    if (acceptanceState != compare.isAcceptanceState()) {
      return false;
    }

    if (initialState != compare.isInitialState()) {
      return false;
    }

    return true;
  }
コード例 #2
0
  public static AdvancedState mergeStates(AdvancedState st1, AdvancedState st2) {
    if (st1.equals(st2)) {
      return st1;
    }

    AdvancedState out = new AdvancedState();

    for (String name : st1.names) {
      out.addName(name);
    }

    for (String name : st2.names) {
      out.addName(name);
    }

    return out;
  }