package cn.lihongjie.coal.coalBlend.dto;

import cn.lihongjie.coal.coal.CoalInfo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Data
public class CoalBlendResult {
    private long numBranches = 0;
    private long numConflicts = 0;
    private long wallTime = 0;
    private long userTime = 0;
    private List<CoalInfo> coals = new ArrayList<>();
    private int totalCount;

    public String tableString() {

        String headerLine =
                String.format(
                        "totalCount %s numBranches %s numConflicts %s wallTime %s userTime %s \n",
                        totalCount, numBranches, numConflicts, wallTime, userTime);
        String collect = coals.stream().map(x -> x.rowString()).collect(Collectors.joining("\n"));
        return headerLine + collect;
    }
}
