Example usage for org.apache.commons.collections4.functors TruePredicate TruePredicate

List of usage examples for org.apache.commons.collections4.functors TruePredicate TruePredicate

Introduction

In this page you can find the example usage for org.apache.commons.collections4.functors TruePredicate TruePredicate.

Prototype

private TruePredicate() 

Source Link

Document

Restricted constructor.

Usage

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis./* w  w  w.  ja  v  a 2s.  c om*/
 * @param source Estado de origem.
 * @param symbol Smbolo a ser consumido.
 * @param target Estado de destino.
 */
public void query(Variable source, Variable symbol, Variable target) {

    // validaes
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(symbol, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");

    // predicado do estado de origem
    Predicate sourcePredicate;

    // se o estado de origem no est disponvel,
    // significa que existem valores
    if (!source.isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }

        // unio dos predicados
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {

        // qualquer valor  vlido
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado do smbolo a ser consumido
    Predicate symbolPredicate;

    // se o smbolo no est disponvel, existem
    // valores associados a ele
    if (!symbol.isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection symbolPredicateList = new ArrayList();
        for (Object currentSymbol : symbol.getValues()) {

            // temos uma transio convencional?
            if (currentSymbol != null) {

                // sim, transio convencional
                symbolPredicateList.add(new SymbolPredicate((Symbol) currentSymbol));

            } else {

                // transio em vazio
                symbolPredicateList.add(new EpsilonPredicate());
            }
        }

        // unio dos predicados
        symbolPredicate = PredicateUtils.anyPredicate(symbolPredicateList);
    } else {

        // qualquer valor  vlido
        symbolPredicate = TruePredicate.truePredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;

    // se o estado de destino no est disponvel,
    // temos valores a considerar
    if (!target.isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }

        // unio dos predicados
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {

        // qualquer valor do estado de
        // destino  vlido
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco de todos os predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, symbolPredicate, targetPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> symbolResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        symbolResult.add(transition.getSymbol());
        targetResult.add(transition.getTargetState());
    }

    // se o estado de origem est
    // disponvel, preenche os valores
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // se o smbolo est disponvel,
    // preenche os valores
    if (symbol.isAvailable()) {
        symbol.setValues(symbolResult);
    }

    // se o estado de destino est
    // disponvel, preenche os valores
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis.//  w w w .ja v  a2s  .com
 * @param source Estado de origem.
 * @param submachine Submquina a ser chamada.
 * @param target Estado de destino.
 */
public void query(Variable source, SubmachineQuery submachine, Variable target) {

    // validaes
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(submachine, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");

    // predicado do estado de origem
    Predicate sourcePredicate;

    // o estado de origem no est disponvel?
    if (!source.isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }

        // unio dos predicados
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {

        // qualquer valor  vlido
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado de submquina
    Predicate submachinePredicate;

    // existem valores de submquina?
    if (!submachine.getVariable().isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection submachinePredicateList = new ArrayList();
        for (Object currentSubmachine : submachine.getVariable().getValues()) {
            submachinePredicateList.add(new SubmachinePredicate((String) currentSubmachine));
        }

        // unio dos predicados
        submachinePredicate = PredicateUtils.anyPredicate(submachinePredicateList);
    } else {

        // qualquer valor  vlido, contanto
        // que seja uma chamada de submquina
        submachinePredicate = new SubmachineCallPredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;

    // existem valores para o
    // estado de destino?
    if (!target.isAvailable()) {

        // para cada valor existente,
        // adiciona um predicado
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }

        // unio dos predicados
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {

        // qualquer valor  vlido
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco de todos
    // os predicados disponveis
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(), PredicateUtils
            .allPredicate(new Predicate[] { sourcePredicate, submachinePredicate, targetPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> submachineResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        submachineResult.add(transition.getSubmachineCall());
        targetResult.add(transition.getTargetState());
    }

    // preenche a varivel do
    // estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche a varivel da
    // chamada de submquina
    if (submachine.getVariable().isAvailable()) {
        submachine.getVariable().setValues(submachineResult);
    }

    // preenche a varivel do
    // estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis.//from   www. j av  a2 s  . c  o m
 * @param source Estado de origem.
 * @param submachine Submquina a ser chamada.
 * @param target Estado de destino.
 * @param postAction Ao posterior.
 */
public void query(Variable source, SubmachineQuery submachine, Variable target, ActionQuery postAction) {

    // validaes
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(submachine, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");
    Validate.notNull(postAction, "A varivel no pode ser nula.");

    // predicado da ao posterior
    Predicate postActionPredicate;

    // tratamento do nome da ao posterior
    Predicate postActionNamePredicate;

    // o nome no est disponvel, ento
    // existem valores
    if (!postAction.getName().isAvailable()) {

        // obtm dos os nomes existentes
        Collection postActionNamePredicateList = new ArrayList();
        for (Object currentPostActionName : postAction.getName().getValues()) {
            postActionNamePredicateList.add(new PostActionPredicate((String) currentPostActionName));
        }

        // unio dos predicados
        postActionNamePredicate = PredicateUtils.anyPredicate(postActionNamePredicateList);
    } else {

        // qualquer valor  vlido, contanto
        // que seja um nome de ao posterior
        postActionNamePredicate = new PostActionCallPredicate();
    }

    // tratamento dos argumentos da ao
    // posterior, se existirem
    if (postAction.hasArguments()) {

        // obtm todos os valores de todos
        // os argumentos da ao posterior
        List<Variable> postActionArguments = postAction.getArguments();
        Collection postActionArgumentsPredicateList = new ArrayList();
        Collection postActionArgumentPredicateList;

        // percorre todos os argumentos
        for (int i = 0; i < postActionArguments.size(); i++) {
            if (!postActionArguments.get(i).isAvailable()) {
                postActionArgumentPredicateList = new ArrayList();
                for (Object currentPostActionArgument : postActionArguments.get(i).getValues()) {
                    postActionArgumentPredicateList
                            .add(new PostActionCheckArgumentPredicate(i, currentPostActionArgument));
                }
                postActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(postActionArgumentPredicateList));
            } else {
                postActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }

        // adiciona o predicado
        postActionArgumentsPredicateList.add(new PostActionCountArgumentsPredicate(postActionArguments.size()));
        postActionArgumentsPredicateList.add(postActionNamePredicate);
        postActionPredicate = PredicateUtils.allPredicate(postActionArgumentsPredicateList);
    } else {

        // no existem argumentos
        postActionPredicate = postActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;

    // existem valores para o
    // estado de origem
    if (!source.isAvailable()) {

        // obtm todos os valores
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }

        // unio dos predicados
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {

        // qualquer valor  vlido
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado de chamada de submquina
    Predicate submachinePredicate;

    // existem valores de chamadas de submquinas
    if (!submachine.getVariable().isAvailable()) {

        // obtm todos os valores
        Collection submachinePredicateList = new ArrayList();
        for (Object currentSubmachine : submachine.getVariable().getValues()) {
            submachinePredicateList.add(new SubmachinePredicate((String) currentSubmachine));
        }

        // unio dos predicados
        submachinePredicate = PredicateUtils.anyPredicate(submachinePredicateList);
    } else {

        // qualquer valor  vlido, contanto
        // que seja uma chamada de submquina
        submachinePredicate = new SubmachineCallPredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;

    // existem valores associados
    if (!target.isAvailable()) {

        // obtm todos os valores
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }

        // unio dos predicados
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {

        // qualquer valor  vlido
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco de todos
    // os predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, submachinePredicate, targetPredicate,
                    postActionPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> submachineResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> postActionNameResult = new HashSet<>();
    List<HashSet<Object>> postActionArgumentsResult = new ArrayList<>();

    // inicializa a lista de argumentos
    // da ao posterior, se existirem
    if (postAction.hasArguments()) {
        for (Variable argument : postAction.getArguments()) {
            postActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        submachineResult.add(transition.getSubmachineCall());
        targetResult.add(transition.getTargetState());
        postActionNameResult.add(transition.getPostActionCall());
        if (postAction.hasArguments()) {
            for (int i = 0; i < postAction.getArguments().size(); i++) {
                postActionArgumentsResult.get(i).add(transition.getPostActionArguments()[i]);
            }
        }
    }

    // preenche o estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche a chamada de submquina
    if (submachine.getVariable().isAvailable()) {
        submachine.getVariable().setValues(submachineResult);
    }

    // preenche o estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // preenche o nome da ao posterior
    if (postAction.getName().isAvailable()) {
        postAction.getName().setValues(postActionNameResult);
    }

    // preenche os argumentos da ao posterior
    if (postAction.hasArguments()) {
        for (int i = 0; i < postAction.getArguments().size(); i++) {
            if (postAction.getArguments().get(i).isAvailable()) {
                postAction.getArguments().get(i).setValues(postActionArgumentsResult.get(i));
            }
        }
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis./*ww  w .  j a  v a2 s  .  c  o m*/
 * @param priorAction Ao anterior.
 * @param source Estado de origem.
 * @param submachine Submquina a ser chamada.
 * @param target Estado de destino.
 */
public void query(ActionQuery priorAction, Variable source, SubmachineQuery submachine, Variable target) {

    // validaes
    Validate.notNull(priorAction, "A varivel no pode ser nula.");
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(submachine, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");

    // predicado da ao anterior
    Predicate priorActionPredicate;

    // tratamento do nome da ao anterior
    Predicate priorActionNamePredicate;
    if (!priorAction.getName().isAvailable()) {
        Collection priorActionNamePredicateList = new ArrayList();
        for (Object currentPriorActionName : priorAction.getName().getValues()) {
            priorActionNamePredicateList.add(new PriorActionPredicate((String) currentPriorActionName));
        }
        priorActionNamePredicate = PredicateUtils.anyPredicate(priorActionNamePredicateList);
    } else {
        priorActionNamePredicate = new PriorActionCallPredicate();
    }

    // tratamento dos argumentos da ao anterior
    if (priorAction.hasArguments()) {
        List<Variable> priorActionArguments = priorAction.getArguments();
        Collection priorActionArgumentsPredicateList = new ArrayList();
        Collection priorActionArgumentPredicateList;
        for (int i = 0; i < priorActionArguments.size(); i++) {
            if (!priorActionArguments.get(i).isAvailable()) {
                priorActionArgumentPredicateList = new ArrayList();
                for (Object currentPriorActionArgument : priorActionArguments.get(i).getValues()) {
                    priorActionArgumentPredicateList
                            .add(new PriorActionCheckArgumentPredicate(i, currentPriorActionArgument));
                }
                priorActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(priorActionArgumentPredicateList));
            } else {
                priorActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        priorActionArgumentsPredicateList
                .add(new PriorActionCountArgumentsPredicate(priorActionArguments.size()));
        priorActionArgumentsPredicateList.add(priorActionNamePredicate);
        priorActionPredicate = PredicateUtils.allPredicate(priorActionArgumentsPredicateList);
    } else {
        priorActionPredicate = priorActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;
    if (!source.isAvailable()) {
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado da chamada de submquina
    Predicate submachinePredicate;
    if (!submachine.getVariable().isAvailable()) {
        Collection submachinePredicateList = new ArrayList();
        for (Object currentSubmachine : submachine.getVariable().getValues()) {
            submachinePredicateList.add(new SubmachinePredicate((String) currentSubmachine));
        }
        submachinePredicate = PredicateUtils.anyPredicate(submachinePredicateList);
    } else {
        submachinePredicate = new SubmachineCallPredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;
    if (!target.isAvailable()) {
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco dos predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, submachinePredicate, targetPredicate,
                    priorActionPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> submachineResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> priorActionNameResult = new HashSet<>();
    List<HashSet<Object>> priorActionArgumentsResult = new ArrayList<>();

    // existem argumentos da ao anterior,
    // inicializa cada conjunto
    if (priorAction.hasArguments()) {
        for (Variable argument : priorAction.getArguments()) {
            priorActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos de resultados
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        submachineResult.add(transition.getSubmachineCall());
        targetResult.add(transition.getTargetState());
        priorActionNameResult.add(transition.getPriorActionCall());
        if (priorAction.hasArguments()) {
            for (int i = 0; i < priorAction.getArguments().size(); i++) {
                priorActionArgumentsResult.get(i).add(transition.getPriorActionArguments()[i]);
            }
        }
    }

    // preenche o estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche a chamada de submquina
    if (submachine.getVariable().isAvailable()) {
        submachine.getVariable().setValues(submachineResult);
    }

    // preenche o estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // preenche o nome da ao anterior
    if (priorAction.getName().isAvailable()) {
        priorAction.getName().setValues(priorActionNameResult);
    }

    // preenche os argumentos da ao anterior
    if (priorAction.hasArguments()) {
        for (int i = 0; i < priorAction.getArguments().size(); i++) {
            if (priorAction.getArguments().get(i).isAvailable()) {
                priorAction.getArguments().get(i).setValues(priorActionArgumentsResult.get(i));
            }
        }
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis./*from   w w  w. j a v  a  2  s  .  c  om*/
 * @param priorAction Ao anterior.
 * @param source Estado de origem.
 * @param submachine Submquina a ser chamada.
 * @param target Estado de destino.
 * @param postAction Ao posterior.
 */
public void query(ActionQuery priorAction, Variable source, SubmachineQuery submachine, Variable target,
        ActionQuery postAction) {

    // validaes
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(submachine, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");
    Validate.notNull(priorAction, "A varivel no pode ser nula.");
    Validate.notNull(postAction, "A varivel no pode ser nula.");

    // predicado da ao anterior
    Predicate priorActionPredicate;

    // tratamento do nome da ao anterior
    Predicate priorActionNamePredicate;
    if (!priorAction.getName().isAvailable()) {
        Collection priorActionNamePredicateList = new ArrayList();
        for (Object currentPriorActionName : priorAction.getName().getValues()) {
            priorActionNamePredicateList.add(new PriorActionPredicate((String) currentPriorActionName));
        }
        priorActionNamePredicate = PredicateUtils.anyPredicate(priorActionNamePredicateList);
    } else {
        priorActionNamePredicate = new PriorActionCallPredicate();
    }

    // tratamento dos argumentos da
    // ao anterior, se existirem
    if (priorAction.hasArguments()) {
        List<Variable> priorActionArguments = priorAction.getArguments();
        Collection priorActionArgumentsPredicateList = new ArrayList();
        Collection priorActionArgumentPredicateList;
        for (int i = 0; i < priorActionArguments.size(); i++) {
            if (!priorActionArguments.get(i).isAvailable()) {
                priorActionArgumentPredicateList = new ArrayList();
                for (Object currentPriorActionArgument : priorActionArguments.get(i).getValues()) {
                    priorActionArgumentPredicateList
                            .add(new PriorActionCheckArgumentPredicate(i, currentPriorActionArgument));
                }
                priorActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(priorActionArgumentPredicateList));
            } else {
                priorActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        priorActionArgumentsPredicateList
                .add(new PriorActionCountArgumentsPredicate(priorActionArguments.size()));
        priorActionArgumentsPredicateList.add(priorActionNamePredicate);
        priorActionPredicate = PredicateUtils.allPredicate(priorActionArgumentsPredicateList);
    } else {
        priorActionPredicate = priorActionNamePredicate;
    }

    // predicado da ao posterior
    Predicate postActionPredicate;

    // tratamento do nome da ao posterior
    Predicate postActionNamePredicate;
    if (!postAction.getName().isAvailable()) {
        Collection postActionNamePredicateList = new ArrayList();
        for (Object currentPostActionName : postAction.getName().getValues()) {
            postActionNamePredicateList.add(new PostActionPredicate((String) currentPostActionName));
        }
        postActionNamePredicate = PredicateUtils.anyPredicate(postActionNamePredicateList);
    } else {
        postActionNamePredicate = new PostActionCallPredicate();
    }

    // tratamento dos argumentos da
    // ao posterior, se existirem
    if (postAction.hasArguments()) {
        List<Variable> postActionArguments = postAction.getArguments();
        Collection postActionArgumentsPredicateList = new ArrayList();
        Collection postActionArgumentPredicateList;
        for (int i = 0; i < postActionArguments.size(); i++) {
            if (!postActionArguments.get(i).isAvailable()) {
                postActionArgumentPredicateList = new ArrayList();
                for (Object currentPostActionArgument : postActionArguments.get(i).getValues()) {
                    postActionArgumentPredicateList
                            .add(new PostActionCheckArgumentPredicate(i, currentPostActionArgument));
                }
                postActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(postActionArgumentPredicateList));
            } else {
                postActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        postActionArgumentsPredicateList.add(new PostActionCountArgumentsPredicate(postActionArguments.size()));
        postActionArgumentsPredicateList.add(postActionNamePredicate);
        postActionPredicate = PredicateUtils.allPredicate(postActionArgumentsPredicateList);
    } else {
        postActionPredicate = postActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;
    if (!source.isAvailable()) {
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado da chamada de submquina
    Predicate submachinePredicate;
    if (!submachine.getVariable().isAvailable()) {
        Collection submachinePredicateList = new ArrayList();
        for (Object currentSubmachine : submachine.getVariable().getValues()) {
            submachinePredicateList.add(new SubmachinePredicate((String) currentSubmachine));
        }
        submachinePredicate = PredicateUtils.anyPredicate(submachinePredicateList);
    } else {
        submachinePredicate = new SubmachineCallPredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;
    if (!target.isAvailable()) {
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco dos predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, submachinePredicate, targetPredicate,
                    priorActionPredicate, postActionPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> submachineResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> priorActionNameResult = new HashSet<>();
    List<HashSet<Object>> priorActionArgumentsResult = new ArrayList<>();
    Set<Object> postActionNameResult = new HashSet<>();
    List<HashSet<Object>> postActionArgumentsResult = new ArrayList<>();

    // inicializa conjunto dos argumentos
    // da ao anterior
    if (priorAction.hasArguments()) {
        for (Variable argument : priorAction.getArguments()) {
            priorActionArgumentsResult.add(new HashSet<>());
        }
    }

    // inicializa conjunto dos argumentos
    // da ao posterior
    if (postAction.hasArguments()) {
        for (Variable argument : postAction.getArguments()) {
            postActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos de resultados
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        submachineResult.add(transition.getSubmachineCall());
        targetResult.add(transition.getTargetState());
        priorActionNameResult.add(transition.getPriorActionCall());
        if (priorAction.hasArguments()) {
            for (int i = 0; i < priorAction.getArguments().size(); i++) {
                priorActionArgumentsResult.get(i).add(transition.getPriorActionArguments()[i]);
            }
        }
        postActionNameResult.add(transition.getPostActionCall());
        if (postAction.hasArguments()) {
            for (int i = 0; i < postAction.getArguments().size(); i++) {
                postActionArgumentsResult.get(i).add(transition.getPostActionArguments()[i]);
            }
        }
    }

    // insere os valores do estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // insere os valores das chamadas de submquinas
    if (submachine.getVariable().isAvailable()) {
        submachine.getVariable().setValues(submachineResult);
    }

    // insere os valores do estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // insere os valores do nome da ao anterior
    if (priorAction.getName().isAvailable()) {
        priorAction.getName().setValues(priorActionNameResult);
    }

    // insere os valores dos argumentos da
    // ao anterior, se existirem
    if (priorAction.hasArguments()) {
        for (int i = 0; i < priorAction.getArguments().size(); i++) {
            if (priorAction.getArguments().get(i).isAvailable()) {
                priorAction.getArguments().get(i).setValues(priorActionArgumentsResult.get(i));
            }
        }
    }

    // insere os valores do nome da ao posterior
    if (postAction.getName().isAvailable()) {
        postAction.getName().setValues(postActionNameResult);
    }

    // insere os valores dos argumentos da
    // ao posterior, se existirem
    if (postAction.hasArguments()) {
        for (int i = 0; i < postAction.getArguments().size(); i++) {
            if (postAction.getArguments().get(i).isAvailable()) {
                postAction.getArguments().get(i).setValues(postActionArgumentsResult.get(i));
            }
        }
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis./*from w w w  .  j ava  2 s  .  c o  m*/
 * @param source Estado de origem.
 * @param symbol Smbolo a ser consumido.
 * @param target Estado de destino.
 * @param postAction Ao posterior.
 */
public void query(Variable source, Variable symbol, Variable target, ActionQuery postAction) {

    // validaes
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(symbol, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");
    Validate.notNull(postAction, "A varivel no pode ser nula.");

    // predicado da ao posterior
    Predicate postActionPredicate;

    // tratamento do nome da ao posterior
    Predicate postActionNamePredicate;
    if (!postAction.getName().isAvailable()) {
        Collection postActionNamePredicateList = new ArrayList();
        for (Object currentPostActionName : postAction.getName().getValues()) {
            postActionNamePredicateList.add(new PostActionPredicate((String) currentPostActionName));
        }
        postActionNamePredicate = PredicateUtils.anyPredicate(postActionNamePredicateList);
    } else {
        postActionNamePredicate = new PostActionCallPredicate();
    }

    // tratamento dos argumentos da ao
    // posterior, se existirem
    if (postAction.hasArguments()) {
        List<Variable> postActionArguments = postAction.getArguments();
        Collection postActionArgumentsPredicateList = new ArrayList();
        Collection postActionArgumentPredicateList;
        for (int i = 0; i < postActionArguments.size(); i++) {
            if (!postActionArguments.get(i).isAvailable()) {
                postActionArgumentPredicateList = new ArrayList();
                for (Object currentPostActionArgument : postActionArguments.get(i).getValues()) {
                    postActionArgumentPredicateList
                            .add(new PostActionCheckArgumentPredicate(i, currentPostActionArgument));
                }
                postActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(postActionArgumentPredicateList));
            } else {
                postActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        postActionArgumentsPredicateList.add(new PostActionCountArgumentsPredicate(postActionArguments.size()));
        postActionArgumentsPredicateList.add(postActionNamePredicate);
        postActionPredicate = PredicateUtils.allPredicate(postActionArgumentsPredicateList);
    } else {
        postActionPredicate = postActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;
    if (!source.isAvailable()) {
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado do smbolo a ser consumido
    Predicate symbolPredicate;
    if (!symbol.isAvailable()) {
        Collection symbolPredicateList = new ArrayList();
        for (Object currentSymbol : symbol.getValues()) {
            if (currentSymbol != null) {
                symbolPredicateList.add(new SymbolPredicate((Symbol) currentSymbol));
            } else {
                symbolPredicateList.add(new EpsilonPredicate());
            }
        }
        symbolPredicate = PredicateUtils.anyPredicate(symbolPredicateList);
    } else {
        symbolPredicate = TruePredicate.truePredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;
    if (!target.isAvailable()) {
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco dos predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, symbolPredicate, targetPredicate,
                    postActionPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> symbolResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> postActionNameResult = new HashSet<>();
    List<HashSet<Object>> postActionArgumentsResult = new ArrayList<>();

    // se a ao posterior tem argumentos,
    // inicializa o conjunto
    if (postAction.hasArguments()) {
        for (Variable argument : postAction.getArguments()) {
            postActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        symbolResult.add(transition.getSymbol());
        targetResult.add(transition.getTargetState());
        postActionNameResult.add(transition.getPostActionCall());
        if (postAction.hasArguments()) {
            for (int i = 0; i < postAction.getArguments().size(); i++) {
                postActionArgumentsResult.get(i).add(transition.getPostActionArguments()[i]);
            }
        }
    }

    // preenche o estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche o smbolo
    if (symbol.isAvailable()) {
        symbol.setValues(symbolResult);
    }

    // preenche o estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // preenche o nome da ao posterior
    if (postAction.getName().isAvailable()) {
        postAction.getName().setValues(postActionNameResult);
    }

    // preenche os argumentos da 
    // ao posterior, se existirem
    if (postAction.hasArguments()) {
        for (int i = 0; i < postAction.getArguments().size(); i++) {
            if (postAction.getArguments().get(i).isAvailable()) {
                postAction.getArguments().get(i).setValues(postActionArgumentsResult.get(i));
            }
        }
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis.// w w w . j  av  a 2s.com
 * @param priorAction Ao anterior.
 * @param source Estado de origem.
 * @param symbol Smbolo a ser consumido.
 * @param target Estado de destino.
 */
public void query(ActionQuery priorAction, Variable source, Variable symbol, Variable target) {

    // validaes
    Validate.notNull(priorAction, "A varivel no pode ser nula.");
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(symbol, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");

    // predicado da ao anterior
    Predicate priorActionPredicate;

    // tratamento do nome da ao anterior
    Predicate priorActionNamePredicate;
    if (!priorAction.getName().isAvailable()) {
        Collection priorActionNamePredicateList = new ArrayList();
        for (Object currentPriorActionName : priorAction.getName().getValues()) {
            priorActionNamePredicateList.add(new PriorActionPredicate((String) currentPriorActionName));
        }
        priorActionNamePredicate = PredicateUtils.anyPredicate(priorActionNamePredicateList);
    } else {
        priorActionNamePredicate = new PriorActionCallPredicate();
    }

    // tratamento dos argumentos da ao
    // anterior, se existirem
    if (priorAction.hasArguments()) {
        List<Variable> priorActionArguments = priorAction.getArguments();
        Collection priorActionArgumentsPredicateList = new ArrayList();
        Collection priorActionArgumentPredicateList;
        for (int i = 0; i < priorActionArguments.size(); i++) {
            if (!priorActionArguments.get(i).isAvailable()) {
                priorActionArgumentPredicateList = new ArrayList();
                for (Object currentPriorActionArgument : priorActionArguments.get(i).getValues()) {
                    priorActionArgumentPredicateList
                            .add(new PriorActionCheckArgumentPredicate(i, currentPriorActionArgument));
                }
                priorActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(priorActionArgumentPredicateList));
            } else {
                priorActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        priorActionArgumentsPredicateList
                .add(new PriorActionCountArgumentsPredicate(priorActionArguments.size()));
        priorActionArgumentsPredicateList.add(priorActionNamePredicate);
        priorActionPredicate = PredicateUtils.allPredicate(priorActionArgumentsPredicateList);
    } else {
        priorActionPredicate = priorActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;
    if (!source.isAvailable()) {
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado do smbolo
    Predicate symbolPredicate;
    if (!symbol.isAvailable()) {
        Collection symbolPredicateList = new ArrayList();
        for (Object currentSymbol : symbol.getValues()) {
            if (currentSymbol != null) {
                symbolPredicateList.add(new SymbolPredicate((Symbol) currentSymbol));
            } else {
                symbolPredicateList.add(new EpsilonPredicate());
            }
        }
        symbolPredicate = PredicateUtils.anyPredicate(symbolPredicateList);
    } else {
        symbolPredicate = TruePredicate.truePredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;
    if (!target.isAvailable()) {
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco dos predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, symbolPredicate, targetPredicate,
                    priorActionPredicate }));

    // conjunto de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> symbolResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> priorActionNameResult = new HashSet<>();
    List<HashSet<Object>> priorActionArgumentsResult = new ArrayList<>();

    // se a ao anterior tem argumentos,
    // inicializa os conjuntos
    if (priorAction.hasArguments()) {
        for (Variable argument : priorAction.getArguments()) {
            priorActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        symbolResult.add(transition.getSymbol());
        targetResult.add(transition.getTargetState());
        priorActionNameResult.add(transition.getPriorActionCall());
        if (priorAction.hasArguments()) {
            for (int i = 0; i < priorAction.getArguments().size(); i++) {
                priorActionArgumentsResult.get(i).add(transition.getPriorActionArguments()[i]);
            }
        }
    }

    // preenche o estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche o smbolo
    if (symbol.isAvailable()) {
        symbol.setValues(symbolResult);
    }

    // preenche o estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // preenche o nome da ao anterior
    if (priorAction.getName().isAvailable()) {
        priorAction.getName().setValues(priorActionNameResult);
    }

    // preenche os argumentos da ao
    // anterior, se existirem
    if (priorAction.hasArguments()) {
        for (int i = 0; i < priorAction.getArguments().size(); i++) {
            if (priorAction.getArguments().get(i).isAvailable()) {
                priorAction.getArguments().get(i).setValues(priorActionArgumentsResult.get(i));
            }
        }
    }

}

From source file:br.usp.poli.lta.cereda.aa.model.actions.ElementaryActions.java

/**
 * Consulta as transies de acordo com os parmetros informados e preenche
 * as variveis./*from  w  ww. j a va 2  s .  c  o  m*/
 * @param priorAction Ao anterior.
 * @param source Estado de origem.
 * @param symbol Smbolo a ser consumido.
 * @param target Estado de destino.
 * @param postAction Ao posterior.
 */
public void query(ActionQuery priorAction, Variable source, Variable symbol, Variable target,
        ActionQuery postAction) {

    // validaes
    Validate.notNull(priorAction, "A varivel no pode ser nula.");
    Validate.notNull(source, "A varivel no pode ser nula.");
    Validate.notNull(symbol, "A varivel no pode ser nula.");
    Validate.notNull(target, "A varivel no pode ser nula.");
    Validate.notNull(postAction, "A varivel no pode ser nula.");

    // predicado da ao anterior
    Predicate priorActionPredicate;

    // tratamento do nome da ao anterior
    Predicate priorActionNamePredicate;
    if (!priorAction.getName().isAvailable()) {
        Collection priorActionNamePredicateList = new ArrayList();
        for (Object currentPriorActionName : priorAction.getName().getValues()) {
            priorActionNamePredicateList.add(new PriorActionPredicate((String) currentPriorActionName));
        }
        priorActionNamePredicate = PredicateUtils.anyPredicate(priorActionNamePredicateList);
    } else {
        priorActionNamePredicate = new PriorActionCallPredicate();
    }

    // tratamento dos argumentos da ao
    // anterior, se existirem
    if (priorAction.hasArguments()) {
        List<Variable> priorActionArguments = priorAction.getArguments();
        Collection priorActionArgumentsPredicateList = new ArrayList();
        Collection priorActionArgumentPredicateList;
        for (int i = 0; i < priorActionArguments.size(); i++) {
            if (!priorActionArguments.get(i).isAvailable()) {
                priorActionArgumentPredicateList = new ArrayList();
                for (Object currentPriorActionArgument : priorActionArguments.get(i).getValues()) {
                    priorActionArgumentPredicateList
                            .add(new PriorActionCheckArgumentPredicate(i, currentPriorActionArgument));
                }
                priorActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(priorActionArgumentPredicateList));
            } else {
                priorActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        priorActionArgumentsPredicateList
                .add(new PriorActionCountArgumentsPredicate(priorActionArguments.size()));
        priorActionArgumentsPredicateList.add(priorActionNamePredicate);
        priorActionPredicate = PredicateUtils.allPredicate(priorActionArgumentsPredicateList);
    } else {
        priorActionPredicate = priorActionNamePredicate;
    }

    // predicado da ao posterior
    Predicate postActionPredicate;

    // tratamento do nome da ao posterior
    Predicate postActionNamePredicate;
    if (!postAction.getName().isAvailable()) {
        Collection postActionNamePredicateList = new ArrayList();
        for (Object currentPostActionName : postAction.getName().getValues()) {
            postActionNamePredicateList.add(new PostActionPredicate((String) currentPostActionName));
        }
        postActionNamePredicate = PredicateUtils.anyPredicate(postActionNamePredicateList);
    } else {
        postActionNamePredicate = new PostActionCallPredicate();
    }

    // tratamento dos argumentos da ao
    // posterior, se existirem
    if (postAction.hasArguments()) {
        List<Variable> postActionArguments = postAction.getArguments();
        Collection postActionArgumentsPredicateList = new ArrayList();
        Collection postActionArgumentPredicateList;
        for (int i = 0; i < postActionArguments.size(); i++) {
            if (!postActionArguments.get(i).isAvailable()) {
                postActionArgumentPredicateList = new ArrayList();
                for (Object currentPostActionArgument : postActionArguments.get(i).getValues()) {
                    postActionArgumentPredicateList
                            .add(new PostActionCheckArgumentPredicate(i, currentPostActionArgument));
                }
                postActionArgumentsPredicateList
                        .add(PredicateUtils.anyPredicate(postActionArgumentPredicateList));
            } else {
                postActionArgumentsPredicateList.add(TruePredicate.truePredicate());
            }
        }
        postActionArgumentsPredicateList.add(new PostActionCountArgumentsPredicate(postActionArguments.size()));
        postActionArgumentsPredicateList.add(postActionNamePredicate);
        postActionPredicate = PredicateUtils.allPredicate(postActionArgumentsPredicateList);
    } else {
        postActionPredicate = postActionNamePredicate;
    }

    // predicado do estado de origem
    Predicate sourcePredicate;
    if (!source.isAvailable()) {
        Collection sourcePredicateList = new ArrayList();
        for (Object currentSource : source.getValues()) {
            sourcePredicateList.add(new SourceStatePredicate((State) currentSource));
        }
        sourcePredicate = PredicateUtils.anyPredicate(sourcePredicateList);
    } else {
        sourcePredicate = TruePredicate.truePredicate();
    }

    // predicado do smbolo
    Predicate symbolPredicate;
    if (!symbol.isAvailable()) {
        Collection symbolPredicateList = new ArrayList();
        for (Object currentSymbol : symbol.getValues()) {
            if (currentSymbol != null) {
                symbolPredicateList.add(new SymbolPredicate((Symbol) currentSymbol));
            } else {
                symbolPredicateList.add(new EpsilonPredicate());
            }
        }
        symbolPredicate = PredicateUtils.anyPredicate(symbolPredicateList);
    } else {
        symbolPredicate = TruePredicate.truePredicate();
    }

    // predicado do estado de destino
    Predicate targetPredicate;
    if (!target.isAvailable()) {
        Collection targetPredicateList = new ArrayList();
        for (Object currentTarget : target.getValues()) {
            targetPredicateList.add(new TargetStatePredicate((State) currentTarget));
        }
        targetPredicate = PredicateUtils.anyPredicate(targetPredicateList);
    } else {
        targetPredicate = TruePredicate.truePredicate();
    }

    // a consulta  a interseco dos predicados
    Collection<Transition> query = CollectionUtils.select(transitions.getTransitions(),
            PredicateUtils.allPredicate(new Predicate[] { sourcePredicate, symbolPredicate, targetPredicate,
                    priorActionPredicate, postActionPredicate }));

    // conjuntos de resultados
    Set<Object> sourceResult = new HashSet<>();
    Set<Object> symbolResult = new HashSet<>();
    Set<Object> targetResult = new HashSet<>();
    Set<Object> priorActionNameResult = new HashSet<>();
    List<HashSet<Object>> priorActionArgumentsResult = new ArrayList<>();
    Set<Object> postActionNameResult = new HashSet<>();
    List<HashSet<Object>> postActionArgumentsResult = new ArrayList<>();

    // inicializa o conjunto de argumentos
    // da ao anterior, se existirem
    if (priorAction.hasArguments()) {
        for (Variable argument : priorAction.getArguments()) {
            priorActionArgumentsResult.add(new HashSet<>());
        }
    }

    // inicializa o conjunto de argumentos
    // da ao posterior, se existirem
    if (postAction.hasArguments()) {
        for (Variable argument : postAction.getArguments()) {
            postActionArgumentsResult.add(new HashSet<>());
        }
    }

    // preenche os conjuntos
    for (Transition transition : query) {
        sourceResult.add(transition.getSourceState());
        symbolResult.add(transition.getSymbol());
        targetResult.add(transition.getTargetState());
        priorActionNameResult.add(transition.getPriorActionCall());
        if (priorAction.hasArguments()) {
            for (int i = 0; i < priorAction.getArguments().size(); i++) {
                priorActionArgumentsResult.get(i).add(transition.getPriorActionArguments()[i]);
            }
        }
        postActionNameResult.add(transition.getPostActionCall());
        if (postAction.hasArguments()) {
            for (int i = 0; i < postAction.getArguments().size(); i++) {
                postActionArgumentsResult.get(i).add(transition.getPostActionArguments()[i]);
            }
        }
    }

    // preenche o estado de origem
    if (source.isAvailable()) {
        source.setValues(sourceResult);
    }

    // preenche o smbolo
    if (symbol.isAvailable()) {
        symbol.setValues(symbolResult);
    }

    // preenche o estado de destino
    if (target.isAvailable()) {
        target.setValues(targetResult);
    }

    // preenche o nome da ao anterior
    if (priorAction.getName().isAvailable()) {
        priorAction.getName().setValues(priorActionNameResult);
    }

    // preenche os argumentos da ao
    // anterior, se existirem
    if (priorAction.hasArguments()) {
        for (int i = 0; i < priorAction.getArguments().size(); i++) {
            if (priorAction.getArguments().get(i).isAvailable()) {
                priorAction.getArguments().get(i).setValues(priorActionArgumentsResult.get(i));
            }
        }
    }

    // preenche o nome da ao posterior
    if (postAction.getName().isAvailable()) {
        postAction.getName().setValues(postActionNameResult);
    }

    // preenche os argumentos da ao
    // posterior, se existirem
    if (postAction.hasArguments()) {
        for (int i = 0; i < postAction.getArguments().size(); i++) {
            if (postAction.getArguments().get(i).isAvailable()) {
                postAction.getArguments().get(i).setValues(postActionArgumentsResult.get(i));
            }
        }
    }
}