// ** This file was generated with DemFGen (vers:12/15/2010) package gen; import edu.neu.ccs.demeterf.Fields; import edu.neu.ccs.demeterf.lib.ident; import edu.neu.ccs.demeterf.lib.verbatim; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.*; import java.lang.Integer; /** Computes a String representation in CD Syntax */ public class Print extends edu.neu.ccs.demeterf.FC{ /** Static stub method for calling print */ public static String PrintM(Object o){ return new edu.neu.ccs.demeterf.Traversal(new Print(),edu.neu.ccs.demeterf.Control.builtins()).traverse(o).toString(); } public _LT combine(byte _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(short _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(int _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(long _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(float _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(double _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(char _h_){ return empty.append(new _S("\'"+escape(""+_h_)+"\'")); } public _LT combine(boolean _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(String _h_){ return empty.append(new _S("\""+escape(""+_h_)+"\"")); } public _LT combine(ident _h_){ return empty.append(new _S(""+_h_)); } public _LT combine(verbatim _h_){ return empty.append(new _S(""+_h_)); } static _LT empty = new _LT(); public static class _LT{ edu.neu.ccs.demeterf.lib.List<_T> l; public _LT(){ l = new edu.neu.ccs.demeterf.lib.Empty<_T>(); } public _LT(edu.neu.ccs.demeterf.lib.List<_T> ll){ l = ll; } public _LT push(_T t){ return new _LT(l.push(t)); } public _LT append(_T t){ return new _LT(l.append(t)); } public _LT append(_LT t){ return new _LT(l.append(t.l)); } public String toString(){ return l.fold(new _F(),""); } public _LT compress(){ return l.isEmpty()?this:compress(new _E(), l); } public static _LT compress(_S s, edu.neu.ccs.demeterf.lib.List<_T> r){ if(r.isEmpty())return (s.isE())?empty:empty.push(s); _T top = r.top(); if(top.isS())return compress(s.append((_S)top), r.pop()); if(s.isE())return compress(s, r.pop()).push(top); return compress(new _E(), r.pop()).push(top).push(s); } } public static class _T{ public boolean isS(){ return false; } public boolean isE(){ return false; } } public static class _P extends _T{ public static _P p = new _P(); } public static class _M extends _T{ public static _M m = new _M(); } public static class _N extends _T{ public static _N n = new _N(); } public static class _R extends _T{ public static _R r = new _R(); } public static class _S extends _T{ public StringBuffer s; public _S(String ss){ s = new StringBuffer(ss); } public _S append(_S ss){ s.append(ss.s); return this; } public boolean isS(){ return true; } } public static class _E extends _S{ public _E(){ super("");} public boolean isS(){ return true; } } public static class _F extends edu.neu.ccs.demeterf.lib.List.Fold<_T,String>{ int idt = 0; public String fold(_T t, String s){ if(t == _P.p)plus(); else if(t == _M.m)minus(); else if(t == _R.r)s += "\r"; else if(t == _N.n)s += "\n"+indent(); else s += ((_S)t).s; return s; } void plus(){ idt++; } void minus(){ idt--; } String indent(){ return indent(idt); } static String indent(int i){ return (i <= 0)?"":" "+indent(i-1); } } 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; } } public _LT combine(ProposeClaimExpectation _h_, _LT forbidden){ return empty.append(new _S("propose")).append(forbidden).compress(); } public _LT combine(OpposeOrAgreeClaimExpectation _h_, _LT claims){ return empty.append(new _S("oppose")).append(claims).compress(); } public _LT combine(ProvideInstanceExpectation _h_, _LT belongsTo){ return empty.append(new _S("instance")).append(belongsTo).compress(); } public _LT combine(ProvideSolutionExpectation _h_, _LT toBeSolved, _LT belongsTo){ return empty.append(new _S("solution")).append(toBeSolved).append(belongsTo).compress(); } public _LT combine(ClaimReply _h_, _LT c){ return empty.append(new _S("claim")).append(c).compress(); } public _LT combine(InstanceReply _h_, _LT i){ return empty.append(new _S("instance")).append(i).compress(); } public _LT combine(SolutionReply _h_, _LT s){ return empty.append(new _S("solution")).append(s).compress(); } public _LT combine(RefuteReply _h_, _LT c){ return empty.append(new _S("refute")).append(c).compress(); } public _LT combine(StrengthenReply _h_, _LT c){ return empty.append(new _S("strengthen")).append(c).compress(); } public _LT combine(AgreeReply _h_){ return empty.append(new _S("agree")).compress(); } public _LT combine(TestER _h_, _LT es, _LT ss, _LT d){ return empty.append(new _S("expectations")).append(es).append(new _S("replies")).append(ss).append(d).compress(); } public _LT combine(InstanceSet _h_){ return empty.append(new _S("game-specific intensional definition")).compress(); } public _LT combine(Claim _h_, _LT is, _LT p){ return empty.append(new _S("claim")).append(is).append(p).compress(); } public _LT combine(Protocol _h_, _LT state){ return empty.append(new _S("protocol")).append(state).compress(); } public _LT combine(InstanceProvided _h_){ return empty.append(new _S("IP")).compress(); } public _LT combine(InstanceSolved _h_){ return empty.append(new _S("IS")).compress(); } public _LT combine(Start _h_){ return empty.append(new _S("START")).compress(); } public _LT combine(End _h_){ return empty.append(new _S("END")).compress(); } public _LT combine(PlayerProxy _h_){ return empty; } public _LT combine(EP _h_, _LT e, _LT p, _LT ok){ return empty.append(e).append(p).append(ok).compress(); } public _LT combine(Expectation _h_){ return empty; } public _LT combine(Transaction _h_){ return empty; } public _LT combine(Test2 _h_, _LT i, _LT s, _LT d, _LT c){ return empty.append(i).append(s).append(d).append(c).compress(); } public _LT combine(Instance _h_){ return empty.append(new _S("game-specific Instance")).compress(); } public _LT combine(Solution _h_){ return empty.append(new _S("game-specific Solution")).compress(); } public _LT combine(Domain _h_){ return empty.append(new _S("domain")).compress(); } public _LT combine(Test1 _h_, _LT i, _LT s, _LT d){ return empty.append(i).append(s).append(d).compress(); } public _LT combine(RED _h_){ return empty.append(new _S("red")).compress(); } public _LT combine(BLACK _h_){ return empty.append(new _S("black")).compress(); } public _LT combine(Empty _h_){ return empty; } public _LT combine(Cons _h_, _LT first, _LT rest){ return empty.append(first).append(new _S(" ")).append(rest).compress(); } }