public virtual IPrimitiveTypeRule[] getPrimitiveRules(System.String theVersion, System.String theTypeName, IPrimitive theType)
        {
            System.Collections.IList active = new System.Collections.ArrayList(myPrimitiveRuleBindings.Count);
            for (int i = 0; i < myPrimitiveRuleBindings.Count; i++)
            {
                System.Object o = myPrimitiveRuleBindings[i];
                if (!(o is RuleBinding))
                {
                    throw new System.InvalidCastException("Item in rule binding list is not a RuleBinding");
                }

                RuleBinding binding = (RuleBinding)o;
                if (binding.Active && binding.appliesToVersion(theVersion) && binding.appliesToScope(theTypeName))
                {
                    active.Add(binding.Rule);
                }
            }
            return (IPrimitiveTypeRule[])SupportClass.ICollectionSupport.ToArray(active, new IPrimitiveTypeRule[0]);
        }
예제 #2
0
        /// <summary>   Gets encoding rules. </summary>
        ///
        /// <exception cref="InvalidCastException"> Thrown when an object cannot be cast to a required
        ///                                         type. </exception>
        ///
        /// <param name="theVersion">   the version. </param>
        /// <param name="theEncoding">  the encoding. </param>
        ///
        /// <returns>   the active encoding rules that apply to the given version and encoding. </returns>

        public virtual IEncodingRule[] getEncodingRules(System.String theVersion, System.String theEncoding)
        {
            System.Collections.IList active = new System.Collections.ArrayList(this.myEncodingRuleBindings.Count);
            for (int i = 0; i < this.myEncodingRuleBindings.Count; i++)
            {
                System.Object o = this.myEncodingRuleBindings[i];
                if (!(o is RuleBinding))
                {
                    throw new System.InvalidCastException("Item in rule binding list is not a RuleBinding");
                }

                RuleBinding binding = (RuleBinding)o;
                if (binding.Active && binding.appliesToVersion(theVersion) && binding.appliesToScope(theEncoding))
                {
                    active.Add(binding.Rule);
                }
            }
            return((IEncodingRule[])SupportClass.ICollectionSupport.ToArray(active, new IEncodingRule[0]));
        }
        public virtual IMessageRule[] getMessageRules(String theVersion, String theMessageType, String theTriggerEvent)
        {
            IList active = new ArrayList(myMessageRuleBindings.Count);

            for (int i = 0; i < myMessageRuleBindings.Count; i++)
            {
                Object o = myMessageRuleBindings[i];
                if (!(o is RuleBinding))
                {
                    throw new InvalidCastException("Item in rule binding list is not a RuleBinding");
                }

                RuleBinding binding = (RuleBinding)o;
                if (binding.Active && binding.appliesToVersion(theVersion) &&
                    binding.appliesToScope(theMessageType + "^" + theTriggerEvent))
                {
                    active.Add(binding.Rule);
                }
            }
            return((IMessageRule[])SupportClass.ICollectionSupport.ToArray(active, new IMessageRule[0]));
        }