<commit_before>// $Id: comparator.h,v 1.3 2000/02/16 19:09:23 oliver Exp $

#ifndef BALL_CONCEPT_COMPARATOR_H
#define BALL_CONCEPT_COMPARATOR_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

namespace BALL 
{

	/**	Generic Comparator Class.
			{\bf Definition:} \URL{BALL/CONCEPT/comparator.h}
	*/
	template <typename T>
	class Comparator
	{
		public:

		/**	@name Constructors and Destructors
		*/
		//@{
	
		/**	Default constructor
		*/
		Comparator();

		/**	Destructor
		*/
		virtual ~Comparator();
		//@}

		/**	@name	Predicates
		*/
		//@{

		/**
		*/
		virtual bool isEqual(const T& a, const T& b) const;

		/**
		*/
		bool isNotEqual(const T& a, const T& b) const;

		/**
		*/
		virtual bool isLess(const T& a, const T& b) const;

		/**
		*/
		bool isLessOrEqual(const T& a, const T& b) const;

		/**
		*/
		bool isGreaterOrEqual(const T& a, const T& b) const;

		/**
		*/
		bool isGreater(const T& a, const T& b) const;

		/**
		*/
		int operator () (const T& a, const T& b) const;
		//@}
	};

	template <typename T>
	inline Comparator<T>::Comparator()
	{
	}

	template <typename T>
	inline Comparator<T>::~Comparator()
	{
	}

	template <class T>
	inline bool Comparator<T>::isEqual(const T& a, const T& b) const
	{
		return (bool)(a == b);
	}

	template <class T>
	inline bool Comparator<T>::isNotEqual(const T& a, const T& b) const
	{
		return (bool)!isEqual(a, b);
	}

	template <class T>
	inline bool Comparator<T>::isLess(const T& a, const T& b) const
	{
		return (bool)(a < b);
	}

	template <class T>
	inline bool Comparator<T>::isLessOrEqual(const T& a, const T& b) const
	{
		return (bool)!isLess(b, a);
	}

	template <class T>
	inline bool Comparator<T>::isGreaterOrEqual(const T& a, const T& b) const
	{
		return (bool)!isLess(a, b);
	}

	template <class T>
	inline bool Comparator<T>::isGreater(const T& a, const T& b) const
	{
		return isLess(b, a);
	}

	template <class T>
	inline int Comparator<T>::operator () (const T& a,const T& b) const
	{
		if (isEqual(a, b) == true)
		{ 
			return 0;
		} else if (isLess(a, b) == true)
		{ 
			return -1;
		} else { 
			return 1;
		}
	}

} // namespace BALL<commit_msg>added: exception qualifier cosmetic changes<commit_after>// $Id: comparator.h,v 1.4 2000/12/09 20:52:56 amoll Exp $

#ifndef BALL_CONCEPT_COMPARATOR_H
#define BALL_CONCEPT_COMPARATOR_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

namespace BALL 
{

	/**	Generic Comparator Class.
			{\bf Definition:} \URL{BALL/CONCEPT/comparator.h}
	*/
	template <typename T>
	class Comparator
	{
		public:

		/**	@name Constructors and Destructors
		*/
		//@{
	
		/**	Default constructor
		*/
		Comparator()
			throw();

		/**	Destructor
		*/
		virtual ~Comparator()
			throw();
		//@}

		/**	@name	Predicates
		*/
		//@{

		/**
		*/
		virtual bool isEqual(const T& a, const T& b) const
			throw();

		/**
		*/
		bool isNotEqual(const T& a, const T& b) const
			throw();

		/**
		*/
		virtual bool isLess(const T& a, const T& b) const
			throw();

		/**
		*/
		bool isLessOrEqual(const T& a, const T& b) const
			throw();

		/**
		*/
		bool isGreaterOrEqual(const T& a, const T& b) const
			throw();

		/**
		*/
		bool isGreater(const T& a, const T& b) const
			throw();

		/**
		*/
		int operator () (const T& a, const T& b) const
			throw();
		//@}
	};

	template <typename T>
	inline Comparator<T>::Comparator()
		throw()
	{
	}

	template <typename T>
	inline Comparator<T>::~Comparator()
		throw()
	{
	}

	template <class T>
	inline bool Comparator<T>::isEqual(const T& a, const T& b) const
		throw()
	{
		return (a == b);
	}

	template <class T>
	inline bool Comparator<T>::isNotEqual(const T& a, const T& b) const
		throw()
	{
		return !isEqual(a, b);
	}

	template <class T>
	inline bool Comparator<T>::isLess(const T& a, const T& b) const
		throw()
	{
		return (a < b);
	}

	template <class T>
	inline bool Comparator<T>::isLessOrEqual(const T& a, const T& b) const
		throw()
	{
		return !isLess(b, a);
	}

	template <class T>
	inline bool Comparator<T>::isGreaterOrEqual(const T& a, const T& b) const
		throw()
	{
		return !isLess(a, b);
	}

	template <class T>
	inline bool Comparator<T>::isGreater(const T& a, const T& b) const
		throw()
	{
		return isLess(b, a);
	}

	template <class T>
	inline int Comparator<T>::operator () (const T& a,const T& b) const
		throw()
	{
		if (isEqual(a, b) == true)
		{ 
			return 0;
		} 

		if (isLess(a, b) == true)
		{ 
			return -1;
		} 
		else 
		{ 
			return 1;
		}
	}

} // namespace BALL
{'fraction_non_alphanumeric': 0.16231301629828088, 'fraction_numerical': 0.008484036615315918, 'mean_word_length': 2.9751552795031055, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5608322', 'n_tokens_mistral': 1983, 'n_tokens_neox': 1775, 'n_words': 484}