#include "context/EntityReference.h"

EntityReference::EntityReference()
{
}

EntityReference::EntityReference(const AgString & context, const AgString & entity)
{
    this->context = context;
    this->entity = entity;
}

AgString EntityReference::getContext()
{
    return context;
}

AgString EntityReference::getEntity()
{
    return entity;
}

AgString EntityReference::getProperty()
{
    return entity;
}

void EntityReference::setContext(const AgString & context)
{
    this->context = context;
}

void EntityReference::setEntity(const AgString & entity)
{
    this->entity = entity;
}

void EntityReference::setProperty(const AgString & property)
{
    this->entity = property;
}

int EntityReference::hashCode()
{
    assert(0);
//    int const prime = int(31);
    int result = int(1);
//    result = prime * result + ((context == 0) ? int(0) : context)->hashCode());
//    result = prime * result + ((entity == 0) ? int(0) : entity)->hashCode());
    return result;
}

/*bool EntityReference::equals(EntityReference *obj)
{
    if(this == obj)
        return true;

    if(obj == 0)
        return false;

    if( context != obj->context)
        return false;

    if( entity != obj->entity)
        return false;

    return true;
}*/

int EntityReference::compareTo(Comparable* ref)
{
    assert(0);

    EntityReference* eref = static_cast<EntityReference*>(ref);
    if (eref == ref)
        return true;

    return (this->toString() == eref->toString());
}


AgString EntityReference::toString()
{
    return context + entity;
}

Cloneable* EntityReference::clone()
{
    assert(0);
    //TODO:
    return 0;
//    try
//    {
//      return (EntityReference*) super.clone();
//    }
//    catch (CloneNotSupportedException ex)
//    {
//      throw new IllegalStateException(ex.getMessage(), ex);
//    }
}
