blob: 8a00f61c579de370e058fccb364942c92ca09657 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pierre Allard,
* Regent L'Archeveque,
* Sebastien Gemme - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.topology.impl;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class RegexNodeFilterCustomImpl extends RegexNodeFilterImpl {
protected Pattern pattern = null;
protected Pattern getPattern() {
if (this.pattern == null) {
this.pattern = Pattern.compile(getRegex());
}
return this.pattern;
}
protected boolean matchesPattern(String stringToTest) {
if (stringToTest != null) {
Matcher m = getPattern().matcher(stringToTest);
return m.find();
} else {
return false;
}
}
} // RegexNodeFilterImpl