Esempio n. 1
0
  /**
   * Saves the options of the specified seek to be used for the next time when this action is run.
   */
  private void saveSeekOptions(UserSeek seek) {
    Preferences prefs = getPrefs();

    prefs.setInt("time", seek.getTime());
    prefs.setInt("inc", seek.getInc());
    prefs.setBool("isRated", seek.isRated());
    prefs.setString("variant", seek.getVariant().getName());
    Player color = seek.getColor();
    prefs.setString("color", color == null ? "auto" : color.isWhite() ? "white" : "black");
    int minRating = seek.getMinRating();
    int maxRating = seek.getMaxRating();
    prefs.setBool(
        "limitRating", (minRating != Integer.MIN_VALUE) || (maxRating != Integer.MAX_VALUE));
    prefs.setInt("minRating", minRating == Integer.MIN_VALUE ? 0 : minRating);
    prefs.setInt("maxRating", maxRating == Integer.MAX_VALUE ? 9999 : maxRating);
    prefs.setBool("manualAccept", seek.isManualAccept());
    prefs.setBool("useFormula", seek.isFormula());
  }