You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.2 KiB

#include "Element.hpp"
int Element::WEAK_COMPATIBILITY = -1;
int Element::NEUTRAL_COMPATIBILITY = 0;
int Element::STRONG_COMPATIBILITY = 1;
Element::Element(std::string elementName,
Element *elementWeakAgainst,
Element *elementStrongAgainst)
: name(elementName),
weakAgainst(elementWeakAgainst),
strongAgainst(elementStrongAgainst)
{
}
std::string Element::getName()
{
return this->name;
}
void Element::setStrongAgainst(Element *element)
{
this->strongAgainst = element;
}
void Element::setWeakAgainst(Element *element)
{
this->weakAgainst = element;
}
bool Element::isStrongAgainst(Element *element)
{
return this->strongAgainst == element;
}
bool Element::isWeakAgainst(Element *element)
{
return this->weakAgainst == element;
}
int Element::compatibilityAgainst(Element *element)
{
if (this->isStrongAgainst(element))
{
return Element::STRONG_COMPATIBILITY;
}
else if (this->isWeakAgainst(element))
{
return Element::WEAK_COMPATIBILITY;
}
else
{
return Element::NEUTRAL_COMPATIBILITY;
}
}
bool Element::operator<(Element &element)
{
return this->name < element.name;
}