Package org.apache.commons.scxml.model

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


        s.getOnEntry().setParent(s);
        s.getOnExit().setParent(s);
        //initialize next / inital
        Initial ini = s.getInitial();
        Map c = s.getChildren();
        TransitionTarget initialState = null;
        if (!c.isEmpty()) {
            if (ini == null) {
                logAndThrowModelError(ERR_STATE_NO_INIT,
                    new Object[] {getStateName(s)});
            }
            Transition initialTransition = ini.getTransition();
            updateTransition(initialTransition, targets);
            initialState = initialTransition.getTarget();
            // we have to allow for an indirect descendant initial (targets)
            //check that initialState is a descendant of s
            if (initialState == null
                    || !SCXMLHelper.isDescendant(initialState, s)) {
                logAndThrowModelError(ERR_STATE_BAD_INIT,
                    new Object[] {getStateName(s)});
            }
        }
        List histories = s.getHistory();
        Iterator histIter = histories.iterator();
        while (histIter.hasNext()) {
            if (s.isSimple()) {
                logAndThrowModelError(ERR_HISTORY_SIMPLE_STATE,
                    new Object[] {getStateName(s)});
            }
            History h = (History) histIter.next();
            Transition historyTransition = h.getTransition();
            if (historyTransition == null) {
                // try to assign initial as default
                if (initialState != null
                        && !(initialState instanceof History)) {
                    historyTransition = new Transition();
                    historyTransition.setNext(initialState.getId());
                    historyTransition.setParent(h);
                    h.setTransition(historyTransition);
                } else {
                    logAndThrowModelError(ERR_HISTORY_NO_DEFAULT,
                        new Object[] {h.getId(), getStateName(s)});
View Full Code Here


            final Map targets) throws ModelException {
        String next = t.getNext();
        if (next == null) { // stay transition
            return;
        }
        TransitionTarget tt = t.getTarget();
        if (tt == null) {
            tt = (TransitionTarget) targets.get(next);
            if (tt == null) {
                logAndThrowModelError(ERR_TARGET_NOT_FOUND, new Object[] {
                    next });
View Full Code Here

        return exec.getSCInstance().lookupContext(tt);
    }

    public static Context lookupContext(SCXMLExecutor exec,
            String id) {
        TransitionTarget tt = lookupTransitionTarget(exec, id);
        if (tt == null) {
            return null;
        }
        return exec.getSCInstance().lookupContext(tt);
    }
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

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

    public void testSerializeOnExit() {
        TransitionTarget target = new State();
       
        OnExit onExit = new OnExit();
        onExit.addAction(new Else());
       
        target.setOnExit(onExit);

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

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

    public void testIsStringEmpty() {
        assertFalse(SCXMLHelper.isStringEmpty("value"));
    }

    public void testIsDescendantNullParent() {
        TransitionTarget state = new State();
        TransitionTarget context = new State();
       
        assertFalse(SCXMLHelper.isDescendant(state, context));
    }
View Full Code Here

       
        assertFalse(SCXMLHelper.isDescendant(state, context));
    }
   
    public void testIsDescendantNotEqual() {
        TransitionTarget state = new State();
        state.setParent(new State());
        TransitionTarget context = new State();
       
        assertFalse(SCXMLHelper.isDescendant(state, context));
    }
View Full Code Here

TOP

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

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.