// ** This file was generated with DemFGen (vers:12/15/2010)

package scg;

import edu.neu.ccs.demeterf.lib.*;
import java.lang.reflect.*;





/** Representation of Claim */
public class Claim{
    protected InstanceSet instanceSet;
    protected FullyQualifiedClassName protocolClassName;
    protected ProtocolI protocol;
    protected double quality;

    /** Construct a(n) Claim Instance */
    public Claim(InstanceSet instanceSet, FullyQualifiedClassName protocolClassName, ProtocolI protocol, double quality){
        this.instanceSet = instanceSet;
        this.protocolClassName = protocolClassName;
        this.protocol = protocol;
        this.quality = quality;
    }
    /** Is the given object Equal to this Claim? */
    public boolean equals(Object o){
        if(!(o instanceof Claim))return false;
        if(o == this)return true;
        Claim oo = (Claim)o;
        return (((Object)instanceSet).equals(oo.instanceSet))&&(((Object)protocolClassName).equals(oo.protocolClassName))&&(((Object)protocol).equals(oo.protocol))&&(((Object)quality).equals(oo.quality));
    }
    /** Parse an instance of Claim from the given String */
    public static Claim parse(String inpt) throws scg.ParseException{
        return new scg.TheParser(new java.io.StringReader(inpt)).parse_Claim();
    }
    /** Parse an instance of Claim from the given Stream */
    public static Claim parse(java.io.InputStream inpt) throws scg.ParseException{
        return new scg.TheParser(inpt).parse_Claim();
    }
    /** Parse an instance of Claim from the given Reader */
    public static Claim parse(java.io.Reader inpt) throws scg.ParseException{
        return new scg.TheParser(inpt).parse_Claim();
    }

    /** Field Class for Claim.instanceSet */
    public static class instanceSet extends edu.neu.ccs.demeterf.Fields.any{}
    /** Field Class for Claim.protocolClassName */
    public static class protocolClassName extends edu.neu.ccs.demeterf.Fields.any{}
    /** Field Class for Claim.protocol */
    public static class protocol extends edu.neu.ccs.demeterf.Fields.any{}
    /** Field Class for Claim.quality */
    public static class quality extends edu.neu.ccs.demeterf.Fields.any{}

	public void finishParse(){
		InstanceSet instanceSet = getInstanceSet();
		instanceSet.finishParse();
	
		try{
			String className = getProtocolClassName().print().trim();
			Class<?> pgProtocolClass = Class.forName(className);
			ProtocolI protocol = (ProtocolI) pgProtocolClass.newInstance();
			setProtocol(protocol);
		} catch(Exception ex){
			ex.printStackTrace();		
		}
	}

    /** DGP method from Class Print */
    public String print(){ return scg.Print.PrintM(this); }
    /** Setter for field Claim.instanceSet */
    public void setInstanceSet(InstanceSet _instanceSet){ instanceSet = _instanceSet; }
    /** Setter for field Claim.protocolClassName */
    public void setProtocolClassName(FullyQualifiedClassName _protocolClassName){ protocolClassName = _protocolClassName; }
    /** Setter for field Claim.protocol */
    public void setProtocol(ProtocolI _protocol){ protocol = _protocol; }
    /** Setter for field Claim.quality */
    public void setQuality(double _quality){ quality = _quality; }
    /** Getter for field Claim.instanceSet */
    public InstanceSet getInstanceSet(){ return instanceSet; }
    /** Getter for field Claim.protocolClassName */
    public FullyQualifiedClassName getProtocolClassName(){ return protocolClassName; }
    /** Getter for field Claim.protocol */
    public ProtocolI getProtocol(){ return protocol; }
    /** Getter for field Claim.quality */
    public double getQuality(){ return quality; }

}


