// ** This file was generated with DemFGen (vers:12/15/2010) package scg; import edu.neu.ccs.demeterf.lib.*; import java.lang.reflect.*; /** Representation of Solution */ public class Solution{ protected FullyQualifiedClassName solutionClassName; protected SolutionI solution; protected verbatim solutionSpec; /** Construct a(n) Solution Instance */ public Solution(FullyQualifiedClassName solutionClassName, SolutionI solution, verbatim solutionSpec){ this.solutionClassName = solutionClassName; this.solution = solution; this.solutionSpec = solutionSpec; } /** Is the given object Equal to this Solution? */ public boolean equals(Object o){ if(!(o instanceof Solution))return false; if(o == this)return true; Solution oo = (Solution)o; return (((Object)solutionClassName).equals(oo.solutionClassName))&&(((Object)solution).equals(oo.solution))&&(((Object)solutionSpec).equals(oo.solutionSpec)); } /** Parse an instance of Solution from the given String */ public static Solution parse(String inpt) throws scg.ParseException{ return new scg.TheParser(new java.io.StringReader(inpt)).parse_Solution(); } /** Parse an instance of Solution from the given Stream */ public static Solution parse(java.io.InputStream inpt) throws scg.ParseException{ return new scg.TheParser(inpt).parse_Solution(); } /** Parse an instance of Solution from the given Reader */ public static Solution parse(java.io.Reader inpt) throws scg.ParseException{ return new scg.TheParser(inpt).parse_Solution(); } /** Field Class for Solution.solutionClassName */ public static class solutionClassName extends edu.neu.ccs.demeterf.Fields.any{} /** Field Class for Solution.solution */ public static class solution extends edu.neu.ccs.demeterf.Fields.any{} /** Field Class for Solution.solutionSpec */ public static class solutionSpec extends edu.neu.ccs.demeterf.Fields.any{} public void finishParse(){ try{ String className = getSolutionClassName().print().trim(); Class pgSolutionClass = Class.forName(className); Method parseMethod = pgSolutionClass.getMethod("parse", String.class); SolutionI sol = (SolutionI) parseMethod.invoke(null, getSolutionSpec().getText()); setSolution(sol); } catch(Exception ex){ ex.printStackTrace(); } } /** DGP method from Class Print */ public String print(){ return scg.Print.PrintM(this); } /** Setter for field Solution.solutionClassName */ public void setSolutionClassName(FullyQualifiedClassName _solutionClassName){ solutionClassName = _solutionClassName; } /** Setter for field Solution.solution */ public void setSolution(SolutionI _solution){ solution = _solution; } /** Setter for field Solution.solutionSpec */ public void setSolutionSpec(verbatim _solutionSpec){ solutionSpec = _solutionSpec; } /** Getter for field Solution.solutionClassName */ public FullyQualifiedClassName getSolutionClassName(){ return solutionClassName; } /** Getter for field Solution.solution */ public SolutionI getSolution(){ return solution; } /** Getter for field Solution.solutionSpec */ public verbatim getSolutionSpec(){ return solutionSpec; } }