/*******************************************************************************
 * GenRGenS v.1.0, Generation of Random Genomic Sequences                      *
 * Copyright (C) 2001  Alain Denise/Yann Ponty                                 *
 *                                                                             *
 * This program is free software; you can redistribute it and/or               *
 * modify it under the terms of the GNU General Public License                 *
 * as published by the Free Software Foundation; either version 2              *
 * of the License, or (at your option) any later version.                      *
 *                                                                             *
 * This program is distributed in the hope that it will be useful,             *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
 * GNU General Public License for more details.                                *
 *                                                                             *
 * You should have received a copy of the GNU General Public License           *
 * along with this program; if not, write to the Free Software                 *
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *
 *******************************************************************************/

package GenRGenS.grammar;

import GenRGenS.*;
import GenRGenS.IU.*;
import GenRGenS.utility.*;
import GenRGenS.utility.holder.*;

public class GrammarGenerationConfiguration implements GeneratorConfigFile
{
		/**
		 * Variable determinant le type de variables utilisée pour le dénombrement
		 * des grammaires.
		 * false => Précision arbitraire
		 * true => Précision bornée(flottants double précision)
		 * Par défaut, le denombrement des structures decomposables
		 * utilise les BigIntegers.
		 */
		public static boolean FloatCounting = false;

    public static boolean ShowStats = false;


		/**
		 * La chaîne de caractère permettant de passer en mode
		 * "flottant" dans le calcul des tables de dénombrements.
		 */
		private static final String FloatCountingOptionString = "-f";

		private static final String ShowStatsOptionString = "-s";




  public Class getGeneratorClass()
  {
    Class gen = null;
    try
    {
      if (!FloatCounting)
      {
        gen = Class.forName("GenRGenS.grammar.CountedNCFG");
      }
      else
      {
        gen = Class.forName("GenRGenS.grammar.DoubleCountedNCFG");
      }
    }
    catch (ClassNotFoundException e)
    {GenRGenS.err.println("Couldn't find class GenRGenS.grammar.(Double?)CountedNCFG.");}
    return gen;
  }

  public Option[] getOptions()
  {
    Option[] options = new Option[2];
    options[0] = new Option(new BooleanHolder()
        {
          public void set(boolean i)
          {
            GrammarGenerationConfiguration.FloatCounting = i;
          }
          public boolean get()
          {
            return GrammarGenerationConfiguration.FloatCounting;
          }
        },
        "Use float variables",
        FloatCountingOptionString,
        "T : Uses double (64 bits) variables when computing tables.\nF : Uses Arbitrary precision arithmetics(default)",
        "Computing tables implies arbitrary precision arithmetics, which involves " +
        "a HUGE amount of time.\nIn some special cases, using 64 bits double " +
        "variables is enough and MUCH more efficient.");
    options[1] = new Option(new BooleanHolder()
        {
          public void set(boolean i)
          {
            GrammarGenerationConfiguration.ShowStats = i;
          }
          public boolean get()
          {
            return GrammarGenerationConfiguration.ShowStats;
          }
        },
        "Show Statistics",
        ShowStatsOptionString,
        "T : Shows symbol occurences frequencies.\nF : nope (default)",
        "Show post generation statistics ? \n(Usefull to the one who wants to calibrate " +
        "weights)");
    return options;
  }

  public String getDescriptionFileHeader()
  { return "GRAMMAR"; }

  public String getLitteralName()
  { return "Grammar-Constrained Generation"; }

}