コード例 #1
0
ファイル: JDFDateTimeState.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * fitsValueDurationList - tests, if the duration of the defined
        ///	 * <code>rangelist</code> value matchest the ValueDurationList, specified
        ///	 * for this State
        ///	 *  </summary>
        ///	 * <param name="rangelist">
        ///	 *            range list to test </param>
        ///	 * <param name="valuelist">
        ///	 *            switches between AllowedValueList and PresentValueList </param>
        ///	 * <returns> boolean - true, if the duration of the defined rangelist is in
        ///	 *         <code>valueList</code> or if ValueDurationList is not specified </returns>
        ///
        private bool fitsValueDurationList(JDFDateTimeRangeList rangelist, EnumFitsValue valuelist)
        {
            JDFDurationRangeList list;

            if (valuelist.Equals(EnumFitsValue.Allowed))
            {
                list = getAllowedValueDurationList();
            }
            else
            {
                list = getPresentValueDurationList();
            }
            if (list == null)
            {
                return(true);
            }

            int siz = rangelist.Count;

            for (int i = 0; i < siz; i++)
            {
                JDFDateTimeRange range = (JDFDateTimeRange)rangelist[i];

                int         duration = (int)((range.Right.TimeInMillis - range.Left.TimeInMillis) / 1000);
                JDFDuration d        = new JDFDuration();
                d.setDuration(duration);
                if (!list.inRange(d))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
///
///	 <summary> * fitsValueDurationList - tests, if the duration of the defined 'rangelist'
///	 * value matches ValueDurationList, specified for this State
///	 *  </summary>
///	 * <param name="rangelist">
///	 *            range list to test </param>
///	 * <returns> boolean - true, if the duration of the defined
///	 *         <code>rangelist</code> is in the ValueList or if
///	 *         ValueDurationList is not specified </returns>
///
        private bool fitsValueDurationList(JDFDateTimeRangeList rangelist)
        {
            if (hasAttribute(AttributeName.VALUEDURATIONLIST))
            {
                JDFDurationRangeList list = getValueDurationList();

                int siz = rangelist.Count;
                for (int i = 0; i < siz; i++)
                {
                    JDFDateTimeRange range = (JDFDateTimeRange)rangelist[i];

                    int         duration = (int)((range.Right.TimeInMillis - range.Left.TimeInMillis) / 1000);
                    JDFDuration d        = new JDFDuration();
                    d.setDuration(duration);
                    if (!list.inRange(d))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(true);
        }
コード例 #3
0
ファイル: JDFTimeSpan.cs プロジェクト: cip4/JDFLibNet
 public virtual void setRange(JDFDateTimeRange @value)
 {
     setAttribute(AttributeName.RANGE, @value.ToString());
 }