/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.runtime.taskexecutor;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

import static org.apache.flink.util.Preconditions.checkNotNull;

/**
 * A report about the current status of all slots of the TaskExecutor, describing
 * which slots are available and allocated, and what jobs (JobManagers) the allocated slots
 * have been allocated to.
 */
public class SlotReport implements Serializable, Iterable<SlotStatus> {

	private static final long serialVersionUID = -3150175198722481689L;

	/** The slots status of the TaskManager. */
	private final Collection<SlotStatus> slotsStatus;

	public SlotReport() {
		this(Collections.<SlotStatus>emptyList());
	}

	public SlotReport(SlotStatus slotStatus) {
		this(Collections.singletonList(slotStatus));
	}

	public SlotReport(final Collection<SlotStatus> slotsStatus) {
		this.slotsStatus = checkNotNull(slotsStatus);
	}

	public int getNumSlotStatus() {
		return slotsStatus.size();
	}

	@Override
	public Iterator<SlotStatus> iterator() {
		return slotsStatus.iterator();
	}

	@Override
	public String toString() {
		return "SlotReport{" +
			"slotsStatus=" + slotsStatus +
			'}';
	}
}

@@ -958,24 +958,60 @@
 il.Iterator;
+%0Aimport java.util.stream.Collectors;
 %0A%0Aimport sta
@@ -1997,71 +1997,291 @@
 %7B%0A%09%09
-return %22SlotReport%7B%22 +%0A%09%09%09%22slotsStatus=%22 + s
+final String lineSeparator = slotsStatus.size() == 1 %7C%7C slotsStatus.size() %3E 10%0A%09%09%09? %22%22%0A%09%09%09: System.lineSeparator();%0A%0A%09%09return slotsStatus.stream()%0A%09%09%09.map(S
 lot
-s
 Status
- +%0A%09%09%09'%7D'
+::toString)%0A%09%09%09.map(s -%3E %22%5Ct%22 + s)%0A%09%09%09.collect(Collectors.joining(lineSeparator, %22SlotReport%7B%22 + lineSeparator, %22%7D%22))
 ;%0A%09%7D

Add line-breaks and intendation in SlotReport#toString