Example #1
0
        public Qualifier GetQualifier()
        {
            Qualifier qualifier = new Qualifier();

            qualifier.guid       = guid;
            qualifier.type       = qualiType;
            qualifier.threshold  = threshold;
            qualifier.actionName = actionName;
            return(qualifier);
        }
Example #2
0
 public void AddQualifier(Qualifier qualifier)
 {
     qualifiers.Add(qualifier);
 }
Example #3
0
 public void RemoveQualifier(Qualifier qualifier)
 {
     qualifiers.Remove(qualifier);
 }
Example #4
0
        public void Init(Context context)
        {
            /*System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
             * sw.Start();*/
            context.Init(graphData.context);
            if (_initialized)
            {
                return;
            }
            _initialized = true;


            selector = graphData.selectorData.GetSelector();

            Dictionary <string, Scorer> guidScorers = new Dictionary <string, Scorer>();

            for (int i = 0; i < graphData.scorers.Count; i++)
            {
                guidScorers.Add(graphData.scorers[i].guid, graphData.scorers[i].GetScorer());
            }
            Dictionary <string, QualiScorer> guidQualiScorers = new Dictionary <string, QualiScorer>();

            for (int i = 0; i < graphData.qualiScorers.Count; i++)
            {
                guidQualiScorers.Add(graphData.qualiScorers[i].guid, graphData.qualiScorers[i].GetQualiScorer());
            }
            Dictionary <string, Qualifier> guidQualifiers = new Dictionary <string, Qualifier>();

            for (int i = 0; i < graphData.qualifiers.Count; i++)
            {
                guidQualifiers.Add(graphData.qualifiers[i].guid, graphData.qualifiers[i].GetQualifier());
            }
            //Assign to qualifiers and to selector
            foreach (QualifierData qd in graphData.qualifiers)
            {
                Qualifier q = guidQualifiers[qd.guid];
                selector.AddQualifier(q);
                foreach (NodeWeightedLink nwl in qd.inLinks)
                {
                    if (guidScorers.ContainsKey(nwl.otherNodeID))
                    {
                        q.AddScorer(guidScorers[nwl.otherNodeID], nwl.weight);
                    }
                    else if (guidQualiScorers.ContainsKey(nwl.otherNodeID))
                    {
                        q.AddScorer(guidQualiScorers[nwl.otherNodeID], nwl.weight);
                    }
                }
            }
            foreach (QualiScorerData qsd in graphData.qualiScorers)
            {
                QualiScorer qs = guidQualiScorers[qsd.guid];
                foreach (NodeWeightedLink nwl in qsd.inLinks)
                {
                    if (guidScorers.ContainsKey(nwl.otherNodeID))
                    {
                        qs.AddScorer(guidScorers[nwl.otherNodeID], nwl.weight);
                    }
                    else if (guidQualiScorers.ContainsKey(nwl.otherNodeID))
                    {
                        qs.AddScorer(guidQualiScorers[nwl.otherNodeID], nwl.weight);
                    }
                }
            }

            /*sw.Stop();
             * Debug.Log($"DecisionInit {sw.ElapsedMilliseconds}ms");*/
        }