private HistoryState getHistoryState(int index) {
    if (index >= 0 && index < myHistory.size()) {
      return myHistory.get(index);
    }
    return null;
  }
private HistoryState getHistoryState(int index)