MatchPattern.java revision 8f8adeb1540d89588dba4c26d00a6ed6887cf6de
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* 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.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: MatchPattern.java,v 1.2 2008/06/25 05:51:29 qcheng Exp $
*
*/
/*
* Portions Copyrighted 2014 ForgeRock AS.
* Portions Copyrighted 2014 Nomura Research Institute, Ltd.
*/
public class MatchPattern {
setIsActiveFlag(true);
setIgnoreCaseFlag(false);
setLastOccurranceInFile(false);
}
boolean matchFound = false;
if (lineLength >= patternLength) {
if (isMatchFromStart()) {
} else if (isMatchFromEnd()) {
} else if (isIgnoreCase()) {
matchFound = true;
}
matchFound = true;
}
}
return matchFound;
}
public boolean isMatchForLastOccurranceInFile() {
return lastOccurranceInFile;
}
public boolean isActive() {
return isActive;
}
public void setIsActiveFlag(boolean flag) {
}
public String getPattern() {
return pattern;
}
public int getMatchType() {
return matchType;
}
public void setIgnoreCaseFlag(boolean flag) {
ignoreCase = flag;
}
public void setLastOccurranceInFile(boolean flag) {
}
}
private boolean isMatchFromStart() {
return (getMatchType() == INT_MATCH_FROM_START);
}
private boolean isMatchFromEnd() {
return (getMatchType() == INT_MATCH_FROM_END);
}
private boolean isIgnoreCase() {
return ignoreCase;
}
}
private void setMatchType(int type) {
|| (type == INT_MATCH_OCCURRANCE)) {
} else {
throw new IllegalArgumentException("Invalid argument for match"
+ " type");
}
}
// Intially will be true. Once found it becomes inactive.
private boolean isActive;
// If true only the last occurrance will be removed. Otherwise the first.
private boolean lastOccurranceInFile;
private boolean ignoreCase;
private int matchType;
public static final int INT_MATCH_OCCURRANCE = 0;
public static final int INT_MATCH_FROM_START = 1;
public static final int INT_MATCH_FROM_END = 2;
}