001package state.three; 002 003interface CState { 004 public int f(C x); 005 public int g(C x); 006 007 public static final CState MINUS = new CStateMinus(); 008 public static final CState PLUS = new CStatePlus(); 009} 010 011class CStateMinus implements CState { 012 public int f(C x) { 013 x.i -= 32; 014 return x.i; 015 } 016 public int g(C x) { 017 x.j -= 27; 018 return x.j; 019 } 020} 021class CStatePlus implements CState { 022 public int f(C x) { 023 x.i += 26; 024 return x.i; 025 } 026 public int g(C x) { 027 x.j += 42; 028 return x.j; 029 } 030} 031