001package gudusoft.gsqlparser.slpc.adapter; 002 003import java.util.ArrayList; 004import java.util.Collections; 005import java.util.List; 006 007/** Exhaustive accounting of records read from one legacy dataflow result. */ 008public final class LegacyCoverageReport { 009 public enum Outcome { EXACT, CONDITIONAL, QUARANTINED, UNSUPPORTED_WITH_LOSS } 010 011 public static final class Entry { 012 private final String legacyKind, legacyId, slpcOwner, detail; 013 private final Outcome outcome; 014 Entry(String legacyKind, String legacyId, Outcome outcome, String slpcOwner, String detail) { 015 this.legacyKind = legacyKind; this.legacyId = legacyId; this.outcome = outcome; 016 this.slpcOwner = slpcOwner; this.detail = detail; 017 } 018 public String legacyKind() { return legacyKind; } 019 public String legacyId() { return legacyId; } 020 public Outcome outcome() { return outcome; } 021 public String slpcOwner() { return slpcOwner; } 022 public String detail() { return detail; } 023 } 024 025 private final List<Entry> entries; 026 private final int inputCount; 027 LegacyCoverageReport(int inputCount, List<Entry> entries) { 028 if (entries.size() > inputCount) throw new IllegalArgumentException("coverage entries exceed legacy input count"); 029 this.inputCount = inputCount; 030 this.entries = Collections.unmodifiableList(new ArrayList<Entry>(entries)); 031 } 032 public List<Entry> entries() { return entries; } 033 public int inputCount() { return inputCount; } 034 public int accountedCount() { return entries.size(); } 035 public int unaccountedCount() { return inputCount - entries.size(); } 036 public int count(Outcome outcome) { int result = 0; for (Entry entry : entries) if (entry.outcome == outcome) result++; return result; } 037}