Filter.java revision ff5eba819da0cf7964d884630fb13262ef12c505
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
public class Filter implements Serializable {
private static final long serialVersionUID = 3L;
/** The list of exact filenames */
/** The list of filenames with wildcards */
/** The list of paths */
/**
* The full list of all patterns. This list will be saved in the
* configuration file (if used)
*/
public Filter() {
items = new PatternList(this);
}
public boolean isEmpty() {
}
/**
* Get the complete list of items that would be matched by this matcher
* @return a list of all wildcards, exact lists and paths that this filter
* contains
*/
return items;
}
/**
* Specify a new filter to use
* @param item the new filter
*/
clear();
add(s);
}
}
/**
* Add a pattern to the list of patterns
* @param pattern the pattern to filename
*/
}
}
/**
* Remove all installed patterns from the list of files to filename
*/
public void clear() {
}
/**
* Should the file be ignored or not?
* @param file the file to check
* @return true if this file should be ignored, false otherwise
*/
boolean ret = false;
ret = true;
} else {
if (m.matches()) {
ret = true;
break;
}
}
}
if (!ret) {
ret = true;
break;
}
}
}
return ret;
}
/**
* Should the file be ignored or not?
* @param name the name of the file to check
* @return true if this pathname should be ignored, false otherwise
*/
}
/**
* Add a pattern to the correct list of internal filters to match
*
* @param pattern the pattern to add
*/
@SuppressWarnings("PMD.ConfusingTernary")
} else {
}
} else {
}
}
/**
* Convert the glob pattern (examples: *.c, *.?xx) to a regular expression
* and compile it.
*
* @param pattern a pattern to match file names against
* @return a compiled regular expression representing the pattern
*/
// Build the regex by replacing "*" with ".*" and "?" with ".". All
// other characters should be quoted to ensure exact match.
int pos = 0;
// Quote the characters up to next wildcard or end of string.
}
// Replace wildcard with equivalent regular expression.
} else {
}
pos++;
}
}
// Compile the regex.
}
}
if (ret) {
}
return ret;
}
}
}