class SysAllocations implements Iterable<SysAllocation> {

    private final ClusterService clusterService;
    private final ClusterInfoService clusterInfoService;
    private final AllocationDeciders allocationDeciders;
    private final AllocationService allocationService;
    private final SnapshotsInfoService snapshotInfoService;

    @Inject
    public SysAllocations(ClusterService clusterService,
                          ClusterInfoService clusterInfoService,
                          SnapshotsInfoService snapshotInfoService,
                          AllocationDeciders allocationDeciders,
                          AllocationService allocationService) {
        this.clusterService = clusterService;
        this.clusterInfoService = clusterInfoService;
        this.snapshotInfoService = snapshotInfoService;
        this.allocationDeciders = allocationDeciders;
        this.allocationService = allocationService;
    }

    @Override
    public Iterator<SysAllocation> iterator() {<FILL_FUNCTION_BODY>}

    private SysAllocation createSysAllocations(RoutingAllocation allocation, ShardRouting shardRouting) {
        allocation.setDebugMode(RoutingAllocation.DebugMode.EXCLUDE_YES_DECISIONS);
        Supplier<ShardAllocationDecision> shardDecision = () -> {
            if (shardRouting.initializing() || shardRouting.relocating()) {
                return ShardAllocationDecision.NOT_TAKEN;
            } else {
                return allocationService.explainShardAllocation(shardRouting, allocation);
            }
        };
        return new SysAllocation(
            shardRouting.shardId(),
            shardRouting.state(),
            shardDecision,
            shardRouting.currentNodeId(),
            shardRouting.primary()
        );
    }
}

        final ClusterState state = clusterService.state();
        final RoutingNodes routingNodes = state.getRoutingNodes();
        final ClusterInfo clusterInfo = clusterInfoService.getClusterInfo();
        final RoutingAllocation allocation = new RoutingAllocation(
            allocationDeciders,
            routingNodes,
            state,
            clusterInfo,
            snapshotInfoService.snapshotShardSizes(),
            System.nanoTime()
        );
        return allocation.routingTable().allShards()
            .stream()
            .filter(shardRouting -> !IndexParts.isDangling(shardRouting.getIndexName()))
            .map(shardRouting -> createSysAllocations(allocation, shardRouting))
            .iterator();
    
<no_super_class>