/* (non-Javadoc) * Get to the next state, depending on the mode. * @see com.eric.state.StateInterface#getForward(com.eric.demo.Demo, java.lang.String) * */ public boolean getForward(Demo demo, String mode) { if (mode.equals("name")) { StateInterface searchByNameState = new SearchByNameState(this.manager); demo.setState(searchByNameState); } else if (mode.equals("mobile")) { StateInterface searchByMobileState = new SearchByMobileState(this.manager); demo.setState(searchByMobileState); } else if (mode.equals("address")) { StateInterface searchByAddressState = new SearchByAddressState(this.manager); demo.setState(searchByAddressState); } else { System.out.println("you can search by `name`, `mobile` or `address`."); System.out.println("regular expression can be used to query."); } return true; }
/* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run() { Demo demo = new Demo(); demo.execute(); }