public static void generate(XPathContext context, ProgramWriter out, MetaCollection col)
     throws XavaException {
   CalculatedCollectionPG pg = new CalculatedCollectionPG();
   pg.setCollection(col);
   pg.setMetaModel(col.getMetaModel());
   pg.generate(context, out);
 }
 /**
  * A program generator is typically (but not always) invoked with a command line with arguments
  * for the XML input file and output file.
  */
 public static void main(String[] args) {
   try {
     ProgramWriter out =
         args.length >= 2
             ? new ProgramWriter(new FileOutputStream(args[1]))
             : new ProgramWriter(System.out);
     CalculatedCollectionPG pg = new CalculatedCollectionPG();
     for (int j = 1; j <= args.length; ++j) {
       pg.properties.put("arg" + j, args[j - 1]);
     }
     pg.generate(new XPathContext(args[0]), out);
     out.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }