001package fr.aumgn.bukkitutils.glob;
002
003import java.util.List;
004
005/**
006 * GlobPattern interface.
007 *
008 * To build a glob pattern you should use
009 * the builder class Glob.
010 *
011 * A GlobPattern is defined from a string
012 * which can contains special matching sequence:
013 * <ul>
014 *   <li>
015 *     "*" (wildcard):
016 *     Matches any number of any characters.
017 *   </li>
018 *   <li>
019 *     "?":
020 *     Matches any character.
021 *   </li>
022 *   <li>
023 *     "[abc]" (characters class):
024 *     Matches all given characters
025 *   </li>
026 *   <li>
027 *     "[^abc] (inverted characters class):
028 *     Matches all characters except the given one
029 *   </li>
030 * </ul>
031 */
032public interface GlobPattern<T> {
033
034    /**
035     * Checks if this pattern matches the given obj.
036     */
037    boolean match(T obj);
038
039    /**
040     * Filters the given array of objects using this
041     * pattern.
042     */
043    List<T> filter(T... objects);
044
045    /**
046     * Filters the given list of objects using this
047     * pattern.
048     */
049    List<T> filter(List<T> objects);
050}