![JAR search and dependency download from the Maven repository](/logo.png)
src.it.unimi.dsi.big.mg4j.util.MG4JClassParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mg4j-big Show documentation
Show all versions of mg4j-big Show documentation
MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java. The big version is a fork of the original MG4J that can handle more than 2^31 terms and documents.
The newest version!
package it.unimi.dsi.big.mg4j.util;
/*
* Copyright (C) 2007-2011 Sebastiano Vigna
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* 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 General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*
*/
import com.martiansoftware.jsap.ParseException;
import com.martiansoftware.jsap.stringparsers.ClassStringParser;
/** A small wrapper around JSAP's standard {@link ClassStringParser}. It
* tries to prefix it.unimi.dsi.big.mg4j.package. to the provided
* class name, making the specification of graph classes on the command line much easier.
*/
public class MG4JClassParser extends ClassStringParser {
private final static MG4JClassParser INSTANCE = new MG4JClassParser();
public final static String[] PACKAGE = { "it.unimi.dsi.big.mg4j.compression", "it.unimi.dsi.big.mg4j.document", "it.unimi.dsi.big.mg4j.index", "it.unimi.dsi.big.mg4j.index.snowball", "it.unimi.dsi.big.mg4j.index.cluster", "it.unimi.dsi.big.mg4j.index.payload", "it.unimi.dsi.big.mg4j.index.remote", "it.unimi.dsi.big.mg4j.io", "it.unimi.dsi.big.mg4j.query", "it.unimi.dsi.big.mg4j.query.parser", "it.unimi.dsi.big.mg4j.search", "it.unimi.dsi.big.mg4j.search.score", "it.unimi.dsi.big.mg4j.tool", "it.unimi.dsi.big.mg4j.util" };
@SuppressWarnings("deprecation")
protected MG4JClassParser() {}
public static ClassStringParser getParser() {
return INSTANCE;
}
/** Parses the given class name, but as a first try prepends it.unimi.dsi.big.mg4j.package..
*
* @param className the name of a class, possibly without package specification.
*/
@Override
public Object parse( String className ) throws ParseException {
for( String p: PACKAGE ) {
try {
return super.parse( p + "." + className );
}
catch( Exception notFound ) {}
}
return super.parse( className );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy