#include "xpathlink.h"

XPathLink::XPathLink()
    : XAsset()
    , mDist(0.0f)
    , mNodeNum(0)
    , mDisconnectCount(0)
    , mNegotiationLink(0)
    , mBadPlaceCount(4)
{
    SetName("Path Link");
}

XPathLink::~XPathLink()
{

}

void XPathLink::ParseData(XDataStream *aStream) {
    if (GetPtr() == -1) {
        *aStream
            >> mDist
            >> mNodeNum
            >> mDisconnectCount
            >> mNegotiationLink
            >> mBadPlaceCount[0]
            >> mBadPlaceCount[1]
            >> mBadPlaceCount[2]
            >> mBadPlaceCount[3];
    }
}

void XPathLink::Clear()
{
    mDist = 0.0f;
    mNodeNum = 0;
    mDisconnectCount = 0;
    mNegotiationLink = 0;
    mBadPlaceCount = QVector<unsigned char>(4);
}

float XPathLink::GetDist() const {
    return mDist;
}

void XPathLink::SetDist(float dist) {
    mDist = dist;
}

unsigned short XPathLink::GetNodeNum() const {
    return mNodeNum;
}

void XPathLink::SetNodeNum(unsigned short num) {
    mNodeNum = num;
}

unsigned char XPathLink::GetDisconnectCount() const {
    return mDisconnectCount;
}

void XPathLink::SetDisconnectCount(unsigned char count) {
    mDisconnectCount = count;
}

unsigned char XPathLink::GetNegotiationLink() const {
    return mNegotiationLink;
}

void XPathLink::SetNegotiationLink(unsigned char link) {
    mNegotiationLink = link;
}

QVector<unsigned char> XPathLink::GetBadPlaceCount() const {
    return mBadPlaceCount;
}

void XPathLink::SetBadPlaceCount(QVector<unsigned char> aCounts) {
    mBadPlaceCount = aCounts;
}
