// 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/Whitespaces.java
// public final class Whitespaces {
// 
//     private static final Pattern LEADING = Pattern.compile("^\\s+");
//     private static final Pattern TRAILING = Pattern.compile("\\s+$");
// 
//     /**
//      * Trims all leading and trailing whitespaces (regex pattern class <code>\s</code>)
//      *
//      * @param s The string to trim.
//      * @return The trimmed string.
//      */
//     public static final String trimAll(String s) {
//         final Matcher leadingMatcher = LEADING.matcher(s);
//         final Matcher trailingMatcher = TRAILING.matcher(s);
//         final boolean hasLeading = leadingMatcher.find();
//         final boolean hasTrailing = trailingMatcher.find();
//         if (!hasLeading && !hasTrailing) {
//             return s;
//         }
//         final int start = hasLeading ? leadingMatcher.end() : 0;
//         final int end = hasTrailing ? trailingMatcher.start() : s.length();
//         return s.substring(start, end);
//     }
// 
//     private Whitespaces() {
//         // hidden
//     }
// }


import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import de.skuzzle.enforcer.restrictimports.util.Preconditions;
import de.skuzzle.enforcer.restrictimports.util.Whitespaces;
package de.skuzzle.enforcer.restrictimports.analyze;



/**
 * Pattern class to match java style package and class names using wild card operators.
 *
 * @author Simon Taddiken
 */
public final class PackagePattern implements Comparable<PackagePattern> {

    private static final String STATIC_PREFIX = "static";

    private final String[] parts;
    private final boolean staticc;

    private PackagePattern(String s) {
        final ParseResult parsed = ParseResult.parse(s);
        this.staticc = parsed.staticc;
        this.parts = parsed.parts;
        checkParts(s, this.parts);
    }

    private static class ParseResult {
        private static final Pattern STATIC_PREFIX_PATTERN = Pattern.compile("^" + STATIC_PREFIX + "\\s+");

        private final String[] parts;
        private final boolean staticc;

        private ParseResult(String[] parts, boolean staticc) {
            this.parts = parts;
            this.staticc = staticc;
        }

        static ParseResult parse(String s) {
// 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/Whitespaces.java
// public final class Whitespaces {
// 
//     private static final Pattern LEADING = Pattern.compile("^\\s+");
//     private static final Pattern TRAILING = Pattern.compile("\\s+$");
// 
//     /**
//      * Trims all leading and trailing whitespaces (regex pattern class <code>\s</code>)
//      *
//      * @param s The string to trim.
//      * @return The trimmed string.
//      */
//     public static final String trimAll(String s) {
//         final Matcher leadingMatcher = LEADING.matcher(s);
//         final Matcher trailingMatcher = TRAILING.matcher(s);
//         final boolean hasLeading = leadingMatcher.find();
//         final boolean hasTrailing = trailingMatcher.find();
//         if (!hasLeading && !hasTrailing) {
//             return s;
//         }
//         final int start = hasLeading ? leadingMatcher.end() : 0;
//         final int end = hasTrailing ? trailingMatcher.start() : s.length();
//         return s.substring(start, end);
//     }
// 
//     private Whitespaces() {
//         // hidden
//     }
// }


// Path: src/main/java/de/skuzzle/enforcer/restrictimports/analyze/PackagePattern.java
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import de.skuzzle.enforcer.restrictimports.util.Preconditions;
import de.skuzzle.enforcer.restrictimports.util.Whitespaces;

package de.skuzzle.enforcer.restrictimports.analyze;



/**
 * Pattern class to match java style package and class names using wild card operators.
 *
 * @author Simon Taddiken
 */
public final class PackagePattern implements Comparable<PackagePattern> {

    private static final String STATIC_PREFIX = "static";

    private final String[] parts;
    private final boolean staticc;

    private PackagePattern(String s) {
        final ParseResult parsed = ParseResult.parse(s);
        this.staticc = parsed.staticc;
        this.parts = parsed.parts;
        checkParts(s, this.parts);
    }

    private static class ParseResult {
        private static final Pattern STATIC_PREFIX_PATTERN = Pattern.compile("^" + STATIC_PREFIX + "\\s+");

        private final String[] parts;
        private final boolean staticc;

        private ParseResult(String[] parts, boolean staticc) {
            this.parts = parts;
            this.staticc = staticc;
        }

        static ParseResult parse(String s) {
            String trimmed = Whitespaces.trimAll(s);