Changeset 887

Show
Ignore:
Timestamp:
04/29/12 16:51:48 (13 months ago)
Author:
anders
Message:

Updated dpfplay example

Location:
dpf-model-editor/trunk/examples/no.hib.dpf.codegen.examples.dpfplay/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • dpf-model-editor/trunk/examples/no.hib.dpf.codegen.examples.dpfplay/src/extensions/dpfplay.ext

    r854 r887  
    2222        let constructorInitList = attr.collect(e|"this." + e.name + " = " + e.name + ";") : 
    2323                constructorInitList.addAll(ref.collect(e|"this." + e.name + " = " + e.name + ";")); 
     24 
     25String printSymbols(Specification spec): 
     26        JAVA extensions.TemplateHelper.printSymbols(no.hib.dpf.core.Specification); 
  • dpf-model-editor/trunk/examples/no.hib.dpf.codegen.examples.dpfplay/src/extensions/TemplateHelper.java

    r854 r887  
    55import no.hib.dpf.core.Constraint; 
    66import no.hib.dpf.core.Node; 
     7import no.hib.dpf.core.Specification; 
    78 
    89public class TemplateHelper { 
     
    4546        public static boolean hasOneOrManyToOtherConstraint(Arrow a) { 
    4647                for(Constraint c : a.getConstraints()) { 
    47                         if(c.getPredicate().getSymbol().equals(MULT_CONSTRAINT)) { 
     48//                      if(c.getPredicate().getSymbol().equals(MULT_CONSTRAINT)) { 
    4849                                if(!parseConstraint(c.getParameters()).equals(Mult.MANY_TO_ONE)) 
    4950                                        return true; 
    50                         } 
     51//                      } 
    5152                } 
    5253                return false; 
     
    7879                return ret.toString(); 
    7980        } 
     81         
     82        public String printSymbols(Specification spec) { 
     83                StringBuffer buf = new StringBuffer(); 
     84                for(Constraint c : spec.getConstraints()) { 
     85//                      try { 
     86                                buf.append("Symbol for " + c.getId() + ": " + c.getPredicate().getSymbol() +  
     87                                                " Parameters: " + c.getParameters() + "\n"); 
     88//                      } catch(NullPointerException e) { 
     89//                              buf.append("Symbol for " + c.getId() + ": npe\n"); 
     90//                      } 
     91                } 
     92                return buf.toString(); 
     93        } 
    8094} 
    8195 
  • dpf-model-editor/trunk/examples/no.hib.dpf.codegen.examples.dpfplay/src/template/templ.xpt

    r856 r887  
    11«IMPORT dpf» 
    22«EXTENSION extensions::dpfplay» 
     3«EXTENSION org::eclipse::xtend::util::stdlib::io» 
    34 
    45«DEFINE main FOR dpf::Specification» 
     6        «syserr(printSymbols(this))» 
    57        «EXPAND graph FOR this.graph» 
    68«ENDDEFINE»