// ** This class was generated with DemFGen (vers:11/03/2008) 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 java.io.FileInputStream; import edu.neu.ccs.demeterf.demfgen.lib.*; public class Print extends edu.neu.ccs.demeterf.ID{ public static String PrintM(Object o){ return new edu.neu.ccs.demeterf.Traversal(new Print(),edu.neu.ccs.demeterf.Control.builtins()).traverse(o).toString(); } _LT combine(byte o){ return empty.append(new _S(""+o)); } _LT combine(short o){ return empty.append(new _S(""+o)); } _LT combine(int o){ return empty.append(new _S(""+o)); } _LT combine(long o){ return empty.append(new _S(""+o)); } _LT combine(float o){ return empty.append(new _S(""+o)); } _LT combine(double o){ return empty.append(new _S(""+o)); } _LT combine(char o){ return empty.append(new _S(""+o)); } _LT combine(boolean o){ return empty.append(new _S(""+o)); } _LT combine(String o){ return empty.append(new _S("\""+o+"\"")); } _LT combine(ident o){ return empty.append(new _S(""+o)); } _LT combine(verbatim o){ return empty.append(new _S(""+o)); } static _LT empty = new _LT(); public static class _LT{ edu.neu.ccs.demeterf.demfgen.lib.List<_T> l; public _LT(){ l = new edu.neu.ccs.demeterf.demfgen.lib.Empty<_T>(); } public _LT(edu.neu.ccs.demeterf.demfgen.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.demfgen.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 _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.demfgen.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 == _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); } } _LT combine(Cons _h_, _LT first, _LT rest){ return empty.append(first).append(rest).compress(); } _LT combine(Empty _h_){ return empty; } _LT combine(Some _h_, _LT just){ return empty.append(just).compress(); } _LT combine(None _h_){ return empty; } _LT combine(Outcome _h_, _LT name){ return empty.append(name).compress(); } _LT combine(Value _h_){ return empty.append(new _S("VAL")).compress(); } _LT combine(Predicate _h_, _LT pred){ return empty.append(new _S("pred")).append(pred).compress(); } _LT combine(Derivative _h_, _LT name, _LT price, _LT predicate, _LT optraw, _LT optfinished){ return empty.append(new _S("deriv")).append(new _S("[")).append(name).append(price).append(predicate).append(optraw).append(optfinished).append(new _S("]")).compress(); } _LT combine(RawMaterial _h_, _LT predicate, _LT instance){ return empty.append(new _S("rm")).append(new _S("[")).append(predicate).append(instance).append(new _S("]")).compress(); } _LT combine(RawMaterialInstance _h_, _LT name){ return empty.append(name).compress(); } _LT combine(FinishedProduct _h_, _LT rm, _LT ip, _LT quality){ return empty.append(new _S("finish")).append(new _S("[")).append(rm).append(ip).append(quality).append(new _S("]")).compress(); } _LT combine(Price _h_, _LT val){ return empty.append(val).compress(); } _LT combine(Quality _h_, _LT val){ return empty.append(val).compress(); } _LT combine(History _h_, _LT rounds){ return empty.append(new _S("history")).append(new _S("[")).append(rounds).append(new _S("]")).compress(); } _LT combine(Round _h_, _LT ptransactions){ return empty.append(new _S("round")).append(new _S("[")).append(ptransactions).append(new _S("]")).compress(); } _LT combine(PlayerTransaction _h_, _LT playerName, _LT transactions){ return empty.append(playerName).append(transactions).compress(); } _LT combine(Transaction _h_, _LT ttype, _LT deriv){ return empty.append(ttype).append(deriv).compress(); } _LT combine(Buy _h_){ return empty.append(new _S("BUY")).compress(); } _LT combine(Create _h_){ return empty.append(new _S("CREATE")).compress(); } _LT combine(Reoffer _h_){ return empty.append(new _S("REOFFER")).compress(); } _LT combine(Deliver _h_){ return empty.append(new _S("DELIVER")).compress(); } _LT combine(Finish _h_){ return empty.append(new _S("FINISH")).compress(); } _LT combine(SDG _h_, _LT players, _LT account, _LT store, _LT config){ return empty.append(new _S("SDG")).append(new _S("players")).append(players).append(new _S("accounts")).append(account).append(new _S("store")).append(store).append(new _S("config")).append(config).compress(); } _LT combine(Player _h_, _LT id, _LT name){ return empty.append(new _S("player")).append(id).append(name).compress(); } _LT combine(PlayerStore _h_, _LT forSale, _LT bought){ return empty.append(new _S("pstore")).append(forSale).append(bought).compress(); } _LT combine(BoughtDeriv _h_, _LT d, _LT seller, _LT r, _LT f){ return empty.append(new _S("bought")).append(d).append(seller).append(r).append(f).compress(); } _LT combine(Config _h_, _LT init, _LT maxTurns, _LT timeslot, _LT mindec){ return empty.append(init).append(maxTurns).append(timeslot).append(mindec).compress(); } _LT combine(Pair _h_, _LT a, _LT b){ return empty.append(a).append(b).compress(); } _LT combine(PlayerID _h_, _LT id){ return empty.append(id).compress(); } }