// ** This class was generated with DemFGen (vers:06/04/2009) package http.gen; import edu.neu.ccs.demeterf.demfgen.lib.*; import java.net.Socket; import java.net.ServerSocket; import java.io.IOException; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStreamReader; import java.io.InputStream; /** Representation of MidURL */ public class MidURL extends URL{ public final ident id; public final URL rest; /** Construct a(n) MidURL Instance */ public MidURL(ident id, URL rest){ this.id = id; this.rest = rest; } /** Is the given object Equal to this MidURL? */ public boolean equals(Object o){ if(!(o instanceof MidURL))return false; if(o == this)return true; MidURL oo = (MidURL)o; return (((Object)id).equals(oo.id))&&(((Object)rest).equals(oo.rest)); } /** Parse an instance of MidURL from the given String */ public static MidURL parse(String inpt) throws ParseException{ return new TheParser(new java.io.StringReader(inpt)).parse_MidURL(); } /** Parse an instance of MidURL from the given Stream */ public static MidURL parse(java.io.InputStream inpt) throws ParseException{ return new TheParser(inpt).parse_MidURL(); } /** Parse an instance of MidURL from the given Reader */ public static MidURL parse(java.io.Reader inpt) throws ParseException{ return new TheParser(inpt).parse_MidURL(); } /** Field Class for MidURL.id */ public static class id extends edu.neu.ccs.demeterf.control.Fields.any{} /** Field Class for MidURL.rest */ public static class rest extends edu.neu.ccs.demeterf.control.Fields.any{} /** Return the URLs Arguments */ public Map urlArgs(){ Map r = rest.urlArgs(); if(!rest.isEmpty())return r; String idS = id.toString(); int amp = idS.indexOf('?'); if(amp<0)return r; idS = idS.substring(idS.indexOf('?')+1).trim(); return HTTPReq.splitArgs(idS); } /** Remove the URLs Arguments */ public String trimArgs(){ if(!rest.isEmpty())return id+rest.trimArgs(); String idS = id.toString(); int amp = idS.indexOf('?'); return amp<0 ? idS: idS.substring(0,amp); } /** DGP method from Class PrintToString */ public String toString(){ return http.gen.PrintToString.PrintToStringM(this); } }