/// /// <summary> * shift this matrix by an xypair /// * </summary> /// * <param name="point"> the point to shift by </param> /// public virtual void shift(JDFXYPair point) { if (point == null) { return; } shift(point.X, point.Y); }
public void testClone() { JDFXYPair ab = new JDFXYPair(1.0, 2.0); JDFXYPair ac = new JDFXYPair(ab); ac.X = 3.0; Assert.AreEqual(1.0, ab.X, 0.0); }
public void testIsLessOrEqual() { JDFXYPair xy = new JDFXYPair(); JDFXYPair ab = new JDFXYPair(1.0, 2.0); xy = new JDFXYPair(1.0 - JDFBaseDataTypes_Fields.EPSILON / 2.0, 2.0 - JDFBaseDataTypes_Fields.EPSILON / 2.0); Assert.IsTrue(ab.Equals(xy)); Assert.IsTrue(ab.isLessOrEqual(xy)); Assert.IsTrue(ab.isGreaterOrEqual(xy)); }
/// /// <summary> * equals - returns true if both JDFShapes are equal, otherwise false /// * </summary> /// * <returns> boolean - true if equal otherwise false </returns> /// public override bool Equals(object other) { if (this == other) { return(true); } if (other == null) { return(false); } if (!other.GetType().Equals(this.GetType())) { return(false); } JDFXYPair xyPair = (JDFXYPair)other; return((Math.Abs(this.X - xyPair.X) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Y - xyPair.Y) <= JDFBaseDataTypes_Fields.EPSILON)); }
public void testSetString() { JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); JDFXYPair xy = new JDFXYPair("1 2"); n.setAttribute("test", xy, null); xy = new JDFXYPair("1.1 2.2"); n.setAttribute("test2", xy, null); Assert.AreEqual("1.1 2.2", n.getAttribute("test2", null, ""), "double double"); try { new JDFXYPair("1 2 3"); } catch (FormatException) { Assert.IsTrue(true, "exception 123 caught"); } }
/// /// <summary> * isLess - equality operator < /// * </summary> /// * <param name="x"> the JDFXYPair object to compare to </param> /// * <returns> boolean - true if this < x </returns> /// public virtual bool isLess(JDFXYPair x) { return(!isGreaterOrEqual(x)); }
/// /// <summary> * isLessOrEqual - equality operator <= /// * </summary> /// * <param name="x"> the JDFXYPair object to compare to </param> /// * <returns> boolean - true if this <= x </returns> /// public virtual bool isLessOrEqual(JDFXYPair x) { return(Equals(x) || ((this.X <= x.X) && (this.Y <= x.Y))); }
/// /// <summary> * isGreaterOrEqual - equality operator >= /// * </summary> /// * <param name="x"> the JDFXYPair object to compare to </param> /// * <returns> boolean - true if this >= x </returns> /// public virtual bool isGreaterOrEqual(JDFXYPair x) { return(Equals(x) || ((this.X >= x.X) && (this.Y >= x.Y))); }
/// /// <summary> * constructs a xy pair with all values set via a JDFXYPair /// * </summary> /// * <param name="xy"> the given xy pair /// * </param> /// public JDFXYPair(JDFXYPair xy) : base(JDFBaseDataTypes_Fields.MAX_XY_DIMENSION) { this.X = xy.X; this.Y = xy.Y; }
/// /// <summary> * add - adds a xy coordinate to the vector /// * </summary> /// * <param name="xy"> the xy coordinate to add </param> /// public virtual void Add(JDFXYPair xy) { m_numList.Add(xy.X); // (new double(xy.getX())); m_numList.Add(xy.Y); // (new double(xy.getY())); }