001    package org.maltparser.core.propagation;
002    
003    import java.util.ArrayList;
004    
005    import org.maltparser.core.exception.MaltChainedException;
006    import org.maltparser.core.propagation.spec.PropagationSpec;
007    import org.maltparser.core.propagation.spec.PropagationSpecs;
008    import org.maltparser.core.symbol.SymbolTableHandler;
009    import org.maltparser.core.syntaxgraph.edge.Edge;
010    
011    public class Propagations {
012            private ArrayList<Propagation> propagations;
013            private SymbolTableHandler symbolTables;
014            
015            public Propagations(PropagationSpecs specs, SymbolTableHandler symbolTables) throws MaltChainedException {
016                    setSymbolTables(symbolTables);
017                    propagations = new ArrayList<Propagation>(specs.size());
018                    for (PropagationSpec spec : specs) {
019                            propagations.add(new Propagation(spec, symbolTables));
020                    }
021            }
022    
023            public void propagate(Edge e) throws MaltChainedException {
024                    for (Propagation propagation : propagations) {
025                            propagation.propagate(e);
026                    }
027            }
028            
029            public SymbolTableHandler getSymbolTables() {
030                    return symbolTables;
031            }
032    
033            public void setSymbolTables(SymbolTableHandler symbolTables) {
034                    this.symbolTables = symbolTables;
035            }
036    
037            public ArrayList<Propagation> getPropagations() {
038                    return propagations;
039            }
040    
041            @Override
042            public String toString() {
043                    return "Propagations [propagations=" + propagations + "]";
044            }
045            
046            
047    }