Brunet.Services.Coordinate.Point.Equals C# (CSharp) Method

Equals() public method

public Equals ( Point other ) : bool
other Point
return bool
    public bool Equals(Point other) {
      if (other.Side.Length != Side.Length) {
	return false;
      }

      for (int i = 0; i < DIMENSIONS; i++) {
	if (other.Side[i] != Side[i]) {
          return false;
	}
      }
#if USE_HEIGHT      
      if (other.Height != Height) {
	return false;
      }
#endif
      return true;
    }
  }

Usage Example

Example #1
0
    public void TestSerialize() {
      NCService nc_service = new NCService();
      Hashtable ht1 = nc_service.EchoVivaldiState();
      MemoryStream ms = new MemoryStream();
      int serialized = AdrConverter.Serialize(ht1, ms);
      byte[] buf = ms.ToArray();
      Assert.AreEqual(serialized, buf.Length, "Buffer length same as written");
      ms.Seek(0, SeekOrigin.Begin);
      object o = AdrConverter.Deserialize(ms);
      Hashtable ht =  o as Hashtable;
      Assert.IsTrue(ht != null);
      Hashtable ht_position = (Hashtable) ht["position"];
      Point o_position = 
  new Point((double[]) ((ArrayList) ht_position["side"]).ToArray(typeof(double)), (double) ht_position["height"]);
    
      double o_weightedError = (double) ht["error"];
      // 
      // Make sure that the values obtained match the orgininal NC state.
      //

      NCService.VivaldiState state = nc_service.State;

      Assert.IsTrue(o_position.Equals(state.Position));
      Assert.AreEqual(o_weightedError, state.WeightedError);
    }
All Usage Examples Of Brunet.Services.Coordinate.Point::Equals