<commit_before>/*
 * atom.cpp
 *
 *  Created on: Nov 27, 2011
 *      Author: joe
 */

#include "atom.h"

bool Atom::isGrounded() const {
	for (boost::ptr_vector<Term>::const_iterator it = terms.begin(); it != terms.end(); it++) {
		if (dynamic_cast<const Constant*>(&(*it)) == NULL) return false;
	}
	return true;
};

Atom& Atom::operator=(const Atom& b) {
	pred = b.pred;
	terms = b.terms;
	return *this;
}

bool Atom::doEquals(const Sentence& t) const {
	const Atom *at = dynamic_cast<const Atom*>(&t);
	if (at == NULL) {
		return false;
	}

	return (pred == at->pred)
			&& (terms == at->terms);
}

void Atom::doToString(std::stringstream& str) const {
		str << pred << "(";
		for (boost::ptr_vector<Term>::const_iterator it = terms.begin();
				it != terms.end();
				it++) {
			str << it->toString();
			if (it + 1 != terms.end()) {
				str << ", ";
			}
		}
		str << ")";<commit_msg>got a syntax error in eclipse and this resolved it.  not sure why it needed the extra indirection?<commit_after>/*
 * atom.cpp
 *
 *  Created on: Nov 27, 2011
 *      Author: joe
 */

#include "atom.h"
#include "term.h"
#include <boost/ptr_container/ptr_vector.hpp>

bool Atom::isGrounded() const {
	for (boost::ptr_vector<Term>::const_iterator it = terms.begin(); it != terms.end(); it++) {
		if (dynamic_cast<const Constant*>(&(*it)) == NULL) return false;
	}
	return true;
};

Atom& Atom::operator=(const Atom& b) {
	pred = b.pred;
	terms = b.terms;
	return *this;
}

bool Atom::doEquals(const Sentence& t) const {
	const Atom *at = dynamic_cast<const Atom*>(&t);
	if (at == NULL) {
		return false;
	}

	return (pred == at->pred)
			&& (terms == at->terms);
}

void Atom::doToString(std::stringstream& str) const {
		str << pred << "(";
		for (boost::ptr_vector<Term>::const_iterator it = terms.begin();
				it != terms.end();
				it++) {
			const Term *t = &(*it);

			str << t->toString();
			if (it + 1 != terms.end()) {
				str << ", ";
			}
		}
		str << ")";
{'fraction_non_alphanumeric': 0.200920245398773, 'fraction_numerical': 0.007157464212678937, 'mean_word_length': 3.4988505747126437, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 18, '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': '1650764', 'n_tokens_mistral': 801, 'n_tokens_neox': 722, 'n_words': 185}