001package org.maltparser.core.propagation; 002 003import java.net.URL; 004 005 006import org.maltparser.core.exception.MaltChainedException; 007import org.maltparser.core.propagation.spec.PropagationSpecs; 008import org.maltparser.core.propagation.spec.PropagationSpecsReader; 009import org.maltparser.core.symbol.SymbolTableHandler; 010import org.maltparser.core.syntaxgraph.edge.Edge; 011import org.maltparser.core.io.dataformat.DataFormatInstance; 012 013public class PropagationManager { 014 private final PropagationSpecs propagationSpecs; 015 private Propagations propagations; 016 017 public PropagationManager() { 018 propagationSpecs = new PropagationSpecs(); 019 } 020 021 public void loadSpecification(URL propagationSpecURL) throws MaltChainedException { 022 PropagationSpecsReader reader = new PropagationSpecsReader(); 023 reader.load(propagationSpecURL, propagationSpecs); 024 } 025 026 public void createPropagations(DataFormatInstance dataFormatInstance, SymbolTableHandler tableHandler) throws MaltChainedException { 027 propagations = new Propagations(propagationSpecs, dataFormatInstance, tableHandler); 028 } 029 030 public void propagate(Edge e) throws MaltChainedException { 031 if (propagations != null && e != null) { 032 propagations.propagate(e); 033 } 034 } 035 036 public PropagationSpecs getPropagationSpecs() { 037 return propagationSpecs; 038 } 039 040 public Propagations getPropagations() { 041 return propagations; 042 } 043}