public ScenarioState finishState(ScenarioState next) { SwipeState swipeState = new SwipeState(this); // make sure these are the same type if (next.GetType().Equals(this.GetType())) { // make sure this is not state if (!this.isSameState(next)) { SwipeState nextState = (SwipeState)next; // make gualState's start be the earlier of the two if (nextState._start.CompareTo(swipeState._start) < 0) { swipeState._start = nextState._start; } // make gualState's start be the later of the two if (nextState._end.CompareTo(swipeState._end) > 0) { swipeState._end = nextState._end; } if (this.Pos.Equals(SwipePosition.START) && nextState.Pos.Equals(SwipePosition.MOVING)) { // if going from start state to moving state // make the capped start state have the same location as moving state swipeState._loc = nextState._loc; } } } return swipeState; }
public ScenarioState finishState(ScenarioState next) { ResumeState gualState = new ResumeState(this); // make sure this is same state if (!this.isSameState(next)) { if (next.GetType().Equals(this.GetType())) { ResumeState nextState = (ResumeState)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; }
public Boolean isSameState(ScenarioState ss) { if (!ss.GetType().Equals(this.GetType())) { return false; } else { return this.Pos == ((ResumeState)ss).Pos; } }
public Boolean isSameState(ScenarioState ss) { if (ss == null) { return false; } if (!ss.GetType().Equals(this.GetType())) { return false; } else { return this.Pos == ((PresenceState)ss).Pos; } }
/// <summary> /// when swipes get merged, their start and end times get merged /// the most recent position becomes the poisiton /// </summary> /// <param name="next"></param> /// <returns></returns> public ScenarioState mergeEqualStates(ScenarioState next) { SwipeState swipeState = new SwipeState(this); // make sure this is same state if (this.isSameState(next)) { if (next.GetType().Equals(this.GetType())) { SwipeState nextState = (SwipeState)next; // make gualState's start be the earlier of the two if (nextState._start.CompareTo(swipeState._start) < 0) { swipeState._start = nextState._start; } // make gualState's end be the later of the two // and make its loc the one of the later state if (nextState._end.CompareTo(swipeState._end) > 0) { swipeState._end = nextState._end; if (nextState.Pos.Equals(SwipePosition.MOVING)) { // only merge state location if merging two moving states swipeState._loc = nextState.Loc; } } } } return swipeState; }
public ScenarioState mergeEqualStates(ScenarioState next) { TalkOnPhoneState curState = new TalkOnPhoneState(this); if (this.isSameState(next)) { if (next.GetType().Equals(this.GetType())) { TalkOnPhoneState nextState = (TalkOnPhoneState)next; // make gualState's start be the earlier of the two if (nextState._start.CompareTo(curState._start) < 0) { curState._start = nextState._start; } // make gualState's start be the later of the two if (nextState._end.CompareTo(curState._end) > 0) { curState._end = nextState._end; } } } return curState; }
public Boolean isSameState(ScenarioState ss) { if (!ss.GetType().Equals(this.GetType())) { return false; } else { return this.State == ((TalkOnPhoneState)ss).State; } }