/****************************************************************************
 * This file was derived from the CNCL library by the Pablo research group.
 *
 * The complete CNCL library is available at:
 *       http://www.comnets.rwth-aachen.de/doc/cncl.html
 *
 * The CNCL copyright notice is included here:
 *
 * |_|_|_  |_|_    |_    |_|_|_  |_               C O M M U N I C A T I O N
 *|_       |_  |_  |_  |_        |_                         N E T W O R K S
 *|_       |_  |_  |_  |_        |_                               C L A S S
 * |_|_|_  |_    |_|_    |_|_|_  |_|_|_|_                     L I B R A R Y
 *
 *
 *
 * Copyright (C) 1992-1998   Communication Networks
 *                           Aachen University of Technology
 *                           D-52056 Aachen
 *                           Germany
 *                           Email: cncl-adm@comnets.rwth-aachen.de
 *
 *
 * This library is free  software; you can  redistribute it and/or modify
 * it  under   the terms  of the GNU   Library  General Public License as
 * published by the  Free Software Foundation;  either  version 2 of  the
 * License, or  (at  your option)  any  later  version.  This  library 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 Library General Public
 * Library General Public License along with  this library; if not, write
 * to the Free Software Foundation,  675  Mass Ave, Cambridge, MA  02139,
 * USA.
 ****************************************************************************/

//   -*- C++ -*-
/*****************************************************************************
 *
 * Class: FlFSet --- Fuzzy set abstract base class
 *
 *****************************************************************************/

#ifndef __FlFSet_h
#define __FlFSet_h


#include <FlNamed.h>		// Base class


#define  FSET_MIN	0.0
#define  FSET_MAX	1.0


/*
 * The class FlFSet
 */

class FlFSet : public FlNamed
{
  public:
					// Get membership values for x
    virtual double get_membership(double x) const = 0;
					// Compute center of gravity
    virtual double center_of_gravity(double min, double max) const;

    virtual double highestPoint(double &x, double &y) const = 0;

  protected:
    double ymin, ymax;			// Range of membership values

  private:

    /***** Constructors ******************************************************/
  public:
    FlFSet();		//  constructor
    FlFSet(double min, double max);
  /***    FlFSet(double min=0, double max=1); */
    FlFSet(FlStringR xname, double min=FSET_MIN, double max=FSET_MAX);

    void init(FlStringR name, double min=FSET_MIN, double max=FSET_MAX);
    

    // Print/debug output
    void printDataPoints(ostream &strm = cout, 
				 double xmin = 0.0, double xmax = 1.0, 
				 int steps = 10) const;
    void generatePlotFiles(double xmin = 0.0, double xmax = 1.0, 
			   int steps = 10, FlStringR tag = "") const;
    void plot(double xmin = 0.0, double xmax = 1.0, 
			   int steps = 10, FlStringR tag = "") const;
    virtual void print(ostream &strm = cout) const = 0;
    virtual void dump (ostream &strm = cout) const = 0;
};


#endif /**__FlFSet_h**/
