Пример #1
0
        public void processSkeleton(Skeleton skeleton)
        {
            Boolean isAbsent = this._absentIndicator.isPositionDetected(skeleton);
            if (isAbsent)
            {
                PresenceState state = new PresenceState(PresenceState.GetsUpAndLeavesPosition.ABSENT, DateTime.Now, DateTime.Now);
                this._history.addState(state);
            }
            else
            {
                Boolean isStanding = this._standingDetector.isPositionDetected(skeleton);
                Boolean isSitting = this._sittingDetector.isPositionDetected(skeleton);
                if (isStanding)
                {
                    PresenceState state = new PresenceState(PresenceState.GetsUpAndLeavesPosition.STAND, DateTime.Now, DateTime.Now);
                    this._history.addState(state);
                }
                else if (isSitting)
                {
                    PresenceState state = new PresenceState(PresenceState.GetsUpAndLeavesPosition.SIT, DateTime.Now, DateTime.Now);
                    this._history.addState(state);
                }

            }
        }
Пример #2
0
        public ScenarioState finishState(ScenarioState next)
        {
            PresenceState gualState = new PresenceState(this);
            // make sure this is same state
            if (!this.isSameState(next))
            {
                if (next.GetType().Equals(this.GetType()))
                {
                    PresenceState nextState = (PresenceState)next;

                    // make gualState's start be the earlier of the two
                    if (nextState._start.CompareTo(gualState._start) < 0)
                    {
                        gualState._start = nextState._start;
                    }
                    // make gualState's start be the later of the two
                    if (nextState._end.CompareTo(gualState._end) > 0)
                    {
                        gualState._end = nextState._end;
                    }
                }
            }
            return gualState;
        }
Пример #3
0
 public PresenceState(PresenceState gualState)
 {
     this._start = gualState._start;
     this._end = gualState._end;
     this._pos = gualState._pos;
 }