Exemplo n.º 1
0
		// --------------------------------------------------------------------

		private static bool Rule02 (string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
		{
			if (nodeIndex.HasTypeInformation) 
				return (
					  Rule02 (name, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "DrawdownNotice"), errorHandler));					
				
			return (
					  Rule02 (name, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "DrawdownNotice"), errorHandler));
		}
Exemplo n.º 2
0
        // --------------------------------------------------------------------

        private static bool Rule10(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(
                    Rule10(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "FacilityNotice"), errorHandler));
            }

            return(
                Rule10(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "FacilityNotice"), errorHandler));
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------------

        private static bool Rule09(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(
                    Rule09(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "RequestSubstitution"), errorHandler)
                    & Rule09(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "RequestSubstitutionRetracted"), errorHandler));
            }

            return(
                Rule09(name, nodeIndex.GetElementsByName("requestSubstitution"), errorHandler)
                & Rule09(name, nodeIndex.GetElementsByName("requestSubstitutionRetracted"), errorHandler));
        }
        /// <summary>
        /// Validates all the elements registered at construction using the
        /// <see cref="NodeIndex"/> to locate them as quickly as possible.
        /// </summary>
        /// <param name="nodeIndex">The <see cref="NodeIndex"/> of the test document.</param>
        /// <param name="errorHandler">The <see cref="ValidationErrorHandler"/> used to report issues.</param>
        /// <returns><c>true</c> if the code values pass the checks, <c>false</c>
        /// otherwise.</returns>
        protected override bool Validate(NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                string ns = FpMLRuleSet.DetermineNamespace(nodeIndex);

                return(Validate(
                           nodeIndex.GetElementsByType(ns, contextType),
                           nodeIndex.GetElementsByType(ns, targetType), errorHandler));
            }

            return(Validate(
                       nodeIndex.GetElementsByName(contextElements),
                       nodeIndex.GetElementsByName(targetElements), errorHandler));
        }
        /// <summary>
        /// Evaluates this <see cref="Precondition"/> against the contents of the
        /// indicated <see cref="NodeIndex"/>.
        /// </summary>
        /// <param name="nodeIndex">The <see cref="NodeIndex"/> of a <see cref="XmlDocument"/></param>
        /// <param name="cache">A cache of previously evaluated precondition results.</param>
        /// <returns>A <see cref="bool"/> value indicating the applicability of this
        /// <see cref="Precondition"/> to the <see cref="XmlDocument"/>.</returns>
        public override bool Evaluate(NodeIndex nodeIndex, Dictionary <Precondition, bool> cache)
        {
            if (nodeIndex.HasTypeInformation)
            {
                string ns = FpMLRuleSet.DetermineNamespace(nodeIndex);

                foreach (string type in types)
                {
                    XmlNodeList list = nodeIndex.GetElementsByType(ns, type);

                    if ((list != null) && (list.Count > 0))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                foreach (String element in elements)
                {
                    XmlNodeList list = nodeIndex.GetElementsByName(element);

                    if ((list != null) && (list.Count > 0))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        // --------------------------------------------------------------------

        private static bool Rule38(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule38(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "MandatoryEarlyTermination"), errorHandler));
            }
            return(Rule38(name, nodeIndex.GetElementsByName("mandatoryEarlyTermination"), errorHandler));
        }
        // --------------------------------------------------------------------

        private static bool Rule05(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule05(name, nodeIndex, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "FirstPeriodStartDate"), errorHandler));
            }
            return(Rule05(name, nodeIndex, nodeIndex.GetElementsByName("firstPeriodStartDate"), errorHandler));
        }
Exemplo n.º 8
0
        // --------------------------------------------------------------------

        private static bool Rule01(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule01(name, nodeIndex, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "PricingDataPointCoordinate"), errorHandler));
            }

            return(Rule01(name, nodeIndex, nodeIndex.GetElementsByName("coordinate"), errorHandler));
        }
Exemplo n.º 9
0
        // --------------------------------------------------------------------

        private static bool Rule02(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule02(name, nodeIndex, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "PaymentCalculationPeriod"), errorHandler));
            }

            return(Rule02(name, nodeIndex, nodeIndex.GetElementsByName("paymentCalculationPeriod"), errorHandler));
        }
Exemplo n.º 10
0
		// --------------------------------------------------------------------

		private static bool Rule01 (string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
		{
			if (nodeIndex.HasTypeInformation) 
				return (
					  Rule01 (name, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "LoanContract"), errorHandler));					
				
			return (
				  Rule01 (name, nodeIndex.GetElementsByName ("loanContract"), errorHandler));
		}
Exemplo n.º 11
0
		// --------------------------------------------------------------------

		private static bool Rule05 (string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
		{
			if (nodeIndex.HasTypeInformation) 
				return (
					  Rule05 (name, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "InterestRatePeriod"), errorHandler));					
				
			return (
				  Rule05 (name, nodeIndex.GetElementsByName ("currentInterestRatePeriod"), errorHandler));
		}
Exemplo n.º 12
0
        //---------------------------------------------------------------------------

        private static bool Rule11(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule11(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "InterestCalculationDetails"), errorHandler));
            }

            return(Rule11(name, nodeIndex.GetElementsByName("interestCalculationDetails"), errorHandler));
        }
Exemplo n.º 13
0
        //---------------------------------------------------------------------------

        private static bool Rule08(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                return(Rule08(name, nodeIndex.GetElementsByType(DetermineNamespace(nodeIndex), "CollateralBalance"), errorHandler));
            }

            return(
                Rule08(name, nodeIndex.GetElementsByName("collateral"), errorHandler));
        }
Exemplo n.º 14
0
        //---------------------------------------------------------------------

        private static bool Rule01(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
        {
            if (nodeIndex.HasTypeInformation)
            {
                String ns = nodeIndex.Document.DocumentElement.NamespaceURI;
                return(Rule01(name, nodeIndex.GetElementsByType(ns, "BusinessDayAdjustments"), errorHandler));
            }

            return(
                Rule01(name, nodeIndex.GetElementsByName("dateAdjustments"), errorHandler)
                & Rule01(name, nodeIndex.GetElementsByName("calculationPeriodDatesAdjustments"), errorHandler)
                & Rule01(name, nodeIndex.GetElementsByName("paymentDatesAdjustments"), errorHandler)
                & Rule01(name, nodeIndex.GetElementsByName("resetDatesAdjustments"), errorHandler));
        }
Exemplo n.º 15
0
 /// <summary>
 /// Returns a <see cref="XmlNodeList"/> containing all the elements
 /// defined in the <see cref="NodeIndex"/> that match the context
 /// specification.
 /// </summary>
 /// <param name="nodeIndex">A <see cref="NodeIndex"/> for the test document.</param>
 /// <returns>A <see cref="XmlNodeList"/> containing all the matching
 /// <see cref="XmlElement"/> instances, if any.</returns>
 public XmlNodeList GetMatchingElements(NodeIndex nodeIndex)
 {
     return(nodeIndex.GetElementsByType(FpMLRuleSet.DetermineNamespace(nodeIndex), typeName));
 }