Example usage for org.apache.commons.collections4 Bag add

List of usage examples for org.apache.commons.collections4 Bag add

Introduction

In this page you can find the example usage for org.apache.commons.collections4 Bag add.

Prototype

boolean add(E object, int nCopies);

Source Link

Document

Adds nCopies copies of the specified object to the Bag.

Usage

From source file:uniol.apt.analysis.synthesize.separation.KBoundedSeparation.java

private Bag<State> expand(Bag<State> input, Event event, int g, boolean forward) {
    TransitionSystem ts = utility.getTransitionSystem();
    Bag<State> result = new HashBag<State>();

    for (State state : ts.getNodes()) {
        int increment = 0;
        for (Arc arc : forward ? state.getPostsetEdges() : state.getPresetEdges()) {
            if (arc.getEvent().equals(event)) {
                int value = getGradient(input, arc) - g;
                if (!forward)
                    value = -value;//from   w  ww .j  a  va  2s. co  m
                if (value > increment)
                    increment = value;
            }
        }
        result.add(state, input.getCount(state) + increment);
    }

    return result;
}