public static EquationBase CreateEquation(EquationContainer equationParent, Position position)
        {
            CompositeBase equation = null;

            switch (position)
            {
            case Position.Bottom:
                equation = new CompositeBottom(equationParent);
                break;

            case Position.Top:
                equation = new CompositeTop(equationParent);
                break;

            case Position.BottomAndTop:
                equation = new CompositeBottomTop(equationParent);
                break;

            case Position.Sub:
                equation = new CompositeSub(equationParent);
                break;

            case Position.Super:
                equation = new CompositeSuper(equationParent);
                break;

            case Position.SubAndSuper:
                equation = new CompositeSubSuper(equationParent);
                break;
            }
            equation.ChangeMainEquationSize(1.3);
            return(equation);
        }
Example #2
0
        /// <summary>
        /// Compares the specified node.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        protected override int Compare(CompositeBase node)
        {
            var source  = node as Segment;
            var results = -1;

            if (source != null)
            {
                // if we have the same name
                results = base.Compare(source);
                if (results == 0)
                {
                    // and this contents equals source
                    foreach (CompositeLeaf n in GetEnumerator <CompositeLeaf>())
                    {
                        if ((results = n.Value.CompareTo(source.GetValue(n.Name))) != 0)
                        {
                            return(results);
                        }
                    }
                    //// and the source equals contents
                    //foreach(CompositeLeaf s in source.GetEnumerator<CompositeLeaf>())
                    //{
                    //    if ((results = s.Value.CompareTo(GetValue(s.Name))) != 0)
                    //        return results;
                    //}
                }
            }
            return(results);
        }
Example #3
0
        public void TestFactory()
        {
            CompositeBase comp = CompositeFactory.CreateInstance("Policy");

            Assert.IsNotNull(comp, "Expected Policy received null!");
            var policy = comp as Policy;

            Assert.IsNotNull(policy, "Could not cast instance to Policy!");
        }
Example #4
0
        /// <summary>
        /// Compares the specified node.  N.B. for our purposes
        /// the segments are equal if the upload key is equal.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        protected override int Compare(CompositeBase node)
        {
            if (string.IsNullOrEmpty(UploadKey))
            {
                return(base.Compare(node));
            }

            var source = node as AhsSegment;

            return(source != null?UploadKey.CompareTo(source.UploadKey) : 1);
        }
Example #5
0
        public void TestGetXmlWithParentElements()
        {
            Console.WriteLine("{0}", _base);
            Assert.AreEqual(_base.Value, "");

            var myBase = _base["CLAIM"] as Composite;

            Assert.IsNotNull(myBase, "NULL returned!");
            Console.WriteLine(myBase.GetXmlWithParentElements());

            myBase = _base["CLAIM:INSURED"] as Composite;
            Assert.IsNotNull(myBase, "NULL returned!");
            Console.WriteLine(myBase.GetXmlWithParentElements());

            myBase = _base["CLAIM:INSURED:VEHICLE"] as Composite;
            Assert.IsNotNull(myBase, "NULL returned!");
            Console.WriteLine(myBase.GetXmlWithParentElements());

            CompositeBase myNode = _base["CLAIM:INSURED:VEHICLE:VIN"];

            Assert.IsNotNull(myNode, "NULL returned!");

            Console.WriteLine(myNode.GetXmlWithParentElements());
        }
Example #6
0
 /// <summary>
 /// tests the Element method determines inclusion in the results set.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <returns></returns>
 protected override bool ElementTest(CompositeBase element)
 {
     return(!element.Dirty);
 }