// Path: src/main/java/com/connect_group/thymesheet/css/selectors/Specifier.java
// public interface Specifier {
// 
//     /** The specifier type. */
//     public static enum Type {
//         ATTRIBUTE, PSEUDO, NEGATION
//     };
// 
//     /**
//      * Get the specifier type.
//      * 
//      * @return The specifier type.
//      */
//     public Type getType();
// 
// }
// 
// Path: src/main/java/com/connect_group/thymesheet/css/util/Assert.java
// public final class Assert {
// 
//     /**
//      * Private CTOR.
//      */
//     private Assert() {
//     }
//     
//     /**
//      * Check if the specified {@code expression} is {@code true}. If not throw an
//      * {@link IllegalArgumentException} with the specified {@code message}.
//      * 
//      * @param expression The expression to check.
//      * @param message The exception message if the {@code expression} is {@code false}.
//      */
//     public static void isTrue(boolean expression, String message) {
//         if (!expression) {
//             throw new IllegalArgumentException(message);
//         }
//     }
//     
//     /**
//      * Check if the specified {@code object} is {@code null}, and throw an
//      * {@link IllegalArgumentException} if it is.
//      *  
//      * @param object The object to check.
//      * @param message The exception message if the {@code object} is {@code null}.
//      */
//     public static void notNull(Object object, String message) {
//         if (object == null) {
//             throw new IllegalArgumentException(message);
//         }
//     }
//     
// }


import com.connect_group.thymesheet.css.selectors.Specifier;
import com.connect_group.thymesheet.css.util.Assert;

/**
 * Copyright (c) 2009-2012, Christer Sandberg
 * Thymesheet modifications Copyright (c) 2013 Adam Perry, Connect Group
 */
package com.connect_group.thymesheet.css.selectors.specifier;


/**
 * An implementation of {@link Specifier} for attributes.
 * <p>
 * Note:
 * <br>
 * This implementation will also be used for ID selectors and class selectors.
 * 
 * @see <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">Attribute selectors</a>
 * 
 * @author Christer Sandberg
 */
public class AttributeSpecifier implements Specifier {

    /** The type of match to perform for the attribute. */
    public static enum Match {
        EXACT, LIST, HYPHEN, PREFIX, SUFFIX, CONTAINS
    };

    /** The name of the attribute. */
    private final String name;

    /** The attribute value. */
    private final String value;

    /** The type of match to perform for the attribute. */
    private final Match match;

    /**
     * Create a new attribute specifier with the specified attribute name.
     * <p>
     * This attribute specifier is used to check if the attribute with the
     * specified name exists whatever the value of the attribute.
     *  
     * @param name The name of the attribute.
     */
    public AttributeSpecifier(String name) {
        Assert.notNull(name, "name is null!");
        this.name = name;
        this.value = null;
        this.match = null;
    }

    /**
     * Create a new attribute specifier with the specified name, value and match type.
     * 
     * @param name The name of the attribute.
     * @param value The attribute value.
     * @param match The type of match to perform for the attribute.
     */
    public AttributeSpecifier(String name, String value, Match match) {
        Assert.notNull(name, "name is null!");
        Assert.notNull(value, "value is null!");

// Path: src/main/java/com/connect_group/thymesheet/css/selectors/Specifier.java
// public interface Specifier {
// 
//     /** The specifier type. */
//     public static enum Type {
//         ATTRIBUTE, PSEUDO, NEGATION
//     };
// 
//     /**
//      * Get the specifier type.
//      * 
//      * @return The specifier type.
//      */
//     public Type getType();
// 
// }
// 
// Path: src/main/java/com/connect_group/thymesheet/css/util/Assert.java
// public final class Assert {
// 
//     /**
//      * Private CTOR.
//      */
//     private Assert() {
//     }
//     
//     /**
//      * Check if the specified {@code expression} is {@code true}. If not throw an
//      * {@link IllegalArgumentException} with the specified {@code message}.
//      * 
//      * @param expression The expression to check.
//      * @param message The exception message if the {@code expression} is {@code false}.
//      */
//     public static void isTrue(boolean expression, String message) {
//         if (!expression) {
//             throw new IllegalArgumentException(message);
//         }
//     }
//     
//     /**
//      * Check if the specified {@code object} is {@code null}, and throw an
//      * {@link IllegalArgumentException} if it is.
//      *  
//      * @param object The object to check.
//      * @param message The exception message if the {@code object} is {@code null}.
//      */
//     public static void notNull(Object object, String message) {
//         if (object == null) {
//             throw new IllegalArgumentException(message);
//         }
//     }
//     
// }


// Path: src/main/java/com/connect_group/thymesheet/css/selectors/specifier/AttributeSpecifier.java
import com.connect_group.thymesheet.css.selectors.Specifier;
import com.connect_group.thymesheet.css.util.Assert;

/**
 * Copyright (c) 2009-2012, Christer Sandberg
 * Thymesheet modifications Copyright (c) 2013 Adam Perry, Connect Group
 */
package com.connect_group.thymesheet.css.selectors.specifier;


/**
 * An implementation of {@link Specifier} for attributes.
 * <p>
 * Note:
 * <br>
 * This implementation will also be used for ID selectors and class selectors.
 * 
 * @see <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">Attribute selectors</a>
 * 
 * @author Christer Sandberg
 */
public class AttributeSpecifier implements Specifier {

    /** The type of match to perform for the attribute. */
    public static enum Match {
        EXACT, LIST, HYPHEN, PREFIX, SUFFIX, CONTAINS
    };

    /** The name of the attribute. */
    private final String name;

    /** The attribute value. */
    private final String value;

    /** The type of match to perform for the attribute. */
    private final Match match;

    /**
     * Create a new attribute specifier with the specified attribute name.
     * <p>
     * This attribute specifier is used to check if the attribute with the
     * specified name exists whatever the value of the attribute.
     *  
     * @param name The name of the attribute.
     */
    public AttributeSpecifier(String name) {
        Assert.notNull(name, "name is null!");
        this.name = name;
        this.value = null;
        this.match = null;
    }

    /**
     * Create a new attribute specifier with the specified name, value and match type.
     * 
     * @param name The name of the attribute.
     * @param value The attribute value.
     * @param match The type of match to perform for the attribute.
     */
    public AttributeSpecifier(String name, String value, Match match) {
        Assert.notNull(name, "name is null!");
        Assert.notNull(value, "value is null!");

        Assert.notNull(match, "match is null!");
