A state-based approach to context modeling and computing