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

int jxl::biff::XFRecord::hashCode (  )  [inline, inherited]

Standard hash code implementation

Returns:
the hash code

Definition at line 1463 of file XFRecord.java.

References jxl::biff::XFRecord::align, jxl::biff::XFRecord::backgroundColour, jxl::biff::XFRecord::bottomBorder, jxl::biff::XFRecord::bottomBorderColour, jxl::biff::XFRecord::fontIndex, jxl::biff::XFRecord::formatIndex, jxl::biff::XFRecord::formatInfoInitialized, jxl::format::BorderLineStyle::getDescription(), jxl::format::Pattern::getValue(), jxl::format::Colour::getValue(), jxl::format::Orientation::getValue(), jxl::format::VerticalAlignment::getValue(), jxl::format::Alignment::getValue(), jxl::biff::XFRecord::hidden, jxl::biff::XFRecord::indentation, 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::hashCode().

  {
    // Must have its formats info initialized in order to compute the hash code
    if (!formatInfoInitialized)
    {
      initializeFormatInformation();
    }

    int hashValue = 17;
    int oddPrimeNumber = 37;

    // The boolean fields
    hashValue = oddPrimeNumber*hashValue + (hidden ? 1:0);
    hashValue = oddPrimeNumber*hashValue + (locked ? 1:0);
    hashValue = oddPrimeNumber*hashValue + (wrap ? 1:0);
    hashValue = oddPrimeNumber*hashValue + (shrinkToFit ? 1:0);

    // The enumerations
    if (xfFormatType == cell)
    {
      hashValue = oddPrimeNumber*hashValue + 1;
    }
    else if (xfFormatType == style)
    {
      hashValue = oddPrimeNumber*hashValue + 2;
    }

    hashValue = oddPrimeNumber*hashValue + (align.getValue() + 1);
    hashValue = oddPrimeNumber*hashValue + (valign.getValue() + 1);
    hashValue = oddPrimeNumber*hashValue + (orientation.getValue());

    hashValue ^= leftBorder.getDescription().hashCode();
    hashValue ^= rightBorder.getDescription().hashCode();
    hashValue ^= topBorder.getDescription().hashCode();
    hashValue ^= bottomBorder.getDescription().hashCode();

    hashValue = oddPrimeNumber*hashValue + (leftBorderColour.getValue());
    hashValue = oddPrimeNumber*hashValue + (rightBorderColour.getValue());
    hashValue = oddPrimeNumber*hashValue + (topBorderColour.getValue());
    hashValue = oddPrimeNumber*hashValue + (bottomBorderColour.getValue());
    hashValue = oddPrimeNumber*hashValue + (backgroundColour.getValue());
    hashValue = oddPrimeNumber*hashValue + (pattern.getValue() + 1);

    // The integer fields
    hashValue = oddPrimeNumber*hashValue + usedAttributes;
    hashValue = oddPrimeNumber*hashValue + parentFormat;
    hashValue = oddPrimeNumber*hashValue + fontIndex;
    hashValue = oddPrimeNumber*hashValue + formatIndex;
    hashValue = oddPrimeNumber*hashValue + indentation;

    return hashValue;
  }


Generated by  Doxygen 1.6.0   Back to index