Ejemplo n.º 1
0
 public GUInputEngine(Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > _guLosses, GraphOfNodes _graph)
 {
     GULosses = _guLosses;
     graph    = _graph;
     //Get Contract Year
     ContractYear = graph.Declarations.Inception.Year;
 }
Ejemplo n.º 2
0
        public override bool GetTermsForGraph(GraphOfNodes graph, out String error)
        {
            Dictionary <string, object> jsonParseResult = ExpData.ContractJSON;

            error = "";
            bool success;

            success = GetContractComponentForGraph(graph, jsonParseResult, "Deductibles", out error);
            if (!success)
            {
                return(false);
            }
            success = GetContractComponentForGraph(graph, jsonParseResult, "Sublimits", out error);
            if (!success)
            {
                return(false);
            }
            success = GetContractComponentForGraph(graph, jsonParseResult, "Covers", out error);
            if (!success)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void UpdateGraphWithDed(Dictionary <string, object> termDictionary, GraphOfNodes graph)
        {
            bool    nodefound = false;
            int     count     = 0;
            Subject cdlSub    = GetSubjectForTerm(termDictionary);

            foreach (GraphNode node in graph.GraphNodes)
            {
                count++;
                if (node is TermNode)
                {
                    TermNode termNode = node as TermNode;

                    if (termNode.Subject.Equals(cdlSub))
                    {
                        nodefound = true;
                        Deductible ded = TermParser.GetDedForTerm(termDictionary, graph.Declarations);
                        termNode.Deductibles.Add(ded);
                        break;
                    }
                }
            }
            if (!nodefound)
            {
                throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON term with subject: (" + cdlSub.ToString() + ")");
            }
        }
Ejemplo n.º 4
0
        protected bool GetContractComponentForGraph(GraphOfNodes graph, Dictionary <string, object> jsonParseResult, string ComponentName, out string message)
        {
            message = "";
            object Component;

            jsonParseResult.TryGetValue(ComponentName, out Component);
            object[]            list = Component as object[];
            UpdateGraphDelegate UpdateGraphForComponent;

            switch (ComponentName)
            {
            case "Deductibles":
                UpdateGraphForComponent = new UpdateGraphDelegate(UpdateGraphWithDed);
                break;

            case "Sublimits":
                UpdateGraphForComponent = new UpdateGraphDelegate(UpdateGraphWithLim);
                break;

            case "Covers":
                UpdateGraphForComponent = new UpdateGraphDelegate(UpdateGraphWithCover);
                break;

            default:
                message = "Cannot handle financial term updates from Contract Component " + ComponentName + " at this time.";
                return(false);
            }

            foreach (object Obj in list)
            {
                Dictionary <string, object> Dict = Obj as Dictionary <string, object>;
                try
                {
                    UpdateGraphForComponent(Dict, graph);
                }
                catch (InvalidOperationException e)
                {
                    message = "Error getting terms for Contract Component " + ComponentName + ": " + e.Message;
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
        private void GetTermsForGraph(ExposureDataAdaptor expData, GraphOfNodes graph)
        {
            string message;
            DeclarationExtractor declarationExtractor = new DeclarationExtractor(expData);

            declarationExtractor.GetDeclarations(graph.Declarations, out message);
            FinancialTermExtractor fintermExtractor;

            if (graph.Declarations.ContractType == "Primary Policy")
            {
                fintermExtractor = new PrimaryTermExtractor(expData, graph.Declarations);
            }
            else if (graph.Declarations.ContractType == "Catastrophe Treaty")
            {
                fintermExtractor = new TreatyTermExtractor(expData, graph.Declarations, graphCache);
            }
            else
            {
                throw new NotSupportedException();
            }

            fintermExtractor.GetTermsForGraph(graph, out message);
        }
Ejemplo n.º 6
0
 public abstract bool GetTermsForGraph(GraphOfNodes graph, out String error);
Ejemplo n.º 7
0
        private void UpdateGraphWithCover(Dictionary <string, object> coverDictionary, GraphOfNodes graph)
        {
            bool    nodefound = false;
            Type    type      = typeof(DedInteractionType);
            Subject sub       = GetSubjectForCover(coverDictionary);

            foreach (GraphNode node in graph.GraphNodes)
            {
                if (node is CoverNode)
                {
                    CoverNode coverNode = node as CoverNode;
                    Cover     cover     = TermParser.GetCoverForTerm(coverDictionary);
                    if (coverNode.Subject.Equals(sub) &&
                        coverNode.CoverName.Trim() == cover.CoverName.Trim())
                    {
                        nodefound       = true;
                        coverNode.Cover = cover;
                        break;
                    }
                }
            }
            if (!nodefound)
            {
                throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON cover with subject: (" + sub.ToString() + ")");
            }
        }
Ejemplo n.º 8
0
 public GraphAllocation(GraphOfNodes _graph)
 {
     graph = _graph;
 }