00001 package instruction.postprocessor; 00002 00003 import instruction.importer.AddCycMappingListener; 00004 import instruction.semanticObjects.Instruction; 00005 00006 import java.util.ArrayList; 00007 import java.util.List; 00008 00009 00015 public class InstructionPostProcessor { 00016 00017 private List<PostProcessor> registry = new ArrayList<PostProcessor>(); 00018 private MeaningsPostProcessor meaningsPostProc; 00019 00020 00021 public InstructionPostProcessor() { 00022 00023 // registry.add( new InstructionFilterPostProcessor() ); 00024 registry.add( new PrepareActionsPostProcessor() ); 00025 registry.add( new PreparePrepositionalPhrasesPostProcessor() ); 00026 registry.add( new BuildObjectNamesPostProcessor() ); 00027 registry.add( new PronounResolverPostProcessor() ); 00028 meaningsPostProc = new MeaningsPostProcessor(); 00029 registry.add( meaningsPostProc ); 00030 registry.add( new ObjectAmountPostProcessor() ); 00031 registry.add( new TimeConstraintPostProcessor() ); 00032 registry.add( new OptionalPostprocessor() ); 00033 } 00034 00041 public void run( List<Instruction> instructions ) throws Exception { 00042 00043 // Run all registered PostProcessors 00044 for (int i = 0; i < registry.size(); i++) 00045 registry.get( i ).run( instructions ); 00046 00047 } 00048 00049 00050 public void printArray( ArrayList a ) { 00051 00052 for ( int i = 0; i < a.size(); i++ ) 00053 System.out.print( a.get( i ).toString() + " | " ); 00054 System.out.println( "" ); 00055 } 00056 00057 public void setAddMappingListener(AddCycMappingListener listener) { 00058 meaningsPostProc.setAddMappingListener(listener); 00059 } 00060 }