00001 package instruction.postprocessor; 00002 00003 import instruction.semanticObjects.Instruction; 00004 import instruction.semanticObjects.Word; 00005 00006 import java.util.List; 00007 00008 public class OptionalPostprocessor implements PostProcessor { 00009 00010 public void run( List<Instruction> instructions ) { 00011 00012 for (int i = 0; i < instructions.size(); i++) { 00013 Instruction in = instructions.get(i); 00014 00015 for (int j = 0; j < in.getAction().getAdverb().size(); j++) { 00016 Word adv = in.getAction().getAdverb().get( j ); 00017 if (adv.getCycConcepts().size() > 0 && adv.getCycConcepts().get( 0 ).equals( "Alternative" )) { 00018 in.setOptional( Instruction.OPTIONAL_GLOBAL ); 00019 // System.out.println("optional found"); 00020 } 00021 } 00022 00023 if (in.isGlobalOptional() && i > 1) { 00024 instructions.get( i-1 ).setOptional( Instruction.OPTIONAL_LOCAL ); 00025 } 00026 00027 } 00028 00029 } 00030 00031 }