001package state.three; 002 003interface I { 004 public int f(); 005 public int g(); 006 public void changeDirection(); 007} 008 009class C implements I { 010 private CState state = CState.MINUS; 011 int i; 012 int j; 013 public int f() { 014 return state.f(this); 015 } 016 public int g() { 017 return state.g(this); 018 } 019 public void changeDirection() { 020 state = (state==CState.MINUS) ? CState.PLUS : CState.MINUS; 021 } 022} 023