public Circuit getCircuit ( Tile tile ) { final Collection < String > neighborGroups = getNeighborGroups ( tile ) ; final Collection < String > groups = new HashSet <> ( neighborGroups ) ; final String group = mapGroup . getGroup ( tile ) ; final Circuit circuit ; if ( groups . size ( ) == 1 ) { if ( group . equals ( groups . iterator ( ) . next ( ) ) ) { circuit = new Circuit ( CircuitType . MIDDLE , group , group ) ; } else { circuit = new Circuit ( CircuitType . BLOCK , group , groups . iterator ( ) . next ( ) ) ; } } else { circuit = getCircuitGroups ( group , neighborGroups ) ; } return circuit ; }
Get the tile circuit .