// Path: src/main/java/de/skuzzle/enforcer/restrictimports/util/Preconditions.java
// public final class Preconditions {
// 
//     public static void checkArgument(boolean condition) {
//         checkArgument(condition, "Unexpected argument");
//     }
// 
//     public static void checkArgument(boolean condition, String message, Object... args) {
//         if (!condition) {
//             throw new IllegalArgumentException(String.format(message, args));
//         }
//     }
// 
//     public static void checkState(boolean condition) {
//         checkState(condition, "Unexpected state");
//     }
// 
//     public static void checkState(boolean condition, String message, Object... args) {
//         if (!condition) {
//             throw new IllegalStateException(String.format(message, args));
//         }
//     }
// 
//     private Preconditions() {
//         throw new IllegalStateException("hidden");
//     }
// }
// 
// Path: src/main/java/de/skuzzle/enforcer/restrictimports/util/StringRepresentation.java
// public final class StringRepresentation {
// 
//     private final String name;
//     private final List<Attribute> attributes = new ArrayList<>();
// 
//     private StringRepresentation(String name) {
//         this.name = name;
//     }
// 
//     public static StringRepresentation ofType(Class<?> type) {
//         return new StringRepresentation(type.getSimpleName());
//     }
// 
//     public static StringRepresentation ofInstance(Object instance) {
//         return ofType(instance.getClass());
//     }
// 
//     public StringRepresentation add(String attribute, Object value) {
//         attributes.add(new Attribute(attribute, value));
//         return this;
//     }
// 
//     @Override
//     public String toString() {
//         return new StringBuilder(name)
//                 .append("{")
//                 .append(attributes.stream().map(Attribute::toString).collect(Collectors.joining(", ")))
//                 .append("}")
//                 .toString();
//     }
// 
//     private static final class Attribute {
//         private final String name;
//         private final Object value;
// 
//         private Attribute(String name, Object value) {
//             this.name = name;
//             this.value = value;
//         }
// 
//         @Override
//         public String toString() {
//             return name + "=" + value;
//         }
//     }
// }


import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import de.skuzzle.enforcer.restrictimports.util.Preconditions;
import de.skuzzle.enforcer.restrictimports.util.StringRepresentation;
package de.skuzzle.enforcer.restrictimports.analyze;



/**
 * Holds the matches that were found within a single source file. Instances can be
 * constructed using {@link #forSourceFile(Path)}.
 *
 * @author Simon Taddiken
 */
public final class MatchedFile {

    private final Path sourceFile;
    private final List<MatchedImport> matchedImports;
    private final BannedImportGroup matchedBy;

// Path: src/main/java/de/skuzzle/enforcer/restrictimports/util/Preconditions.java
// public final class Preconditions {
// 
//     public static void checkArgument(boolean condition) {
//         checkArgument(condition, "Unexpected argument");
//     }
// 
//     public static void checkArgument(boolean condition, String message, Object... args) {
//         if (!condition) {
//             throw new IllegalArgumentException(String.format(message, args));
//         }
//     }
// 
//     public static void checkState(boolean condition) {
//         checkState(condition, "Unexpected state");
//     }
// 
//     public static void checkState(boolean condition, String message, Object... args) {
//         if (!condition) {
//             throw new IllegalStateException(String.format(message, args));
//         }
//     }
// 
//     private Preconditions() {
//         throw new IllegalStateException("hidden");
//     }
// }
// 
// Path: src/main/java/de/skuzzle/enforcer/restrictimports/util/StringRepresentation.java
// public final class StringRepresentation {
// 
//     private final String name;
//     private final List<Attribute> attributes = new ArrayList<>();
// 
//     private StringRepresentation(String name) {
//         this.name = name;
//     }
// 
//     public static StringRepresentation ofType(Class<?> type) {
//         return new StringRepresentation(type.getSimpleName());
//     }
// 
//     public static StringRepresentation ofInstance(Object instance) {
//         return ofType(instance.getClass());
//     }
// 
//     public StringRepresentation add(String attribute, Object value) {
//         attributes.add(new Attribute(attribute, value));
//         return this;
//     }
// 
//     @Override
//     public String toString() {
//         return new StringBuilder(name)
//                 .append("{")
//                 .append(attributes.stream().map(Attribute::toString).collect(Collectors.joining(", ")))
//                 .append("}")
//                 .toString();
//     }
// 
//     private static final class Attribute {
//         private final String name;
//         private final Object value;
// 
//         private Attribute(String name, Object value) {
//             this.name = name;
//             this.value = value;
//         }
// 
//         @Override
//         public String toString() {
//             return name + "=" + value;
//         }
//     }
// }


// Path: src/main/java/de/skuzzle/enforcer/restrictimports/analyze/MatchedFile.java
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import de.skuzzle.enforcer.restrictimports.util.Preconditions;
import de.skuzzle.enforcer.restrictimports.util.StringRepresentation;

package de.skuzzle.enforcer.restrictimports.analyze;



/**
 * Holds the matches that were found within a single source file. Instances can be
 * constructed using {@link #forSourceFile(Path)}.
 *
 * @author Simon Taddiken
 */
public final class MatchedFile {

    private final Path sourceFile;
    private final List<MatchedImport> matchedImports;
    private final BannedImportGroup matchedBy;

    MatchedFile(Path sourceFile, List<MatchedImport> matchedImports, BannedImportGroup matchedBy) {