// ** Batch Generated with DemeterF // ** This file was generated with DemFGen (vers:05/23/2010) package edu.neu.ccs.demeterf.demfgen.traversals; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.lib.*; import edu.neu.ccs.demeterf.demfgen.*; import edu.neu.ccs.demeterf.demfgen.dgp.DGPFunc; import edu.neu.ccs.demeterf.demfgen.traversals.Travs; import edu.neu.ccs.demeterf.demfgen.pcdgp.PCDGPFunc; import edu.neu.ccs.demeterf.dispatch.*; import edu.neu.ccs.demeterf.*; import edu.neu.ccs.demeterf.demfgen.ClassHier.InhrtPair; import edu.neu.ccs.demeterf.demfgen.DemFGenMain; import java.io.*; import java.io.FileInputStream; import edu.neu.ccs.demeterf.util.Util; import edu.neu.ccs.demeterf.util.CLI; import edu.neu.ccs.demeterf.demfgen.classes.Package; import edu.neu.ccs.demeterf.demfgen.DemFGenMain; import edu.neu.ccs.demeterf.demfgen.classes.*; public class ClassGenTrav { private ClassGen func; public ClassGenTrav(ClassGen f){ func = f; } public String traverse(final List<CDFile> _h, final ClassGen.PackDesc _targ_){ return traverseList_CDFile_(_h, _targ_); } public String traverseUseParams(final UseParams _h, final ClassGen.PackDesc _targ_){ String _types = traverseNETypeUseList(_h.getTypes(), _targ_); return func.combine((UseParams)_h,(String)_types); } public String traverseTypeUseParams(final TypeUseParams _h, final ClassGen.PackDesc _targ_){ if(_h instanceof UseParams) return traverseUseParams((UseParams)_h, _targ_); if(_h instanceof EmptyUseParams) return traverseEmptyUseParams((EmptyUseParams)_h, _targ_); else throw new RuntimeException("Unknown TypeUseParams Variant"); } public String traverseTypeUseList(final TypeUseList _h, final ClassGen.PackDesc _targ_){ if(_h instanceof TypeUseCons) return traverseTypeUseCons((TypeUseCons)_h, _targ_); if(_h instanceof TypeUseEmpty) return traverseTypeUseEmpty((TypeUseEmpty)_h, _targ_); else throw new RuntimeException("Unknown TypeUseList Variant"); } public String traverseTypeUseEmpty(final TypeUseEmpty _h, final ClassGen.PackDesc _targ_){ return func.combine((TypeUseEmpty)_h); } public String traverseTypeUseCons(final TypeUseCons _h, final ClassGen.PackDesc _targ_){ String _first = traverseTypeUse(_h.getFirst(), _targ_); String _rest = traverseTypeUseList(_h.getRest(), _targ_); return func.combine((TypeUseCons)_h,(String)_first, (String)_rest); } public String traverseTypeUse(final TypeUse _h, final ClassGen.PackDesc _targ_){ ident _name = _h.getName(); String _tparams = traverseTypeUseParams(_h.getTparams(), _targ_); return func.combine((TypeUse)_h,(ident)_name, (String)_tparams); } public String traverseTypeDefList(final TypeDefList _h, final ClassGen.PackDesc _targ_){ if(_h instanceof TypeDefCons) return traverseTypeDefCons((TypeDefCons)_h, _targ_); if(_h instanceof TypeDefEmpty) return traverseTypeDefEmpty((TypeDefEmpty)_h, _targ_); else throw new RuntimeException("Unknown TypeDefList Variant"); } public String traverseTypeDefEmpty(final TypeDefEmpty _h, final ClassGen.PackDesc _targ_){ return func.combine((TypeDefEmpty)_h); } public String traverseTypeDefCons(final TypeDefCons _h, final ClassGen.PackDesc _targ_){ String _first = traverseTypeDef(_h.getFirst(), _targ_); String _rest = traverseTypeDefList(_h.getRest(), _targ_); return func.combine((TypeDefList)_h,(String)_first, (String)_rest); } public String traverseTypeDef(final TypeDef _h, final ClassGen.PackDesc _targ_){ if(_h instanceof IntfcDef) return traverseIntfcDef((IntfcDef)_h, _targ_); if(_h instanceof ClassDef) return traverseClassDef((ClassDef)_h, _targ_); else throw new RuntimeException("Unknown TypeDef Variant"); } public String traverseNoImpl(final NoImpl _h, final ClassGen.PackDesc _targ_){ return func.combine((Impl)_h); } public String traverseNETypeUseList(final NETypeUseList _h, final ClassGen.PackDesc _targ_){ String _first = traverseTypeUse(_h.getFirst(), _targ_); String _rest = traverseTypeUseList(_h.getRest(), _targ_); return func.combine((NETypeUseList)_h,(String)_first, (String)_rest); } public String traverseList_CDFile_(final List<CDFile> _h, final ClassGen.PackDesc _targ_){ if(_h instanceof Cons) return traverseCons_CDFile_((Cons<CDFile>)_h, _targ_); if(_h instanceof Empty) return traverseEmpty_CDFile_((Empty<CDFile>)_h, _targ_); else throw new RuntimeException("Unknown List Variant"); } public String traverseIntfcDef(final IntfcDef _h, final ClassGen.PackDesc _targ_){ DoGen _gen = _h.getGen(); ident _name = _h.getName(); TypeDefParams _tparams = _h.getTparams(); PESubtypeList _subtypes = _h.getSubtypes(); return func.combine((IntfcDef)_h,(DoGen)_gen, (ident)_name, (TypeDefParams)_tparams, (PESubtypeList)_subtypes, (ClassGen.PackDesc)_targ_); } public String traverseIntfImpl(final IntfImpl _h, final ClassGen.PackDesc _targ_){ String _intf = traverseNETypeUseList(_h.getIntf(), _targ_); return func.combine((Impl)_h); } public String traverseImpl(final Impl _h, final ClassGen.PackDesc _targ_){ if(_h instanceof IntfImpl) return traverseIntfImpl((IntfImpl)_h, _targ_); if(_h instanceof NoImpl) return traverseNoImpl((NoImpl)_h, _targ_); else throw new RuntimeException("Unknown Impl Variant"); } public Object traverseFieldOrSyntax(final FieldOrSyntax _h, final ClassGen.PackDesc _targ_){ if(_h instanceof Field) return traverseField((Field)_h, _targ_); if(_h instanceof Syntax) return (Syntax)_h; else throw new RuntimeException("Unknown FieldOrSyntax Variant"); } public StrLTrip traverseFieldList(final FieldList _h, final ClassGen.PackDesc _targ_){ if(_h instanceof FieldCons) return traverseFieldCons((FieldCons)_h, _targ_); if(_h instanceof FieldEmpty) return traverseFieldEmpty((FieldEmpty)_h, _targ_); else throw new RuntimeException("Unknown FieldList Variant"); } public StrLTrip traverseFieldEmpty(final FieldEmpty _h, final ClassGen.PackDesc _targ_){ return func.combine((FieldEmpty)_h); } public StrLTrip traverseFieldCons(final FieldCons _h, final ClassGen.PackDesc _targ_){ Object _first = traverseFieldOrSyntax(_h.getFirst(), _targ_); StrLTrip _rest = traverseFieldList(_h.getRest(), _targ_); if((_first instanceof StrLTrip.StrTrip)){ return func.combine((FieldList)_h,(StrLTrip.StrTrip)_first, (StrLTrip)_rest); }else{ return func.combine((FieldList)_h,(Syntax)_first, (StrLTrip)_rest); } } public StrLTrip.StrTrip traverseField(final Field _h, final ClassGen.PackDesc _targ_){ ident _name = _h.getName(); String _type = traverseTypeUse(_h.getType(), _targ_); return func.combine((Field)_h,(ident)_name, (String)_type); } public String traverseEmptyUseParams(final EmptyUseParams _h, final ClassGen.PackDesc _targ_){ return func.combine((EmptyUseParams)_h); } public String traverseEmpty_CDFile_(final Empty<CDFile> _h, final ClassGen.PackDesc _targ_){ return func.combine((List<?>)_h); } public String traverseCons_CDFile_(final Cons<CDFile> _h, final ClassGen.PackDesc _targ_){ String _first = traverseCDFile(_h.getFirst(), _targ_); String _rest = traverseList_CDFile_(_h.getRest(), _targ_); if((_first instanceof String)){ if((_rest instanceof String)){ return func.combine((List<?>)_h,(String)_first, (String)_rest); }else{ return func.combine((List<?>)_h); } }else{ return func.combine((List<?>)_h); } } public String traverseClassDef(final ClassDef _h, final ClassGen.PackDesc _targ_){ DoGen _gen = _h.getGen(); ident _name = _h.getName(); TypeDefParams _tparams = _h.getTparams(); PESubtypeList _subtypes = _h.getSubtypes(); StrLTrip _fields = traverseFieldList(_h.getFields(), _targ_); String _ext = traverseImpl(_h.getExt(), _targ_); return func.combine((ClassDef)_h,(DoGen)_gen, (ident)_name, (TypeDefParams)_tparams, (PESubtypeList)_subtypes, (StrLTrip)_fields, (String)_ext, (ClassGen.PackDesc)_targ_); } public String traverseCDFile(final CDFile _h, final ClassGen.PackDesc _targ_){ IncludeList _incl = _h.getIncl(); DGPUses _dgpuse = _h.getDgpuse(); PackageDef _pkg = _h.getPkg(); LookDef _look = _h.getLook(); ImportList _imports = _h.getImports(); String _types = traverseTypeDefList(_h.getTypes(), func.update(_h, new CDFile.types(), _targ_)); return func.combine((CDFile)_h); } }