// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }


import de.jformchecker.Criterion;
package de.jformchecker.criteria;


/**
 * Checks if string is equal to one of the passed in strings.
 * 
 * Based on work of armandino (at) gmail.com
 */
public final class AcceptString extends Accept {
	private boolean caseSensitive = true;

	AcceptString(String... values) {
		super(values);
	}

	protected boolean areEqual(String v1, String v2) {
		if (caseSensitive)
			return super.areEqual(v1, v2);

		return v1.equalsIgnoreCase(v2);
	}

	/**
	 * Specifies string comparison to be case-insensitive.
	 */
// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }


// Path: src/main/java/de/jformchecker/criteria/AcceptString.java
import de.jformchecker.Criterion;

package de.jformchecker.criteria;


/**
 * Checks if string is equal to one of the passed in strings.
 * 
 * Based on work of armandino (at) gmail.com
 */
public final class AcceptString extends Accept {
	private boolean caseSensitive = true;

	AcceptString(String... values) {
		super(values);
	}

	protected boolean areEqual(String v1, String v2) {
		if (caseSensitive)
			return super.areEqual(v1, v2);

		return v1.equalsIgnoreCase(v2);
	}

	/**
	 * Specifies string comparison to be case-insensitive.
	 */
	public Criterion ignoreCase() {