Package org.apache.commons.scxml.model

Examples of org.apache.commons.scxml.model.State


       //we have to use getTargets() here since the initialState can be
       //an indirect descendant
       // Concern marked by one of the code reviewers: better type check,
       //            now ClassCastException happens for Parallel
       // Response: initial should be a State, for Parallel, it is implicit
       State initialState = (State) scxml.getTargets().get(initialstate);
       if (initialState == null) {
           // Where do we, where do we go?
           logAndThrowModelError(ERR_SCXML_NO_INIT, new Object[] {
               initialstate });
       }
View Full Code Here


                    logAndThrowModelError(ERR_HISTORY_NO_DEFAULT,
                        new Object[] {h.getId(), getStateName(s)});
                }
            }
            updateTransition(historyTransition, targets);
            State historyState = (State) historyTransition.getTarget();
            if (historyState == null) {
                logAndThrowModelError(ERR_STATE_NO_HIST,
                    new Object[] {getStateName(s)});
            }
            if (!h.isDeep()) {
View Full Code Here

       
        assertFalse(Builtin.isMember(set, "on"));
    }
   
    public void testIsMemberFalse() {
        TransitionTarget state = new State();
        state.setId("off");
       
        Set set = new HashSet();
        set.add(state);
       
        assertFalse(Builtin.isMember(set, "on"));
View Full Code Here

       
        assertFalse(Builtin.isMember(set, "on"));
    }
   
    public void testIsMemberTrue() {
        TransitionTarget state = new State();
        state.setId("on");
       
        Set set = new HashSet();
        set.add(state);
       
        assertTrue(Builtin.isMember(set, "on"));
View Full Code Here

     * @return Whether a final configuration has been reached.
     */
    public boolean isFinal() {
        boolean rslt = true;
        for (Iterator i = states.iterator(); i.hasNext();) {
            State s = (State) i.next();
            if (!s.getIsFinal()) {
                rslt = false;
                break;
            }
            //the status is final only iff these are top-level states
            if (s.getParent() != null) {
                rslt = false;
                break;
            }
        }
        if (!events.isEmpty()) {
View Full Code Here

    public void testSerializeSCXMLNoStates() {
        SCXML scxml = new SCXML();
        scxml.setXmlns("namespace");
        scxml.setVersion("version1");
        scxml.setInitialstate("off");
        scxml.addState(new State());
       
        String assertValue = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<scxml xmlns=\"namespace\" version=\"version1\" "
            + "initialstate=\"off\">\n <state>\n </state>\n</scxml>\n";
       
View Full Code Here

       
        assertEquals(assertValue.toString(), returnValue.toString());
    }

    public void testSerializeActionsListNull() {
        TransitionTarget target = new State();
        target.setId("1");
       
        StringBuffer returnValue = new StringBuffer();
        boolean returnBoolean = SCXMLSerializer.serializeActions(returnValue, null, " ");
       
        assertFalse(returnBoolean);
View Full Code Here

        assertFalse(returnBoolean);
        assertEquals(actualValue, returnValue.toString());
    }
   
    public void testSerializeOnEntrySizeZero() {
        TransitionTarget target = new State();
        target.setOnEntry(new OnEntry());

        String actualValue = "";

        StringBuffer returnValue = new StringBuffer();
        SCXMLSerializer.serializeOnEntry(returnValue, target, " ");
View Full Code Here

       
        assertEquals(actualValue, returnValue.toString());
    }

    public void testSerializeOnEntry() {
        TransitionTarget target = new State();
       
        OnEntry onEntry = new OnEntry();
        onEntry.addAction(new Else());
       
        target.setOnEntry(onEntry);

        String actualValue = " <onentry>\n  <else/>\n </onentry>\n";

        StringBuffer returnValue = new StringBuffer();
        SCXMLSerializer.serializeOnEntry(returnValue, target, " ");
View Full Code Here

       
        assertEquals(actualValue, returnValue.toString());
    }
   
    public void testSerializeOnExitSizeZero() {
        TransitionTarget target = new State();
        target.setOnExit(new OnExit());

        String actualValue = "";

        StringBuffer returnValue = new StringBuffer();
        SCXMLSerializer.serializeOnExit(returnValue, target, " ");
View Full Code Here

TOP

Related Classes of org.apache.commons.scxml.model.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.