add a demo of state pattern.