// ** This class was generated with DemFGen (vers:11/09/2009) package edu.neu.ccs.demeterf.http.classes; import edu.neu.ccs.demeterf.lib.*; import java.net.Socket; import java.net.InetSocketAddress; 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{ protected final ident id; protected 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.Fields.any{} /** Field Class for MidURL.rest */ public static class rest extends edu.neu.ccs.demeterf.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 PrintHeapToString */ public String toString(){ return edu.neu.ccs.demeterf.http.classes.PrintHeapToString.PrintHeapToStringM(this); } /** Getter for field MidURL.rest */ public URL getRest(){ return rest; } /** Getter for field MidURL.id */ public ident getId(){ return id; } }