Esempio n. 1
0
 public void Update(List <TireData> target, TireDataMaxmin maxmin, List <int> indexHolder, int NumSearch = 0)
 {
     Target            = target;
     Maxmin            = maxmin;
     IndexHolderParent = indexHolder;
     ExtractData(NumSearch);
 }
Esempio n. 2
0
        public static TireDataMaxmin GetLimitData(List <TireData> list)
        {
            var maxmin = new TireDataMaxmin();

            maxmin.count = list.Count;
            foreach (var data in list)
            {
                for (int i = 0; i < TireData.Count(); ++i)
                {
                    if (maxmin.Max[(TireDataColumn)i] < data[(TireDataColumn)i])
                    {
                        maxmin.Max[(TireDataColumn)i] = data[(TireDataColumn)i];
                    }
                    if (maxmin.Min[(TireDataColumn)i] > data[(TireDataColumn)i])
                    {
                        maxmin.Min[(TireDataColumn)i] = data[(TireDataColumn)i];
                    }
                    maxmin.Mean[(TireDataColumn)i] += data[(TireDataColumn)i];
                }
            }
            for (int i = 0; i < TireData.Count(); ++i)
            {
                maxmin.Mean[(TireDataColumn)i] /= list.Count();
            }
            return(maxmin);
        }
Esempio n. 3
0
        public void Reset(List <TireData> target, TireDataMaxmin maxmin)
        {
            Target = target;
            Maxmin = maxmin;

            foreach (var kv in Constrains)
            {
                kv.Value.Clear();
            }
            State = TireDataSelectorState.Changed;
        }
Esempio n. 4
0
        static public TireDataSelector Load(Stream reader, List <TireData> target, TireDataMaxmin maxmin)
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            var             data            = binaryFormatter.Deserialize(reader) as TireDataSelector;

            if (data != null)
            {
                data.NotExtractedData = new List <TireData>();
                data.Maxmin           = maxmin;
                data.Target           = target;
                //data.Update(target, maxmin);
                data.State = TireDataSelectorState.NotChanged;
            }
            return(data);
        }
Esempio n. 5
0
        public static TireDataMaxmin TireDataMaxminMerge(TireDataMaxmin lh, TireDataMaxmin rh)
        {
            var value = new TireDataMaxmin();

            foreach (TireDataColumn column in Enum.GetValues(typeof(TireDataColumn)))
            {
                if (column == TireDataColumn.NT)
                {
                    continue;
                }
                value.Max[column]  = Math.Max(lh.Max[column], rh.Max[column]);
                value.Min[column]  = Math.Min(lh.Min[column], rh.Min[column]);
                value.Mean[column] = (lh.Min[column] * lh.count + rh.Min[column] * rh.count) / (lh.count + rh.count);
            }
            return(value);
        }
Esempio n. 6
0
        public override void ExtractData(int NumSearch)
        {
            var maxmin = new TireDataMaxmin();

            ExtractedData.Clear();
            NotExtractedData.Clear();
            IndexHolder.Clear();
            IndexHolder.Add(0);
            for (int i = 0; i < IndexHolderParent.Count - 1; ++i)
            {
                if (NumSearch > 0 && i >= NumSearch)
                {
                    break;
                }
                var  list = SplitedTransientTable(i);
                bool add  = true;
                foreach (var data in list)
                {
                    foreach (TireDataColumn column in Enum.GetValues(typeof(TireDataColumn)))
                    {
                        if (column == TireDataColumn.NT)
                        {
                            continue;
                        }
                        bool remove = false;
                        foreach (var constrain in Constrains[column])
                        {
                            if (!constrain.Not)
                            {
                                continue;
                            }
                            if (!constrain.Evaluate(data))
                            {
                                remove = true;
                                break;
                            }
                        }
                        if (remove == true)
                        {
                            add = false;
                            break;
                        }
                        if (!remove)
                        {
                            remove = true;
                            int counttemp = 0;

                            if (column == TireDataColumn.NT)
                            {
                                continue;
                            }
                            foreach (var constrain in Constrains[column])
                            {
                                if (constrain.Not)
                                {
                                    continue;
                                }
                                ++counttemp;
                                if (constrain.Evaluate(data))
                                {
                                    remove = false;
                                    break;
                                }
                                else
                                {
                                }
                            }

                            if (counttemp == 0)
                            {
                                remove = false;
                            }
                        }
                        add = add && !remove;
                    }
                }


                if (add)
                {
                    ExtractedData.AddRange(list);
                    IndexHolder.Add(ExtractedData.Count);
                }
                else
                {
                    NotExtractedData.AddRange(list);
                }
            }


            State = TireDataSelectorState.Changed;
            ExtractedDataMaxmin = StaticFunctions.GetLimitData(ExtractedData);
        }
Esempio n. 7
0
 public void Reset(List <TireData> target, TireDataMaxmin maxmin, List <int> indexHolder)
 {
     base.Reset(target, maxmin);
     IndexHolderParent = indexHolder;
 }
Esempio n. 8
0
        virtual public void ExtractData(int NumSearch)
        {
            var maxmin = new TireDataMaxmin();

            ExtractedData.Clear();
            NotExtractedData.Clear();

            int i = 0;

            foreach (var data in Target)
            {
                /*
                 * bool add = true;
                 * foreach (TireDataColumn column in Enum.GetValues(typeof(TireDataColumn)))
                 * {
                 *  if (column == TireDataColumn.NT) continue;
                 *
                 *
                 *
                 *  bool add_EvalNot = true;
                 *  bool add_EvalOrd = false;
                 *  if (Constrains[column].Count != 0)
                 *  {
                 *      foreach (var constrain in Constrains[column])
                 *      {
                 *          if(!constrain.Not)
                 *          {
                 *              add_EvalOrd = add_EvalOrd || constrain.Evaluate(data);
                 *          }
                 *          else
                 *          {
                 *              add_EvalNot = constrain.Evaluate(data);
                 *          }
                 *          if (!add_EvalNot) break;
                 *      }
                 *  }
                 *  else
                 *  {
                 *      add_EvalNot = true;
                 *      add_EvalOrd = true;
                 *  }
                 *  add = add && (add_EvalNot && add_EvalOrd);
                 *  if (!add) break;
                 * }
                 *
                 *
                 *
                 *
                 * if (add)
                 * {
                 *  ExtractedData.Add(data);
                 * }
                 * else
                 * {
                 *  NotExtractedData.Add(data);
                 * }
                 */
                if (NumSearch > 0 && i >= NumSearch)
                {
                    break;
                }
                ++i;
                bool add = true;
                foreach (TireDataColumn column in Enum.GetValues(typeof(TireDataColumn)))
                {
                    if (column == TireDataColumn.NT)
                    {
                        continue;
                    }
                    bool remove = false;
                    foreach (var constrain in Constrains[column])
                    {
                        if (!constrain.Not)
                        {
                            continue;
                        }
                        if (!constrain.Evaluate(data))
                        {
                            remove = true;
                            break;
                        }
                    }
                    if (remove == true)
                    {
                        add = false;
                        break;
                    }
                    if (!remove)
                    {
                        remove = true;
                        int counttemp = 0;

                        if (column == TireDataColumn.NT)
                        {
                            continue;
                        }
                        foreach (var constrain in Constrains[column])
                        {
                            if (constrain.Not)
                            {
                                continue;
                            }
                            ++counttemp;
                            if (constrain.Evaluate(data))
                            {
                                remove = false;
                                break;
                            }
                        }

                        if (counttemp == 0)
                        {
                            remove = false;
                        }
                    }
                    add = add && !remove;
                }


                if (add)
                {
                    ExtractedData.Add(data);
                }
                else
                {
                    NotExtractedData.Add(data);
                }
            }
            State = TireDataSelectorState.Changed;
            ExtractedDataMaxmin = StaticFunctions.GetLimitData(ExtractedData);
        }
Esempio n. 9
0
 public void Update(List <TireData> target, TireDataMaxmin maxmin, int NumSearch = 0)
 {
     Target = target;
     Maxmin = maxmin;
     ExtractData(NumSearch);
 }