public ScenarioState finishState(ScenarioState next) { TalkOnPhoneState curState = new TalkOnPhoneState(this); // make sure this is same state 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 TalkOnPhoneState(TalkOnPhoneState phoneState) { this._start = phoneState._start; this._end = phoneState._end; this._state = phoneState._state; }