// behextract.beh // Last modified - March 10 '97 // Author - Kedar Patankar //*******************Class ProgramBehavior ********************************/ ProgramBehavior { traversal collectSgraphs(SGraphCollector sgc) { to StrategyDefinition; } (@ public SGraphCollector go_get_graphs() { SGraphCollector sgc = new SGraphCollector(new Vector(),new Vector()); collectSgraphs(sgc); return sgc; } @) traversal checkStars(DummyVisitor dv) { to {AnyPart,AnyClass,SuperclassGlob,CompoundStrategy, StrategyVariable, PathDirective}; } (@ public void check_star() { DummyVisitor dv = new DummyVisitor(); checkStars(dv); } @) } //******************end ProgramBehavior************************************/ DummyVisitor { before { AnyClass, AnyPart} (@ throw new UnsupportedSyntaxException("APStudio doesn't support \"*\" in strategy edge specification"); @) before {CompoundStrategy, StrategyVariable, PathDirective} (@ throw new UnsupportedSyntaxException("APStudio supports only StrategyGraph type of StrategyExpressions"); @) before SuperclassGlob (@ throw new UnsupportedSyntaxException("APStudio doesn't support superclass edges(edges starting with :>)"); @) } //****************** SGraphCollector************************************/ SGraphCollector { before StrategyDefinition (@ StrategyExpression se = host.get_exp(); if (se instanceof StrategyGraph) { this.get_graphs().addElement((StrategyGraph)se); this.get_names().addElement(host.get_strategyname().get_name().toString()); } @) } //******************end SGraphCollector************************************/ //****************** SGEdge************************************/ SGEdge { // Source vertices traversal collectSource(VecVisitor vv) { bypassing {->*,dest,*, NegativeConstraint} to ClassName; } (@ public VecVisitor go_get_source() { VecVisitor vv = new VecVisitor(new Vector()); collectSource(vv); return vv; } @) // Target vertices traversal collectDest(VecVisitor vv) { bypassing {->*,source,*, NegativeConstraint} to ClassName; } (@ public VecVisitor go_get_destination() { VecVisitor vv = new VecVisitor(new Vector()); collectDest(vv); return vv; } @) // Bypassing vertices traversal collectBypassVs(VecVisitor vv) { bypassing {ClassGlobSpec,EdgeGlob,OnlyThrough} to ClassName; } (@ public VecVisitor go_get_bypassV() { VecVisitor vv = new VecVisitor(new Vector()); collectBypassVs(vv); return vv; } @) // Only Through vertices traversal collectOnlyThruVs(VecVisitor vv) { bypassing {ClassGlobSpec,EdgeGlob,Bypassing} to ClassName; } (@ public VecVisitor go_get_onlythruV() { VecVisitor vv = new VecVisitor(new Vector()); collectOnlyThruVs(vv); return vv; } @) // collect part-globs traversal collectPartGlob(VecVisitor vv) { to{PartGlob}; } (@ public VecVisitor go_get_part_globs() { VecVisitor vv = new VecVisitor(new Vector()); collectPartGlob(vv); return vv; } @) // collect subclass-globs traversal collectSubclassGlob(VecVisitor vv) { to{SubclassGlob}; } (@ public VecVisitor go_get_subclass_globs() { VecVisitor vv = new VecVisitor(new Vector()); collectSubclassGlob(vv); return vv; } @) } //******************end SGEdge************************************/ {PartGlob,SubclassGlob} { traversal getSourceName(StringVisitor sv) { bypassing DestGlob to ClassName; } (@ public String go_get_sourcename() { StringVisitor sv = new StringVisitor(new String()); getSourceName(sv); return sv.get_name(); } @) traversal getDestName(StringVisitor sv) { bypassing SourceGlob to ClassName; } (@ public String go_get_destname() { StringVisitor sv = new StringVisitor(new String()); getDestName(sv); return sv.get_name(); } @) } PartGlob { traversal getPartName(StringVisitor sv) { to PartName; } (@ public String go_get_partname() { StringVisitor sv = new StringVisitor(new String()); getPartName(sv); return sv.get_name(); } @) } VecVisitor { before ClassName (@ this.get_names().addElement(host.get_name().toString()); @) before {PartGlob,SubclassGlob} (@ this.get_names().addElement(host); @) } StringVisitor { before {ClassName,PartName} (@ this.set_name(host.get_name().toString()); @) }