#include "xpathnodetransient.h"
#include "xpathnode.h"

XPathNodeTransient::XPathNodeTransient()
    : XAsset()
    , mSearchFrame(0)
    , mNextOpen(new XPathNode())
    , mPrevOpen(new XPathNode())
    , mParent(new XPathNode())
    , mCost(0.0f)
    , mHeuristic(0.0f)
    , mCostFactor(0.0f)
{
}

XPathNodeTransient::~XPathNodeTransient()
{

}

void XPathNodeTransient::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        qint32 node1Ptr, node2Ptr, node3Ptr;
        *aStream
            >>mSearchFrame
            >>node1Ptr
            >>node2Ptr
            >>node3Ptr
            >>mCost
            >>mHeuristic
            >>mCostFactor;
    }
}

int XPathNodeTransient::GetSearchFrame() const {
    return mSearchFrame;
}

void XPathNodeTransient::SetSearchFrame(int frame) {
    mSearchFrame = frame;
}

XPathNode* XPathNodeTransient::GetNextOpen() const {
    return mNextOpen;
}

void XPathNodeTransient::SetNextOpen(XPathNode* node) {
    mNextOpen = node;
}

XPathNode* XPathNodeTransient::GetPrevOpen() const {
    return mPrevOpen;
}

void XPathNodeTransient::SetPrevOpen(XPathNode* node) {
    mPrevOpen = node;
}

XPathNode* XPathNodeTransient::GetParent() const {
    return mParent;
}

void XPathNodeTransient::SetParent(XPathNode* parent) {
    mParent = parent;
}

float XPathNodeTransient::GetCost() const {
    return mCost;
}

void XPathNodeTransient::SetCost(float cost) {
    mCost = cost;
}

float XPathNodeTransient::GetHeuristic() const {
    return mHeuristic;
}

void XPathNodeTransient::SetHeuristic(float heuristic) {
    mHeuristic = heuristic;
}

float XPathNodeTransient::GetCostFactor() const {
    return mCostFactor;
}

void XPathNodeTransient::SetCostFactor(float factor) {
    mCostFactor = factor;
}
