Package org.apache.commons.scxml.model

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


        for (Iterator i = counts.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            TransitionTarget tt = (TransitionTarget) entry.getKey();
            Set count = (Set) entry.getValue();
            if (tt instanceof Parallel) {
                Parallel p = (Parallel) tt;
                if (count.size() < p.getStates().size()) {
                    errRep.onError(ErrorConstants.ILLEGAL_CONFIG,
                        "Not all AND states active for parallel "
                        + p.getId(), entry);
                    legalConfig = false;
                }
            } else {
                if (count.size() > 1) {
                    errRep.onError(ErrorConstants.ILLEGAL_CONFIG,
View Full Code Here


            }
        }
        if (p.isCrossRegion()) {
            for (Iterator regions = p.getRegionsExited().iterator();
                    regions.hasNext();) {
                Parallel par = ((Parallel) ((State) regions.next()).
                    getParent());
                //let's find affected states in sibling regions
                for (Iterator siblings = par.getStates().iterator();
                        siblings.hasNext();) {
                    State s = (State) siblings.next();
                    for (Iterator act = currentStates.iterator();
                            act.hasNext();) {
                        TransitionTarget a = (TransitionTarget) act.next();
View Full Code Here

                        parent.setDone(true);
                    }
                    if (parent != null && parent.isRegion()) {
                        //3.4 we got a region, which is finalized
                        //let's check its siblings too
                        Parallel p = (Parallel) parent.getParent();
                        int finCount = 0;
                        int pCount = p.getStates().size();
                        for (Iterator regions = p.getStates().iterator();
                                regions.hasNext();) {
                            State reg = (State) regions.next();
                            if (reg.isDone()) {
                                finCount++;
                            }
                        }
                        if (finCount == pCount) {
                            te = new TriggerEvent(p.getId() + ".done",
                                        TriggerEvent.CHANGE_EVENT);
                            internalEvents.add(te);
                            te = new TriggerEvent(p.getParent().getId()
                                + ".done", TriggerEvent.CHANGE_EVENT);
                            internalEvents.add(te);
                            //this is not in the specs, but is makes sense
                            p.getParentState().setDone(true);
                        }
                    }
                }
            }
        }
View Full Code Here

                            }
                        }
                    }
                }
            } else if (tt instanceof Parallel) {
                Parallel prl = (Parallel) tt;
                for (Iterator i = prl.getStates().iterator(); i.hasNext();) {
                    //fork
                    wrkSet.addLast(i.next());
                }
            } else if (tt instanceof History) {
                History h = (History) tt;
View Full Code Here

            for (int len = 0; len < et.size(); len++) {
                serializeTransition(b, (Transition) et.get(len), indent
                    + INDENT);
            }
        }
        Parallel p = s.getParallel();
        Invoke inv = s.getInvoke();
        if (p != null) {
            serializeParallel(b, p, indent + INDENT);
        } else if (inv != null) {
            serializeInvoke(b , inv, indent + INDENT);
View Full Code Here

                //could add next two lines as a Digester rule for Transition
                trn.setParent(s);
                updateTransition(trn, targets);
            }
        }
        Parallel p = s.getParallel();
        Invoke inv = s.getInvoke();
        if ((inv != null && p != null)
                || (inv != null && !c.isEmpty())
                || (p != null && !c.isEmpty())) {
            logAndThrowModelError(ERR_STATE_BAD_CONTENTS,
View Full Code Here

        assertTrue(SCXMLHelper.isLegalConfig(states, new SimpleErrorReporter()));
    }
   
    public void testIsLegalConfigInvalidParallel() {
        Set states = new HashSet();
        Parallel parallel = new Parallel();

        Parallel parent = new Parallel();
        parent.setId("4");

        State state1 = new State();
        state1.setId("1");
        State state2 = new State();
        state2.setId("2");
       
        parent.addState(state1);
        parent.addState(state2);
       
        parallel.setParent(parent);
       
        states.add(parallel);
       
View Full Code Here

        SCXML scxml = new SCXML();
        scxml.setVersion("1.0");
        scxml.setInitial("par");

        Parallel par = new Parallel();
        par.setId("par");

        State s1 = new State();
        s1.setId("S1");

        State s11 = new State();
        s11.setId("S11");

        s1.addChild((TransitionTarget)s11);

        State s2 = new State();
        s2.setId("S2");

        State s21 = new State();
        s21.setId("S21");

        s2.addChild((TransitionTarget)s21);

        par.addChild((TransitionTarget)s1);
        par.addChild((TransitionTarget)s2);

        scxml.addChild(par);

        String assertValue = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<scxml xmlns=\"http://www.w3.org/2005/07/scxml\" "
View Full Code Here

            for (int len = 0; len < et.size(); len++) {
                serializeTransition(b, (Transition) et.get(len), indent
                    + INDENT);
            }
        }
        Parallel p = s.getParallel();
        Invoke inv = s.getInvoke();
        if (p != null) {
            serializeParallel(b, p, indent + INDENT);
        } else if (inv != null) {
            serializeInvoke(b , inv, indent + INDENT);
View Full Code Here

                //could add next two lines as a Digester rule for Transition
                trn.setParent(s);
                updateTransition(trn, targets);
            }
        }
        Parallel p = s.getParallel();
        Invoke inv = s.getInvoke();
        if ((inv != null && p != null)
                || (inv != null && !c.isEmpty())
                || (p != null && !c.isEmpty())) {
            logAndThrowModelError(ERR_STATE_BAD_CONTENTS,
View Full Code Here

TOP

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

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.