X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=stop.cpp;h=d4cb7f7ff7c6628a64bc0de641e8be5f9f4ba994;hb=2172ce055533d5865d58538ee00bf609e59b0f99;hp=620a6e1169e967d8d3dd1c1b8ab6f6ec11fb242a;hpb=5c28697247e009e93b8b03bec8cdee88339d3226;p=cs356-p1-elevator.git diff --git a/stop.cpp b/stop.cpp index 620a6e1..d4cb7f7 100644 --- a/stop.cpp +++ b/stop.cpp @@ -22,7 +22,7 @@ bool Stop::operator< (const Stop& rhs) const { /* If we do not use the direction to help differentiate, then it is * possible that an object can be neither less, greater, or equal */ - return ((position_ < rhs.position_) || (direction_ < rhs.direction_)); + return (position_ < rhs.position_); } bool Stop::operator> (const Stop& rhs) const @@ -35,9 +35,35 @@ const Direction Stop::getDirection () const return direction_; } +const Position Stop::getPosition () const +{ + return position_; +} + std::ostream& operator<< (std::ostream& os, const Stop& rhs) { - os << "Stop(" << rhs.position_ << ", " << rhs.direction_ << ")"; + os << "Stop(" << rhs.position_ << ", "; // << rhs.direction_ << ")"; + + switch (rhs.direction_) + { + case IDLE: + os << "IDLE"; + break; + case UP: + os << "UP"; + break; + case DOWN: + os << "DOWN"; + break; + case ALL: + os << "ALL"; + break; + default: + os << "UNHANDLED"; + break; + } + + os << ")"; return os; }