public Set getTransitions()

in src/main/software/amazon/event/ruler/CompoundByteTransition.java [172:201]


    public Set<ByteTransition> getTransitions() {
        // Determine all unique ceilings held in the ByteMaps of all nextByteStates.
        Set<Integer> allCeilings = new TreeSet<>();
        for (SingleByteTransition transition : byteTransitions) {
            ByteState nextByteState = transition.getNextByteState();
            if (nextByteState != null) {
                allCeilings.addAll(nextByteState.getCeilings());
            }
        }

        // For each unique ceiling, determine all singular transitions accessible for that byte value, then add
        // coalesced version to final result.
        Set<ByteTransition> result = new HashSet<>();
        for (Integer ceiling : allCeilings) {
            Set<SingleByteTransition> singles = new HashSet<>();
            for (SingleByteTransition transition : byteTransitions) {
                ByteTransition nextTransition = transition.getTransition((byte) (ceiling - 1));
                if (nextTransition != null) {
                    nextTransition.expand().forEach(t -> singles.add(t));
                }
            }

            ByteTransition coalesced = coalesce(singles);
            if (coalesced != null) {
                result.add(coalesced);
            }
        }

        return result;
    }