#include "NodeParameter.h"

namespace cosi {

namespace quantity {

namespace onchipcommunication {

NodeParameter::NodeParameter() {
}

NodeParameter::~NodeParameter() {
}

NodeParameter NodeParameter::Get() {
	return (*this);
}

void NodeParameter::Set(NodeParameter pLp) {
	(*this) = pLp ;
}

cosi::library::onchipcommunication::Technology NodeParameter::GetTechnology() const {
	return mTech ;
}

void NodeParameter::SetTechnology(
		cosi::library::onchipcommunication::Technology pTech) {
	mTech = pTech ;
	IsBot(false);
}

bool NodeParameter::operator ==(const NodeParameter &pP) const {
	if ( IsAny() && pP.IsAny() ) {
		return true;
	}
	if ( IsBot() && pP.IsBot() ) {
		return true;
	}
	if ( mTech == pP.GetTechnology()) {
		return true;
	} else {
		return false;
	}
}

bool NodeParameter::operator <(const NodeParameter &pP) const {
	if ( pP.IsAny() && ! IsAny()) {
		return true;
	}
	if ( IsBot() && ! pP.IsBot() ) {
		return true;
	}
	return false;
}

NodeParameter NodeParameter::operator+(NodeParameter pT) {
	if ( IsAny() )
	return pT;
	if ( pT.IsAny())
	return (*this);
	if ( (*this) == pT ) {
		return (*this);
	} else {
		return NodeParameter();
	}
}
NodeParameter NodeParameter::operator-(NodeParameter pT) {
	if ( IsAny() )
	return pT;
	if ( pT.IsAny())
	return (*this);
	if ( (*this) == pT ) {
		return (*this);
	} else {
		return NodeParameter();
	}
}

std::ostream& operator <<(std::ostream &pOs, const NodeParameter &pP) {
	pOs << "Technology " ;
	if ( pP.GetTechnology() == cosi::library::onchipcommunication::T90 )
		pOs << " 90 nm" ;
	else if ( pP.GetTechnology() == cosi::library::onchipcommunication::T65 )
		pOs << " 65 nm" ;
	else if ( pP.GetTechnology() == cosi::library::onchipcommunication::T45 )
			pOs << " 45 nm" ;
	else if ( pP.GetTechnology() == cosi::library::onchipcommunication::T32 )
			pOs << " 32 nm" ;
	return pOs;
}

std::string NodeParameter::sQuantityType="{Technology}";
std::string NodeParameter::sQuantityName="NodeParameters";

}

}

}
