Package org.apache.commons.scxml.model

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


        assertEquals("value", instance.getContext(target).get("name"));
        assertEquals("value", instance.lookupContext(target).get("name"));
    }

    public void testGetLastConfigurationNull() {
        History history = new History();
       
        Set returnConfiguration = instance.getLastConfiguration(history);
       
        assertEquals(0, returnConfiguration.size());
    }
View Full Code Here


        assertEquals(0, returnConfiguration.size());
    }


    public void testGetLastConfiguration() {
        History history = new History();
        history.setId("1");
       
        Set configuration = new HashSet();
        configuration.add("value1");
        configuration.add("value2");
       
View Full Code Here

        assertTrue(returnConfiguration.contains("value1"));
        assertTrue(returnConfiguration.contains("value2"));
    }
   
    public void testIsEmpty() {
        assertTrue(instance.isEmpty(new History()));
    }
View Full Code Here

    public void testIsEmpty() {
        assertTrue(instance.isEmpty(new History()));
    }
   
    public void testIsEmptyFalse() {
        History history = new History();
        history.setId("1");
       
        Set configuration = new HashSet();
        configuration.add("value1");
        configuration.add("value2");
       
View Full Code Here

        assertFalse(instance.isEmpty(history));
    }
   
    public void testReset() {
        History history = new History();
        history.setId("1");
       
        Set configuration = new HashSet();
        configuration.add("value1");
        configuration.add("value2");
       
View Full Code Here

                for (Iterator i = prl.getStates().iterator(); i.hasNext();) {
                    //fork
                    wrkSet.addLast(i.next());
                }
            } else if (tt instanceof History) {
                History h = (History) tt;
                if (scInstance.isEmpty(h)) {
                    wrkSet.addLast(h.getTransition().getRuntimeTarget());
                } else {
                    wrkSet.addAll(scInstance.getLastConfiguration(h));
                }
            } else {
                throw new ModelException("Unknown TransitionTarget subclass:"
View Full Code Here

                if (s.hasHistory()) {
                    Set shallow = null;
                    Set deep = null;
                    for (Iterator j = s.getHistory().iterator();
                            j.hasNext();) {
                        History h = (History) j.next();
                        if (h.isDeep()) {
                            if (deep == null) {
                                //calculate deep history for a given state once
                                deep = new HashSet();
                                Iterator k = oldState.iterator();
                                while (k.hasNext()) {
View Full Code Here

                for (Iterator i = prl.getChildren().iterator(); i.hasNext();) {
                    //fork
                    wrkSet.addLast(i.next());
                }
            } else if (tt instanceof History) {
                History h = (History) tt;
                if (scInstance.isEmpty(h)) {
                    wrkSet.addAll(h.getTransition().getRuntimeTargets());
                } else {
                    wrkSet.addAll(scInstance.getLastConfiguration(h));
                }
            } else {
                throw new ModelException("Unknown TransitionTarget subclass:"
View Full Code Here

                if (s.hasHistory()) {
                    Set shallow = null;
                    Set deep = null;
                    for (Iterator j = s.getHistory().iterator();
                            j.hasNext();) {
                        History h = (History) j.next();
                        if (h.isDeep()) {
                            if (deep == null) {
                                //calculate deep history for a given state once
                                deep = new HashSet();
                                Iterator k = oldState.iterator();
                                while (k.hasNext()) {
View Full Code Here

        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 (initialStates != null && initialStates.size() > 0) {
                    for (int i = 0; i < initialStates.size(); i++) {
                        if (initialStates.get(i) instanceof History) {
                            logAndThrowModelError(ERR_HISTORY_BAD_DEFAULT,
                                new Object[] {h.getId(), getStateName(s)});
                        }
                    }
                    historyTransition = new Transition();
                    historyTransition.getTargets().addAll(initialStates);
                    h.setTransition(historyTransition);
                } else {
                    logAndThrowModelError(ERR_HISTORY_NO_DEFAULT,
                        new Object[] {h.getId(), getStateName(s)});
                }
            }
            updateTransition(historyTransition, targets);
            List historyStates = historyTransition.getTargets();
            if (historyStates.size() == 0) {
                logAndThrowModelError(ERR_STATE_NO_HIST,
                    new Object[] {getStateName(s)});
            }
            for (int i = 0; i < historyStates.size(); i++) {
                TransitionTarget historyState = (TransitionTarget)
                    historyStates.get(i);
                if (!h.isDeep()) {
                    if (!c.containsValue(historyState)) {
                        logAndThrowModelError(ERR_STATE_BAD_SHALLOW_HIST,
                            new Object[] {getStateName(s)});
                    }
                } else {
View Full Code Here

TOP

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

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.