예제 #1
0
 public BarrierHistory this[IBarrierValue Barrier]
 {
     get
     {
         return(this.Histories[Barrier.BarrierUniqueKey]);
     }
 }
예제 #2
0
 private BarrierHistory(IBarrierValue Barrier, string PositionStates, string RangeStates, Dictionary <EventType, int> LastMatchedLengths)
 {
     this.Barrier            = Barrier;
     this.PositionStates     = PositionStates;
     this.RangeStates        = RangeStates;
     this.LastMatchedLengths = LastMatchedLengths;
 }
예제 #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;
 }
예제 #4
0
        public void UpdateState(IBarrierValue Barrier, BarrierHistory.Position Position, BarrierHistory.Range Range)
        {
            if (!this.Histories.ContainsKey(Barrier.BarrierUniqueKey))
            {
                this.Histories.Add(Barrier.BarrierUniqueKey, new BarrierHistory(Barrier));
            }

            this.Histories[Barrier.BarrierUniqueKey].UpdateState(Barrier, Position, Range);
        }
예제 #5
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);
     }
 }
예제 #6
0
        public BarrierHistory(IBarrierValue Barrier)
        {
            this.Barrier        = Barrier;
            this.PositionStates = String.Empty;
            this.RangeStates    = String.Empty;

            this.LastMatchedLengths = new Dictionary <EventType, int>();
            EventType[] eventTypes = (EventType[])Enum.GetValues(typeof(EventType));
            foreach (EventType type in eventTypes)
            {
                if (type != EventType.NotSet)
                {
                    this.LastMatchedLengths.Add(type, 0);
                }
            }
        }
예제 #7
0
        public void UpdateState(IBarrierValue Barrier, Position Position, Range Range)
        {
            if (this.Barrier.BarrierUniqueKey != Barrier.BarrierUniqueKey)
            {
                throw new ApplicationException("Wrong barrier.");
            }

            this.Barrier = Barrier;

            char position = AllPositionStates.SingleOrDefault(s => s.Key == Position).Value;
            char range    = AllRangeStates.SingleOrDefault(s => s.Key == Range).Value;

            if ((String.IsNullOrEmpty(this.PositionStates)) || (!this.PositionStates.EndsWith(Convert.ToString(position))))
            {
                this.PositionStates = String.Concat(this.PositionStates, position);
            }

            if ((String.IsNullOrEmpty(this.RangeStates)) || (!this.RangeStates.EndsWith(Convert.ToString(range))))
            {
                this.RangeStates = String.Concat(this.RangeStates, range);
            }
        }