Add the feature so you can press Enter and accept the dialogs.
[cs356-p1-elevator.git] / stop.cpp
index 620a6e1..54f0f4f 100644 (file)
--- a/stop.cpp
+++ b/stop.cpp
@@ -12,8 +12,10 @@ bool Stop::operator== (const Stop& rhs) const
        if (rhs.position_ != position_)
                return false;
 
+#if 0
        if (direction_ == ALL || rhs.direction_ == ALL)
                return true;
+#endif
 
        return (rhs.direction_ == direction_);
 }
@@ -22,7 +24,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,11 +37,36 @@ 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;
 }
 
-
 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */