// ** This class was generated with DemFGen (vers:02/05/2009) package gen; import edu.neu.ccs.demeterf.demfgen.lib.*; import edu.neu.ccs.demeterf.*; /** Representation of Literal */ public class Literal extends LiteralOrBoolean{ public final Sign value; public final Variable var; /** Construct a(n) Literal Instance */ public Literal(Sign value, Variable var){ this.value = value; this.var = var; } /** Is the given Literal Equal to this one? */ public boolean equals(Object o){ if(!(o instanceof Literal))return false; Literal oo = (Literal)o; return (((Object)value).equals(oo.value))&&(((Object)var).equals(oo.var)); } /** Parse an instance of Literal from the given String */ public static Literal parse(String inpt) throws ParseException{ return new TheParser(new java.io.StringReader(inpt)).parse_Literal(); } /** Parse an instance of Literal from the given Stream */ public static Literal parse(java.io.InputStream inpt) throws ParseException{ return new TheParser(inpt).parse_Literal(); } /** Parse an instance of Literal from the given Reader */ public static Literal parse(java.io.Reader inpt) throws ParseException{ return new TheParser(inpt).parse_Literal(); } /** Field Class for Literal.value */ public static class value extends edu.neu.ccs.demeterf.control.Fields.any{} /** Field Class for Literal.var */ public static class var extends edu.neu.ccs.demeterf.control.Fields.any{} boolean isPositive2() { return value.isPositive(); } boolean isPositive() { return new Traversal(new ID() { // assume one Pos in first field of Literal boolean combine(Pos pos) {return true;} boolean combine(Neg neg) {return false;} boolean combine(Literal o, boolean s) { return s; } // boolean combine(Object o, boolean s) { return s; } }, Control.bypass("gen.Literal.var")). traverse(this); // nicer: Control.strategy("Literal -> Pos") } /** DGP method from Class Display */ public String display(){ return gen.Display.DisplayM(this); } /** DGP method from Class Print */ public String print(){ return gen.Print.PrintM(this); } /** DGP method from Class ToStr */ public String toStr(){ return gen.ToStr.ToStrM(this); } }