    001    package org.maltparser.parser.algorithm.planar;
    002
    003    import org.maltparser.core.exception.MaltChainedException;
    004    import org.maltparser.core.feature.function.Function;
    005    import org.maltparser.parser.AbstractParserFactory;
    006    import org.maltparser.parser.Algorithm;
    007    import org.maltparser.parser.DependencyParserConfig;
    008    import org.maltparser.parser.ParserConfiguration;
    009    /**
    010     * @author Carlos Gomez Rodriguez
    011     *
    012     */
    013    public abstract class PlanarFactory implements AbstractParserFactory {
    014            protected Algorithm algorithm;
    015            protected DependencyParserConfig manager;
    016
    017            public PlanarFactory(Algorithm algorithm) {
    018                    setAlgorithm(algorithm);
    019                    setManager(algorithm.getManager());
    020            }
    021
    022            public ParserConfiguration makeParserConfiguration() throws MaltChainedException {
    023                    if (manager.getConfigLogger().isInfoEnabled()) {
    024                            manager.getConfigLogger().info("  Parser configuration : Planar with no_covered_roots = " + manager.getOptionValue("planar", "no_covered_roots").toString().toUpperCase() + ", " + "acyclicity = " + manager.getOptionValue("planar", "acyclicity").toString().toUpperCase() + ", connectedness = " + manager.getOptionValue("planar", "connectedness").toString().toUpperCase() + "\n");
    025                    }
    026                    return new PlanarConfig(manager.getSymbolTables() , manager.getOptionValue("planar", "no_covered_roots").toString() , manager.getOptionValue("planar", "acyclicity").toString() , manager.getOptionValue("planar", "connectedness").toString());
    027            }
    028
    029            public Function makeFunction(String subFunctionName) throws MaltChainedException {
    030                    return new PlanarAddressFunction(subFunctionName, algorithm);
    031            }
    032
    033            public Algorithm getAlgorithm() {
    034                    return algorithm;
    035            }
    036
    037            public void setAlgorithm(Algorithm algorithm) {
    038                    this.algorithm = algorithm;
    039            }
    040
    041            public DependencyParserConfig getManager() {
    042                    return manager;
    043            }
    044
    045            public void setManager(DependencyParserConfig manager) {
    046                    this.manager = manager;
    047            }
    048    }