summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2RoutingTableElem.cpp
blob: 93a248907cdda0c998a0d3bed8ba24af1b7952c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "T2RoutingTableElem.h"

T2RoutingTableElem::T2RoutingTableElem() {
    mNextFloorID = 0;
    mScore = 0;
    mTime = 0;
    mFinalHPos = 0;
}

T2RoutingTableElem::~T2RoutingTableElem() {
}

BOOL T2RoutingTableElem::IsStopFloor() const {
    return ((mNextFloorID != 0) && (mScore == 0));
}

void T2RoutingTableElem::SetTable(unsigned int inNextFloorID, int inFinalHPos) {
    mNextFloorID = inNextFloorID;
    mScore = 0;
    mTime = 0;
    mFinalHPos = inFinalHPos;
}

BOOL T2RoutingTableElem::IsSetTable(unsigned int inNextFloorID, unsigned int inScore, int inTime, int inFinalHPos) {
    BOOL result = false;

    if (mNextFloorID == 0 || mScore > inScore) {
        mNextFloorID = inNextFloorID;
        mScore = inScore;
        mTime = inTime;
        mFinalHPos = inFinalHPos;
        result = true;
    }

    return result;
}

BOOL T2RoutingTableElem::HasNextRoute(unsigned int inFloorID) const {
    return (mNextFloorID != 0) && (mNextFloorID != inFloorID);
}