예제 #1
0
        /*---------------------------------------------------------------------------------------------------*/
        public void toFilter()
        {
            int nDigit = Convert.ToInt32(Math.Floor(DIGIT + 0.6));

            for (int i = 0; i < prevStatus.Count; i++)
            {
                CONTINUOUSID ctID = continousIDs.Find(x => x.obj.ID.Equals(prevStatus[i].ID));
                if (ctID == null)
                {
                    continue;
                }

                CAN_OBJ prevObj = prevStatus[i];
                CAN_OBJ nextObj = nextStatus.Find(x => x.ID.Equals(prevObj.ID));
                if (nextObj == null)
                {
                    continue;
                }

                int d;
                for (d = 0; d <= prevObj.DataLen - nDigit; d++)
                {
                    int idIndexIndex = ctID.indexs.FindIndex(x => x.Equals(d));
                    if (idIndexIndex == -1)
                    {
                        continue;
                    }

                    Int64 prev = 0, next = 0;
                    prev = jointValue(prevObj, d, nDigit, ENDIAN);
                    next = jointValue(nextObj, d, nDigit, ENDIAN);

                    if (DIGIT == 1.5)
                    {
                        prev = prev & 0x0FFF;
                        next = next & 0x0FFF;
                    }

                    //不正确
                    if ((next - prev) * TREND <= 0)
                    {
                        ctID.indexs.RemoveAt(idIndexIndex);
                    }
                }

                //删除后续的索引!
                for (; d < prevObj.DataLen; d++)
                {
                    int idIndexIndex = ctID.indexs.FindIndex(x => x.Equals(d));
                    if (idIndexIndex == -1)
                    {
                        continue;
                    }
                    ctID.indexs.RemoveAt(idIndexIndex);
                }
            }

            //删除多余ID
            removeIndexListNone();
        }
예제 #2
0
 /*---------------------------------------------------------------------------------------------------*/
 public void countingIDs()
 {
     continousIDs.Clear();
     for (int i = 0; i < prevStatus.Count; i++)
     {
         CONTINUOUSID ctID = continousIDs.Find(x => x.obj.ID.Equals(prevStatus[i].ID));
         if (ctID == null)
         {
             continousIDs.Add(new CONTINUOUSID(prevStatus[i]));
         }
     }
 }