Ejemplo n.º 1
0
        private ITerm <Value> ConstructSublimit(Dictionary <string, object> KeyValueData, bool IsItNetOfDeductible = false)
        {
            ITerm <Value> Term = (ITerm <Value>)ConstructTerm(KeyValueData);

            return((ITerm <Value>)Activator.CreateInstance(
                       GetType("Sublimit<" + Term.GetType().GetGenericArguments()[0] + ">"),
                       Term.GetExpression(), Term.GetSubject(),
                       Term.GetTimeBasis(), IsItNetOfDeductible, Term.GetLabel()));
        }
Ejemplo n.º 2
0
        private ITerm <Value> ConstructDeductible(Dictionary <string, object> KeyValueData, bool IsItAbsorbable = false)
        {
            ITerm <Value> Term = (ITerm <Value>)ConstructTerm(KeyValueData);

            bool IsFranchise = false;

            if (KeyValueData.ContainsKey("IsFranchise"))
            {
                IsFranchise = bool.Parse((string)KeyValueData["IsFranchise"]);
            }

            Interaction _Interaction
                = (Interaction)Enum.Parse(typeof(Interaction), (string)KeyValueData["Interaction"]);

            return((ITerm <Value>)Activator.CreateInstance(
                       GetType("Deductible<" + Term.GetType().GetGenericArguments()[0] + ">"),
                       Term.GetExpression(), Term.GetSubject(),
                       _Interaction, IsFranchise,
                       Term.GetTimeBasis(), Term.GetLabel(), IsItAbsorbable));
        }
Ejemplo n.º 3
0
        public bool Add(ITerm <Value> Term, Dictionary <long, RiskItemCharacteristicIDAttributes> CoverageIdAttrMap,
                        Dictionary <string, HashSet <long> > ResolvedSchedule, bool CheckForPerRisk = true)
        {
            Subject NodeIdentity = Term.GetSubject();

            bool IsAddSuccessful = true;

            if (NodeIdentity == null)
            {
                NodeIdentity = EMPTYSUBJECTCONSTRAINT;
            }

            TermCollection TermCollection = (IdentityMap.ContainsKey(NodeIdentity) ?
                                             IdentityMap[NodeIdentity].GetContent() : new TermCollection(NodeIdentity));

            // Switching off the following check intentionally, in order to allow redundant terms
            //if (TermCollection.Contains(Term))
            //    throw new ArgumentException("A term node with the same identity (i.e. subject) already contains this term in its collection!");

            IsAddSuccessful = TermCollection.Add(Term);

            if (IsAddSuccessful && !IdentityMap.ContainsKey(NodeIdentity))
            {
                TermNode _TermNode = new TermNode(TermCollection);

                IsAddSuccessful &= base.Add(_TermNode);

                if (IsAddSuccessful)
                {
                    IdentityMap.Add(NodeIdentity, _TermNode);
                    // A newly added term node (i.e. with no parent or child links) is both a root and a leaf, trivially.
                    IsAddSuccessful &= RootNodes.Add(_TermNode);
                    ExecutionState.RegisterModificationInGraphTopology();
                }
            }

            return(IsAddSuccessful);
        }