// ** This class was generated with DemFGen (vers:06/04/2009) package gen; import edu.neu.ccs.demeterf.control.Fields; import edu.neu.ccs.demeterf.demfgen.lib.ident; import edu.neu.ccs.demeterf.demfgen.lib.verbatim; import edu.neu.ccs.demeterf.demfgen.lib.*; import edu.neu.ccs.demeterf.*; /** Computes a simple String representation */ public class ToStr extends edu.neu.ccs.demeterf.ID{ /** Static stub method for calling toStr */ public static String ToStrM(Object o){ return new edu.neu.ccs.demeterf.Traversal(new ToStr(),edu.neu.ccs.demeterf.Control.builtins()).traverse(o); } public String combine(byte _h_) { return ""+_h_; } public String combine(short _h_) { return ""+_h_; } public String combine(int _h_) { return ""+_h_; } public String combine(long _h_) { return ""+_h_; } public String combine(float _h_) { return ""+_h_; } public String combine(double _h_) { return ""+_h_; } public String combine(char _h_) { return "\'"+escape(""+_h_)+"\'"; } public String combine(boolean _h_) { return ""+_h_; } public String combine(String _h_) { return "\""+escape(""+_h_)+"\""; } public String combine(ident _h_) { return ""+_h_; } public String combine(verbatim _h_) { return ""+_h_; } public String combine(Cons _h_, String first, String rest) { return "Cons("+first+","+rest+")"; } public String combine(Empty _h_) { return "Empty("+")"; } public String combine(Start _h_, String r) { return "Start("+r+")"; } public String combine(RandomGenerationAspect _h_, String cd, String advisedFields) { return "RandomGenerationAspect("+cd+","+advisedFields+")"; } public String combine(AdvisedField _h_, String f, String k) { return "AdvisedField("+f+","+k+")"; } public String combine(ClassDictionary _h_) { return "ClassDictionary("+")"; } public String combine(ListField _h_, String length, String element) { return "ListField("+length+","+element+")"; } public String combine(Subset _h_, String r) { return "Subset("+r+")"; } public String combine(Distinct _h_) { return "Distinct("+")"; } public String combine(Single _h_, String v) { return "Single("+v+")"; } public String combine(Range _h_, String low, String high) { return "Range("+low+","+high+")"; } public String combine(Enumeration _h_, String l) { return "Enumeration("+l+")"; } public String combine(Ref _h_, String v) { return "Ref("+v+")"; } public String combine(QualIdent _h_, String first, String rest) { return "QualIdent("+first+","+rest+")"; } public String combine(DField _h_, String f) { return "DField("+f+")"; } public String combine(Field _h_, String v) { return "Field("+v+")"; } public String combine(NumericalField _h_, String nc) { return "NumericalField("+nc+")"; } public String combine(ConstrainedField _h_, String v) { return "ConstrainedField("+v+")"; } public String combine(B _h_, String xyz) { return "B("+xyz+")"; } public String combine(Basket _h_, String z, String items) { return "Basket("+z+","+items+")"; } public String combine(Pencil _h_) { return "Pencil("+")"; } public String combine(Apple _h_) { return "Apple("+")"; } public String combine(Orange _h_) { return "Orange("+")"; } public String combine(Z _h_) { return "Z("+")"; } public static String escape(String s){ char str[] = s.toCharArray(); StringBuffer ret = new StringBuffer(""); for(char c:str)ret.append(escape(c)); return ret.toString(); } public static String escape(char c){ switch(c){ case '\n':return "\\n"; case '\t':return "\t"; case '\b':return "\\b"; case '\r':return "\r"; case '\f':return "\\f"; case '\\':return "\\"; case '\'':return "\\'"; case '\"':return "\\\""; default: return ""+c; } } }