Пример #1
0
        /// <summary>
        /// Create an XdmSequenceType corresponding to a given XdmItemType and occurrence indicator
        /// </summary>
        /// <param name="itemType">The item type</param>
        /// <param name="occurrenceIndicator">The occurrence indicator, one of '?' (zero-or-one),
        /// '*' (zero-or-more), '+' (one-or-more), ' ' (a single space) (exactly one),
        /// or 'º' (masculine ordinal indicator, xBA) (exactly zero). The type empty-sequence()
        /// can be represented by an occurrence indicator of 'º' with any item type.</param>

        public XdmSequenceType(XdmItemType itemType, char occurrenceIndicator)
        {
            int occ;

            switch (occurrenceIndicator)
            {
            case '*':
                occ = JStaticProperty.ALLOWS_ZERO_OR_MORE;
                break;

            case '+':
                occ = JStaticProperty.ALLOWS_ONE_OR_MORE;
                break;

            case '?':
                occ = JStaticProperty.ALLOWS_ZERO_OR_ONE;
                break;

            case ' ':
                occ = JStaticProperty.EXACTLY_ONE;
                break;

            case 'º':         //xBA
                occ = JStaticProperty.ALLOWS_ZERO;
                break;

            default:
                throw new ArgumentException("Unknown occurrence indicator");
            }
            this.itemType    = itemType;
            this.occurrences = occ;
        }
Пример #2
0
        internal static XdmSequenceType FromSequenceType(JSequenceType seqType)
        {
            XdmItemType itemType = XdmItemType.MakeXdmItemType(seqType.getPrimaryType());
            char        occ;

            if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO_OR_MORE)
            {
                occ = '*';
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ONE_OR_MORE)
            {
                occ = '+';
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO_OR_ONE)
            {
                occ = '?';
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO)
            {
                occ = 'º';     //xBA
            }
            else
            {
                occ = ' ';
            }
            return(new XdmSequenceType(itemType, occ));
        }
Пример #3
0
        internal static XdmSequenceType FromSequenceType(JSequenceType seqType)
        {
            XdmItemType itemType = XdmItemType.MakeXdmItemType(seqType.getPrimaryType());
            char        occ;

            if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO_OR_MORE)
            {
                occ = ZERO_OR_MORE;
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ONE_OR_MORE)
            {
                occ = ONE_OR_MORE;
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO_OR_ONE)
            {
                occ = ZERO_OR_ONE;
            }
            else if (seqType.getCardinality() == JStaticProperty.ALLOWS_ZERO)
            {
                occ = ZERO;
            }
            else
            {
                occ = ONE;
            }
            if (itemType == null)
            {
                return(null);
            }
            return(new XdmSequenceType(itemType, occ));
        }
Пример #4
0
 /// <summary>
 ///  Determine whether this ItemType subsumes another ItemType. Specifically,
 /// <code>A.subsumes(B)</code> is true if every value that matches the ItemType B also matches
 /// the ItemType A.
 /// </summary>
 /// <param name="other">the other ItemType</param>
 /// <returns>true if this ItemType subsumes the other ItemType. This includes the case where A and B
 ///         represent the same ItemType.</returns>
 public override bool Subsumes(XdmItemType other)
 {
     return(true);
 }
Пример #5
0
 /// <summary>
 /// Determine whether this ItemType subsumes another ItemType. Specifically
 /// <code>A.Sumsumes(B)</code> is true if every value that matches the ItemType B also
 /// matches the ItemType A.
 /// </summary>
 /// <param name="other">the other ItemType</param>
 /// <returns>true if this ItemType subsumes the other ItemType. This includes the case where A and B
 /// represent the same ItemType.</returns>
 public override bool Subsumes(XdmItemType other)
 {
     return(type.subsumes(other.Unwrap()));
 }
Пример #6
0
 /// <summary>
 /// Determine whether this ItemType subsumes another ItemType. Specifically,
 /// <code>A.subsumes(B)</code> is true if every value that matches the ItemType B also matches
 /// the ItemType A.
 /// </summary>
 /// <param name="other">the other ItemType</param>
 /// <returns>true if this ItemType subsumes the other ItemType. This includes the case where A and B
 ///         represent the same ItemType.</returns>
 virtual public bool Subsumes(XdmItemType other)
 {
     return(type.subsumes(other.type));
 }
Пример #7
0
 /// <summary>
 /// Create an XdmSequenceType corresponding to a given XdmItemType and occurrence indicator
 /// </summary>
 /// <param name="itemType">The item type</param>
 /// <param name="occurrenceIndicator">The occurrence indicator, one of '?' (zero-or-one), 
 /// '*' (zero-or-more), '+' (one-or-more), ' ' (a single space) (exactly one),
 /// or 'º' (masculine ordinal indicator, xBA) (exactly zero). The type empty-sequence()
 /// can be represented by an occurrence indicator of 'º' with any item type.</param>
 public XdmSequenceType(XdmItemType itemType, char occurrenceIndicator)
 {
     int occ;
         switch (occurrenceIndicator)
         {
             case '*':
                 occ = JStaticProperty.ALLOWS_ZERO_OR_MORE;
                 break;
             case '+':
                 occ = JStaticProperty.ALLOWS_ONE_OR_MORE;
                 break;
             case '?':
                 occ = JStaticProperty.ALLOWS_ZERO_OR_ONE;
                 break;
             case ' ':
                 occ = JStaticProperty.EXACTLY_ONE;
                 break;
             case 'º': //xBA
                 occ = JStaticProperty.ALLOWS_ZERO;
                 break;
             default:
                 throw new ArgumentException("Unknown occurrence indicator");
         }
         this.itemType = itemType;
         this.occurrences = occ;
 }