<commit_before>// $Id: bond.C,v 1.6 2000/04/17 13:49:32 amoll Exp $

#include <BALL/KERNEL/bond.h>

#include <BALL/KERNEL/system.h>
#include <BALL/KERNEL/baseFragment.h>

using namespace std;

namespace BALL 
{

	Bond::TooManyBonds::TooManyBonds(const char* file, int line)
		:	Exception::GeneralException(file, line)
	{
	}

	Bond::Bond()
		: Composite(),
			PropertyManager(),
			first_(BALL_BOND_DEFAULT_FIRST_ATOM),
			second_(BALL_BOND_DEFAULT_SECOND_ATOM),
			name_(BALL_BOND_DEFAULT_NAME),
			bond_order_(BALL_BOND_DEFAULT_ORDER),
			bond_type_(BALL_BOND_DEFAULT_TYPE)
	{
	}

	Bond::Bond(const Bond& bond, bool deep)
		: Composite(bond, deep),
			PropertyManager(bond, deep),
			first_(bond.first_),
			second_(bond.second_),
			name_(bond.name_),
			bond_order_(bond.bond_order_),
			bond_type_(bond.bond_type_)
	{
	}
		
	Bond::Bond
		(const String &name, Atom &first,
		 Atom &second, Bond::Order order,Type type)
		: Composite(),
			PropertyManager(),
			first_(BALL_BOND_DEFAULT_FIRST_ATOM),
			second_(BALL_BOND_DEFAULT_SECOND_ATOM),
			name_(name),
			bond_order_(order),
			bond_type_(type)
	{
		createBond(*this, first, second);
	}

	Bond* Bond::createBond(Bond& bond, Atom& first, Atom& second)
	{
		if ((Size)first.number_of_bonds_ > (Size)Atom::MAX_NUMBER_OF_BONDS)
		{
			throw TooManyBonds(__FILE__, __LINE__);
		}
		
		if ((Size)second.number_of_bonds_ > (Size)Atom::MAX_NUMBER_OF_BONDS)
		{
			throw TooManyBonds(__FILE__, __LINE__);
		}

		// if the bond is already bonded, delete it and create <commit_msg>fixed: error in bondTest: > instead of >=, so it was possible to construct 9 bonds!<commit_after>// $Id: bond.C,v 1.7 2000/05/29 08:18:17 oliver Exp $

#include <BALL/KERNEL/bond.h>

#include <BALL/KERNEL/system.h>
#include <BALL/KERNEL/baseFragment.h>

using namespace std;

namespace BALL 
{

	Bond::TooManyBonds::TooManyBonds(const char* file, int line)
		:	Exception::GeneralException(file, line)
	{
	}

	Bond::Bond()
		: Composite(),
			PropertyManager(),
			first_(BALL_BOND_DEFAULT_FIRST_ATOM),
			second_(BALL_BOND_DEFAULT_SECOND_ATOM),
			name_(BALL_BOND_DEFAULT_NAME),
			bond_order_(BALL_BOND_DEFAULT_ORDER),
			bond_type_(BALL_BOND_DEFAULT_TYPE)
	{
	}

	Bond::Bond(const Bond& bond, bool deep)
		: Composite(bond, deep),
			PropertyManager(bond, deep),
			first_(bond.first_),
			second_(bond.second_),
			name_(bond.name_),
			bond_order_(bond.bond_order_),
			bond_type_(bond.bond_type_)
	{
	}
		
	Bond::Bond
		(const String &name, Atom &first,
		 Atom &second, Bond::Order order,Type type)
		: Composite(),
			PropertyManager(),
			first_(BALL_BOND_DEFAULT_FIRST_ATOM),
			second_(BALL_BOND_DEFAULT_SECOND_ATOM),
			name_(name),
			bond_order_(order),
			bond_type_(type)
	{
		createBond(*this, first, second);
	}

	Bond* Bond::createBond(Bond& bond, Atom& first, Atom& second)
	{
		if ((Size)first.number_of_bonds_ >= (Size)Atom::MAX_NUMBER_OF_BONDS)
		{
			throw TooManyBonds(__FILE__, __LINE__);
		}
		
		if ((Size)second.number_of_bonds_ >= (Size)Atom::MAX_NUMBER_OF_BONDS)
		{
			throw TooManyBonds(__FILE__, __LINE__);
		}

		// if the bond is already bonded, delete it and create 
{'fraction_non_alphanumeric': 0.13190673906100286, 'fraction_numerical': 0.010539763653784734, 'mean_word_length': 4.77859778597786, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '3473389', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1223, 'n_words': 209}