Esempio n. 1
0
        public List <BarrierEventObject> GetAllEvents(StudyValue StudyValue, int BarNumber)
        {
            List <BarrierEventObject> events = new List <BarrierEventObject>();

            foreach (BarrierHistory history in this.Histories.Values)
            {
                EventType[] eventTypes = (EventType[])Enum.GetValues(typeof(EventType));
                foreach (EventType eventType in eventTypes)
                {
                    if (eventType != EventType.NotSet)
                    {
                        Direction[] directions = (Direction[])Enum.GetValues(typeof(Direction));
                        foreach (Direction direction in directions)
                        {
                            EventPatternKey key = new EventPatternKey(eventType, direction);
                            if ((direction != Direction.NotSet) && (direction != Direction.Unknown))
                            {
                                BarrierEventObject evnt = GetEvent(key, history.Barrier, StudyValue, BarNumber);
                                if (evnt != null)
                                {
                                    events.Add(evnt);
                                }
                            }
                        }
                    }
                }
            }

            return(events);
        }
Esempio n. 2
0
        private Dictionary <IBarrierValue, Decimal> GetBarrierDistances(
            StudyValue StudyValue,
            int BarNumber,
            bool IsTrendTypeTest,
            TrendType TrendType,
            bool IsBoundaryTest,
            CongestionBoundary CongestionBoundary)
        {
            Dictionary <IBarrierValue, Decimal> distances = new Dictionary <IBarrierValue, Decimal>();

            foreach (IBarrierValue barrier in this.GetBarriers())
            {
                if ((!IsTrendTypeTest) || ((barrier is ITrendLine) && ((barrier as ITrendLine).TrendType == TrendType)))
                {
                    if ((!IsBoundaryTest) || (CongestionBoundary == barrier.CongestedBoundary))
                    {
                        // TODO: should not have to check this, but some double zero lines are coming through twice
                        if (!distances.ContainsKey(barrier))
                        {
                            distances.Add(barrier, barrier.GetValueAt(BarNumber) - StudyValue.Value);
                        }
                    }
                }
            }

            return(distances);
        }
Esempio n. 3
0
 public BarrierEventObject(EventType EventType, Direction Direction, IBarrierValue Barrier, StudyValue StudyValue, int BarNumber)
 {
     this.EventType  = EventType;
     this.Direction  = Direction;
     this.Barrier    = Barrier;
     this.StudyValue = StudyValue;
     this.BarNumber  = BarNumber;
 }
Esempio n. 4
0
 private BarrierEventObject GetEvent(
     EventPatternKey EventPatternKey,
     IBarrierValue Barrier,
     StudyValue StudyValue,
     int BarNumber)
 {
     if (this.Histories[Barrier.BarrierUniqueKey].IsEvent(EventPatternKey))
     {
         return(new BarrierEventObject(EventPatternKey.EventType, EventPatternKey.Direction, Barrier, StudyValue, BarNumber));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 5
0
        public virtual List <IBarrierValue> GetClosestBarrierBelow(
            StudyValue StudyValue,
            int BarNumber,
            bool IsTrendTypeTest,
            TrendType TrendType,
            bool IsBoundaryTest,
            CongestionBoundary CongestionBoundary)
        {
            List <IBarrierValue> barriers = new List <IBarrierValue>();

            foreach (IBarrierValue barrier in
                     GetBarrierDistances(StudyValue, BarNumber, IsTrendTypeTest, TrendType, IsBoundaryTest, CongestionBoundary).Where(t => t.Value < 0.0M).OrderBy(t => t.Value).Reverse().Select(t => t.Key))
            {
                barriers.Add(barrier);
            }

            return(barriers);
        }
Esempio n. 6
0
        public List <IBarrierValue> GetClosestBarrierBelow(
            StudyValue StudyValue,
            int BarNumber,
            bool IsTrendTypeTest,
            TrendType TrendType,
            bool IsBoundaryTest,
            CongestionBoundary CongestionBoundary,
            int MinimumTests)
        {
            List <IBarrierValue> barriers = new List <IBarrierValue>();

            foreach (IBarrierValue barrier in base.GetClosestBarrierBelow(StudyValue, BarNumber, IsTrendTypeTest, TrendType, IsBoundaryTest, CongestionBoundary))
            {
                if ((barrier as IAggregateLine).NumTests >= MinimumTests)
                {
                    barriers.Add(barrier);
                }
            }

            return(barriers);
        }