package com.conveyal.gtfs.error;

import java.io.Serializable;

/** Indicates that an entity referenced another entity that does not exist. */
public class ReferentialIntegrityError extends GTFSError implements Serializable {
    public static final long serialVersionUID = 1L;

    // TODO: maybe also store the entity ID of the entity which contained the bad reference, in addition to the row number
    public final String badReference;

    public ReferentialIntegrityError(String tableName, long row, String field, String badReference) {
        super(tableName, row, field);
        this.badReference = badReference;
    }

    @Override public String getMessage() {
        return String.format(badReference);
    }

}

@@ -623,16 +623,302 @@
 %0A    %7D%0A%0A
+    /** must be comparable to put into mapdb */%0A    @Override%0A    public int compareTo (GTFSError o) %7B%0A        int compare = super.compareTo(o);%0A        if (compare != 0) return compare;%0A        return this.badReference.compareTo((((ReferentialIntegrityError) o).badReference));%0A    %7D%0A%0A
     @Ove

fix compareTo so that multiple bad refs from same line are reported