Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

boolean jxl::biff::XFRecord::equals ( Object  o  )  [inline, inherited]

Equals method. This is called when comparing writable formats in order to prevent duplicate formats being added to the workbook

Parameters:
o object to compare
Returns:
TRUE if the objects are equal, FALSE otherwise

Definition at line 1523 of file XFRecord.java.

References jxl::biff::XFRecord::align, jxl::biff::XFRecord::backgroundColour, jxl::biff::XFRecord::bottomBorder, jxl::biff::XFRecord::bottomBorderColour, jxl::biff::FontRecord::equals(), jxl::biff::XFRecord::font, jxl::biff::XFRecord::fontIndex, jxl::biff::XFRecord::format, jxl::biff::XFRecord::formatIndex, jxl::biff::XFRecord::formatInfoInitialized, jxl::biff::XFRecord::hidden, jxl::biff::XFRecord::indentation, jxl::biff::XFRecord::initialized, jxl::biff::XFRecord::initializeFormatInformation(), jxl::biff::XFRecord::leftBorder, jxl::biff::XFRecord::leftBorderColour, jxl::biff::XFRecord::locked, jxl::biff::XFRecord::orientation, jxl::biff::XFRecord::parentFormat, jxl::biff::XFRecord::pattern, jxl::biff::XFRecord::rightBorder, jxl::biff::XFRecord::rightBorderColour, jxl::biff::XFRecord::shrinkToFit, jxl::biff::XFRecord::topBorder, jxl::biff::XFRecord::topBorderColour, jxl::biff::XFRecord::usedAttributes, jxl::biff::XFRecord::valign, jxl::biff::XFRecord::wrap, and jxl::biff::XFRecord::xfFormatType.

Referenced by jxl::write::biff::ColumnInfoRecord::equals(), and jxl::biff::FormattingRecords::rationalize().

  {
    if (o == this)
    {
      return true;
    }

    if (!(o instanceof XFRecord))
    {
      return false;
    }

    XFRecord xfr = (XFRecord) o;

    // Both records must be writable and have their format info initialized
    if (!formatInfoInitialized)
    {
      initializeFormatInformation();
    }

    if (!xfr.formatInfoInitialized)
    {
      xfr.initializeFormatInformation();
    }

    if (xfFormatType   != xfr.xfFormatType ||
        parentFormat   != xfr.parentFormat ||
        locked         != xfr.locked ||
        hidden         != xfr.hidden ||
        usedAttributes != xfr.usedAttributes)
    {
      return false;
    }

    if (align       != xfr.align ||
        valign      != xfr.valign ||
        orientation != xfr.orientation ||
        wrap        != xfr.wrap ||
        shrinkToFit != xfr.shrinkToFit ||
        indentation != xfr.indentation)
    {
      return false;
    }

    if (leftBorder   != xfr.leftBorder  ||
        rightBorder  != xfr.rightBorder ||
        topBorder    != xfr.topBorder   ||
        bottomBorder != xfr.bottomBorder)
    {
      return false;
    }

    if (leftBorderColour   != xfr.leftBorderColour  ||
        rightBorderColour  != xfr.rightBorderColour ||
        topBorderColour    != xfr.topBorderColour   ||
        bottomBorderColour != xfr.bottomBorderColour)
    {
      return false;
    }

    if (backgroundColour != xfr.backgroundColour ||
        pattern          != xfr.pattern)
    {
      return false;
    }

    if (initialized && xfr.initialized)
    {
      // Both formats are initialized, so it is sufficient to just do 
      // shallow equals on font, format objects,
      // since we are testing for the presence of clones anwyay
      // Use indices rather than objects because of the rationalization
      // process (which does not set the object on an XFRecord)
      if (fontIndex   != xfr.fontIndex ||
          formatIndex != xfr.formatIndex)
      {
        return false;
      }
    }
    else
    {
      // Perform a deep compare of fonts and formats
      if (!font.equals(xfr.font) ||
          !format.equals(xfr.format))
      {
        return false;
      }
    }

    return true;
  }


Generated by  Doxygen 1.6.0   Back to index