/**
   * Checks this <code>ImageExportOptions</code> to another object for equality.
   *
   * @param o The other object to compare to.
   * @return Returns <code>true</code> only if the other object is also an <code>ImageExportOptions
   *     </code> and they both are for the same {@link ImageType} and all of their options are
   *     equal.
   */
  public boolean equals(Object o) {
    if (o == null || !o.getClass().equals(getClass())) return false;
    final ImageExportOptions otherOpts = (ImageExportOptions) o;

    final File otherExportFile = otherOpts.getExportFile();
    if (otherExportFile == null) {
      if (getExportFile() != null) return false;
    } else if (!otherExportFile.equals(getExportFile())) return false;

    if (!otherOpts.getImageType().equals(getImageType())) return false;

    final Map<String, ImageExportOption> om = otherOpts.m_exportOptions;
    if (om.size() != m_exportOptions.size()) return false;
    for (Map.Entry<String, ImageExportOption> me : om.entrySet()) {
      final ImageExportOption opt = m_exportOptions.get(me.getKey());
      if (opt == null || !opt.equals(me.getValue())) return false;
    }
    return true;
  }