// **************************************** Methods // ********************************************* /// /// <summary> * getString - returns the range as a String /// * </summary> /// * <returns> String - the range as a String </returns> /// public override string ToString() { if (m_left.Equals(m_right)) { return(JDFConstants.EMPTYSTRING + Left); } return(Left + " ~ " + Right); }
/// /// <summary> * isUniqueOrdered - tests if 'this' is UniqueOrdered RangeList /// * </summary> /// * <returns> boolean - true if 'this' is UniqueOrdered RangeList </returns> /// public override bool isUniqueOrdered() { int siz = rangeList.Count; if (siz == 0) { return(false); // attempt to operate on a null element } List <JDFShape> v = new List <JDFShape>(); // vector of ranges for (int i = 0; i < siz; i++) { JDFShapeRange r = (JDFShapeRange)rangeList[i]; v.Add(r.Left); if (!r.Left.Equals(r.Right)) { v.Add(r.Right); } } int n = v.Count - 1; if (n == 0) { return(true); // single value } JDFShape first = v[0]; JDFShape last = v[n]; if (first.Equals(last)) { return(false); } for (int j = 0; j < n; j++) { JDFShape @value = v[j]; JDFShape nextvalue = v[j + 1]; if (((first.isLess(last) && @value.isLess(nextvalue)) || (first.isGreater(last) && @value.isGreater(nextvalue))) == false) { return(false); } } return(true); }