001package org.hl7.fhir.validation.cli.utils;
002
003import org.hl7.fhir.utilities.VersionUtilities;
004
005import java.util.ArrayList;
006import java.util.Collections;
007import java.util.List;
008
009public class VersionSourceInformation {
010
011  private final List<String> report = new ArrayList<>();
012  private final List<String> versions = new ArrayList<>();
013
014  public void see(String version, String src) {
015    version = VersionUtilities.getMajMin(version);
016    report.add(src + ": " + version);
017    if (!versions.contains(version)) {
018      versions.add(version);
019      Collections.sort(versions);
020    }
021  }
022
023  public boolean isEmpty() {
024    return versions.isEmpty();
025  }
026
027  public int size() {
028    return versions.size();
029  }
030
031  public String version() {
032    return versions.get(0);
033  }
034
035  public List<String> getReport() {
036    if (report.isEmpty()) {
037      report.add("(nothing found)");
038    }
039    return report;
040  }
041}