/// <summary>
        /// Returns true if Organization instances are equal
        /// </summary>
        /// <param name="other">Instance of Organization to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Organization other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     TradingName == other.TradingName ||
                     TradingName != null &&
                     TradingName.Equals(other.TradingName)
                 ) &&
                 (
                     Href == other.Href ||
                     Href != null &&
                     Href.Equals(other.Href)
                 ) &&
                 (
                     IsLegalEntity == other.IsLegalEntity ||
                     IsLegalEntity != null &&
                     IsLegalEntity.Equals(other.IsLegalEntity)
                 ) &&
                 (
                     OrganizationType == other.OrganizationType ||
                     OrganizationType != null &&
                     OrganizationType.Equals(other.OrganizationType)
                 ) &&
                 (
                     NameType == other.NameType ||
                     NameType != null &&
                     NameType.Equals(other.NameType)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ));
        }
Exemple #2
0
 /// <summary>
 /// Two DnsResourceDataKey are equal iff their authentication prohibited, confidentiality prohibited, experimental, user associated, IPSec, email,
 /// name type, signatory, protocol, algorithm, flags extension and public key fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataKey other)
 {
     return(other != null &&
            AuthenticationProhibited.Equals(other.AuthenticationProhibited) &&
            ConfidentialityProhibited.Equals(other.ConfidentialityProhibited) &&
            Experimental.Equals(other.Experimental) &&
            UserAssociated.Equals(other.UserAssociated) &&
            IpSec.Equals(other.IpSec) &&
            Email.Equals(other.Email) &&
            NameType.Equals(other.NameType) &&
            Signatory.Equals(other.Signatory) &&
            Protocol.Equals(other.Protocol) &&
            Algorithm.Equals(other.Algorithm) &&
            (FlagsExtension.HasValue
                 ? other.FlagsExtension.HasValue && FlagsExtension.Value.Equals(other.FlagsExtension.Value)
                 : !other.FlagsExtension.HasValue) &&
            PublicKey.Equals(other.PublicKey));
 }
        /**
         * Resolves a cell or area reference dynamically.
         * @param workbookName the name of the workbook Containing the reference.  If <code>null</code>
         * the current workbook is assumed.  Note - to Evaluate formulas which use multiple workbooks,
         * a {@link CollaboratingWorkbooksEnvironment} must be set up.
         * @param sheetName the name of the sheet Containing the reference.  May be <code>null</code>
         * (when <c>workbookName</c> is also null) in which case the current workbook and sheet is
         * assumed.
         * @param refStrPart1 the single cell reference or first part of the area reference.  Must not
         * be <code>null</code>.
         * @param refStrPart2 the second part of the area reference. For single cell references this
         * parameter must be <code>null</code>
         * @param isA1Style specifies the format for <c>refStrPart1</c> and <c>refStrPart2</c>.
         * Pass <c>true</c> for 'A1' style and <c>false</c> for 'R1C1' style.
         * TODO - currently POI only supports 'A1' reference style
         * @return a {@link RefEval} or {@link AreaEval}
         */

        public ValueEval GetDynamicReference(string workbookName, string sheetName, string refStrPart1,
                                             string refStrPart2, bool isA1Style)
        {
            if (!isA1Style)
            {
                throw new Exception("R1C1 style not supported yet");
            }
            SheetRefEvaluator se = CreateExternSheetRefEvaluator(workbookName, sheetName);

            if (se == null)
            {
                return(ErrorEval.REF_INVALID);
            }
            SheetRangeEvaluator sre = new SheetRangeEvaluator(_sheetIndex, se);

            // ugly typecast - TODO - make spReadsheet version more easily accessible
            SpreadsheetVersion ssVersion = ((IFormulaParsingWorkbook)_workbook).GetSpreadsheetVersion();

            NameType part1refType = ClassifyCellReference(refStrPart1, ssVersion);

            switch (part1refType)
            {
            case NameType.BadCellOrNamedRange:
                return(ErrorEval.REF_INVALID);

            case NameType.NamedRange:
                IEvaluationName nm = ((IFormulaParsingWorkbook)_workbook).GetName(refStrPart1, _sheetIndex);
                if (!nm.IsRange)
                {
                    throw new Exception("Specified name '" + refStrPart1 + "' is not a range as expected.");
                }
                return(_bookEvaluator.EvaluateNameFormula(nm.NameDefinition, this));
            }
            if (refStrPart2 == null)
            {
                // no ':'
                switch (part1refType)
                {
                case NameType.Column:
                case NameType.Row:
                    return(ErrorEval.REF_INVALID);

                case NameType.Cell:
                    CellReference cr = new CellReference(refStrPart1);
                    return(new LazyRefEval(cr.Row, cr.Col, sre));
                }
                throw new InvalidOperationException("Unexpected reference classification of '" + refStrPart1 + "'.");
            }
            NameType part2refType = ClassifyCellReference(refStrPart1, ssVersion);

            switch (part2refType)
            {
            case NameType.BadCellOrNamedRange:
                return(ErrorEval.REF_INVALID);

            case NameType.NamedRange:
                throw new Exception("Cannot Evaluate '" + refStrPart1
                                    + "'. Indirect Evaluation of defined names not supported yet");
            }

            if (part2refType != part1refType)
            {
                // LHS and RHS of ':' must be compatible
                return(ErrorEval.REF_INVALID);
            }
            int firstRow, firstCol, lastRow, lastCol;

            switch (part1refType)
            {
            case NameType.Column:
                firstRow = 0;
                if (part2refType.Equals(NameType.Column))
                {
                    lastRow  = ssVersion.LastRowIndex;
                    firstCol = ParseRowRef(refStrPart1);
                    lastCol  = ParseRowRef(refStrPart2);
                }
                else
                {
                    lastRow  = ssVersion.LastRowIndex;
                    firstCol = ParseColRef(refStrPart1);
                    lastCol  = ParseColRef(refStrPart2);
                }
                break;

            case NameType.Row:
                // support of cell range in the form of integer:integer
                firstCol = 0;
                if (part2refType.Equals(NameType.Row))
                {
                    firstRow = ParseColRef(refStrPart1);
                    lastRow  = ParseColRef(refStrPart2);
                    lastCol  = ssVersion.LastColumnIndex;
                }
                else
                {
                    lastCol  = ssVersion.LastColumnIndex;
                    firstRow = ParseRowRef(refStrPart1);
                    lastRow  = ParseRowRef(refStrPart2);
                }
                break;

            case NameType.Cell:
                CellReference cr;
                cr       = new CellReference(refStrPart1);
                firstRow = cr.Row;
                firstCol = cr.Col;
                cr       = new CellReference(refStrPart2);
                lastRow  = cr.Row;
                lastCol  = cr.Col;
                break;

            default:
                throw new InvalidOperationException("Unexpected reference classification of '" + refStrPart1 + "'.");
            }
            return(new LazyAreaEval(firstRow, firstCol, lastRow, lastCol, sre));
        }