// ** This class was generated with DemFGen (vers:04/27/2009) import edu.neu.ccs.demeterf.control.Fields; import edu.neu.ccs.demeterf.lib.ident; import edu.neu.ccs.demeterf.lib.verbatim; /** Computes a simple String representation, named as a ToString method */ public class ToString extends edu.neu.ccs.demeterf.ID{ /** Static stub method for calling toString */ public static String ToStringM(Object o){ return new edu.neu.ccs.demeterf.Traversal(new ToString(),edu.neu.ccs.demeterf.Control.builtins()).<String>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(Pict _h_){ return "Pict("+")"; } public String combine(Circle _h_, String rad){ return "Circle("+rad+")"; } public String combine(Square _h_, String size){ return "Square("+size+")"; } public String combine(Offset _h_, String dx, String dy, String inner){ return "Offset("+dx+","+dy+","+inner+")"; } public String combine(Overlay _h_, String top, String bot){ return "Overlay("+top+","+bot+")"; } 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; } } }