// Step 1: Locate our spinner control and save it to the class for convenience // You could get it every time, I'm just being lazy... :-) spinner = (Spinner)this.findViewById(R.id.Spinner01); // Step 2: Create and fill an ArrayAdapter with a bunch of "State" objects ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, new State[] { new State( 1, "Minnesota", "MN" ), new State( 99, "Wisconsin", "WI" ), new State( 53, "Utah", "UT" ), new State( 153, "Texas", "TX" ) }); // Step 3: Tell the spinner about our adapter spinner.setAdapter(spinnerArrayAdapter);
State one = new State("one"); State two = new State("two"); State three = new State("three"); Condition sunday = new Condition("Sunday"); Condition raining = new Condition("Raining"); Condition notSunday = new Condition("Not Sunday"); Condition notRaining = new Condition("Not Raining"); List<Transition> transitions = new ArrayList<Transition>(); transitions.add(one, new Set(sunday), three); transitions.add(one, new Set(sunday), two); // <<--- Invalid, cant go to two and three transitions.add(one, new Set(raining), three); transitions.add(one, new Set(sunday, raining), three); transitions.add(one, new Set(notSunday, notRaining), three); StateMachine machine = new StateMachine(one, transitions); System.out.print(machine.current); // "one" machine.apply(new Set(sunday, raining)); System.out.print(machine.current); // "three
/** * Initiates an OpenId Connection authorization code flow using the specified request identifier to maintain state. * * @param oidcRequestIdentifier request identifier * @return state */ public State createState(final String oidcRequestIdentifier) { if (!isOidcEnabled()) { throw new IllegalStateException(OPEN_ID_CONNECT_SUPPORT_IS_NOT_CONFIGURED); } final CacheKey oidcRequestIdentifierKey = new CacheKey(oidcRequestIdentifier); final State state = new State(generateStateValue()); try { synchronized (stateLookupForPendingRequests) { final State cachedState = stateLookupForPendingRequests.get(oidcRequestIdentifierKey, () -> state); if (!timeConstantEqualityCheck(state.getValue(), cachedState.getValue())) { throw new IllegalStateException("An existing login request is already in progress."); } } } catch (ExecutionException e) { throw new IllegalStateException("Unable to store the login request state."); } return state; }
public void addState() { try { State state=new State(); state.setStateName("Delhi"); stateDao.create(state); addCity(); addCustomer(); } catch(Exception e) { e.printStackTrace(); } }
public Test() { test1[1][1] = new State(); test1[1][1].position = 1; .... }
public class MessagePresenter { private void setMessage() { // logic here State state = new State(true, "Hello from the server"); view().setMessage(state); } }
private State USA = new State("United States of America"); private State CAN = new State("Canada"); private State MEX = new State("Mexico"); private ArrayList<State> stateArray = new ArrayList<State>; public static void main() { } public void addState(State state) //I need a way to add the Private objects called State into an array here. The command must take User Interface { stateArray.add(state); }
// Step 1: Locate our spinner control and save it to the class for convenience // You could get it every time, I'm just being lazy... :-) spinner = (Spinner)this.findViewById(R.id.Spinner01); // Step 2: Create and fill an ArrayAdapter with a bunch of "State" objects ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, new State[] { new State( 1, "Minnesota", "MN" ), new State( 99, "Wisconsin", "WI" ), new State( 53, "Utah", "UT" ), new State( 153, "Texas", "TX" ) }); // Step 3: Tell the spinner about our adapter spinner.setAdapter(spinnerArrayAdapter);
final List<Figure> figures = new ArrayList<Figure>(); figures.add(new State()); for (final Figure figure : figures) { figure.getDrawable().draw(); // prints "the rectangle" }
State[] state=new State[numberOfStates]; for(int i=0;i<numberOfStates;i++) { // need to actually create each object, not just print that you did it. state[i] = new State(/* any args needed */); System.out.println("state"+i+" Created."); }
final Fragment state = new State(); final FragmentManager fm = getSupportFragmentManager(); final FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.your_container_id, state); ft.commit();
ArrayList arrayListIdle = new ArrayList(); while(rs.next){ state = new State(); List<State> arrayState = new ArrayList<State>(); state.updateStateArray(arrayState);//This function mods the elements of (arrayState);//This state.setArrayStates(arrayState);//add a list of arrayState to the object state arrayListIdle.addAll(state); }
public class CustomPageParser extends HTMLPageParser { @Override protected void addUserDefinedRules(State html, PageBuilder page) { super.addUserDefinedRules(html, page); // Ensure that while in <textarea> tag, none of the other rules kick in. State textarea = new State(); html.addRule(new StateTransitionRule("textarea", textarea)); } }
public void addState() { State state=new State(); state.setStateName("Delhi"); stateDao.create(state); addCity(); addCustomer(); }
public Response saveStateRules(@Context HttpServletRequest request,StatePojo statePojo) { ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(statePojo); State state = new State(); state.setRulejson(json); }
State initialState = new State(); // empty board, no moves Stack<State> stack = new Stack<State>(); stack.add(initialState); while ( ! stack.isEmpty()) { State current = stack.pop(); for (State next : current.getSuccesorStates()) { if (next.isLegal()) { stack.add(next); } } }
public class StateTest { public static void main(String[] args) { State illinois = new State("Illinois"); illinois.addCity("Chicago"); illinois.addCity("Peoria"); illinois.addCity("Springfield"); System.out.println(illinois); } }
State philippines = new State("Philippines"); philippines.setCapital("Manila"); philippines.getPresidents().add(new President("Aguinaldo", 1)); philippines.getPresidents().add(new President("Marcos", 10)); philippines.getPresidents().add(new President("Quezon", 2)); Collections.sort(philippines.getPresidents(), new President()); for(President p: philippines.getPresidents()) System.out.print(p.getPresName());