#ifndef FUNCTIONALDEPENDENCY
#define FUNCTIONALDEPENDENCY

#include "attributeset.hh"
#include <string>

/**
 * The FunctionalDependency represents a functional dependency (e.g. AB->CD).
 * Every FunctionalDependency consists of two attribute sets, representing the left and
 * the right side of the FD (left->right).
 */
class FunctionalDependency
{
	public:
		static const std::string RIGHTARROW;

		/**constructs a functional dependency left->right*/
		FunctionalDependency(const AttributeSet& left, const AttributeSet& right);

		/**constructs a functional dependency from a textual representation*/
		FunctionalDependency(const std::string& fdString);

		virtual ~FunctionalDependency();

		/**
		 * Getter to retrieve the left side of the FD.
		 * @return the attributes on the left side of the FD
		 */
		AttributeSet getLeftSide() const;

		/**
		 * Getter to retrieve the right side of the FD.
		 * @return the attributes on the right side of the FD
		 */
		AttributeSet getRightSide() const;

		/**
		 * Retrieves a printable representation of the FD.
		 * @return a string representing the FD
		 */
		std::string getText() const;

		/**
		 * Checks whether a FD is 'smaller' than another one (needed for set container).
		 * @param that the FD to compare the current FD to
		 * @return true if the FD is 'smaller' than the other one, false otherwise
		 */
		bool operator <(const FunctionalDependency& that) const;

	private:
		AttributeSet theLeftSide;
		AttributeSet theRightSide;
};

#endif
