// joycub V2 - an interpeter for the programming language Joy
// (c) 2004-2006 Sergey Zubkov 
// op.cc - prototype module to test out the new design considerations
static char RCSID[] ="$Id: set.cc,v 1.1 2006/02/27 18:50:34 cubbi Exp cubbi $";

#include <iostream>
#include <sstream>
#include "set.h"

JC_set::JC_set(void) : JC_list() {};
JC_set::JC_set(vector<JC_objref*>& v) : JC_list(v) {};
JC_set::~JC_set(void) {};

const obj_type JC_set::get_type(void) const { return SET; };

std::string JC_set::key(void) const { return to_string(); };

std::string JC_set::to_string(void) const {
	std::ostringstream s;
	s << "{";
	for(vector<JC_objref*>::const_iterator it = contents.begin();
				it!=contents.end(); it++) {
//			s << (*it)->to_string() << ":";
			s << (*it)->to_string() << " ";
	}
	s << "}";
//	s << "}:" << ref_count;
	return s.str();
}
std::string JC_set::to_output_string(void) const {
	std::ostringstream s;
	s << "{";
	for(unsigned int i=0; i<contents.size(); i++) {
		s << contents[i]->to_output_string();
		if(i<contents.size()-1) s << " ";
	}
	s << "}";
	return s.str();
}


