private String getTransitiveGroup(Circuit initialCircuit, Tile tile)
    {
        final Set<Circuit> circuitSet = circuits.keySet();
        final Collection<String> groups = new HashSet<>(circuitSet.size());
        final String groupIn = mapGroup.getGroup(tile);
        for (final Circuit circuit : circuitSet)
        {
            final String groupOut = circuit.getOut();
            for (final Tile neighbor : map.getNeighbors(tile))
            {
                final String groupNeighbor = mapGroup.getGroup(neighbor);
                if (groupNeighbor.equals(groupOut) && !groupNeighbor.equals(groupIn))
                {
                    return groupOut;
                }
            }
            groups.add(groupOut);
        }
        return getShortestTransitiveGroup(groups, initialCircuit);
    }
private String getTransitiveGroup ( Circuit initialCircuit , Tile tile ) { final Set < Circuit > circuitSet = circuits . keySet ( ) ; final Collection < String > groups = new HashSet < > ( circuitSet . size ( ) ) ; final String groupIn = mapGroup . getGroup ( tile ) ; for ( final Circuit circuit : circuitSet ) { final String groupOut = circuit . getOut ( ) ; for ( final Tile neighbor : map . getNeighbors ( tile ) ) { final String groupNeighbor = mapGroup . getGroup ( neighbor ) ; if ( groupNeighbor . equals ( groupOut ) && ! groupNeighbor . equals ( groupIn ) ) { return groupOut ; } } groups . add ( groupOut ) ; } return getShortestTransitiveGroup ( groups , initialCircuit ) ; }
Get the transitive group by replacing the transition group name with the plain one.

@param initialCircuit The initial circuit.
@param tile The tile reference.
@return The plain group name.