Beispiel #1
0
        public static List <ValueMark> GetValidValues(AgentType agentType, string agentFullname, int frame)
        {
            Debug.Check(!string.IsNullOrEmpty(agentFullname) && frame > -1);

            List <ValueMark> valueSet = new List <ValueMark>();

            if (_agentDatabase.ContainsKey(agentFullname))
            {
                AgentData agentData = _agentDatabase[agentFullname];

                // Properties
                if (agentType != null)
                {
                    //foreach (PropertyDef p in agentType.GetProperties())
                    //{
                    //    ValueMark value = agentData.GetValidValue(p.BasicName, frame);

                    //    if (value != null)
                    //        valueSet.Add(value);
                    //}

                    foreach (string valueName in agentData.ValueSet.Keys)
                    {
                        ValueMark value = agentData.GetValidValue(valueName, frame);

                        if (value != null)
                        {
                            valueSet.Add(value);
                        }
                    }
                }
            }

            return(valueSet);
        }
Beispiel #2
0
        public static List <ValueMark> GetValidValues(Nodes.Node node, AgentType agentType, string agentFullname, int frame)
        {
            Debug.Check(!string.IsNullOrEmpty(agentFullname) && frame > -1);

            List <ValueMark> valueSet = new List <ValueMark>();

            if (_agentDatabase.ContainsKey(agentFullname))
            {
                AgentData agentData = _agentDatabase[agentFullname];

                // Properties
                if (agentType != null)
                {
                    foreach (PropertyDef p in agentType.GetProperties())
                    {
                        ValueMark value = agentData.GetValidValue(p.Name, frame);
                        if (value != null)
                        {
                            valueSet.Add(value);
                        }
                    }
                }

                // Par
                if (node != null)
                {
                    foreach (ParInfo par in node.Pars)
                    {
                        ValueMark value = agentData.GetValidValue(par.Name, frame);
                        if (value != null)
                        {
                            valueSet.Add(value);
                        }
                    }
                }
            }

            return(valueSet);
        }
Beispiel #3
0
            public void AddValue(string valueName, int frame, string value)
            {
                Debug.Check(!string.IsNullOrEmpty(valueName) && frame > -1 && value != null);

                if (!_valueSet.ContainsKey(valueName))
                {
                    _valueSet[valueName] = new List <ValueMark>();
                }

                List <ValueMark> values = _valueSet[valueName];

                ValueMark valueMark = new ValueMark();

                valueMark.Frame = frame;
                valueMark.Name  = valueName;
                valueMark.Value = value;

                if (values.Count == 0 || values[values.Count - 1].Frame < frame)
                {
                    values.Add(valueMark);
                }
                else
                {
                    int index = values.BinarySearch(valueMark, _valueComparer);

                    if (index >= 0)
                    {
                        valueMark = values[index];
                        Debug.Check(valueMark.Frame == frame && valueMark.Name == valueName);
                        valueMark.Value = value;
                    }
                    else
                    {
                        index = -index - 1;
                        values.Insert(index, valueMark);
                    }
                }
            }