// ** This class was generated with DemFGen (vers:11/03/2008) package gen; import edu.neu.ccs.demeterf.demfgen.lib.*; import edu.neu.ccs.demeterf.*; public class RawMaterial{ public final List<Constraint> constraints; public final Option<List<RelationNr>> pred; public final Option<Option<String>> nested; public final Option<String> not; public final Option<N> number; public RawMaterial(List<Constraint> constraints, Option<List<RelationNr>> pred, Option<Option<String>> nested, Option<String> not, Option<N> number){ this.constraints = constraints; this.pred = pred; this.nested = nested; this.not = not; this.number = number; } public boolean equals(Object o){ if(!(o instanceof RawMaterial))return false; RawMaterial oo = (RawMaterial)o; return (((Object)constraints).equals(oo.constraints))&&(((Object)pred).equals(oo.pred))&&(((Object)nested).equals(oo.nested))&&(((Object)not).equals(oo.not))&&(((Object)number).equals(oo.number)); } public static RawMaterial parse(String inpt) throws ParseException{ return new TheParser(new java.io.StringReader(inpt)).parse_RawMaterial(); } public static RawMaterial parse(java.io.InputStream inpt) throws ParseException{ return new TheParser(inpt).parse_RawMaterial(); } public static RawMaterial parse(java.io.Reader inpt) throws ParseException{ return new TheParser(inpt).parse_RawMaterial(); } public static class constraints extends edu.neu.ccs.demeterf.control.Fields.any{} public static class pred extends edu.neu.ccs.demeterf.control.Fields.any{} public static class nested extends edu.neu.ccs.demeterf.control.Fields.any{} public static class not extends edu.neu.ccs.demeterf.control.Fields.any{} public static class number extends edu.neu.ccs.demeterf.control.Fields.any{} static class RelationNrComp implements java.util.Comparator<RelationNr>{ public int compare(RelationNr a, RelationNr b){ // return a.v.compareTo(b.v); return new Integer(a.v).compareTo(b.v); } } public Map<RelationNr,Weight> countRelationNrs(){ Map<RelationNr,Weight> in = TUCombiner.traverse(this,new TUCombiner<Map<RelationNr,Weight>>(){ Map<RelationNr,Weight> empty = Map.<RelationNr,Weight>create(new RelationNrComp()); public Map<RelationNr,Weight> combine(){ return empty; } public Map<RelationNr,Weight> fold(Map<RelationNr,Weight> a, Map<RelationNr,Weight> b){ return a.merge(b, new Map.Merge<Weight>(){ public Weight merge(Weight i, Weight j) { return i.sum(j); } }); } Map<RelationNr,Weight> combine(Constraint c, Weight w, RelationNr r){ return empty.put(r,w); } }, Control.bypass(Constraint.class)); return in; } public Option<Option<String>> get_nested(){ return nested;} public String display(){ return gen.Display.DisplayM(this); } public String print(){ return gen.Print.PrintM(this); } public String toStr(){ return gen.ToStr.ToStrM(this); } }