Ejemplo n.º 1
0
        ///
        ///	 <summary> * equals - returns true if both JDFNumberRangeList are equal otherwise false
        ///	 *  </summary>
        ///	 * <returns> boolean - true if equal otherwise false </returns>
        ///
        public override sealed bool Equals(object other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }
            if (!other.GetType().Equals(this.GetType()))
            {
                return(false);
            }

            int          size           = rangeList.Count;
            JDFRangeList rangeListOther = (JDFRangeList)other;
            int          sizeOther      = rangeListOther.rangeList.Count;

            if (size != sizeOther)
            {
                return(false);
            }
            for (int i = 0; i < size; i++)
            {
                JDFRange range      = this[i];
                JDFRange rangeOther = rangeListOther[i];

                if (!range.Equals(rangeOther))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        ///
        ///	 <summary> * isPartOfRange - is range 'r' within this range?
        ///	 *  </summary>
        ///	 * <param name="r"> the range to test
        ///	 *  </param>
        ///	 * <returns> boolean - true if range 'r' is within this range, else false </returns>
        ///
        public override bool isPartOfRange(JDFRange ra)
        {
            JDFDurationRange r     = (JDFDurationRange)ra;
            JDFDuration      min   = this.LowerValue;
            JDFDuration      r_min = r.LowerValue;
            JDFDuration      max   = this.UpperValue;
            JDFDuration      r_max = r.UpperValue;

            return((r_min.isLonger(min) || r_min.Equals(min)) && (r_max.isShorter(max) || r_max.Equals(max)));
        }
Ejemplo n.º 3
0
        ///
        ///	 <summary> * isPartOfRange - is range 'r' within this range?
        ///	 *  </summary>
        ///	 * <param name="ra"> the range to test
        ///	 *  </param>
        ///	 * <returns> boolean - true if range 'r' is within this range, else false </returns>
        ///
        public override bool isPartOfRange(JDFRange ra)
        {
            JDFRectangleRange r     = (JDFRectangleRange)ra;
            JDFRectangle      min   = this.LowerValue;
            JDFRectangle      r_min = r.LowerValue;
            JDFRectangle      max   = this.UpperValue;
            JDFRectangle      r_max = r.UpperValue;

            return(r_min.isGreaterOrEqual(min) && r_max.isLessOrEqual(max));
        }
Ejemplo n.º 4
0
        ///
        ///	 <summary> * isList - tests if 'this' is a List
        ///	 *  </summary>
        ///	 * <returns> boolean - true if 'this' contains no ranges </returns>
        ///
        public bool isList()
        {
            int sz = rangeList.Count;

            for (int i = 0; i < sz; i++)
            {
                JDFRange range = this[i];
                if (!range.getLeftObject().Equals(range.getRightObject()))
                {
                    return(false);
                }
            }
            return(true); // if we are here 'this' is a List
        }
Ejemplo n.º 5
0
        ///
        ///	 <summary> * isPartOfRange - check whether JDFRangeList 'x' is within this range list
        ///	 *  </summary>
        ///	 * <param name="x"> the range list to test </param>
        ///	 * <returns> boolean - true if range list 'x' is within 'this' range list, else false </returns>
        ///
        public bool isPartOfRange(JDFRangeList x)
        {
            int size = x.Count;

            for (int i = 0; i < size; i++)
            {
                JDFRange range = x[i];
                if (isPartOfRange(range))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 6
0
        ///
        ///	 <summary> * isPartOfRange - check whether range 'x' is in the range defined by 'this'
        ///	 *  </summary>
        ///	 * <param name="x"> JDFRange to test </param>
        ///	 * <returns> boolean - true if 'x' is in the range defined by 'this' </returns>
        ///
        public bool isPartOfRange(JDFRange x)
        {
            int sz = rangeList.Count;

            for (int i = 0; i < sz; i++)
            {
                JDFRange r = (JDFRange)rangeList[i];

                if (r.isPartOfRange(x))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 7
0
        ///
        ///	 <summary> * isUnique - tests if 'this' has only unique values
        ///	 *  </summary>
        ///	 * <returns> boolean: true if 'this' is a unique range list </returns>
        ///
        public bool isUnique()
        {
            int sz = rangeList.Count;

            for (int i = 0; i < sz; i++)
            {
                JDFRange range = this[i];
                for (int j = 0; j < sz; j++)
                {
                    if (j != i)
                    {
                        JDFRange other = this[j];
                        // even if one of the range deliminators belongs to any
                        // other range - return false (range is not unique)
                        if ((other.inObjectRange(range.getLeftObject())) || (other.inObjectRange(range.getRightObject())))
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 8
0
 public override bool isPartOfRange(JDFRange ra)
 {
     return(this.Equals(ra));
 }
Ejemplo n.º 9
0
        ///
        ///	 <summary> * isPartOfRange - is range 'ir' within this range?
        ///	 *  </summary>
        ///	 * <param name="ir"> the range to test
        ///	 *  </param>
        ///	 * <returns> boolean - true if range 'ir' is within this range, else false </returns>
        ///
        public override bool isPartOfRange(JDFRange r)
        {
            JDFIntegerRange ir = (JDFIntegerRange)r;

            return((ir.LowerValue >= this.LowerValue) && (ir.UpperValue <= this.UpperValue));
        }
Ejemplo n.º 10
0
        ///
        ///	 <summary> * isPartOfRange - is range 'r' within this range?
        ///	 *  </summary>
        ///	 * <param name="r"> the range to test
        ///	 *  </param>
        ///	 * <returns> boolean - true if range 'r' is within this range, else false </returns>
        ///
        public override bool isPartOfRange(JDFRange ra)
        {
            JDFNumberRange r = (JDFNumberRange)ra;

            return((r.LowerValue >= this.LowerValue) && (r.UpperValue <= this.UpperValue));
        }
Ejemplo n.º 11
0
        // **************************************** Constructors
        // ****************************************

        ///
        ///	 <summary> * isPartOfRange - is range 'ra' within this range?
        ///	 *  </summary>
        ///	 * <param name="ra"> the range to test
        ///	 *  </param>
        ///	 * <returns> boolean - true if range 'r' is within this range, else false </returns>
        ///
        public abstract bool isPartOfRange(JDFRange ra);