
org.eobjects.analyzer.reference.SimpleStringPattern Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AnalyzerBeans-pattern-finder
Show all versions of AnalyzerBeans-pattern-finder
Pattern finder component for AnalyzerBeans
The newest version!
/**
* AnalyzerBeans
* Copyright (C) 2014 Neopost - Customer Information Management
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.eobjects.analyzer.reference;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;
import org.eobjects.analyzer.beans.stringpattern.DefaultTokenizer;
import org.eobjects.analyzer.beans.stringpattern.Token;
import org.eobjects.analyzer.beans.stringpattern.TokenPattern;
import org.eobjects.analyzer.beans.stringpattern.TokenPatternImpl;
import org.eobjects.analyzer.beans.stringpattern.Tokenizer;
import org.eobjects.analyzer.beans.stringpattern.TokenizerConfiguration;
import org.eobjects.analyzer.util.LabelUtils;
import org.eobjects.analyzer.util.ReadObjectBuilder;
/**
* Represents a string pattern that is based on a sequence of token types. The
* pattern format is similar to the one used by the Pattern finder analyzer,
* which makes it ideal for reusing discovered patterns.
*
* @see TokenPattern
*
*
*/
public final class SimpleStringPattern extends AbstractReferenceData implements StringPattern {
private static final long serialVersionUID = 1L;
private final String _expression;
private transient TokenPattern _tokenPattern;
private transient DefaultTokenizer _tokenizer;
private transient TokenizerConfiguration _configuration;
public SimpleStringPattern(String name, String expression) {
this(name, expression, new TokenizerConfiguration());
}
public SimpleStringPattern(String name, String expression, TokenizerConfiguration configuration) {
super(name);
_expression = expression;
_configuration = configuration;
}
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
ReadObjectBuilder.create(this, SimpleStringPattern.class).readObject(stream);
}
@Override
protected void decorateIdentity(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy