#ifndef _OTAny_h_
#define _OTAny_h_
/* OTAny.h
 *
 * Copyright (C) 1997-2002 Paul Boersma
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 * pb 1998/12/30
 * pb 2002/07/16 GPL
 */

#ifndef _Collection_h_
	#include "Collection.h"
#endif
#ifndef _Graphics_h_
	#include "Graphics.h"
#endif
#ifndef _Strings_h_
	#include "Strings.h"
#endif

#include "OTAny_def.h"

/* OTConstraint */

#define OTConstraint_methods Data_methods
oo_CLASS_CREATE (OTConstraint, Data)

OTConstraint OTConstraint_create (int which, double ranking);

/* OTAnyGrammar */

#define OTAnyGrammar_members Data_members \
	Ordered constraints;
#define OTAnyGrammar_methods Data_methods \
	const char ** (*constraintNames) (I); \
	int (*evaluate) (I, int which, const char *input, const char *output, long icand_hint); \
	long (*gen) (I, thou, const char *input); \
	void (*generateInput) (I, char input []); \
	int (*locallyRanked) (I, int which1, int which2);
oo_CLASS_CREATE (OTAnyGrammar, Data)

OTAnyGrammar OTAnyGrammar_create (void *klas);
const char * OTAnyGrammar_constraintName (OTAnyGrammar me, int which);
int OTAnyGrammar_addConstraint (OTAnyGrammar me, int which, double ranking);
int OTAnyGrammar_evaluateConstraint (OTAnyGrammar me, int which, const char *input, const char *output, long icand_hint);

void OTAnyGrammar_generateOneInput (OTAnyGrammar me, char *input);
Strings OTAnyGrammar_generateInputs (OTAnyGrammar me, long n);
void OTAnyGrammar_sort (OTAnyGrammar me, double spreading);

int OTAnyGrammar_inputToOutput (OTAnyGrammar me, const char *input, char *output, double rankingSpreading);
Strings OTAnyGrammar_inputsToOutputs (OTAnyGrammar me, Strings inputs, double rankingSpreading);
Strings OTAnyGrammar_inputToOutputs (OTAnyGrammar me, const char *input, long n, double rankingSpreading);

int OTAnyGrammar_learnOne_ts (OTAnyGrammar me, const char *adultUnderlyingForm, const char *adultOutput);
int OTAnyGrammar_learn_ts (OTAnyGrammar me, Strings inputs, Strings outputs);

/* Strategies: */
#define OTAnyGrammar_DEMOTION_ONLY  0
#define OTAnyGrammar_SYMMETRIC_HIGHEST  1
#define OTAnyGrammar_SYMMETRIC_ALL  2
#define OTAnyGrammar_WEIGHTED_UNCANCELLED  3
#define OTAnyGrammar_WEIGHTED_ALL  4
int OTAnyGrammar_learnOne_mgla (OTAnyGrammar me, const char *adultUnderlyingForm, const char *adultOutput,
	double rankingSpreading, int strategy, int honourLocalRankings,
	double demotionMean, double relativeDemotionSpreading);
int OTAnyGrammar_learn_mgla (OTAnyGrammar me, Strings inputs, Strings outputs,
	double rankingSpreading, int strategy, int honourLocalRankings,
	double demotionMean, double relativeDemotionSpreading);

/* OTAnyTableau */

#define OTAnyTableau_methods Data_methods
oo_CLASS_CREATE (OTAnyTableau, Data)

OTAnyTableau OTAnyGrammar_to_Tableau (OTAnyGrammar me, const char *input);
long OTAnyTableau_getWinner (OTAnyTableau me);
void OTAnyTableau_draw (OTAnyTableau me, Graphics g);

/* End of file OTAny.h */
#endif
