remove extraneous setters/getters
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 17 Jul 2007 10:58:13 +0200
changeset 1588 51b44f1f4ae5
parent 1587 95fd31a3d358
child 1589 fcbbf3a5670e
remove extraneous setters/getters
src/node/mobility-model.cc
src/node/mobility-model.h
src/node/ns2-mobility-file-topology.cc
--- a/src/node/mobility-model.cc	Tue Jul 17 10:54:50 2007 +0200
+++ b/src/node/mobility-model.cc	Tue Jul 17 10:58:13 2007 +0200
@@ -49,24 +49,6 @@
 {
   return DoGet ();
 }
-double 
-MobilityModel::GetX (void) const
-{
-  Position position = DoGet ();
-  return position.x;
-}
-double 
-MobilityModel::GetY (void) const
-{
-  Position position = DoGet ();
-  return position.y;
-}
-double 
-MobilityModel::GetZ (void) const
-{
-  Position position = DoGet ();
-  return position.z;
-}
 
 void 
 MobilityModel::Set (double x, double y, double z)
@@ -79,36 +61,6 @@
 {
   DoSet (position);
 }
-void 
-MobilityModel::SetXY (double x, double y)
-{
-  Position position = DoGet ();
-  position.x = x;
-  position.y = y;
-  DoSet (position);
- }
-void 
-MobilityModel::SetX (double x)
-{
-  Position position = DoGet ();
-  position.x = x;
-  DoSet (position);
-}
-void 
-MobilityModel::SetY (double y)
-{
-  Position position = DoGet ();
-  position.y = y;
-  DoSet (position);
-}
-void 
-MobilityModel::SetZ (double z)
-{
-  Position position = DoGet ();
-  position.z = z;
-  DoSet (position);
-}
-
 
 double 
 MobilityModel::GetDistanceFrom (const MobilityModel &other) const
--- a/src/node/mobility-model.h	Tue Jul 17 10:54:50 2007 +0200
+++ b/src/node/mobility-model.h	Tue Jul 17 10:58:13 2007 +0200
@@ -70,33 +70,9 @@
    * Unit is meters
    */
   Position Get (void) const;
-  /**
-   * \returns the current x coordinate
-   *
-   * Unit is meters
-   */
-  double GetX (void) const;
-  /**
-   * \returns the current y coordinate
-   *
-   * Unit is meters
-   */
-  double GetY (void) const;
-  /**
-   * \returns the current z coordinate
-   *
-   * Unit is meters
-   */
-  double GetZ (void) const;
-
-  void Add (double dx, double dy, double dz);
 
   void Set (double x, double y, double z);
   void Set (const Position &position);
-  void SetXY (double x, double y);
-  void SetX (double x);
-  void SetY (double y);
-  void SetZ (double z);
   /**
    * \param position a reference to another position object instance
    * \returns the distance between the two objects.
--- a/src/node/ns2-mobility-file-topology.cc	Tue Jul 17 10:54:50 2007 +0200
+++ b/src/node/ns2-mobility-file-topology.cc	Tue Jul 17 10:58:13 2007 +0200
@@ -97,21 +97,27 @@
 	    {
 	      double value = ReadDouble (line.substr (endNodeId + 9, std::string::npos));
 	      std::string coordinate = line.substr (endNodeId + 6, 1);
+              Position position = model->Get ();
 	      if (coordinate == "X")
 		{
-		  model->SetX (value);
+                  position.x = value;
 		  NS_DEBUG ("X=" << value);
 		}
 	      else if (coordinate == "Y")
 		{
-		  model->SetY (value);
+                  position.y = value;
 		  NS_DEBUG ("Y=" << value);
 		}
 	      else if (coordinate == "Z")
 		{
-		  model->SetZ (value);
+                  position.z = value;
 		  NS_DEBUG ("Z=" << value);
 		}
+              else
+                {
+                  continue;
+                }
+              model->Set (position);
 	    }
 	  else 
 	    {